Build wtype from source
masterTo build wtype, use the meson and ninja build systems. Follow these steps to configure, compile, and install the binary:
meson build
ninja -C build
sudo ninja -C build installrepository·master·Indexed 19 days ago
https://github.com/atx/wtypeA Wayland-native command-line tool for simulating keyboard input using the virtual-keyboard protocol. It serves as a modern alternative to xdotool for Wayland compositors, allowing users to type strings, simulate specific key presses and releases via XKB symbol names, manage modifier keys (Shift, Ctrl, Alt, etc.), and control timing with keystroke and event stream delays.
To build wtype, use the meson and ninja build systems. Follow these steps to configure, compile, and install the binary:
meson build
ninja -C build
sudo ninja -C build installwtype is a command-line tool for Wayland that simulates keyboard input using the virtual-keyboard Wayland protocol. It functions similarly to xdotool type does for X11. You can use it to type strings of text or to simulate specific key presses and modifier combinations.
wtype "Hello World"The wtype CLI tool allows you to simulate keyboard input on Wayland by typing strings, pressing specific keys, or managing modifier keys (Shift, Ctrl, Alt, etc.).
To type a simple string, pass it as an argument:
wtype "hello world"Use flags to control the behavior of the typing sequence:
-d <ms>: Set a delay (in milliseconds) between each keystroke.-s <ms>: Sleep for a specified number of milliseconds.-k <keyname>: Press a specific key (uses XKB symbol names).-P <keyname>: Press and hold a key.-p <keyname>: Release a key.-M <modifier>: Press a modifier key.-m <modifier>: Release a modifier key.--: Everything following -- is treated as raw text to be typed.-: Read text from stdin.Supported modifier names (case-insensitive):
shiftcapslockctrllogo or winaltaltgrwtype "hello world"
wtype -d 100 "slow typing"
wtype -s 500 "wait then type"
wtype -M shift -k a -m shift
wtype -- "text with special characters"
wtype -You can use wtype to type arbitrary unicode characters directly into the focused window.
wtype ∇⋅∇ψ = ρYou can pipe text into wtype to type it. Use the - flag to indicate that text should be read from standard input. This option can only appear once.
echo "text from pipe" | wtype -The -d flag allows you to specify a delay (in milliseconds) between keystrokes. This delay can be applied to specific strings in the command line or to input coming from stdin.
# delay of 0 when typing "foo", 120ms on "bar"
wtype foo -d 120 bar
# also applied on stdin
echo everything | wtype -d 12 -Use the -M flag to press a modifier key and the -m flag to release it. This is useful for simulating keyboard shortcuts like Ctrl+C.
wtype -M ctrl c -m ctrlUse -P to press a named key and -p to release it. Key names must correspond to those defined by xkb_keysym_get_name.
# Press and release the Left key
wtype -P left -p leftWhen performing complex sequences of key presses, use the -s flag to insert a delay (in milliseconds) into the stream of key events. This helps ensure the compositor processes the sequence correctly before the next event occurs.
# Hold the Right key for 1000ms
wtype -P right -s 1000 -p rightThe following flags are used to configure the sequence of keyboard events sent by wtype.
-d <ms> Set delay between type keystrokes
-s <ms> Sleep for <ms> milliseconds
-k <key> Type a specific key (XKB name)
-P <key> Press a key
-p <key> Release a key
-M <mod> Press a modifier
-m <mod> Release a modifier
-- Treat following arguments as raw text
- Read text from stdinYou can simulate modifier keys using the -M (press) and -m (release) flags.
Supported Modifiers:
shift, capslock, ctrl, logo, win, alt, altgr.
Note: Modifiers are automatically released once the wtype program terminates.
wtype -M ctrl -k cThe following names can be used with the -M (press) and -m (release) flags.
shift
capslock
ctrl
logo
win
alt
altgr