forked from tstirrat/hammerspoon-config
-
Notifications
You must be signed in to change notification settings - Fork 3
/
init.lua
46 lines (32 loc) · 855 Bytes
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
local alert = require 'hs.alert'
import = require('utils/import')
import.clear_cache()
config = import('config')
function config:get(key_path, default)
local root = self
for part in string.gmatch(key_path, "[^\\.]+") do
root = root[part]
if root == nil then
return default
end
end
return root
end
local modules = {}
for _, v in ipairs(config.modules) do
local module_name = 'modules/' .. v
local module = import(module_name)
if type(module.init) == "function" then
module.init()
end
table.insert(modules, module)
end
local buf = {}
if hs.wasLoaded == nil then
hs.wasLoaded = true
table.insert(buf, "Hammerspoon loaded: ")
else
table.insert(buf, "Hammerspoon re-loaded: ")
end
table.insert(buf, #modules .. " modules.")
alert.show(table.concat(buf))