forked from emanresusername/.hammerspoon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.lua
44 lines (38 loc) · 781 Bytes
/
console.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
local console = hs.console
local application = require("application")
local timer = require("timer")
local _alpha = console.alpha
console.alpha = _alpha()
local useAlpha = _alpha() < 1
local hswindow = console.hswindow
local function app()
return hswindow():application()
end
function console.keyStrokes(text)
hs.eventtap.keyStrokes(text, app())
end
timer.waitUntil(
function()
return hswindow()
end,
function()
local hotkey, watcher = application.hotkey(
app(),
{"cmd"},
"u",
function(app)
useAlpha = not useAlpha
if useAlpha then
_alpha(console.alpha)
else
_alpha(1)
end
end
)
if app():isFrontmost() then
hotkey:enable()
end
end,
0.1
)
return console