1
0

feat: introduce a background daemon service for persistent operation and inter-process communication.

This commit is contained in:
2026-02-28 12:32:03 +01:00
parent 77bc1d4ee5
commit 75a6d20e0d
7 changed files with 322 additions and 150 deletions

View File

@@ -4,8 +4,12 @@ namespace Toak.IO;
public static class Notifications
{
private static bool _notifySendAvailable = true;
public static void Notify(string summary, string body = "")
{
if (!_notifySendAvailable) return;
try
{
var pInfo = new ProcessStartInfo
@@ -17,15 +21,22 @@ public static class Notifications
};
Process.Start(pInfo);
}
catch (System.ComponentModel.Win32Exception)
{
Console.WriteLine("[Notifications] 'notify-send' executable not found. Notifications will be disabled.");
_notifySendAvailable = false;
}
catch (Exception ex)
{
Console.WriteLine($"[Notifications] Failed to send notification: {ex.Message}");
}
}
private static bool _paplayAvailable = true;
public static void PlaySound(string soundPath)
{
if (string.IsNullOrWhiteSpace(soundPath)) return;
if (!_paplayAvailable || string.IsNullOrWhiteSpace(soundPath)) return;
try
{
var absolutePath = soundPath;
@@ -60,6 +71,11 @@ public static class Notifications
};
Process.Start(pInfo);
}
catch (System.ComponentModel.Win32Exception)
{
Console.WriteLine("[Notifications] 'paplay' executable not found. Sound effects will be disabled.");
_paplayAvailable = false;
}
catch (Exception ex)
{
Console.WriteLine($"[Notifications] Failed to play sound: {ex.Message}");