Hammerspoon
add stuff: open config, type in LaTeX, save, reload config
bind function to hotkey
hs.hotkey.bind({"functionKey", …}, "key",…, function()
…
end)
functionKey: cmd alt ctrl
key: X \\ Left
the {} must stay even if it`s empty
show alert message
hs.alert.show("message")
generate system notification with title and content
hs.notify.new({title="title", informativeText="content"}):send()
define the current window as win
local win = hs.window.focusedWindow()
define win’s window frame as f
local f = win:frame()
position of f is (f.x, f.y) its width and height f.w, f.h
define the screen win at as screen
local screen = win:screen()
define screen’s screen frame as max
local max = screen:frame()
update the frame of win as f
win:setFrame(f)
hs.pathwatcher.new(.....):start()
reload config
hs.reload()
automatically reload config
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()
hs.alert.show("Config loaded")
get the home direction of the system
os.getenv("HOME")
connect string to path
..
call function whenever changes in direction
hs.pathwatcher.new("direction", function):start()