24 lines
934 B
C#
24 lines
934 B
C#
using Toak.Core.Interfaces;
|
|
using Toak.IO.Injectors;
|
|
|
|
namespace Toak.IO;
|
|
|
|
/// <summary>
|
|
/// Resolves the correct <see cref="ITextInjector"/> implementation based on the configured backend name.
|
|
/// </summary>
|
|
public static class TextInjectorFactory
|
|
{
|
|
/// <summary>
|
|
/// Creates the appropriate <see cref="ITextInjector"/> for the given <paramref name="backend"/> string.
|
|
/// Supported values: <c>wtype</c>, <c>wl-clipboard</c>, <c>ydotool</c>, <c>xdotool</c> (default).
|
|
/// </summary>
|
|
public static ITextInjector Create(string backend, INotifications notifications) =>
|
|
backend.ToLowerInvariant() switch
|
|
{
|
|
"wtype" => new WtypeTextInjector(notifications),
|
|
"wl-clipboard" => new WlClipboardTextInjector(notifications),
|
|
"ydotool" => new YdotoolTextInjector(notifications),
|
|
_ => new XdotoolTextInjector(notifications)
|
|
};
|
|
}
|