1
0

feat: Add FFmpeg audio recording and ydotool typing backends, making them configurable.

This commit is contained in:
2026-02-28 15:58:45 +01:00
parent 96ccf0ea9a
commit 3ceecbe5ee
6 changed files with 149 additions and 4 deletions

View File

@@ -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...");