feat: add vmux setup and vmux hook for Claude Code integration

- vmux setup: idempotently adds hooks to ~/.claude/settings.json
- vmux hook: receives Claude Code hook events via env vars and forwards to daemon
- Daemon handles "hook" action on Unix socket (no HTTP server needed)
- Hooks provide instant state detection (permission/question/idle)
This commit is contained in:
Pierre Martin
2026-03-23 23:11:47 +01:00
parent 994b78aee5
commit 0e4ced5b1f
3 changed files with 128 additions and 1 deletions

14
main.go
View File

@@ -148,6 +148,18 @@ func main() {
}
runI3Bar(sockPath)
case "hook":
event := parseHookEnv()
if event.HookEventName == "" {
os.Exit(0)
}
client := NewClient(sockPath)
hookArgs, _ := json.Marshal(event)
client.Send(Request{Action: "hook", Args: hookArgs})
case "setup":
runSetup()
case "daemon":
runDaemon(sockPath)
@@ -208,8 +220,8 @@ Commands:
label <id> <text> Assign a label to a session
focus <minutes> Suppress notifications for N minutes
i3bar Output i3bar JSON (use as status_command in i3 config)
setup Add vmux hooks to Claude Code settings (idempotent)
stop Stop the vmux daemon
daemon Run the daemon in foreground (used internally)
Flags:
--no-color Disable colored output