diff --git a/tests/examples/text/root/fake_click.lua b/tests/examples/text/root/fake_click.lua new file mode 100644 index 000000000..3fbe35b92 --- /dev/null +++ b/tests/examples/text/root/fake_click.lua @@ -0,0 +1,9 @@ +--DOC_NO_USAGE --DOC_ASTERISK + + local function click(button_id, x, y) + mouse.coords {x = x, y = y} + root.fake_input("button_press" , button_id) + root.fake_input("button_release", button_id) + end +--DOC_NEWLINE + click(1, 42, 42) diff --git a/tests/examples/text/root/fake_string.lua b/tests/examples/text/root/fake_string.lua new file mode 100644 index 000000000..78db2e8f8 --- /dev/null +++ b/tests/examples/text/root/fake_string.lua @@ -0,0 +1,23 @@ +--DOC_HEADER --DOC_NO_USAGE --DOC_ASTERISK + +local awful = { keygrabber = require("awful.keygrabber") } --DOC_HIDE + +local works = false --DOC_HIDE + +awful.keygrabber{autostart=true, stop_key = "!", --DOC_HIDE + stop_callback = function(_,_,_, seq) works=seq=="Hello world" end} --DOC_HIDE + + local function send_string_to_client(s, c) + local old_c = client.focus + client.focus = c + for i=1, #s do + local char = s:sub(i,i) + root.fake_input("key_press" , char) + root.fake_input("key_release", char) + end + client.focus = old_c + end +--DOC_NEWLINE + send_string_to_client("Hello world!") + +assert(works) --DOC_HIDE