diff options
| author | gbc dev <gbc@localhost> | 2026-07-15 10:10:16 +0200 |
|---|---|---|
| committer | gbc dev <gbc@localhost> | 2026-07-15 10:10:16 +0200 |
| commit | d52d92092d98ed2d6c48e6433cacb899582f617e (patch) | |
| tree | 7e835fb815d6ec868b2362b37bab63f8365857dc | |
| parent | fix(control): ignore SIGPIPE so a vanishing client can't kill the emulator (diff) | |
| download | sl0pboy-d52d92092d98ed2d6c48e6433cacb899582f617e.tar.gz sl0pboy-d52d92092d98ed2d6c48e6433cacb899582f617e.tar.xz sl0pboy-d52d92092d98ed2d6c48e6433cacb899582f617e.zip | |
gbctl: 'hud' kills any existing HUD pane before spawning (no double-HUD)
gbctl hud now scans tmux for panes started with gbhud.py and kills them before
spawning, so there's never more than one HUD (fixes the double-spawn flicker).
Added 'gbctl hud --kill' to just tear the HUD down.
| -rw-r--r-- | core.3094252 | bin | 0 -> 11268096 bytes | |||
| -rw-r--r-- | core.3095917 | bin | 0 -> 11268096 bytes | |||
| -rw-r--r-- | core.3096524 | bin | 0 -> 11268096 bytes | |||
| -rw-r--r-- | core.3096981 | bin | 0 -> 11268096 bytes | |||
| -rw-r--r-- | core.3103352 | bin | 0 -> 11268096 bytes | |||
| -rw-r--r-- | core.3104381 | bin | 0 -> 11268096 bytes | |||
| -rw-r--r-- | core.3107696 | bin | 0 -> 11268096 bytes | |||
| -rw-r--r-- | core.3112782 | bin | 0 -> 11268096 bytes | |||
| -rw-r--r-- | core.3114457 | bin | 0 -> 11268096 bytes | |||
| -rw-r--r-- | core.3115685 | bin | 0 -> 11268096 bytes | |||
| -rw-r--r-- | core.3117279 | bin | 0 -> 11268096 bytes | |||
| -rw-r--r-- | core.3118071 | bin | 0 -> 11268096 bytes | |||
| -rwxr-xr-x | gbctl | 27 |
13 files changed, 26 insertions, 1 deletions
diff --git a/core.3094252 b/core.3094252 Binary files differnew file mode 100644 index 0000000..8da34bb --- /dev/null +++ b/core.3094252 diff --git a/core.3095917 b/core.3095917 Binary files differnew file mode 100644 index 0000000..549133c --- /dev/null +++ b/core.3095917 diff --git a/core.3096524 b/core.3096524 Binary files differnew file mode 100644 index 0000000..04786a5 --- /dev/null +++ b/core.3096524 diff --git a/core.3096981 b/core.3096981 Binary files differnew file mode 100644 index 0000000..b3a5c51 --- /dev/null +++ b/core.3096981 diff --git a/core.3103352 b/core.3103352 Binary files differnew file mode 100644 index 0000000..230f6a2 --- /dev/null +++ b/core.3103352 diff --git a/core.3104381 b/core.3104381 Binary files differnew file mode 100644 index 0000000..4c71880 --- /dev/null +++ b/core.3104381 diff --git a/core.3107696 b/core.3107696 Binary files differnew file mode 100644 index 0000000..965f8c9 --- /dev/null +++ b/core.3107696 diff --git a/core.3112782 b/core.3112782 Binary files differnew file mode 100644 index 0000000..88d4aca --- /dev/null +++ b/core.3112782 diff --git a/core.3114457 b/core.3114457 Binary files differnew file mode 100644 index 0000000..1c71b59 --- /dev/null +++ b/core.3114457 diff --git a/core.3115685 b/core.3115685 Binary files differnew file mode 100644 index 0000000..5d7c329 --- /dev/null +++ b/core.3115685 diff --git a/core.3117279 b/core.3117279 Binary files differnew file mode 100644 index 0000000..3973114 --- /dev/null +++ b/core.3117279 diff --git a/core.3118071 b/core.3118071 Binary files differnew file mode 100644 index 0000000..f45e7a0 --- /dev/null +++ b/core.3118071 @@ -284,11 +284,35 @@ def cmd_screen(argv): r = subprocess.run(args, capture_output=True, text=True) sys.stdout.write(r.stdout) +def _kill_hud_panes(): + # kill any pane whose start command references the HUD, so there's never + # more than one HUD running (avoids the double-spawn tmux flicker). + n = 0 + try: + r = subprocess.run( + ["tmux", "list-panes", "-a", "-F", "#{pane_id}\t#{pane_start_command}"], + capture_output=True, text=True) + for line in r.stdout.splitlines(): + pid, _, startcmd = line.partition("\t") + if "gbhud.py" in startcmd: + subprocess.run(["tmux", "kill-pane", "-t", pid], capture_output=True) + n += 1 + except Exception: + pass + return n + def cmd_hud(argv): # spawn a tmux pane running the live debug HUD, bound to the resolved socket + killonly = "--kill" in argv + if killonly: + argv = [a for a in argv if a != "--kill"] + k = _kill_hud_panes() + print("killed %d hud pane(s)" % k) + return sock_path = _resolve_sock(argv) if "TMUX" not in os.environ: die("not inside tmux; gbctl hud needs a tmux session") + killed = _kill_hud_panes() # never leave a second HUD around hud = os.path.join(HERE, "tools", "gbhud.py") split = "-h" if "--split" in argv: @@ -298,7 +322,8 @@ def cmd_hud(argv): capture_output=True, text=True) if r.returncode != 0: die("tmux spawn failed: %s" % r.stderr.strip()) - print("hud pane=%s sock=%s" % (r.stdout.strip(), sock_path)) + note = (" (replaced %d)" % killed) if killed else "" + print("hud pane=%s sock=%s%s" % (r.stdout.strip(), sock_path, note)) def cmd_monitor(argv): secs = float(argv[0]) if argv and _isnum(argv[0]) else None |
