For those unfamiliar, xdotool lets you automate mouse and keyboard events. Combined with wmctrl and a few other tools, you can script just about any kind of desktop automation you can think of. I have used it to auto-download spreadsheets from my bank, click through repetitive dialogs on poorly designed websites, click a button after a time delay, etc.
Wayland kind of breaks that. Until today, I was not aware of any perfect wayland-compliant xdotool replacement. There is ydotool, but the version on the bookworm repos is broken, you have to do some hacky workarounds to make the daemon work without sudo, it types rather slowly, it cannot send events to a selected window, and it does not work inside nested wayland compositors.
Wtype is closer, does not require sudo, and does work inside nested wayland compositors, but it only allows for simulating keyboard events, and no support for selecting a window to send the events to.
It seems that nobody has heard of wlrctl. I was just introduced to it by a developer at labwc. Wlrctl is too new to be packaged on the Debian repos, but you can compile it manually.
Currently a five-minute bug prevents compiling on ARM, but it is fixed by making a warning non-fatal.
Just use these commands to compile and install:The manpage does not seem to be hosted online anywhere, so here it is:I can confirm that wlrctl seems to work perfectly on LabWC, and presumably it works fine on WayFire, though I did not test this. Obviously, it is not going to work on x11.
Wayland kind of breaks that. Until today, I was not aware of any perfect wayland-compliant xdotool replacement. There is ydotool, but the version on the bookworm repos is broken, you have to do some hacky workarounds to make the daemon work without sudo, it types rather slowly, it cannot send events to a selected window, and it does not work inside nested wayland compositors.
Wtype is closer, does not require sudo, and does work inside nested wayland compositors, but it only allows for simulating keyboard events, and no support for selecting a window to send the events to.
It seems that nobody has heard of wlrctl. I was just introduced to it by a developer at labwc. Wlrctl is too new to be packaged on the Debian repos, but you can compile it manually.
Currently a five-minute bug prevents compiling on ARM, but it is fixed by making a warning non-fatal.
Just use these commands to compile and install:
Code:
git clone https://git.sr.ht/~brocellous/wlrctlcd wlrctlsed -i "/add_project_arguments('-Wno-missing-braces', language: 'c')/a add_project_arguments('-Wno-type-limits', language: 'c')" meson.buildmeson setup --prefix=/usr/local buildsudo ninja -C build install
Code:
wlrctl(1) General Commands Manual wlrctl(1)NAME wlrctl - A command line utility for miscellaneous wlroots extensionsSYNOPSIS wlrctl [options...] [command]OPTIONS -h, --help Show a help message and quit. -v, --version Show the wlrctl version and quit.COMMANDS keyboard <action> Use a virtual keyboard. pointer <action> Use a virtual pointer device. window|toplevel <action> Use the foreign toplevel interface. output { <action> | <identifier> [config_action] } Use the output management interface.KEYBOARD ACTIONS type <string> [modifiers ...] Send a string to be typed into the focused client modifiers <SHIFT,CTRL,ALT,SUPER> Comma-separated list of modifiers that will be depressed on the virtual keyboard while string is be‐ ing typed.POINTER ACTIONS click [button] Click a mouse button. If unspecified, clicks the default (left) button. move <dx> <dy> Move the cursor. dx is the displacement in positive-right direc‐ tion, dy is the displacement in the positive-downward direction. Negative numbers are allowed. Units are pixels. scroll <dy> <dx> Scroll the cursor. dy is the amount of vertical scroll, dx is the amount of horizontal scroll. Negative numbers are allowed.TOPLEVEL ACTIONS minimize [matches...] Instruct the compositor to minimize matching windows. maximize [matches...] Instruct the compositor to maximize matching windows. fullscreen [matches...] Instruct the compositor to fullscreen matching windows. focus [matches...] Instruct the compositor to focus matching windows. close [matches...] Instruct the compositor to close matching windows. find [matches...] Exit with a successful return code iff there is at least one window matching the provided criteria. wait [matches...] Wait to return a successful return code until all the matching win‐ dows have closed. If there are no matches, exit with a failing re‐ turn code immediately. waitfor [matches...] Wait to return a successful return code until there is at least one window that matches the requested criteria.OUTPUT ACTIONS list List the names of all known outputsTOPLEVEL MATCHSPEC A match is a colon separated attribute/value pair. e.g. To match a firefox window, a suitable match value is app_id:firefox. You may give any number of match specifiers, and a window must match all of them to be considered. If the app_id or title keys are specified more than once, a window may match any of the given values. Otherwise later key value pairs override previous ones. A match without a key is assumed to be an app_id, so just firefox works in the example above. Currently supported attributes are: app_id, title, and state. Supported state values are: maximized, minimized, active, and fullscreen, and their negations: unmaximized, unminimized, inactive, and unfullscreen. You can also use a '-' prefix, for example state:-fullscreen.AUTHOR Written by Ronan Pigott <rpigott@berkeley.edu> 2024-05-25 wlrctl(1)
Statistics: Posted by Botspot — Sat May 25, 2024 10:20 pm