Start a hammerspoon config!

Sun, 29 Jan 2017 00:07:24 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 29 Jan 2017 00:07:24 -0500
changeset 493
165f65e47a3c
parent 492
e5d6f6523162
child 494
d6d298c93437

Start a hammerspoon config!

.hammerspoon/init.lua file | annotate | diff | comparison | revisions
new file mode 100644
--- /dev/null
+++ b/.hammerspoon/init.lua
@@ -0,0 +1,31 @@
+hs.window.animationDuration = 0
+
+function reloadConfig(files)
+    hs.reload()
+end
+hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", reloadConfig):start()
+
+local bindKey  = hs.hotkey.bind
+local cmd      = hs.fnutils.partial(bindKey, {"cmd"})
+local cmdShift = hs.fnutils.partial(bindKey, {"cmd", "shift"})
+
+cmdShift('r', reloadConfig)
+
+function focusTo(direction)
+  hs.window['focusWindow' .. direction](hs.window.focusedWindow() or hs.window.desktop())
+end
+
+cmd('k',  function () focusTo('North') end)
+cmd('up', function () focusTo('North') end)
+
+cmd('j',    function () focusTo('South') end)
+cmd('down', function () focusTo('South') end)
+
+cmd('h',    function () focusTo('West') end)
+cmd('left', function () focusTo('West') end)
+
+cmd('l',     function () focusTo('East') end)
+cmd('right', function () focusTo('East') end)
+
+cmdShift('up', function () hs.window.focusedWindow():maximize() end)
+

mercurial