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:
Levi Woodard
2026-10-01 18:39:24 -06:00
parent c143db6b68
commit 4158165410
10 changed files with 568 additions and 153 deletions

View File

@@ -352,6 +352,45 @@ keys:
command: ""
```
### Folders
A key can open a **folder** — a second page of keys that replaces the deck until
you go back. Folders nest to any depth, and every folder gets a back key (slot 0
by default, drawn with a built-in arrow). Pressing the folder key's `command`, if
it has one, still runs.
```yaml
keys:
12:
icon: folder.png
text: Media
folder: media # name of an entry under folders:
folders:
media:
back: # optional — defaults to key 0, built-in arrow, "Back"
key: 0
icon: back.png # omit to use the built-in arrow
text: Back
keys: # same key types as the root page: icons, GIFs,
1: # text, toggles, modules, live text, priv: commands
icon: play.png
command: playerctl play-pause
2:
icon: more.png
folder: media-extra # folders can open other folders
media-extra:
keys:
1:
text: Next
command: playerctl next
```
Each page's animations, polls, and live-text refreshes are stopped when you leave
it and restarted when you return. A config reload always lands on the root page.
Folder keys show up in `streamdeck-ctl status` with kind `folder`, and every
folder's keys are listed under `folders`.
### Status / toggle keys
A key can poll any shell command on an interval and show one of two icons based on the result. Pressing the button runs `command` as usual, and the icon re-checks ~400 ms later so it reflects the new state immediately.