Fixing Clickable Hyperlinks in Tmux With Ghostty
When using tmux inside the Ghostty terminal emulator, you might encounter issues where clickable hyperlinks don’t work as expected. I ran into this problem myself. At first, I searched through GitHub issues and tried the suggested solutions, but none of them worked. So I switched to Kitty ✋😭✋
Recently, I revisited the problem and here is what I found that works.
Solutions
TL;DR
- Option 1: Disable
mouse-shift-capturein Ghostty config. - Option 2: Disable mouse support in tmux config by setting
set -g mouse offin your~/.tmux.conf.
| Ghostty\Tmux | Integration: Off | Integration: On |
|---|---|---|
| Shift Capture: False | ⌘ + Click | ⇧ + ⌘ + Click |
| Shift Capture: True | ⌘ + Click | Not Work |
Option 1
Ghostty has a feature called mouse-shift-capture [1] which is disabled by default. Somehow, I had enabled this feature in my config (~/.config/ghostty/config), which is why ⇧ + ⌘ + Click wasn’t working on my laptop.
By commenting out or removing mouse-shift-capture = true from the Ghostty config, I can open links in tmux with ⇧ + ⌘ + Click again.
Why this works
This option determines determines who handles the click: the Terminal (Ghostty) or the Program (Tmux)
- When set to true (Broken):
- Ghostty sends
⇧ + ⌘ + Clickdirectly to Tmux. - Result: Tmux receives the signal but doesn’t know how to open a browser.
- Ghostty sends
- When set to false (Fixed):
- Ghostty sees the Shift key and decides to keep the event, ignoring Tmux.
- Result: Ghostty recognizes
⌘ + Clickand opens the link for you.
Option 2
Alternatively, disable mouse support in tmux by commenting out or removing set -g mouse on from your ~/.tmux.conf can also solve the problem.
And with this change, you can open links with ⌘ + Click (no Shift required). However, the downside is that you will lose the following mouse functionalities in tmux:
- Mouse scrolling in pane history
- Mouse text selection and copying
- Mouse tab/pane selection (click to focus a tab/pane)
- Mouse pane resizing (drag pane borders)
Why this works
I didn’t read the tmux’s doc to confirm this, but my understanding is:
- When set to
on(Intercepted):- Tmux tells Ghostty to let it handle mouse events.
- Result: Ghostty forwards normal clicks to Tmux.
⌘ + Clickis handled by Tmux, which doesn’t know how to open a browser. Hence, it doesn’t work.
- When set to
off(Fixed):- Tmux ignores the mouse, leaving Ghostty in full control of all mouse events. No
⇧bypass key is needed. Hence⌘ + Clickworks as expected.
- Tmux ignores the mouse, leaving Ghostty in full control of all mouse events. No
Outro
I use tmux primarily to save time, like:
- Utilizing
tmux-floating-paneto quickly do something without leaving my current context, for details, see my post on tmux_floating_pane. - Using tmux’s copy mode to quickly copy text without needing to switch to the mouse, for details, see my post on
There is a certain irony in how much time I spend debugging my tools just to save a split second. Does tmux worth the cost? Maybe like the Kitty’s developer said, “Terminal multiplexers are a bad idea” 😭
Maybe I’ll ditch tmux one day, but for now, I really need the floating-pane feature. [2]
Determines whether running programs can detect the shift key pressed with a mouse click. Typically, the shift key is used to extend mouse selection. Option Reference - Configuration ↩︎
Maybe Ghossty will implement floating pane feature Float pane / popup support · ghostty-org/ghostty · Discussion #3197 ↩︎
Fixing Clickable Hyperlinks in Tmux With Ghostty
https://vluv.space/fixing-clickable-hyperlinks-tmux-ghostty/