2018-07-21 20:25:15 +02:00
|
|
|
|
|
|
|
local awful = { keygrabber = require("awful.keygrabber") } --DOC_HIDE
|
|
|
|
|
2017-07-02 04:43:26 +02:00
|
|
|
local naughty = { notification = function() end } --DOC_HIDE
|
2018-07-21 20:25:15 +02:00
|
|
|
|
|
|
|
local autostart_works = false --DOC_HIDE
|
|
|
|
|
|
|
|
awful.keygrabber {
|
|
|
|
autostart = true,
|
|
|
|
stop_key = "Return",
|
|
|
|
stop_callback = function(_, _, _, sequence)
|
|
|
|
autostart_works = true --DOC_HIDE
|
|
|
|
assert(sequence == "abc") --DOC_HIDE
|
2019-01-04 10:39:07 +01:00
|
|
|
naughty.notification {message="The keys were:"..sequence}
|
2018-07-21 20:25:15 +02:00
|
|
|
end,
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, v in ipairs {"a", "b", "c"} do--DOC_HIDE
|
|
|
|
root.fake_input("key_press" , v)--DOC_HIDE
|
|
|
|
root.fake_input("key_release", v)--DOC_HIDE
|
|
|
|
end--DOC_HIDE
|
|
|
|
|
|
|
|
root.fake_input("key_press" , "Return")--DOC_HIDE
|
|
|
|
root.fake_input("key_release", "Return")--DOC_HIDE
|
|
|
|
|
|
|
|
assert(autostart_works) --DOC_HIDE
|