feat: initial gosleep-timer implementation

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
This commit is contained in:
2026-07-03 01:43:22 +02:00
commit 8501fd074c
34 changed files with 3401 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
package engine
import (
"context"
"os/exec"
"time"
)
type ExecResult struct {
Cmd string
Output string
Err error
Elapsed time.Duration
}
func Execute(ctx context.Context, cmd string, timeout time.Duration) ExecResult {
start := time.Now()
var cancel context.CancelFunc
if timeout > 0 {
ctx, cancel = context.WithTimeout(ctx, timeout)
defer cancel()
}
out, err := exec.CommandContext(ctx, "bash", "-c", cmd).CombinedOutput()
elapsed := time.Since(start)
return ExecResult{
Cmd: cmd,
Output: string(out),
Err: err,
Elapsed: elapsed,
}
}
func ExecuteAll(ctx context.Context, cmds []string, timeout time.Duration) []ExecResult {
results := make([]ExecResult, len(cmds))
for i, cmd := range cmds {
results[i] = Execute(ctx, cmd, timeout)
}
return results
}