-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.lua
48 lines (32 loc) · 814 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
44
45
46
47
48
local frontmostApplication = require 'hs.application'.frontmostApplication
local modal_new = require 'hs.hotkey'.modal.new
local setup = require 'kit'.setup
local content = require 'cheatsheet/content'
local view = require 'cheatsheet/view'
local _M = {}
_M.config = {
escape = { {}, 'escape' },
}
local modal
local function hide()
return modal:exit()
end
_M.hide = hide
local function show()
return modal:enter()
end
_M.show = show
function _M.init(config)
setup(content, config.content)
setup(view, config.view)
local escape = config.escape
modal = modal_new()
function modal:entered()
view.show(content.parse(frontmostApplication()))
end
function modal:exited()
view.hide()
end
modal:bind(escape[1], escape[2], hide)
end
return _M