aboutsummaryrefslogtreecommitdiff
path: root/hammerspoon
diff options
context:
space:
mode:
authorMatt Singleton <msingleton@aclu.org>2019-06-05 16:39:07 -0400
committerMatt Singleton <msingleton@aclu.org>2019-06-05 16:39:07 -0400
commit9e02bc8057446d5a93e9e9f80976a0128ebce58e (patch)
treed00055c472e1c1fedc28467be41062fd848541a3 /hammerspoon
parentf74f785e7b552ca4b1d443aa59e2231865640ed0 (diff)
center window, but never smaller than 1280px
Diffstat (limited to 'hammerspoon')
-rw-r--r--hammerspoon/init.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua
index c745976..9460093 100644
--- a/hammerspoon/init.lua
+++ b/hammerspoon/init.lua
@@ -1,5 +1,6 @@
local window = require "hs.window"
local hotkey = require "hs.hotkey"
+local geom = require "hs.geometry"
window.animationDuration = 0
@@ -25,7 +26,12 @@ end)
hotkey.bind({"alt"}, "down", function()
local win = window.focusedWindow()
if win ~= nil then
- win:moveToUnit({x=0.167, y=0, w=0.666, h=1})
+ local screen_frame = win:screen():frame()
+ local new_geom = geom.copy(win:frame())
+ new_geom.w = 1280
+ new_geom.h = screen_frame.h
+ new_geom.center = screen_frame.center
+ win:setFrame(new_geom)
end
end)