summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Soarez <igor@soarez.org>2026-09-21 15:51:53 +0300
committerIgor Soarez <igor@soarez.org>2026-09-21 15:51:53 +0300
commitb3108c1548240674a000795d5340293d1adf4122 (patch)
treedbfd23f9dc46139d2230937648826e395643149c
parentd312cb2acca4cff77c82ea4467585e0a2814c47c (diff)
hammerspoon: load ~/.config/hammerspoon/local.lua where a machine has one
The shell has ~/.localprofile and ssh and git their config-local; Hammerspoon had nothing, so a machine wanting one different hotkey had to edit the file every machine shares. Only init.lua is linked, so the directory around it is already the machine's own -- a sibling file there is in no repo. Loaded last, so it can override anything above, and through pcall: a mistake in a local file must not take the rest of the config down. Reload with ctrl-shift-alt-h as usual.
-rw-r--r--config/hammerspoon/init.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/config/hammerspoon/init.lua b/config/hammerspoon/init.lua
index 45ce362..93950a9 100644
--- a/config/hammerspoon/init.lua
+++ b/config/hammerspoon/init.lua
@@ -584,3 +584,23 @@ hotkey('9', ca, window_resize(geometry.rect(0.20, 0, 0.80, 1)))
-- hotkey('6', csa, demo_dump('/tmp/screencast6.txt'))
-- hotkey('7', csa, demo_dump('/tmp/screencast7.txt'))
-- hotkey('8', csa, demo_dump('/tmp/screencast8.txt'))
+
+-- Machine-local Hammerspoon config, where a machine has any:
+-- ~/.config/hammerspoon/local.lua, a real file beside the init.lua link and in
+-- no repo, like ~/.localprofile for the shell. Only init.lua is linked, so that
+-- directory is the machine's own and anything else in it stays there.
+--
+-- Last, so it can override the hotkeys and settings above, and in a pcall: a
+-- mistake in it must not take the rest of this config down with it. Reload with
+-- ctrl-shift-alt-h, the same as any other change here.
+local local_config = os.getenv("HOME") .. "/.config/hammerspoon/local.lua"
+if hs.fs.attributes(local_config) then
+ local ok, err = pcall(dofile, local_config)
+ if not ok then
+ print("local.lua: " .. tostring(err))
+ hs.notify.new({
+ title = "Hammerspoon",
+ informativeText = "local.lua failed: " .. tostring(err),
+ }):send()
+ end
+end