Files
gosleep/modules/module.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

40 lines
723 B
Go

package modules
import (
"context"
"github.com/forust/gosleep-timer/config"
)
type Stage string
const (
StagePre Stage = "pre"
StagePost Stage = "post"
)
type ModuleContext struct {
Context context.Context
Profile string
Duration string
Config *config.Modules
}
type ModuleResult struct {
Module string
Cmd string
Output string
Error error
Stage Stage
}
type Module interface {
Name() string
// Enabled returns true if this module should run for the given config
Enabled(cfg *config.Modules) bool
// BuildCmds returns shell commands for the given stage (pre/post)
BuildCmds(ctx *ModuleContext, stage Stage) []string
// Validate checks if required binaries exist
Validate() error
}