Files
gosleep/modules/lock/lock.go
T
forust 8501fd074c 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
2026-07-03 01:43:22 +02:00

37 lines
704 B
Go

package lock
import (
"github.com/forust/gosleep-timer/config"
"github.com/forust/gosleep-timer/modules"
)
type LockModule struct{}
func (m *LockModule) Name() string {
return "lock"
}
func (m *LockModule) Enabled(cfg *config.Modules) bool {
return cfg.Lock != nil && cfg.Lock.Enabled
}
func (m *LockModule) BuildCmds(ctx *modules.ModuleContext, stage modules.Stage) []string {
if stage != modules.StagePost {
return nil
}
cmd := ctx.Config.Lock.Command
if cmd == "" {
cmd = "loginctl lock-session"
}
return []string{cmd}
}
func (m *LockModule) Validate() error {
// No strict validation — custom commands may be set
return nil
}
func init() {
modules.Register(&LockModule{})
}