From 6a28a8569c9e23537b2b1bee9746a766250fd293 Mon Sep 17 00:00:00 2001 From: oz6un Date: Tue, 14 Jul 2026 10:55:53 +0300 Subject: [PATCH] feat: tmux status-bar touch controls for mobile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Managing tmux windows on a phone was the friction point: modifier keys (Ctrl-b, Alt) transmit unreliably on mobile terminals, and startup-command tricks fail once an agent is running in the pane (no shell to type into). The one input that always works is a status-bar tap — tmux handles those itself, regardless of pane contents. So the status bar is now a touch control panel: tap a window name to switch, tap [+] for a new window, tap [x] to close one (y/n confirm so a stray tap can't kill a running agent). Implemented via range=user status regions + a MouseDown1Status dispatch whose else-branch is the default select-window, so desktop/keyboard behavior (prefix+c / & / n / p) is unchanged. Verified functionally on-device; box brought to parity. Co-Authored-By: Claude Fable 5 --- README.md | 4 +++- files/tmux.conf | 22 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 11d9113..c996db1 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,9 @@ Optional: enable **Tailscale Serve** on your tailnet for HTTPS preview URLs — ## Daily use - **`ssh devbox`** lands you in fish inside a persistent tmux session. Detach with `Ctrl-b d`, - split with `Ctrl-b |` / `Ctrl-b -`, new window with `Ctrl-b c`. Mouse works and selections + split with `Ctrl-b |` / `Ctrl-b -`, new window with `Ctrl-b c`. On a phone (Termius etc.), + the status bar is touch: **tap a window name to switch**, tap **`[+]`** for a new window, tap + **`[x]`** to close one — no modifier keys. Mouse works and selections copy to your local clipboard. Sessions survive network drops and the nightly reboot — layouts restore, and `claude --continue` resumes a conversation. tmux is what makes reconnecting seamless; if your client drops, reconnect and you're back exactly where you were. diff --git a/files/tmux.conf b/files/tmux.conf index 8cdbba9..688cbe9 100644 --- a/files/tmux.conf +++ b/files/tmux.conf @@ -18,7 +18,27 @@ bind - split-window -v -c "#{pane_current_path}" bind c new-window -c "#{pane_current_path}" set -g status-style "bg=default" set -g status-left "#[bold] #S " -set -g status-right " #H · %H:%M " + +# --- Mobile touch controls ------------------------------------------------- +# tmux handles status-bar taps itself, so these work even when a pane runs an +# agent (no shell needed) and need no modifier keys: +# * single-tap a window name -> switch to it +# * tap [+] -> new window (in the current dir) +# * tap [x] -> close the current window (asks y/n first) +# Keyboard fallbacks stay as tmux defaults: prefix+c new, prefix+& close, +# prefix+n/p/w switch. +set -g status-right "#[range=user|newwin] [+] #[norange]#[range=user|killwin] [x] #[norange] #H · %H:%M " +bind -n MouseDown1Status { + if -F "#{==:#{mouse_status_range},newwin}" { + new-window -c "#{pane_current_path}" + } { + if -F "#{==:#{mouse_status_range},killwin}" { + confirm-before -p "close window '#W'? (y/n)" kill-window + } { + select-window -t= + } + } +} # Session persistence across reboots. # FOOTGUN: the tpm path must be relative to THIS user's home — an absolute