Skip to content

Commit 79d0c96

Browse files
committed
add timer logger
1 parent 239780c commit 79d0c96

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

init.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ obj.license = 'MIT - https://opensource.org/licenses/MIT'
1818
function obj:init()
1919
self.sendEscape = false
2020
self.lastModifiers = {}
21+
-- self.timestamp = 0
2122

2223
-- Create an eventtap to run each time the modifier keys change (i.e., each
2324
-- time a key like control, shift, option, or command is pressed or released)
@@ -40,9 +41,12 @@ function obj:init()
4041
self.lastModifiers = newModifiers
4142
self.sendEscape = true
4243
self.controlKeyTimer:start()
44+
-- self.timestamp = hs.timer.absoluteTime()
4345
else
4446
if self.sendEscape then
4547
hs.eventtap.keyStroke({}, 'escape', 1)
48+
-- print('escape sent after ' .. (hs.timer.absoluteTime() - self.timestamp) / 1000000 .. ' ms')
49+
-- self.timestamp = 0
4650
end
4751
self.lastModifiers = newModifiers
4852
self.controlKeyTimer:stop()
@@ -70,6 +74,8 @@ function obj:start(tapTime)
7074
local CANCEL_DELAY_MS = tapTime or 150 -- ms, if `control` is held for this long, don't send `escape`
7175
self.controlKeyTimer = hs.timer.delayed.new(CANCEL_DELAY_MS / 1000, function()
7276
self.sendEscape = false
77+
-- print('timer canceled after ' .. (hs.timer.absoluteTime() - self.timestamp) / 1000000 .. ' ms')
78+
-- self.timestamp = 0
7379
end)
7480
self.controlTap:start()
7581
self.keyDownEventTap:start()

0 commit comments

Comments
 (0)