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
+29
View File
@@ -0,0 +1,29 @@
package hotkeydaemon
import (
"testing"
"time"
"github.com/leonardotrapani/hyprvoice/internal/bus"
"github.com/leonardotrapani/hyprvoice/internal/notify"
)
func TestToggle(t *testing.T) {
d := New(notify.Nop{})
go d.Run()
time.Sleep(50 * time.Millisecond) // give listener time to start
defer bus.SendCommand('q')
if out, _ := bus.SendCommand('t'); out != "STATUS recording=true\n" {
t.Fatalf("unexpected: %s", out)
}
if !d.Rec() {
t.Fatalf("state should be true after first toggle")
}
if out, _ := bus.SendCommand('t'); out != "STATUS recording=false\n" {
t.Fatalf("unexpected: %s", out)
}
if d.Rec() {
t.Fatalf("state should be false after second toggle")
}
}