[hammerspoon] use fennel, disable quitter
change
commit 10cc190cfcd736001088e2d961b4d0b75871e3c6
author Alpha Chen <alpha@kejadlen.dev>
date
parent fa09f59d
diff --git a/.hammerspoon/init.fnl b/.hammerspoon/init.fnl
new file mode 100644
index 00000000..be03f233
--- /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 6af5a083..4e00d886 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()