Launch new window with Ghostty CLI on macOS #9221
-
|
I use yabai and skhd on macOS for a tiling VM experience (that I'm used to from Linux). Currently I use Kitty as a terminal emulator. I have a keybinding set in skhd to launch a new Kitty window: It would be nice if I could do the same with Ghostty. Last time I checked this wasn't possible. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
|
it is fully possible but ghostty follows the macos method of using open (this has been possible since 1.0) this will open a new instance of the application (im pretty sure -n will as well but im not sure maybe that is only a new window) Ghostty does not plan on having it in the cli |
Beta Was this translation helpful? Give feedback.
-
|
this seems promising? Im not sure if you can do applescript stuff through the CLI |
Beta Was this translation helpful? Give feedback.
-
|
If you're mainly interested in the keybind rather than the CLI itself, you may also consider the following solution: Caveat that I don't know yabai/skhd syntax, so I'm just extrapolating from your example here, but the idea is to launch ghostty with a global keybind that shadows the system keybind. That way, if ghostty is already open, it will intercept the keybind and open a new window in the same instance. This is how I've set it up on my system, albeit through the macOS Shortcuts app instead of the wm config. If you want this to work no matter how the ghostty process was first launched, you can add the global keybind to the ghostty config instead of passing it on the command line. So you'd have # in ~/.config/ghostty/config
keybind = global:ctrl+alt+enter=new_window |
Beta Was this translation helpful? Give feedback.
I'm not entirely sure what the problem was, but I managed to solve it with the following config:
This is the syntax telling SKHD not to consume a keybinding.
The weird thing: when configured in both SKHD and Ghostty, it seemed like SKHD didn't actually get the event when Ghostty was running. So it looks like it got lost between the two somewhere. :D
Anyway, the above seems to be working just fine, doing exactly what I wanted, so huge thanks!