feat: Add FFmpeg audio recording and ydotool typing backends, making them configurable.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Spectre.Console;
|
||||
@@ -52,13 +53,18 @@ public static class OnboardCommand
|
||||
}));
|
||||
|
||||
var sessionType = Environment.GetEnvironmentVariable("XDG_SESSION_TYPE")?.ToLowerInvariant();
|
||||
var defaultBackend = sessionType == "wayland" ? "wtype" : "xdotool";
|
||||
var otherBackend = defaultBackend == "wtype" ? "xdotool" : "wtype";
|
||||
var typingBackends = sessionType == "wayland" ? new[] { "wtype", "ydotool", "xdotool" } : new[] { "xdotool", "ydotool" };
|
||||
|
||||
config.TypingBackend = AnsiConsole.Prompt(
|
||||
new SelectionPrompt<string>()
|
||||
.Title($"Select [green]Typing Backend[/] (Detected: {sessionType}):")
|
||||
.AddChoices(new[] { defaultBackend, otherBackend }));
|
||||
.AddChoices(typingBackends));
|
||||
|
||||
config.AudioBackend = AnsiConsole.Prompt(
|
||||
new SelectionPrompt<string>()
|
||||
.Title("Select [green]Audio Recording Backend[/]:")
|
||||
.AddChoices(new[] { "pw-record", "ffmpeg" })
|
||||
.UseConverter(c => c == "pw-record" ? "pw-record (Default PipeWire)" : "ffmpeg (Universal PulseAudio)"));
|
||||
|
||||
var availableSkills = SkillRegistry.AllSkills.Select(s => s.Name).ToList();
|
||||
|
||||
@@ -75,5 +81,21 @@ public static class OnboardCommand
|
||||
configManager.SaveConfig(config);
|
||||
|
||||
AnsiConsole.MarkupLine("\n[bold green]Configuration saved successfully![/]");
|
||||
|
||||
try
|
||||
{
|
||||
var processInfo = new ProcessStartInfo("systemctl", "--user restart toak.service")
|
||||
{
|
||||
CreateNoWindow = true,
|
||||
UseShellExecute = false
|
||||
};
|
||||
Process.Start(processInfo)?.WaitForExit();
|
||||
AnsiConsole.MarkupLine("[grey]Restarted Toak daemon service.[/]");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Toak.Core.Logger.LogDebug($"Failed to restart toak service: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user