LinuxCommandLibrary

wtype

Type text into a window

TLDR

Simulate typing text

$ wtype "[Hello World]"
copy

Type a specific key
$ wtype -k [Left]
copy

Press a modifier
$ wtype -M [shift|ctrl|...]
copy

Release a modifier
$ wtype -m [ctrl]
copy

Wait between keystrokes (in milliseconds)
$ wtype -d [500] -- "[text]"
copy

Read text from stdin
$ echo "[text]" | wtype -
copy

SYNOPSIS

wtype [OPTIONS] [TEXT...]

PARAMETERS

-s, --sleep <MS>
    Sleep for the specified number of MS milliseconds before typing subsequent text or keys.

-M, --modifier <MOD>
    Add or remove a modifier key (e.g., shift, ctrl, alt, super) for subsequent key presses. Prepend with 'no-' to remove (e.g., no-shift).

-m, --key-down <KEY>
    Press and hold the specified KEY down. It remains pressed until explicitly released with --key-up or the program exits.

-u, --key-up <KEY>
    Release the specified KEY that was previously pressed down.

-k, --key <KEY>
    Press and immediately release the specified KEY. This is a shortcut for --key-down followed by --key-up.

--file <PATH>
    Read input text from the file specified by PATH instead of from command-line arguments.

--show-keycodes
    Display a list of available key names and their corresponding keycodes, useful for finding valid KEY arguments.

-h, --help
    Display a brief help message and exit.

-v, --version
    Display version information and exit.

DESCRIPTION

wtype is a command-line utility meticulously crafted to simulate keyboard input events within a Wayland composited environment. Its primary function is to enable users to programmatically "type" arbitrary text or send specific key presses, which is invaluable for a wide range of use cases including scripting repetitive tasks, automating workflows, and facilitating comprehensive testing of applications and system interactions within a Wayland session.

Unlike traditional methods, wtype interacts directly with the Wayland compositor, injecting input events as if they originated from a physical keyboard. This direct interaction ensures high fidelity and reliability for simulated inputs, making it a powerful tool for advanced system control and automation in modern Linux desktop environments running Wayland.

CAVEATS

wtype is specifically designed for Wayland compositors and will not function in an X11 environment.
It requires a running Wayland session and appropriate permissions to inject input events.
As a tool for input simulation, it can have security implications if used maliciously or without proper oversight.

HISTORY

wtype emerged as a modern utility to fill a gap in the Wayland ecosystem, providing a command-line interface for keyboard input automation similar to how xdotool serves X11.
Its development reflects the increasing adoption of Wayland as the display server protocol and the need for robust scripting and testing tools native to it.

SEE ALSO

xdotool(1), ydotool(1)

Copied to clipboard