Skip to content

Instantly share code, notes, and snippets.

@kiinoda
Created November 2, 2022 09:18
Show Gist options
  • Save kiinoda/e32b412411f99f0cb9dc34ee99ed6bf9 to your computer and use it in GitHub Desktop.
Save kiinoda/e32b412411f99f0cb9dc34ee99ed6bf9 to your computer and use it in GitHub Desktop.
Hammerspoon - maximize main window of app, leave margin all around it
-- 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