xdotool-like for KDE Wayland

Overview

kdotool - a xdotool clone for KDE Wayland

Introduction

Wayland, 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 note that the window id this program uses is KWin's internal window id, which looks like a UUID ({xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}). It's not a X11 window id.

Global Options

  • --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.

New Commands Not In xdotool

The following can be used in chained commands:

  • savewindowstack _name_ Save the current window stack to a variable
  • loadwindowstack _name_ Load a previously saved window stack

Supported xdotool Commands

Window Queries

These commands generate a window stack that following window action commands can refer to.

  • search
    • MISSING:
      • --maxdepth
      • --onlyvisible
      • --sync
    • NOTE:
      • --screen (KDE 5 only)
  • getactivewindow

Window Actions

These commands either take a window-id argument, or use the window stack.

  • getwindowname
  • getwindowclassname
  • getwindowpid
  • getwindowgeometry
    • MISSING: --shell
    • NOTE: shows screen number only in KDE 5
  • windowsize
    • MISSING:
      • --usehints
      • --sync
  • windowmove
    • MISSING:
      • --sync
  • windowminimize
    • MISSING: --sync
  • windowraise (KDE 6 only)
    • Use windowactivate instead?
  • windowactivate
    • MISSING: --sync
  • windowclose
  • set_desktop_for_window
  • get_desktop_for_window
  • windowstate
    • Supported properties:
      • above
      • below
      • skip_taskbar
      • skip_pager
      • fullscreen
      • shaded
      • demands_attention
    • MISSING:
      • modal
      • sticky
      • hidden
      • maximized_vert
      • maximized_horz

Global Actions

These actions aren't targeting a specific window, but the whole desktop.

  • set_desktop
    • MISSING: --relative
  • get_desktop
  • set_num_desktops (KDE 5 only)
  • get_num_desktops

Won't support

You can use ydotool, dotool, wtype, etc. for these:

  • Keyboard commands
  • Mouse commands

KWin doesn't have such functionality:

  • set_desktop_viewport
  • get_desktop_viewport

X11-specific:

  • windowreparent
  • windowmap
  • windowunmap

Unclear if we can support

  • behave window action command
  • exec
  • sleep
  • scripts

KWin has such functionality, but not exposed to the js API:

  • selectwindow
  • windowlower
  • windowquit
  • windowkill
  • getwindowfocus: use getactivewindow instead?
  • windowfocus: use windowactivate instead?
  • set_window

Troubleshooting

If 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.

You might also like...
A cog-like tool, written in Rust.

Corg A cog-like tool, written in Rust. The primary difference between Cog and Corg is how Corg executes code blocks. Being written in Rust, it cannot

Quinine is a Rust library that implements atomic, lock-free, but write-once versions of containers like `Box` or `Arc`

Quinine is a Rust library that implements atomic, lock-free, but write-once versions of containers like `Box` or `Arc`

simple, C-like programming language

CUP: C(ompiler) U(nder) P(rogress) A badly named, in-progress programming language just to learn how these things work. Wait, doesn't everyone write a

Compiler from a lisp-like language to mlog

slimlog slimlog compiles a lisp-like language to mlog Architecture slimlog is divided into three distinct parts Parser Parses the source file Compiler

A Rust crate to expressively declare bitfield-like structs

proc-bitfield A Rust crate to expressively declare bitfield-like structs, automatically ensuring their correctness at compile time and declaring acces

A budget PLC-like board for controlling 24V DC equipment.
A budget PLC-like board for controlling 24V DC equipment.

Poppy Logic Controller The Poppy Logic Controller is a budget PLC (Programmable Logic Controller). Importantly, it is only an I/O board without any PL

Rust macro to use a match-like syntax as a elegant alternative to nesting if-else statement

cond Rust macro to use a match-like syntax as an elegant alternative to many if-else statements. I got the idea from empty Go switch statements. I tho

Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

KDE activities for hyprland [maintainer=@yavko]

Hypract [WIP] KDE activities for Hyprland using Hyprland-rs Usage This cli tool replaces your workspace change commands so keep that in mind use switc

Steno for Wayland

WayPlover Steno for Wayland Description A Steno Stroke Interpreter for Wayland. Open Steno Project Learn Plover Usage wayplover --port /dev/ttyACM0 --

