Last active
December 19, 2024 15:27
-
-
Save jaawerth/db68fcd3e571e4180bbaf153f7e258a5 to your computer and use it in GitHub Desktop.
hammerspoon (Macos automation) using fennel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; gist doesn't know what fennel is so let's say clj | |
; vi: ft=clojure | |
(set hs.logger.defaultLogLevel "info") | |
(local {:application app :hotkey hotkey} hs) | |
; use the SpoonInstall Spoon easy installing+loading of Spoons | |
(hs.loadSpoon :SpoonInstall) | |
(local install (. spoon :SpoonInstall)) | |
; for window sizing, use the WIndowHalfsAndThirds Spoon until I can write something custom | |
(: install :andUse :WindowHalfsAndThirds) | |
; just bind the default hotkeys for now | |
(: spoon.WindowHalfsAndThirds :bindHotkeys | |
(. spoon :WindowHalfsAndThirds :defaultHotkeys)) | |
; launch/focus/activate kitty terminal | |
(hotkey.bind [:cmd :ctrl] :t | |
"😾 terminal" | |
(partial app.open "kitty")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local fennel = require"fennel" | |
-- allow requiring of fennel modules | |
table.insert(package.loaders or package.searchers, fennel.searcher) | |
fennel.dofile("init.fnl", { allowedGlobals = false }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I needed to perform a minor correction to this code to get it working: