From b39f233bf65c4a4b1d8d7a813b21d8477699ffae Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 7 Sep 2025 21:10:15 +0300 Subject: feat(tmux): add status line updates via @hexai_status; wire into CLI, LSP stats, and tmux-action --- internal/tmux/status.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 internal/tmux/status.go (limited to 'internal/tmux') diff --git a/internal/tmux/status.go b/internal/tmux/status.go new file mode 100644 index 0000000..4e1f9e4 --- /dev/null +++ b/internal/tmux/status.go @@ -0,0 +1,28 @@ +package tmux + +import ( + "os" + "os/exec" + "strings" +) + +// Enabled reports whether tmux status updates are enabled via env (default: on). +func Enabled() bool { + v := strings.TrimSpace(os.Getenv("HEXAI_TMUX_STATUS")) + if v == "" { return true } + v = strings.ToLower(v) + return v == "1" || v == "true" || v == "yes" || v == "on" +} + +// SetUserOption sets a global tmux user option like @hexai_status to value. +func SetUserOption(key, value string) error { + if !Enabled() || !HasBinary() || !InSession() { return nil } + k := strings.TrimPrefix(strings.TrimSpace(key), "@") + if k == "" { return nil } + // Use set-option -g so it appears for all windows + return exec.Command("tmux", "set-option", "-g", "@"+k, value).Run() +} + +// SetStatus is a convenience for setting @hexai_status. +func SetStatus(value string) error { return SetUserOption("hexai_status", value) } + -- cgit v1.2.3