[hammerspoon] cleanup wm
change ryppkkqlokkspnprmzrtrnrrmmtmlokp
commit 1cfd85fa0c06461059e2bce9f37392b5c86ac0b6
author Alpha Chen <alpha@kejadlen.dev>
date
parent zwpoulpt
diff --git a/.hammerspoon/wm.fnl b/.hammerspoon/wm.fnl
index 1dd31cc3..676539f6 100644
--- a/.hammerspoon/wm.fnl
+++ b/.hammerspoon/wm.fnl
@@ -1,24 +1,25 @@
 ;; Ported from https://github.com/miromannino/miro-windows-manager/blob/master/MiroWindowsManager.spoon/init.lua#L95-L121
 
-(local {:fnutils {:indexOf index-of}} hs)
+(local {:fnutils {:indexOf index-of} : grid : logger : window} hs)
 (local {: is-ff-focused : with-ax-hotfix} (require :little-ff))
 
-(local log (hs.logger.new :init :info))
+(local log (logger.new :init :info))
 
-(local full {:x 0 :y 0 :w 8 :h 8})
-(local three-quarters {:x 1 :y 1 :w 6 :h 6})
-(local half {:x 2 :y 2 :w 4 :h 4})
-(local steps [full three-quarters half])
+;; fnlfmt: skip
+(local steps (let [full           {:x 0 :y 0 :w 8 :h 8}
+                   three-quarters {:x 1 :y 1 :w 6 :h 6}
+                   half           {:x 2 :y 2 :w 4 :h 4}]
+               [full three-quarters half]))
 
 (λ init []
-  (hs.grid.setGrid :8x8)
-  (hs.grid.setMargins "0,0"))
+  (grid.setGrid :8x8)
+  (grid.setMargins "0,0"))
 
 (λ step []
-  (when (hs.window.focusedWindow)
-    (let [win (hs.window.frontmostWindow)
+  (when (window.focusedWindow)
+    (let [win (window.frontmostWindow)
           screen (win:screen)
-          cell (hs.grid.get win screen)
+          cell (grid.get win screen)
           next-step-index (-> (index-of steps cell)
                               (or -1)
                               (% (length steps))
@@ -26,6 +27,6 @@
           next-step (. steps next-step-index)
           around (if (is-ff-focused) #(with-ax-hotfix (win:application) $1)
                      #($1))]
-      (around #(hs.grid.set win next-step screen)))))
+      (around #(grid.set win next-step screen)))))
 
 {: init : step}