Is it possible to create a keyboard shortcut that acts differently on single vs double-tap. For example:
Mod4+ss
is registered/handled as Mod4+s
,Mod4+s
. So, does something like the following count? The following function would be the callback function for you key. This function starts a timer the first time you press Mod4+s
. If no second press follows in 0.1 seconds, then this counts as a single tap. Otherwise, the timer is stopped and a double tap is registered.
local double_tap_timer = nil
local function press()
if double_tap_timer then
double_tap_timer:stop()
double_tap_timer = nil
print("We got a double tap")
return
end
double_tap_timer = gears.timer.start_new(0.1, function()
double_tap_timer = nil
print("We got a single tap")
return false
end)
end
(I only wrote the code, I didn't actually test this. Let's consider that as an exercise for the interested reader.)