feat(04-02): add vmux i3bar subcommand with i3status wrapping
- runI3Bar: standalone mode (polling 2s) and i3status wrapping mode - i3bar protocol v1: header + infinite JSON array on stdout - queryVmuxBlock: daemon offline fallback in gray - CLI: vmux i3bar auto-detects i3status in PATH - Stdout sync after each write to avoid buffering Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
13
main.go
13
main.go
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -141,6 +142,17 @@ func main() {
|
||||
}
|
||||
fmt.Println("Daemon stopped.")
|
||||
|
||||
case "i3bar":
|
||||
if err := EnsureDaemon(sockPath); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
i3statusCmd := ""
|
||||
if _, err := exec.LookPath("i3status"); err == nil {
|
||||
i3statusCmd = "i3status"
|
||||
}
|
||||
runI3Bar(sockPath, i3statusCmd)
|
||||
|
||||
case "daemon":
|
||||
runDaemon(sockPath)
|
||||
|
||||
@@ -199,6 +211,7 @@ Commands:
|
||||
switch <query> Switch to the workspace of the matching session
|
||||
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)
|
||||
stop Stop the vmux daemon
|
||||
daemon Run the daemon in foreground (used internally)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user