Last active
February 13, 2026 12:47
-
-
Save centum/b7a1c5d436651daac68dec4a9fa0b6d7 to your computer and use it in GitHub Desktop.
Open WezTerm in Quake Style by Hammerspoon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local log = hs.logger.new("INIT", "info") | |
| function topFocus(app) | |
| -- get screen where you are with your mouse | |
| local screen = hs.mouse.getCurrentScreen() | |
| -- get main window | |
| local app_window = app:mainWindow() | |
| -- move app to current screen | |
| app_window:moveToScreen(screen) | |
| -- get max coordinates | |
| local max = screen:fullFrame() | |
| -- get main window frame | |
| local f = app_window:frame() | |
| -- set dimension of frame | |
| f.x = max.x | |
| f.y = max.y | |
| f.w = max.w | |
| f.h = max.h * 0.55 -- 55% of max height | |
| -- log.d("Frame: " .. hs.inspect(f)) | |
| -- set new frame dimension after a little delay | |
| hs.timer.doAfter(0.2, function() | |
| app_window:setFrame(f) | |
| end) | |
| -- focus to app | |
| app_window:focus() | |
| end | |
| function toggleWezTerm(appName) | |
| -- pass true for the second param to not pick up browser window titles | |
| local app = hs.application.find(appName, true) | |
| if not app then | |
| log.d("Try start app: " .. appName) | |
| -- app = hs.application.open(appName, 2, true) | |
| app = hs.application.launchOrFocus(appName) | |
| if not app then | |
| log.e("FAILED to start app: " .. appName) | |
| return | |
| end | |
| hs.timer.doAfter(0.5, function() | |
| app = hs.application.find(appName, true) | |
| topFocus(app) | |
| end) | |
| else | |
| if app:isFrontmost() then | |
| app:hide() | |
| else | |
| topFocus(app) | |
| end | |
| end | |
| end | |
| hs.hotkey.bind({"option"}, "1", function() | |
| toggleWezTerm("WezTerm") | |
| end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment