Unbinding Ghostty's Cmd keys and binding them in Herdr

Since setting up Herdr inside Ghostty, the same actions had two shortcuts, Cmd+T for a Ghostty tab and Ctrl+B C for a Herdr tab, and that made things a bit confusing and then I had to keep using my mouse for everything in Herdr. But Oron Ben suggested something on X and that clicked, I then followed his write-up to unbound the Cmd keys in Ghostty and bound the same keys directly in Herdr.

Now, Ghostty passes the keypress through to the terminal and Herdr answers it, no prefix and no escape-code translation.

My Herdr setup

Shortcut Before (Ghostty) Now (Herdr)
Cmd+T new tab new tab
Cmd+W close tab close pane
Cmd+D split right split pane vertically
Cmd+Shift+D split down split pane horizontally
Cmd+] & Cmd+[ focus next and previous split cycle next and previous pane
Cmd+Shift+] & Cmd+Shift+[ next and previous tab next and previous tab
Cmd+1..9 jump to tab switch workspace
Alt+1..9 types special characters switch tab

Ghostty keeps everything else, Cmd+N for a new window, Cmd+C / Cmd+V for copy and paste, search, and font size. And Herdr's Ctrl+B prefix mode keeps working as a fallback, with Ctrl+B ? showing the help panel.

I also created a short video to show how easier it is to navigate inside Herdr using these keyboard shortcuts.

The Ghostty side lives in the same config file my cmux setup already used at ~/Library/Application Support/com.mitchellh.ghostty/config.ghostty, symlinked from ~/.config/ghostty/config.

macos-option-as-alt = true

keybind = cmd+t=unbind
keybind = cmd+w=unbind
keybind = cmd+d=unbind
keybind = cmd+shift+d=unbind
keybind = cmd+[=unbind
keybind = cmd+]=unbind
keybind = cmd+shift+[=unbind
keybind = cmd+shift+]=unbind
keybind = cmd+1=unbind
keybind = cmd+digit_1=unbind
keybind = cmd+2=unbind
keybind = cmd+digit_2=unbind
keybind = cmd+3=unbind
keybind = cmd+digit_3=unbind
keybind = cmd+4=unbind
keybind = cmd+digit_4=unbind
keybind = cmd+5=unbind
keybind = cmd+digit_5=unbind
keybind = cmd+6=unbind
keybind = cmd+digit_6=unbind
keybind = cmd+7=unbind
keybind = cmd+digit_7=unbind
keybind = cmd+8=unbind
keybind = cmd+digit_8=unbind
keybind = cmd+9=unbind
keybind = cmd+digit_9=unbind

Ghostty binds both cmd+1 and cmd+digit_1 by default, 1 matches the character and digit_1 the physical key, so both lines are needed for every digit. You can check with ghostty +show-config --default | grep goto_tab.

The Herdr side goes into ~/.config/herdr/config.toml:

[keys]
new_tab = "cmd+t"
close_pane = "cmd+w"
split_vertical = "cmd+d"
split_horizontal = "cmd+shift+d"
cycle_pane_next = "cmd+]"
cycle_pane_previous = "cmd+["
next_tab = "cmd+shift+]"
previous_tab = "cmd+shift+["
switch_workspace = "cmd+1..9"
switch_tab = "alt+1..9"

herdr config check validates the TOML and herdr server reload-config applies it to the running server without a restart. For Alt to work at all, macos-option-as-alt = true is required in Ghostty, otherwise Option types special characters.

So far, I'm loving the setup.