Cthulhu is no longer a fork. Now it is a screen reader written in Golang.

This commit is contained in:
Storm Dragon committed 2026-10-14 00:16:34 -04:00
1 parent a998fe67de
commit 069fc674dc
708 files changed
+112482 -532

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
package shortcutui
import (
"os"
"os/exec"
"strings"
"testing"
"time"
)
func TestNativeShortcutListOpensAndClosesFromKeyboard(t *testing.T) {
if os.Getenv("CTHULHU_NATIVE_X11") != "1" {
t.Skip("requires isolated X11 display")
}
finished := make(chan error, 1)
go func() {
deadline := time.Now().Add(4 * time.Second)
for time.Now().Before(deadline) {
if output, err := exec.Command("xdotool", "search", "--onlyvisible", "--name", "^Cthulhu Shortcut Test$").Output(); err == nil && len(strings.TrimSpace(string(output))) != 0 {
window := strings.Fields(string(output))[0]
if err := exec.Command("xdotool", "windowfocus", window).Run(); err != nil {
finished <- err
return
}
finished <- exec.Command("xdotool", "key", "Escape").Run()
return
}
time.Sleep(20 * time.Millisecond)
}
finished <- os.ErrDeadlineExceeded
}()
data := `{"title":"Cthulhu Shortcut Test","rows":[{"group":"Default","label":"Quit Cthulhu.","keys":"Cthulhu+q"}]}`
if err := Run(strings.NewReader(data)); err != nil {
t.Fatal(err)
}
if err := <-finished; err != nil {
t.Fatal(err)
}
}