| Crates.io | kdotool |
| lib.rs | kdotool |
| version | 0.2.1 |
| created_at | 2023-11-23 14:46:34.80297+00 |
| updated_at | 2023-11-23 14:46:34.80297+00 |
| description | A xdotool-like tool to manipulate windows on KDE Wayland |
| homepage | |
| repository | https://github.com/jinliu/kdotool |
| max_upload_size | |
| id | 1046238 |
| size | 74,179 |
xdotool clone for KDE WaylandWayland, for security concerns, removed most of the X11 APIs that xdotool uses to simulate user input and control windows. ydotool solves the input part by talking directly to the kernel input device. However, for the window control part, you have to use each Wayland compositor's own APIs.
This program uses KWin's scripting API to control windows. In each invocation, it generates a KWin script on-the-fly, loads it into KWin, runs it, and then deletes it, using KWin's DBus interface.
This program should work with both KDE 5 and the upcoming KDE 6. It should work
with both Wayland and X11 sessions. (But you can use the original xdotool in
X11, anyway. So this is mainly for Wayland.)
Not all xdotool commands are supported. Some are not available through the KWin
API. Some might be not even possible in Wayland. See below for details.
Please refer to xdotool documentation for the usage of each command.
Please note that the window id this program uses is KWin's internal window id,
which looks like a UUID (e.g. {04add7fb-72b8-4e58-8ac1-5e22730b907b}). It's not
a X11 window id.
--help Show help.--version Show version.Options not in xdotool:
--dry-run Just print the generated KWin script. Don't run it.--debug Print debug messages.--shortcut _shortcut_ Specify a shortcut to run the generated KWin script.
The shortcut must be in the format of modifier+key, e.g. Alt+Shift+X.
The shortcut will be registered in KWin. The script is not run immediately.
You must press the shortcut to run it.
--name _name_ Specify a name for the shortcut, So you can remove it
later with --remove. This option is only valid with --shortcut.remove _name_ Remove a previously registered shortcut.The following can be used in chained commands:
savewindowstack _name_ Save the current window stack to a variableloadwindowstack _name_ Load a previously saved window stackThese commands generate a window stack that following window action commands can refer to.
search
--maxdepth--onlyvisible--sync--screen (KDE 5 only)getactivewindowThese commands either take a window-id argument, or use the window stack.
getwindownamegetwindowclassnamegetwindowpidgetwindowgeometry
--shellwindowsize
--usehints--syncwindowmove
--syncwindowminimize
--syncwindowraise (KDE 6 only)
windowactivate instead?windowactivate
--syncset_desktop_for_windowget_desktop_for_windowwindowstate
These actions aren't targeting a specific window, but the whole desktop.
set_desktopget_desktopset_num_desktops (KDE 5 only)get_num_desktopsYou can use ydotool, dotool, wtype, etc. for these:
KWin doesn't have such functionality:
set_desktop_viewportget_desktop_viewportX11-specific:
windowreparentwindowmapwindowunmapexecsleepKWin has such functionality, but not exposed to the js API:
selectwindowwindowlowerwindowquitwindowkillgetwindowfocus: use getactivewindow instead?windowfocus: use windowactivate instead?set_windowIf anything fails to work, you can re-run the command with --debug option.
It will print the generated KWin script, and the output of the script from
KWin. If you think it's a bug, please create an issue in GitHub.