From 10cc190cfcd736001088e2d961b4d0b75871e3c6 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Tue, 3 Mar 2020 08:06:43 -0800 Subject: [PATCH] [hammerspoon] use fennel, disable quitter --- .hammerspoon/init.fnl | 15 +++++++++++++++ .hammerspoon/init.lua | 28 ++++------------------------ 2 files changed, 19 insertions(+), 24 deletions(-) create mode 100644 .hammerspoon/init.fnl diff --git a/.hammerspoon/init.fnl b/.hammerspoon/init.fnl new file mode 100644 index 0000000..be03f23 --- /dev/null +++ b/.hammerspoon/init.fnl @@ -0,0 +1,15 @@ +(let [mash [:cmd :alt :ctrl] + smash [:cmd :alt :ctrl :shift] + wm {:left hs.layout.left50 + :right hs.layout.right50 + :ne [ 0.5 0 0.5 0.5 ] + :nw [ 0 0 0.5 0.5 ] + :se [ 0.5 0.5 0.5 0.5 ] + :sw [ 0 0.5 0.5 0.5 ] + :max hs.layout.maximized} + move (fn [key] (let [win (hs.window.focusedWindow) + geo (. wm key)] + (win:move geo nil true)))] + (hs.hotkey.bind mash "h" (fn [] (move :left))) + (hs.hotkey.bind mash "l" (fn [] (move :right))) + (hs.hotkey.bind mash "m" (fn [] (move :max)))) diff --git a/.hammerspoon/init.lua b/.hammerspoon/init.lua index 6af5a08..4e00d88 100644 --- a/.hammerspoon/init.lua +++ b/.hammerspoon/init.lua @@ -1,27 +1,7 @@ -local mash = {"cmd", "alt", "ctrl"} -local smash = {"cmd", "alt", "ctrl", "shift"} - --- Window management -- - -wm = { - left = hs.layout.left50, - right = hs.layout.right50, - ne = { 0.5, 0, 0.5, 0.5 }, - nw = { 0, 0, 0.5, 0.5 }, - se = { 0.5, 0.5, 0.5, 0.5 }, - sw = { 0, 0.5, 0.5, 0.5 }, - max = hs.layout.maximized, -} - -function move(key) - local win = hs.window.focusedWindow() - local geo = wm[key] - win:move(geo, nil, true) -end +fennel = require("fennel") +table.insert(package.loaders or package.searchers, fennel.searcher) -hs.hotkey.bind(mash, "h", function() move("left") end) -hs.hotkey.bind(mash, "l", function() move("right") end) -hs.hotkey.bind(mash, "m", function() move("max") end) +fennel.dofile("init.fnl", { allowedGlobals = false }) -- Defeat paste blocking -- @@ -43,7 +23,7 @@ spoon.Quitter.quitAppsAfter = { ["com.reederapp.macOS"] = 600, ["com.tinyspeck.slackmacgap"] = 600, } -spoon.Quitter:start() +-- spoon.Quitter:start() hs.loadSpoon("ReloadConfiguration") spoon.ReloadConfiguration:start()