GitHub

wtype is a Wayland tool that allows you to simulate keyboard input like xdotool type for X11. This is accomplished via the virtual-keyboard Wayland protocol.

Building

Install dependencies (Debian/Ubuntu):

sudo apt-get update
sudo apt-get install gcc make libwayland-dev libxkbcommon-dev wayland-protocols curl

Compile from source:

git clone https://github.com/linuxserver/waylandtyper.git
cd waylandtyper
make fetch-deps
make

Usage

# Type unicode characters
./wtype "∇⋅∇ψ = ρ"

To press/release modifiers, -M/-m can be used respectively.

# Press Ctrl+C
./wtype -M ctrl c -m ctrl

To alter the delay between keystrokes, use -d.

# delay of 0 when typing "foo", 120ms on "bar"
./wtype foo -d 120 bar
# also applied on stdin
echo "everything" | ./wtype -d 12 -

To press/release a named key (as given by xkb_keysym_get_name), -P/-p can be used.

# Press and release the Left key
./wtype -P left -p left

Note that when wtype terminates, all the pressed keys/modifiers get released, as the compositor destroys the associated virtual keyboard object. To help perform a more complicated sequence of key presses, -s can be used to insert delays into the stream of key events.

# Hold the Right key for 1000ms
./wtype -P right -s 1000 -p right

License

This project is licensed under the MIT License.

Read the original on github.com ↗