-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
93 lines (71 loc) · 2.43 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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
-- -----------------------------------------------------------------------
-- ** Extra Requires ** --
-- -----------------------------------------------------------------------
require "window_manager"
-- require "outlook"
require "debug"
-- require "modules/safari_inspector"
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
-- -----------------------------------------------------------------------
-- ** Debug Utilities ** --
-- -----------------------------------------------------------------------
function reloadConfig(files)
local 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
hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", reloadConfig):start()
hs.alert.show("Config loaded")
-- Helper function to inspect a given item to the console
function inspectToConsole(object)
hs.console.printStyledtext(hs.inspect(object))
end
-- TESTING hotkey bind override to check for conflicting keycombos
local oldBind = hs.hotkey.bind
local registeredHotkeys = {}
hs.hotkey.bind = function(...)
local mods = select(1, ...)
local key = select(2, ...)
table.insert(registeredHotkeys, { mods, key })
inspectToConsole(registeredHotkeys)
oldBind(...)
end
-- -----------------------------------------------------------------------
-- ** Hotkey Bindings ** --
-- -----------------------------------------------------------------------
-- hs.hotkey.bind({"cmd", "shift"}, "M", toggleChromeProfile)
-- Stuff that shouldn't be here
hs.loadSpoon("RoundedCorners")
spoon.RoundedCorners:start()
hs.application.watcher.new(function(appName, event, application)
if appName == "HipChat" and event == hs.application.watcher.launched then
hs.alert.show("HipChat launched!")
end
end):start()