setup project with daemon, socket, cmd, air, notifying, state

This commit is contained in:
LeonardoTrapani
2025-08-07 00:01:49 +02:00
parent d3fc5ee3a4
commit f7936610c9
11 changed files with 457 additions and 25 deletions
+33
View File
@@ -0,0 +1,33 @@
package notify
import (
"fmt"
"os/exec"
)
type Notifier interface {
RecordingChanged(on bool)
Error(msg string)
}
type Desktop struct{}
func (Desktop) RecordingChanged(on bool) {
state := "Stopped"
if on {
state = "Started"
}
exec.Command("notify-send", "-a", "Hyprvoice",
fmt.Sprintf("Hyprvoice: %s Recording", state)).Run()
}
func (Desktop) Error(msg string) {
exec.Command("notify-send", "-a", "Hyprvoice", "-u", "critical", msg).Run()
}
// Nop is a Notifier that does absolutely nothing.
// Useful in unit tests or headless builds.
type Nop struct{}
func (Nop) RecordingChanged(on bool) {}
func (Nop) Error(msg string) {}