-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoises.lua
42 lines (36 loc) · 842 Bytes
/
noises.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
--
-- Miscellaneous, use noises
--
local util = require("utils")
local modifier = -20
local timer = hs.timer.new(0.01, function()
hs.eventtap.event.newScrollEvent({ 0, modifier }, {}, "pixel"):post()
end)
local noiseCallback = {
[1] = function()
if hs.eventtap.checkKeyboardModifiers().cmd then
modifier = 20
else
modifier = -20
end
timer:start()
end,
[2] = util:bind(timer, "stop"),
[3] = function()
hs.application.frontmostApplication():hide()
end
}
local noises = hs.noises.new(function(noiseType)
noiseCallback[noiseType]()
end)
local noisesStarted = false
hs.hotkey.bind(cah, "y", function()
if noisesStarted then
noises:stop()
hs.alert.show("Stopped listening")
else
noises:start()
hs.alert.show("Started listening")
end
noisesStarted = not noisesStarted
end)