From 9e02bc8057446d5a93e9e9f80976a0128ebce58e Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Wed, 5 Jun 2019 16:39:07 -0400 Subject: center window, but never smaller than 1280px --- hammerspoon/init.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3