Replies: 1 comment 1 reply
-
Put something together now but not sure how correct this is: function resizeAndCenterWinByPerc(perc)
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
local w = max.w*perc
local h = max.h*perc
f.w = w
f.h = h
win:setFrame(f, 0)
f.x = max.w/2 - w/2
f.y = max.h/2 - h/2
nf = screen:localToAbsolute(f)
win:move(nf, screen, true, 0)
end
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "C", function()
resizeAndCenterWinByPerc(0.8)
end)
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "V", function()
resizeAndCenterWinByPerc(0.6)
end) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am not sure if I'm doing something wrong but I am trying to center the window and it works fine on the main monitor but doesn't work for any other monitors.
Here's there relevant code:
Can anyone point me in the right direction on how I can make this work accross different monitors?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions