From b3108c1548240674a000795d5340293d1adf4122 Mon Sep 17 00:00:00 2001 From: Igor Soarez Date: Mon, 21 Sep 2026 15:51:53 +0300 Subject: 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. --- config/hammerspoon/init.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 -- cgit v1.2.3