Make Wezterm behave like Ghostty's Quick Terminal, i.e. use a keybind to focus/hide a scratch terminal that always stays on top.
Keybind: Alt-`
- First press: Spawns a wezterm terminal with workspace
"_scratch"and focuses it in the middle of the screen. - Subsequent pressees: Hides the terminal if it is focused. Otherwise bring the terminal to the centre and focus.
Define a "_scratch" workspace (or any other name of your choice) so Wezterm can do special handling for this specific GUI window,
e.g. resize it to preference and always keep it above other apps.
See wezterm.lua below.
Hammerspoon is responsible for summoning and hiding the scratch terminal.
See hammerspoon.lua below.
If you have a tiling window manager like Aerospace, you will probably want to set an exception to not manage the scratch terminal, e.g.
[[on-window-detected]]
if.app-name-regex-substring = 'wezterm'
if.window-title-regex-substring = '_scratch'
run = 'layout floating'wezterm --version:20250511-222021-ad44b159- Hammerspoon: Version 1.0.0 (6864)
aerospace --version:0.18.5-Beta 4213dfd9d958dbfe3f801e07d7d5af53303baa75
-
I don't want to use Wezterm's multiplexer.
In the hammerspoon script, find the
wez.spawnmethod and remove--domain unix --attachfrom theargsvariable. In fact, play around with this part of the script and please let me know if there's a better way to interact withwezterm. -
I don't like the terminal in the center of the screen and prefer the curtain-like apperance of Quake mode.
Update your wezterm configuration to change how the window is positioned. See https://gist.github.com/xieve/fc67361a2a0cb8fc23ab8369a8fc1170 for example.
-
Are there other ways to achieve this result? How about on other platforms?
Yes, please see this discussion wezterm/wezterm#1751 and another relevant gist: https://gist.github.com/xieve/fc67361a2a0cb8fc23ab8369a8fc1170.

Hi, thanks for this great gist! I'm trying to set up the quick terminal but running into some issues on macOS.
Environment
macOS: Tahoe 26.0.1
WezTerm: installed via brew install --cask wezterm at /Applications/WezTerm.app, 20240203-110809-5046fc22
Hammerspoon: Version 1.0.0 (6864)
Issues
When running the spawn command, I get:
failed to exec "/usr/local/bin/wezterm-gui" "start" "--class" "org.wezfurlong.wezterm._scratch" "--workspace" "_scratch": Os { code: 2, kind: NotFound, message: "No such file or directory" }
The wezterm binary at /usr/local/bin/wezterm expects wezterm-gui to be in the same directory, but it's actually at /Applications/WezTerm.app/Contents/MacOS/wezterm-gui.
Workaround: Creating a symlink solved this:
bashsudo ln -sf /Applications/WezTerm.app/Contents/MacOS/wezterm-gui /usr/local/bin/wezterm-gui
The original script uses:
luaio.popen(os.getenv("SHELL") .. [[ -l -i -c "]] .. command .. [["]])
But Hammerspoon's wez.findWindow() consistently fails to detect the spawned window, even though the window does appear with the correct _scratch title.
Attempted fixes:
Using hs.execute() instead of io.popen() - blocks execution
Using open -na WezTerm --args start --workspace _scratch - spawns window but doesn't trigger gui-attached event
Increasing wait time and retry count - still can't find window
The manual command works fine:
bashwezterm start --class org.wezfurlong.wezterm._scratch --workspace _scratch
Questions
Is there a recommended way to install WezTerm that avoids the wezterm-gui path issue?
Has anyone else experienced Hammerspoon's hs.application.find() or hs.window.allWindows() failing to detect newly spawned wezterm windows?
Would it be better to use a different approach for spawning, like AppleScript or a different Lua API?
Any guidance would be appreciated! The setup looks amazing when it works.