LinuxCommandLibrary

ydotool

Simulate keyboard and mouse events

TLDR

Start the ydotool daemon in the background

$ ydotoold
copy

Perform a input
$ ydotool click 0xC0
copy

Perform a input
$ ydotool click 0xC1
copy

Input
$ ydotool key 56:1 62:1 62:0 56:0
copy

SYNOPSIS

ydotool [options] command [arguments]

PARAMETERS

--help
    Show help message and exit.

--version
    Show version and exit.

type
    Type the given string.

key ...
    Press and release the specified keys.

mousemove [relative]
    Move the mouse cursor to the absolute (or relative if 'relative' is specified) coordinates (x, y).

mousedown

DESCRIPTION

ydotool is a command-line tool for Linux that allows you to automate keyboard and mouse actions within the X Window System. It provides a way to simulate user input, making it useful for scripting tasks, testing applications, and creating macros. Unlike some other automation tools, ydotool operates independently of specific window managers or toolkits, making it relatively versatile. It allows users to script keyboard input (typing text, pressing keys), mouse movements, and mouse clicks.

Important considerations:
Requires X11 to be running.
Needs sufficient privileges to interact with X11.

CAVEATS

ydotool relies on the X11 protocol and may not work in environments that do not support it, such as Wayland or purely command-line environments. The user needs correct permissions to access the X server.

BUTTON MAPPING

Mouse button numbers typically follow the convention: 1 - Left, 2 - Middle, 3 - Right, 4 - Scroll Up, 5 - Scroll Down.

KEY NAMES

Key names generally correspond to the key names found in `/usr/include/X11/keysymdef.h`, without the `XK_` prefix. For example, `XK_Enter` becomes `Enter`.

HISTORY

ydotool was created to address some limitations of existing X11 automation tools, aiming for a more flexible and reliable way to simulate user input. The development continues.

SEE ALSO

xdotool(1), xte(1), wmctrl(1)

Copied to clipboard