refactor: centralize common strings, paths, and default values into a new Constants class.
This commit is contained in:
48
Core/Constants.cs
Normal file
48
Core/Constants.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Toak.Core;
|
||||
|
||||
public static class Constants
|
||||
{
|
||||
public const string AppName = "toak";
|
||||
|
||||
public static class Paths
|
||||
{
|
||||
public static readonly string AppDataDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), AppName);
|
||||
public static readonly string ConfigDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config", AppName);
|
||||
|
||||
public static readonly string ConfigFile = Path.Combine(ConfigDir, "config.json");
|
||||
public static readonly string HistoryFile = Path.Combine(AppDataDir, "history.jsonl");
|
||||
public static readonly string DaemonLockFile = Path.Combine(AppDataDir, "daemon.lock");
|
||||
|
||||
public static readonly string StateFile = Path.Combine(Path.GetTempPath(), "toak_state.pid");
|
||||
public static readonly string RecordingWavFile = Path.Combine(Path.GetTempPath(), "toak_recording.wav");
|
||||
public static readonly string LatencyTestWavFile = Path.Combine(Path.GetTempPath(), "toak_latency_test.wav");
|
||||
|
||||
public static string GetSocketPath()
|
||||
{
|
||||
var runtimeDir = Environment.GetEnvironmentVariable("XDG_RUNTIME_DIR");
|
||||
return Path.Combine(string.IsNullOrEmpty(runtimeDir) ? Path.GetTempPath() : runtimeDir, "toak.sock");
|
||||
}
|
||||
}
|
||||
|
||||
public static class Commands
|
||||
{
|
||||
public const string AudioRecord = "pw-record";
|
||||
public const string AudioFfmpeg = "ffmpeg";
|
||||
public const string ProcessKill = "kill";
|
||||
public const string TypeX11 = "xdotool";
|
||||
public const string TypeWayland = "wtype";
|
||||
public const string Notify = "notify-send";
|
||||
public const string PlaySound = "paplay";
|
||||
public const string ClipboardX11 = "xclip";
|
||||
public const string ClipboardWayland = "wl-copy";
|
||||
}
|
||||
|
||||
public static class Defaults
|
||||
{
|
||||
public const string LlmModel = "openai/gpt-oss-20b";
|
||||
public const string WhisperModel = "whisper-large-v3-turbo";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user