Ghostty + Zellij + Fish Shell
Ghostty just dropped, let's intergrate it with my previous Terminal stack of Zellij and Fish!
Roman Zipp, December 28th, 2024
If you have some issues, questions or comments, there is a GitHub discussion about this procedure!
At first I did not understand why Ghostty got so much hype. I've used WezTerm and was pretty satisfied with it (even did some fun scripting for transparent window background when the window is out of focus).
Although there were some quirks:
I could not get WezTerm to forward macOS
CMD + ...
keybindings to Zellij
-> this is what we're gonna solveI had to set a separate DPI and font size for each of my external displays and the integrated Macbook screen
-> automatically works in Ghostty
Ghostty
Well, head over to the Ghostty install docs. I assume you already did that if you clicked on this article.
Zellij
Zellij is basically a modern type of tmux, written in Rust - of course.
Fish
A shell environment - but modern. Easily extendable.
Integrate
We have some requirements:
Automatically launch Zellij when opening a Terminal in Ghostty
We do not want Zellij if we're in another Terminal - such as the integrated Terminal in JetBrains IDEs
Ghostty as an initial-command
config option but I didn't feel like the Ghostty config was the right place for our environment check. Additionally, we would loose the automatic shell detection when overriding this config option.
For keybindings, I do not need native Terminal tabs but rather want to use tabs + panes in Zellij. So I want to use the usual key combinations of Command +n
(new tab) and Command + Option + Arrow
for switching between them.
config.fish
# Unset the default fish greeting text which messes up Zellij set fish_greeting # Check if we're in an interactive shell if status is-interactive # At this point, specify the Zellij config dir, so we can launch it manually if we want to export ZELLIJ_CONFIG_DIR=$HOME/.dotfiles/zellij # Check if our Terminal emulator is Ghostty if [ "$TERM" = "xterm-ghostty" ] # Launch zellij eval (zellij setup --generate-auto-start fish | string collect) end end
ghostty
Config file
I've made some minor adjustments to the Ghostty config file. It works really well out of the box!
mouse-scroll-multiplier = 0.5 window-decoration = true window-padding-x = 8 window-padding-y = 8 theme = catppuccin-mocha font-feature = -liga macos-titlebar-style = transparent # Unbind CMD+... keys so they will be forwarded to Zellij keybind = cmd+t=unbind keybind = cmd+n=unbind keybind = cmd+c=unbind keybind = cmd+w=unbind keybind = cmd+opt+left=unbind keybind = cmd+opt+right=unbind
zellij.kdl
Config
keybinds { normal { bind "Super c" { Copy; } bind "Super Alt Left" { GoToPreviousTab; } bind "Super Alt Right" { GoToNextTab; } bind "Super w" { CloseTab; } bind "Super n" { NewTab; } } }
And this is what we got!