012. Tmux UX and Clipboard Integration Strategy¶
Date: 2026-02-15
Status¶
Accepted
Context¶
Tmux behavior and clipboard handling were split across multiple locations with duplicated backend detection logic. This led to:
- Inconsistent copy/paste behavior between shell and tmux plugin flows.
- Keybinding conflicts that made tmux copy/yank behavior less intuitive.
- Higher maintenance cost due to drift between alias logic and tmux plugin commands.
- Weak diagnostics for clipboard failures during setup/doctor runs.
At the same time, default auto-attach behavior in shell startup would risk disrupting IDE terminals, CI, and non-interactive workflows.
Decision¶
We standardize tmux UX and clipboard integration with these rules:
- Unified Clipboard Backend
- Introduce one helper script:
~/.local/bin/clipboard(managed fromdot_local/bin/executable_clipboard). -
Route both shell aliases (
copy,cbpaste) and tmux thumbs copy commands through this helper. -
Intuitive Tmux Copy/Paste
- Keep copy-mode vi flow (
v,y,Enter) and mouse-copy behavior. - Reserve
Prefix + yfor yank semantics and move synchronize panes toPrefix + Y. -
Add explicit paste shortcuts:
Prefix + p(paste latest),Prefix + P(choose buffer). -
Operational Diagnostics
- Add clipboard helper/backend checks to
mise run doctor. -
Report detected backend (
xclip,wayland,macos,wsl,win32yank) with actionable warnings. -
Auto-Attach Policy
- Keep tmux auto-attach as opt-in only.
- Do not auto-attach by default in shell startup.
Consequences¶
Positive¶
- Copy/paste behavior is consistent across shell and tmux.
- Tmux interaction is more predictable for daily usage.
- Clipboard troubleshooting is faster with explicit doctor diagnostics.
- Reduced duplication and lower long-term maintenance burden.
- Avoids accidental shell/session hijacking from default auto-attach.
Negative¶
- Adds one managed helper script to maintain.
- Slightly more indirection for clipboard commands.
Compliance¶
- Idempotent with chezmoi-managed files.
- Cross-platform backend handling (Linux/Wayland/macOS/WSL/win32yank).
- Doctor diagnostics added.
- Test coverage added for tmux and alias integration.