From: Peng Li Date: Thu, 14 Sep 2017 22:57:35 +0000 (+0800) Subject: Hammmerspoon - add windowmax toggle hotkey X-Git-Url: http://47.100.26.94:8080/?a=commitdiff_plain;h=da1444b79dabf62580ab6acc7383ac0ee08857cd;p=dotfiles.git Hammmerspoon - add windowmax toggle hotkey --- diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua index c795b62..5beeeda 100644 --- a/hammerspoon/init.lua +++ b/hammerspoon/init.lua @@ -85,15 +85,17 @@ function move_window(direction) f.w = max.w f.h = max.h / 2 elseif direction == "max" then - f.x = max.x - f.y = max.y - f.w = max.w - f.h = max.h - elseif direction == "center" then - f.x = max.x + (max.w / 6) - f.y = max.y + (max.h / 6) - f.w = max.w * 2 / 3 - f.h = max.h * 2 / 3 + if f.w > (max.w * 3/4) and f.h > (max.h * 3/4) then + f.x = max.x + (max.w / 6) + f.y = max.y + (max.h / 6) + f.w = max.w * 2 / 3 + f.h = max.h * 2 / 3 + else + f.x = max.x + f.y = max.y + f.w = max.w + f.h = max.h + end else hs.alert.show("move_window(): Freaky parameter received " .. direction) end @@ -108,7 +110,6 @@ hs.hotkey.bind(hyper, "l", move_window("right")) hs.hotkey.bind(hyper, "k", move_window("up")) hs.hotkey.bind(hyper, "j", move_window("down")) hs.hotkey.bind(hyper, "m", move_window("max")) -hs.hotkey.bind(hyper, "c", move_window("center")) -- Search and dictionary -- Past and copy