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
35 lines
657 B
Go
35 lines
657 B
Go
package custom
|
|
|
|
import (
|
|
"github.com/forust/gosleep-timer/config"
|
|
"github.com/forust/gosleep-timer/modules"
|
|
)
|
|
|
|
type CustomModule struct{}
|
|
|
|
func (m *CustomModule) Name() string {
|
|
return "custom"
|
|
}
|
|
|
|
func (m *CustomModule) Enabled(cfg *config.Modules) bool {
|
|
return cfg.Custom != nil && cfg.Custom.Enabled
|
|
}
|
|
|
|
func (m *CustomModule) BuildCmds(ctx *modules.ModuleContext, stage modules.Stage) []string {
|
|
switch stage {
|
|
case modules.StagePre:
|
|
return ctx.Config.Custom.Pre
|
|
case modules.StagePost:
|
|
return ctx.Config.Custom.Post
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *CustomModule) Validate() error {
|
|
return nil
|
|
}
|
|
|
|
func init() {
|
|
modules.Register(&CustomModule{})
|
|
}
|