Permalink
Browse files

Automatically reload hammerspoon whenever its config files change

  • Loading branch information...
yuku committed May 30, 2017
1 parent 4a20b86 commit ff3adc238580ba9fc58187be64da7fe4e022985c
Showing with 16 additions and 1 deletion.
  1. +14 −1 hammerspoon/config_reloading.lua
  2. +2 −0 hammerspoon/init.lua
@@ -3,4 +3,17 @@
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "R", function ()
hs.reload()
end)
hs.alert.show("Config loaded")
-- Fancy configuration reloading
function reloadConfig(files)
doReload = false
for _,file in pairs(files) do
if file:sub(-4) == ".lua" then
doReload = true
end
end
if doReload then
hs.reload()
end
end
myWatcher = hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", reloadConfig):start()
View
@@ -6,3 +6,5 @@ require("app_launcher")
require("global_keymap")
require("windows_manipulation")
require("config_reloading")
hs.alert.show("Config loaded")

0 comments on commit ff3adc2

Please sign in to comment.