Created
November 2, 2022 09:18
-
-
Save kiinoda/e32b412411f99f0cb9dc34ee99ed6bf9 to your computer and use it in GitHub Desktop.
Hammerspoon - maximize main window of app, leave margin all around it
This file contains 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
-- maximize main window of app, leave margin all around it | |
appMaximizeWithBorder = function (appBundle) | |
local app = hs.application.get(appBundle) | |
if app then | |
win = app:mainWindow() | |
screenSize = win:screen():fullFrame() | |
local marginTop = 40 | |
local marginRBL = 16 -- margin Right, Bottom, Left | |
local winRectangle = hs.geometry.rect( | |
marginRBL, marginTop, | |
screenSize.w-2*marginRBL, screenSize.h-marginTop-marginRBL | |
) | |
win:setFrame(winRectangle) | |
end | |
end | |
hs.hotkey.bind({"ctrl"}, "return", function() appMaximizeWithBorder("net.kovidgoyal.kitty") end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment