forked from ashfinal/awesome-hammerspoon
-
Notifications
You must be signed in to change notification settings - Fork 6
/
preload.lua
33 lines (29 loc) · 978 Bytes
/
preload.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
-- The default duration for animations, in seconds. Initial value is 0.2; set to 0 to disable animations.
hs.window.animationDuration = 0
-- auto reload config
configFileWatcher =
hs.pathwatcher.new(hs.configdir, function(files)
local isLuaFileChange = utils.some(files, function(p)
return not (string.match(p, "^.+/([^%.#][^/]+%.lua)$") == nil)
end)
if isLuaFileChange then
hs.reload()
end
end):start()
-- persist console history across launches
hs.shutdownCallback = function() hs.settings.set('history', hs.console.getHistory()) end
hs.console.setHistory(hs.settings.get('history'))
-- ensure CLI installed
hs.ipc.cliInstall()
-- helpful aliases
i = hs.inspect
fw = hs.window.focusedWindow
fmt = string.format
bind = hs.hotkey.bind
alert = hs.alert.show
clear = hs.console.clearConsole
reload = hs.reload
pbcopy = hs.pasteboard.setContents
std = hs.stdlib and require("hs.stdlib")
utils = hs.fnutils
hyper = {'⌘', '⌃'}