mirror of
https://github.com/nmasur/dotfiles
synced 2025-08-12 17:34:40 +00:00
isolate escape from trackpad
This commit is contained in:
@@ -63,6 +63,20 @@ function obj:init()
|
|||||||
self.sendEscape = false
|
self.sendEscape = false
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
-- If mouse is moving, don't send escape
|
||||||
|
self.scrolling = hs.eventtap.new({hs.eventtap.event.types.gesture},
|
||||||
|
function(event)
|
||||||
|
local touches = event:getTouches()
|
||||||
|
local i, v = next(touches, nil)
|
||||||
|
while i do
|
||||||
|
if v["phase"] == "moved" then
|
||||||
|
self.sendEscape = false
|
||||||
|
end
|
||||||
|
i, v = next(touches, i) -- get next index
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- ControlEscape:start()
|
--- ControlEscape:start()
|
||||||
@@ -71,6 +85,7 @@ end
|
|||||||
function obj:start()
|
function obj:start()
|
||||||
self.controlTap:start()
|
self.controlTap:start()
|
||||||
self.asModifier:start()
|
self.asModifier:start()
|
||||||
|
self.scrolling:start()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- ControlEscape:stop()
|
--- ControlEscape:stop()
|
||||||
@@ -80,6 +95,7 @@ function obj:stop()
|
|||||||
-- Stop monitoring keystrokes
|
-- Stop monitoring keystrokes
|
||||||
self.controlTap:stop()
|
self.controlTap:stop()
|
||||||
self.asModifier:stop()
|
self.asModifier:stop()
|
||||||
|
self.scrolling:stop()
|
||||||
|
|
||||||
-- Reset state
|
-- Reset state
|
||||||
self.sendEscape = false
|
self.sendEscape = false
|
||||||
|
Reference in New Issue
Block a user