Skip to content

Add tmux installation and configuration - #31

Open
drabaioli wants to merge 6 commits into
mainfrom
add-tmux-config
Open

Add tmux installation and configuration#31
drabaioli wants to merge 6 commits into
mainfrom
add-tmux-config

Conversation

@drabaioli

Copy link
Copy Markdown
Owner

What

Adds tmux to the distro setup.

  • scripts/install_tmux.sh — installs tmux via apt and copies data/tmux.conf to ~/.tmux.conf (follows the same pattern as the other install scripts).
  • setup.sh — registers the new script in the component list, between nerd fonts and terminal config.
  • data/tmux.conf — new config:
    • Prefix-free window nav/creation and pane nav (Ctrl+hjkl), Alt+Shift+S session chooser.
    • mouse on — wheel scrolls copy-mode, click focuses/resizes panes.
    • history-limit 50000, status bar on top with custom theme.
    • vi-style copy-mode; Shift+PageUp/PageDown scroll like plain gnome-terminal.

Notes

  • tmux is not auto-started — it stays manual (tmux), so no risk to existing shells during testing.
  • todo.md in the working tree is an unrelated stray file and is intentionally excluded.

Testing

Will run for a few days before merging.

🤖 Generated with Claude Code

drabaioli and others added 6 commits July 24, 2026 20:04
Add scripts/install_tmux.sh (apt install + copy config to ~/.tmux.conf)
and wire it into setup.sh's component list. Include data/tmux.conf with
prefix-free window/pane keybindings, mouse support, vi copy-mode, and
Shift+PageUp/PageDown scrolling.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Append a guarded block to ~/.bashrc that execs tmux for interactive
gnome-terminal shells, one independent session per window. Includes a
NO_TMUX escape hatch for a plain bash shell.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Now that tmux wraps every interactive shell, gnome-terminal no longer needs
its own tab bindings -- tmux owns window creation and navigation. Disable
new-tab, next/prev-tab and move-tab-left/right so they stop shadowing the
keys tmux and vim want. new-window (Ctrl+N) is kept.

Also capture profile tweaks that were only live in dconf: audible-bell=false
(no terminal bell), scrollbar-policy='never' (hide the scrollbar handle),
theme-variant='dark' and the explicit Tango palette. Pinning the palette
keeps colours reproducible instead of inheriting each distro's default.

Comment out the vim <C-S-t> tabnew mapping: VTE 0.68 has no modifyOtherKeys
support, so Ctrl+Shift+T arrives as the same 0x14 byte as Ctrl+T and the
mapping can never fire. The comment records how to re-check after an upgrade.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Selection now behaves closer to gnome-terminal's:

- Double/triple-click copy without tmux's built-in `run-shell -d 0.3`
  delay, which held the highlight before copying. Measured median latency
  from the second click to the copy landing: 671ms -> 293ms. The residual
  ~290ms is tmux resolving the click (it waits out the triple-click
  window) and is hardcoded.
- Alt+drag selects whole words, Ctrl+drag whole lines; plain drag stays
  character-precise. gnome-terminal's double-click-then-drag cannot be
  reproduced: tmux only classifies a double-click *after* the button is
  released, having already handled the drag as a fresh character-wise
  selection.
- copy-command routes every copy into X PRIMARY and CLIPBOARD via xclip,
  so Shift+Insert pastes tmux selections just like gnome-terminal ones.
  `y` in copy-mode switches to copy-pipe-and-cancel so it goes through
  copy-command too.

F12 toggles a passthrough mode that hands everything back: all key
combinations reach the pane (Ctrl+t, Ctrl+j, Ctrl+hjkl, Shift+arrows, and
the prefix itself) and the mouse returns to gnome-terminal, so native
double-click-drag selection works. The status bar turns orange while it is
active, since F12 is then the only key tmux still handles.

install_tmux.sh switches from apt to `snap install --classic tmux`.
Ubuntu 22.04 only carries tmux 3.2a, while these bindings were written and
verified against 3.6b, which is what the snap provides and what was
already installed here. It also installs xclip, now a dependency of the
copy-command above.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The F12 bindings set prefix, key-table, mouse and the status colours with
-g. Every terminal shares a single tmux server, so one F12 press turned
passthrough on everywhere: other open terminals lost their prefix and
mouse, the state survived the client that set it going away, and any
terminal opened afterwards started in passthrough with only the orange
status bar to explain why Ctrl+b did nothing.

All five are session options, so setting them without -g confines
passthrough to the terminal it was toggled in. Restoring now uses -u to
drop the session override rather than reassigning the theme colours, which
had duplicated them from the status bar config above and would have
drifted the moment either changed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The session chooser was bound to M-S-s, a key no VTE terminal produces:
gnome-terminal sends Alt+Shift+s as ESC plus a literal uppercase S, which
tmux resolves to M-S. Bind that instead.

In ~/.bashrc, `exec tmux` replaced the shell before tmux could fail, so a
broken ~/.tmux.conf or a snap mid-refresh would close the terminal window
with no shell left to fix it from. Use `tmux new-session && exit` so a
failure falls through to a plain bash prompt.

Also guard the ~/.bashrc append with a marker check so re-running
load_terminal_config.sh no longer stacks up duplicate blocks.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant