feat: Add FFmpeg audio recording and ydotool typing backends, making them configurable.
This commit is contained in:
@@ -34,6 +34,17 @@ public class TextInjector : ITextInjector
|
||||
CreateNoWindow = true
|
||||
};
|
||||
}
|
||||
else if (backend.ToLowerInvariant() == "ydotool")
|
||||
{
|
||||
Logger.LogDebug($"Injecting text using ydotool...");
|
||||
pInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = Toak.Core.Constants.Commands.TypeYdotool,
|
||||
Arguments = $"type \"{text.Replace("\"", "\\\"")}\"",
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
}
|
||||
else // xdotool
|
||||
{
|
||||
Logger.LogDebug($"Injecting text using xdotool...");
|
||||
@@ -74,6 +85,25 @@ public class TextInjector : ITextInjector
|
||||
RedirectStandardInput = true
|
||||
};
|
||||
}
|
||||
else if (backend.ToLowerInvariant() == "ydotool")
|
||||
{
|
||||
Logger.LogDebug($"Setting up stream injection using ydotool (chunked)...");
|
||||
await foreach (var token in tokenStream)
|
||||
{
|
||||
Logger.LogDebug($"Injecting token: '{token}'");
|
||||
fullText += token;
|
||||
var chunkInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = Toak.Core.Constants.Commands.TypeYdotool,
|
||||
Arguments = $"type \"{token.Replace("\"", "\\\"")}\"",
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
var chunkP = Process.Start(chunkInfo);
|
||||
if (chunkP != null) await chunkP.WaitForExitAsync();
|
||||
}
|
||||
return fullText;
|
||||
}
|
||||
else // xdotool
|
||||
{
|
||||
Logger.LogDebug($"Setting up stream injection using xdotool...");
|
||||
|
||||
Reference in New Issue
Block a user