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

44 lines
799 B
Go

package kill
import (
"fmt"
"os/exec"
"github.com/forust/gosleep-timer/config"
"github.com/forust/gosleep-timer/modules"
)
type KillModule struct{}
func (m *KillModule) Name() string {
return "kill"
}
func (m *KillModule) Enabled(cfg *config.Modules) bool {
return cfg.Kill != nil && cfg.Kill.Enabled && len(cfg.Kill.Processes) > 0
}
func (m *KillModule) BuildCmds(ctx *modules.ModuleContext, stage modules.Stage) []string {
if stage != modules.StagePre {
return nil
}
var cmds []string
for _, proc := range ctx.Config.Kill.Processes {
if proc == "" {
continue
}
cmds = append(cmds, fmt.Sprintf("pkill %s", proc))
}
return cmds
}
func (m *KillModule) Validate() error {
_, err := exec.LookPath("pkill")
return err
}
func init() {
modules.Register(&KillModule{})
}