8501fd074c
Go TUI sleep timer with modular architecture. - Config: YAML-based, profile inheritance, auto WM detection - Engine: timer, executor, stage pipeline (pre→timer→post) - Modules: workspace (niri/hyprland/kde), media, lock, kill, notify, sound, brightness, mute, custom, script - TUI: bubbletea app with profiles, module toggles, progress bar - CLI: run, list-profiles, export, import, history, stats - History: JSONL log with statistics - QR: config export as ASCII QR
43 lines
941 B
Go
43 lines
941 B
Go
package tui
|
|
|
|
type KeyAction int
|
|
|
|
const (
|
|
KeyQuit KeyAction = iota
|
|
KeyStart
|
|
KeyStop
|
|
KeyToggleModule
|
|
KeyNextProfile
|
|
KeyPrevProfile
|
|
KeyFocusNext
|
|
KeyFocusPrev
|
|
KeyHistory
|
|
KeyStats
|
|
KeyHelp
|
|
)
|
|
|
|
type KeyBinding struct {
|
|
Key string
|
|
Action KeyAction
|
|
Label string
|
|
}
|
|
|
|
var DefaultKeyBindings = []KeyBinding{
|
|
{Key: "s", Action: KeyStart, Label: "start"},
|
|
{Key: "S", Action: KeyStop, Label: "stop"},
|
|
{Key: "tab", Action: KeyFocusNext, Label: "next"},
|
|
{Key: "shift+tab", Action: KeyFocusPrev, Label: "prev"},
|
|
{Key: "h", Action: KeyHistory, Label: "history"},
|
|
{Key: "?", Action: KeyHelp, Label: "help"},
|
|
{Key: "q", Action: KeyQuit, Label: "quit"},
|
|
{Key: "esc", Action: KeyQuit, Label: "quit"},
|
|
}
|
|
|
|
func HelpView() string {
|
|
s := "\n Keys:\n"
|
|
for _, kb := range DefaultKeyBindings {
|
|
s += " " + kb.Key + " — " + kb.Label + "\n"
|
|
}
|
|
return s
|
|
}
|