Focus-follows-mouse for tmux panes in Ghostty.
Hover your mouse over a tmux pane and it automatically gets focus — no clicking required. Just like Ghostty's native focus-follows-mouse, but for tmux panes.
Split your terminal into panes with tmux, then just move your mouse between them. The active pane follows your cursor.
Requires macOS 13+ and Ghostty terminal.
git clone https://github.com/julian0xff/tmux-focus.git
cd tmux-focus
swift build -c release
cp .build/release/tmux-focus /usr/local/bin/Or with Homebrew (coming soon):
brew install julian0xff/tap/tmux-focustmux-focus # Start the daemon (run in background with &)
tmux-focus --stop # Stop the daemon
tmux-focus --help # Show all optionsStart it in the background:
tmux-focus &| Flag | Description |
|---|---|
--tmux <path> |
Path to tmux binary (auto-detected) |
--padding-x <px> |
Override Ghostty window-padding-x |
--padding-y <top,bottom> |
Override Ghostty window-padding-y |
--hz <number> |
Mouse polling rate in Hz (default: 20) |
- Monitors mouse movement via macOS global event monitor
- Detects the Ghostty window under the cursor
- Maps pixel coordinates to tmux cell coordinates using your Ghostty padding config
- Runs
tmux select-panewhen you hover over a different pane
The daemon reads your Ghostty config (~/.config/ghostty/config) to get the correct padding values. No manual configuration needed for most setups.
- Only activates when Ghostty is the frontmost app
- Only runs when tmux has 2+ panes (single pane = no-op)
- Only calls
tmux select-panewhen the pane actually changes (not on every mouse move) - Throttled to 20Hz — negligible CPU usage (~0.1%)
- Does nothing when tmux is not running
Add to your shell config (.zshrc / .bashrc):
# Start tmux-focus if tmux is running and daemon isn't
if command -v tmux-focus >/dev/null 2>&1 && tmux list-sessions &>/dev/null && ! pgrep -qf 'tmux-focus$'; then
tmux-focus &>/dev/null &
disown
fi- macOS 13.0+
- Ghostty terminal
- tmux
- Accessibility permissions (System Settings → Privacy & Security → Accessibility → Ghostty)
MIT