Add folder support: keys that open sub-pages with a back key
A key with `folder: NAME` swaps the deck to the keys defined under `folders.NAME`. Every folder shows a back key (slot 0 by default, drawn with a built-in chevron) that pops back to the parent; folders nest. The daemon now runs one page at a time: per-key setup moved into setupKey(), openPage() draws a page under its own context, and page.stop() tears it down before the next page is drawn (and on exit, so device death no longer waits on uncancelled goroutines). streamdeck-ctl gains `key set -folder`, reports kind "folder", lists every folder in status, and refuses to `key press` a navigation-only key. The Omarchy grid shows a folder glyph. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ARLa4moGb154fzc9TevgV
This commit is contained in:
@@ -78,6 +78,7 @@ key set flags (only the flags you pass are written):
|
||||
-icon NAME -icon-true NAME -icon-false NAME
|
||||
-text STR -text-color STR -text-command STR -refresh DUR
|
||||
-command STR -module NAME -function NAME
|
||||
-folder NAME (pressing the key opens that folder)
|
||||
-param K=V (repeatable)
|
||||
-poll-command STR -poll-match STR -poll-interval DUR
|
||||
-unset FIELD (repeatable — removes a field)
|
||||
@@ -161,6 +162,7 @@ func keySet(cfgPath string, index int, args []string) error {
|
||||
"text-command": fs.String("text-command", "", "command whose stdout becomes the overlay text"),
|
||||
"refresh": fs.String("refresh", "", "how often to re-run text-command, e.g. 1s"),
|
||||
"command": fs.String("command", "", "shell command to run on press"),
|
||||
"folder": fs.String("folder", "", "folder (from the folders: block) the key opens"),
|
||||
"module": fs.String("module", "", "module name from modules.yaml"),
|
||||
"function": fs.String("function", "", "function name within the module"),
|
||||
"poll-command": fs.String("poll-command", "", "command used to poll toggle state"),
|
||||
@@ -171,6 +173,7 @@ func keySet(cfgPath string, index int, args []string) error {
|
||||
"icon": "icon", "icon-true": "icon_true", "icon-false": "icon_false",
|
||||
"text": "text", "text-color": "text_color", "text-command": "text_command",
|
||||
"refresh": "refresh", "command": "command", "module": "module", "function": "function",
|
||||
"folder": "folder",
|
||||
}
|
||||
|
||||
var params stringList
|
||||
@@ -300,6 +303,10 @@ func keyPress(cfgPath string, index int) error {
|
||||
return fmt.Errorf("key %d is not configured", index)
|
||||
}
|
||||
|
||||
if key.Folder != "" && key.Command == "" && key.Module == "" {
|
||||
return fmt.Errorf("key %d opens folder %q — navigation only happens on the deck", index, key.Folder)
|
||||
}
|
||||
|
||||
command := key.Command
|
||||
if key.Module != "" && key.Function != "" {
|
||||
reg, err := modules.LoadRegistry(config.ModulesPath(cfgPath))
|
||||
|
||||
Reference in New Issue
Block a user