3
1
I'm using Hammerspoon to resize my windows on OSX. Particularly, I want to be able to make windows take up half the screen, either vertically or horizontally, as well as take up the entire screen.
However, there is major redrawing lag when I switch between axes (e.g. vertical to horizontal). Previously I've used Spectacle, which performs the same task snappily.
To demonstrate, here are short clips of me resizing windows in Hammerspoon vs Spectacle.
Hammerspoon - https://vid.me/xg8o
Spectacle - https://vid.me/7dLP
Is this a limitation of how Hammerspoon resizes windows or could I optimize my config better?
Here's my init.lua
--
-- Window management
--
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Left", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local max = win:screen():frame()
f.x = max.x
f.y = max.y
f.w = max.w / 2
f.h = max.h
win:setFrame(f)
end)
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Right", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local max = win:screen():frame()
f.x = max.w / 2
f.y = max.y
f.w = max.w / 2
f.h = max.h
win:setFrame(f)
end)
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Up", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local max = win:screen():frame()
f.x = max.x
f.y = max.y
f.w = max.w
f.h = max.h / 2
win:setFrame(f)
end)
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Down", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local max = win:screen():frame()
f.x = max.x
f.y = max.h / 2
f.w = max.w
f.h = max.h / 2
win:setFrame(f)
end)
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "f", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local max = win:screen():frame()
f.x = max.x
f.y = max.y
f.w = max.w
f.h = max.h
win:setFrame(f)
end)