A wallpaper daemon for Wayland compositors

Paper A wallpaper daemon for Wayland compositors implementing the layer-shell protocol. Features Supports png and jpg format Tiled wallpapers Bordered

`xrandr` for Gnome/wayland, on distros that don't support `wlr-randr`

gnome-randr-rust A reimplementation of xrandr for Gnome on Wayland, especially for systems that don't support wlr-output-management-unstable-v1 (e.g.

Turn off monitors to save power (for Wayland)

Same as xset dpms force off, but for Wayland. It requires zwlr_output_power_manager_v1 and org_kde_kwin_idle support from the Wayland compositer. wlro

Dynamic key remapper for X11 and Wayland

𝑋𝑟𝑒𝑚𝑎𝑝 ⌨️ xremap is a key remapper for Linux. Unlike xmodmap, it supports app-specific remapping and Wayland. Concept Fast - Xremap is written i

Wayland compositor for AwesomeWM
Wayland compositor for AwesomeWM

Way Cooler Way Cooler is the compositor component of AwesomeWM for Wayland. Building To build Way Cooler, ensure you have meson installed (as well as

Wallpaper daemon for Wayland

wpaperd wpaperd is a minimal wallpaper daemon for Wayland. It allows the user to choose a different image for each output (aka for each monitor) just

Default implementation of the Wayland protocol for use with wl

Wayland An implementation of core Wayland interfaces and convenience functions for accelerating the development of Wayland clients and servers using t

A simple program that provides DBus interface to control display temperature and brightness under wayland without flickering

wl-gammarelay-rs Like wl-gammarelay, but written in rust, runs on a single thread, has three times less SLOC and uses DBus (for simplicity). Dbus inte

A simple clipboard manager for wayland.

Wpilman A simple clipboard manager for wayland. Installation Just compile it yourself or install the AUR package: paru -S wlipman-git # or yay -S wlip

Comments
Releases(v0.2.1)
Owner
Jin Liu
Jin Liu
A wallpaper daemon for Wayland compositors

Paper A wallpaper daemon for Wayland compositors implementing the layer-shell protocol. Features Supports png and jpg format Tiled wallpapers Bordered

snakedye 20 Nov 26, 2022
Turn off monitors to save power (for Wayland)

Same as xset dpms force off, but for Wayland. It requires zwlr_output_power_manager_v1 and org_kde_kwin_idle support from the Wayland compositer. wlro

依云 15 Dec 8, 2022
Dynamic key remapper for X11 and Wayland

???????????? ⌨️ xremap is a key remapper for Linux. Unlike xmodmap, it supports app-specific remapping and Wayland. Concept Fast - Xremap is written i

Takashi Kokubun 643 Jan 8, 2023
Wallpaper daemon for Wayland

wpaperd wpaperd is a minimal wallpaper daemon for Wayland. It allows the user to choose a different image for each output (aka for each monitor) just

Danilo Spinella 53 Dec 28, 2022
Default implementation of the Wayland protocol for use with wl

Wayland An implementation of core Wayland interfaces and convenience functions for accelerating the development of Wayland clients and servers using t

AidoP 1 Jan 24, 2022
A simple clipboard manager for wayland.

Wpilman A simple clipboard manager for wayland. Installation Just compile it yourself or install the AUR package: paru -S wlipman-git # or yay -S wlip

null 3 Jan 13, 2023
Wayland clipboard manager that will make you clap 👏

Clapboard - clipboard manager that makes you clap ?? Clapboard is a simple clipboard manager for Wayland, built in Rust. It saves a history of your cl

Yo'av Moshe 18 Jan 28, 2023
Swayidle alternative to handle wayland idle notifications, sleep and lock events in Rust with Lua scripting based configuration language

swayidle-rs This is intended as a replacement of sway's idle management daemon. I use it as a tool to understand rust message passing and state manage

Reza Jelveh 8 Nov 27, 2023
A tool that, like, screams at you when you say like

Dislike Do you, like,... dislike constantly saying "like" as much as I do? Then, like,... you've come the right place! This tool is like EXACTLY what

ElKowar 27 Jun 27, 2022
Devops kafka topics like files with kls, ktail, khead and kecho

Devops kafka topics like files with kls, ktail, khead and kecho

imotai 4 Dec 31, 2021