aboutsummaryrefslogtreecommitdiffstats
path: root/.hammerspoon/hyper.lua
blob: 4cca4dbf262ea6612fba5358c7446fa98ff6c0d3 (plain)
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
local hyper = hs.hotkey.modal.new({}, nil)

hyper.pressed = function()
	hyper:enter()
end
hyper.released = function()
	hyper:exit()
end

-- Hyper mode needs to be bound to a key. Here we are binding
-- it to F17, because this is yet another key that's unused.
-- Why not F18? We will use key-events from F18 to turn hyper
-- mode on and off. Using F17 as both the modal and source of key
-- events will result in a very jittery Hyper mode.
hs.hotkey.bind({}, "F18", hyper.pressed, hyper.released)

hyper.bindApp = function(mods, key, app)
	local fn = function()
		hs.application.launchOrFocus(app)
	end
	if type(app) == "function" then
		fn = app
	end
	hyper:bind(mods, key, fn)
end

return hyper