From f97262188b674b170309a330adae6f5211373920 Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Sat, 16 Apr 2016 12:06:16 -0400 Subject: switch from mjolnir to hammerspoon for mac window management --- hammerspoon/init.lua | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 hammerspoon/init.lua (limited to 'hammerspoon') diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua new file mode 100644 index 0000000..c745976 --- /dev/null +++ b/hammerspoon/init.lua @@ -0,0 +1,38 @@ +local window = require "hs.window" +local hotkey = require "hs.hotkey" + +window.animationDuration = 0 + +hotkey.bind({"alt"}, "0", function() + local win = window.focusedWindow() + win:maximize() +end) + +hotkey.bind({"alt"}, "left", function() + local win = window.focusedWindow() + if win ~= nil then + win:moveToUnit({x=0, y=0, w=0.5, h=1}) + end +end) + +hotkey.bind({"alt"}, "right", function() + local win = window.focusedWindow() + if win ~= nil then + win:moveToUnit({x=0.5, y=0, w=0.5, h=1}) + end +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}) + end +end) + +hotkey.bind({"alt"}, "r", function() + hs.reload() +end) + +hotkey.bind({"alt"}, "c", function() + hs.openConsole() +end) -- cgit v1.2.3