### Build and Install ydotool from Source Source: https://context7.com/reimunotmoe/ydotool/llms.txt Provides commands to clone the ydotool repository, build it using CMake and make, and install it. It also shows how to build without man pages or with systemd/OpenRC services. ```bash # Clone and build git clone https://github.com/ReimuNotMoe/ydotool.git cd ydotool mkdir build && cd build cmake .. make -j$(nproc) sudo make install # Build without man pages cmake .. -DBUILD_DOCS=OFF make -j$(nproc) # Build with systemd system service (runs as root) cmake .. -DSYSTEMD_SYSTEM_SERVICE=ON -DSYSTEMD_USER_SERVICE=OFF make -j$(nproc) sudo make install # Build with OpenRC service cmake .. -DOPENRC=ON make -j$(nproc) ``` -------------------------------- ### Install Systemd Service File Source: https://github.com/reimunotmoe/ydotool/blob/master/Daemon/systemd/CMakeLists.txt Configures and installs the ydotool systemd service file. It uses a template file and installs it to the determined systemd unit directory. ```cmake configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/ydotoold.service.in" "${PROJECT_BINARY_DIR}/ydotoold.service" @ONLY) install(FILES "${PROJECT_BINARY_DIR}/ydotoold.service" DESTINATION ${SD_UNITDIR}) ``` -------------------------------- ### Start ydotoold Daemon Source: https://context7.com/reimunotmoe/ydotool/llms.txt Start the ydotool daemon, which requires access to /dev/uinput. You can specify custom socket paths and permissions, or run it as a systemd user service. ```bash sudo ydotoold & ``` ```bash sudo ydotoold --socket-path /run/ydotool.sock --socket-perm 0666 & ``` ```bash sudo ydotoold --socket-path /run/ydotool.sock --socket-perm 0660 --socket-own 1000:1000 & ``` ```bash sudo ydotoold --keyboard-off ``` ```bash sudo ydotoold --touch-on ``` ```bash sudo ydotoold --mouse-off ``` ```bash systemctl --user enable --now ydotoold ``` ```bash ydotoold --version ``` ```bash # Expected output when ready: # Socket path: /run/user/1000/.ydotool_socket # Socket permission: 0600 # READY ``` -------------------------------- ### Install ydotool Dependencies Source: https://context7.com/reimunotmoe/ydotool/llms.txt Lists commands for installing the `scdoc` package, which is required for building man pages, on Debian/Ubuntu and RHEL/Fedora systems. ```bash # Install dependencies (Debian/Ubuntu) sudo apt install scdoc # Install dependencies (RHEL/Fedora) sudo dnf install scdoc ``` -------------------------------- ### Configure Hyprland Keyboard Layout for ydotool Source: https://context7.com/reimunotmoe/ydotool/llms.txt Example configuration for Hyprland to set the keyboard layout for the `ydotoold` virtual device. ```bash # Hyprland: ~/.config/hypr/hyprland.conf device:ydotoold-virtual-device { kb_layout = us kb_variant = kb_options = } ``` -------------------------------- ### Switch to tty1, wait, and type text Source: https://github.com/reimunotmoe/ydotool/blob/master/README.md This example demonstrates switching to a TTY, waiting for a specified duration, and then typing a string. It combines key presses for switching and a type command. ```bash ydotool key 29:1 56:1 59:1 59:0 56:0 29:0; sleep 2; ydotool type 'echo Hey guys. This is Austin.' ``` -------------------------------- ### Enable and Verify ydotool Systemd User Service Source: https://context7.com/reimunotmoe/ydotool/llms.txt Shows how to enable and start the `ydotoold` systemd user service, reload the daemon, and verify its status using `journalctl`. ```bash # After install, enable systemd user service systemctl --user daemon-reload systemctl --user enable --now ydotoold # Verify the daemon is ready journalctl --user -u ydotoold -f # Should show: Socket path: ..., Socket permission: 0600, READY ``` -------------------------------- ### Configure Sway Keyboard Layout for ydotool Source: https://context7.com/reimunotmoe/ydotool/llms.txt Example configuration for Sway to set the keyboard layout for the `ydotoold` virtual device. It first shows how to find the device identifier. ```bash # Sway: ~/.config/sway/config # First, find the device identifier: # swaymsg -t get_inputs | grep ydotoold input "16700:26214:ydotoold_virtual_device" { xkb_layout "us" xkb_variant "" xkb_options "" } ``` -------------------------------- ### Move mouse pointer to absolute position Source: https://github.com/reimunotmoe/ydotool/blob/master/README.md This example shows how to move the mouse pointer to a specific absolute coordinate on the screen. Ensure the coordinates are within the screen bounds. ```bash ydotool mousemove --absolute -x 100 -y 100 ``` -------------------------------- ### Configure YDOTOOL_SOCKET Source: https://context7.com/reimunotmoe/ydotool/llms.txt Set the YDOTOOL_SOCKET environment variable to connect to a daemon running on a non-default path. The daemon must also be started with the same path. Shows error output when the daemon is not running or permissions are incorrect. ```bash # Use a custom socket (daemon must also be started with the same path) export YDOTOOL_SOCKET=/run/ydotool.sock ydotool type 'hello' ``` ```bash # One-shot override without exporting YDOTOOL_SOCKET=/tmp/my.sock ydotool key 28:1 28:0 ``` ```bash # Error output when daemon is not running: # failed to connect socket `/run/user/1000/.ydotool_socket': No such file or directory # Please check if ydotoold is running. ``` ```bash # Error output when permissions are wrong: # failed to connect socket `/tmp/.ydotool_socket': Permission denied # Please check if the current user has sufficient permissions to access the socket file. ``` -------------------------------- ### Custom Target for Man Page Generation Source: https://github.com/reimunotmoe/ydotool/blob/master/manpage/CMakeLists.txt Defines a custom target to generate man pages using the scdoc command. It takes source and binary paths and installs the generated man page. ```cmake function(man_page section page) set(src "${CMAKE_CURRENT_SOURCE_DIR}/${page}.${section}.scd") set(bin "${CMAKE_CURRENT_BINARY_DIR}/${page}.${section}") add_custom_target(${page}.${section} ALL COMMAND ${SCDOC} < ${src} > ${bin}) install(FILES ${bin} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section}/) endfunction(man_page) ``` -------------------------------- ### Systemd Unit Directory Configuration Source: https://github.com/reimunotmoe/ydotool/blob/master/Daemon/systemd/CMakeLists.txt Configures the systemd unit directory based on package checks or a fallback. This snippet determines where the systemd service file will be installed. ```cmake find_package(PkgConfig) # Try to get the systemd directory for system/user units from the package # and fall back on upstream default without the '/usr' prefix if not forced by # command line. pkg_check_modules(SYSTEMD systemd) if (SYSTEMD_FOUND) if(SYSTEMD_USER_SERVICE) pkg_get_variable(SD_UNITDIR systemd systemduserunitdir) elseif(SYSTEMD_SYSTEM_SERVICE) pkg_get_variable(SD_UNITDIR systemd systemdsystemunitdir) endif() endif() if(NOT DEFINED SD_UNITDIR) set(SD_UNITDIR "lib/systemd/user") endif() message("Systemd service file is going to be installed at ${SD_UNITDIR}") ``` -------------------------------- ### Press Super/Meta key and 'd' Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates pressing the Super/Meta key (125) then 'd' (32) to trigger the 'show desktop' action. ```bash ydotool key 125:1 32:1 32:0 125:0 ``` -------------------------------- ### Compile ydotool with CMake Source: https://github.com/reimunotmoe/ydotool/blob/master/README.md Standard build process for ydotool using CMake. It involves creating a build directory, navigating into it, configuring the build with CMake, and then compiling the project. ```bash mkdir build cd build cmake .. make -j `nproc` ``` -------------------------------- ### Use hex keycodes for Enter Source: https://context7.com/reimunotmoe/ydotool/llms.txt Demonstrates using hexadecimal keycodes for simulating key presses, with 0x1c representing the Enter key (keycode 28). ```bash ydotool key 0x1c:1 0x1c:0 ``` -------------------------------- ### Build Documentation Option Source: https://github.com/reimunotmoe/ydotool/blob/master/manpage/CMakeLists.txt An option to control the building of documentation, which requires the scdoc tool. ```cmake option(BUILD_DOCS "build documentation (requires scdoc)" ON) ``` -------------------------------- ### Configure Hyprland Per-Device Input Source: https://github.com/reimunotmoe/ydotool/blob/master/README.md Add this to your Hyprland configuration to set keyboard layout, variant, and options for the 'ydotoold-virtual-device'. ```ini device:ydotoold-virtual-device { kb_layout = us kb_variant = kb_options = } ``` -------------------------------- ### Chaining clicks Source: https://context7.com/reimunotmoe/ydotool/llms.txt Demonstrates chaining a right-click, a short pause (using sleep), and then a left-click. ```bash ydotool click 0xC1; sleep 0.1; ydotool click 0xC0 ``` -------------------------------- ### Absolute-Mode Mouse Movement to Target Coordinates Source: https://context7.com/reimunotmoe/ydotool/llms.txt Illustrates how to move the mouse to absolute coordinates. It first moves to the origin using INT32_MIN and then to the desired X and Y coordinates. ```c // Absolute-mode trick: move to origin first (INT32_MIN) uinput_emit(EV_REL, REL_X, INT32_MIN, false); uinput_emit(EV_REL, REL_Y, INT32_MIN, true); // Then move to target coordinates uinput_emit(EV_REL, REL_X, 640, false); uinput_emit(EV_REL, REL_Y, 480, true); ``` -------------------------------- ### ydotoold - Daemon Operations Source: https://context7.com/reimunotmoe/ydotool/llms.txt The ydotoold daemon must be running to process ydotool client commands. It creates a virtual input device and listens on a Unix domain socket. Various options allow customization of socket path, permissions, and device capabilities. ```APIDOC ## ydotoold ### Description Starts the ydotoold daemon, which creates a virtual input device and listens for commands on a Unix domain socket. This daemon must be running before using the `ydotool` client. ### Usage ```bash sudo ydotoold [OPTIONS] ``` ### Options * `--socket-path `: Specifies the path for the Unix domain socket. * `--socket-perm `: Sets the file permissions for the socket. * `--socket-own `: Sets the owner and group for the socket file. * `--keyboard-off`: Disables keyboard input events. * `--mouse-off`: Disables mouse input events. * `--touch-on`: Enables touchscreen (EV_ABS) events. ### Examples ```bash # Start the daemon with default settings sudo ydotoold & # Start with a custom socket path and permissions sudo ydotoold --socket-path /run/ydotool.sock --socket-perm 0666 & # Start as a systemd user service systemctl --user enable --now ydotoold # Check version ydotoold --version ``` ``` -------------------------------- ### ydotool stdin Source: https://context7.com/reimunotmoe/ydotool/llms.txt Forwards live keyboard input from the terminal to the virtual input device. Puts the terminal into raw mode and restores it on exit. ```APIDOC ## ydotool stdin — Forward Live Keyboard Input `stdin` puts the terminal into raw (non-canonical, no-echo) mode and forwards every keypress to the virtual input device in real time. It handles standard ASCII, uppercase (emits Shift), control characters (emits Ctrl), and ANSI escape sequences for arrow keys and Page Up/Down. Press Ctrl-C to exit and restore the terminal. ### Usage ```bash ydotool stdin ``` ### Examples Start interactive keyboard forwarding (terminal enters raw mode): ```bash ydotool stdin # Output while running: # Type anything (CTRL-C to exit): # Key code: 104 0 0 <- 'h' key # Maps to: 35 # Key code: 27 91 65 0 <- Up arrow (ESC [ A) # Maps to: 103 <- KEY_UP # Key code: 3 0 0 <- Ctrl-C: exits and restores terminal ``` Forward SSH keypresses to a local display: ```bash # (run on local machine, pipe from SSH session is not needed; # stdin captures local terminal input and injects it into the uinput device) ydotool stdin ``` Use case: control a local kiosk/fbdev application from a remote SSH session: ```bash # On the remote machine (where ydotoold is running): ssh user@kiosk-host ydotool stdin ``` ``` -------------------------------- ### Switch to TTY1 Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates pressing Ctrl+Alt+F1 to switch to the first virtual terminal. Uses keycodes for Ctrl (29), Alt (56), and F1 (59). ```bash ydotool key 29:1 56:1 59:1 59:0 56:0 29:0 ``` -------------------------------- ### Relatively move mouse pointer Source: https://github.com/reimunotmoe/ydotool/blob/master/README.md Demonstrates how to move the mouse pointer by a relative offset from its current position. Use negative values to move left or up. ```bash ydotool mousemove -x -100 -y 100 ``` -------------------------------- ### ydotool key: Emit Raw Key Events Source: https://context7.com/reimunotmoe/ydotool/llms.txt Sends raw EV_KEY events using Linux keycode numbers. Each argument is `:`, where state 1 is pressed and 0 is released. Values can be decimal or hexadecimal. Non-parseable tokens act as delays. ```bash # Example: Press and release the Enter key (keycode 28) ydotool key 28:1 28:0 ``` -------------------------------- ### ydotool key - Emit Raw Key Events Source: https://context7.com/reimunotmoe/ydotool/llms.txt Sends raw `EV_KEY` events to the system using Linux keycode numbers. Allows precise control over key presses and releases. ```APIDOC ## ydotool key ### Description Sends raw `EV_KEY` events using Linux keycode numbers. Each argument specifies a keycode and its state (1 for pressed, 0 for released). ### Usage ```bash ydotool key : [: ...] ``` ### Parameters * ``: The numerical or symbolic Linux keycode (e.g., `28` for Enter, `1` for Esc). * ``: `1` for key press (down), `0` for key release (up). ### Notes * Values containing `x` are parsed as hexadecimal; others as decimal. * Non-parseable tokens are treated as delays. ### Examples ```bash # Press and release the Enter key ydotool key 28:1 28:0 # Press and hold the Left Shift key, then press 'A', then release Shift ydotool key 42:1 30:1 30:0 42:0 # Simulate pressing the Escape key ydotool key 1:1 1:0 ``` ``` -------------------------------- ### Emit Key-Down and Key-Up Events with SYN_REPORT Source: https://context7.com/reimunotmoe/ydotool/llms.txt Demonstrates emitting a key-down event for KEY_ENTER followed by a key-up event. `syn_report=true` ensures a SYN_REPORT event is appended automatically. ```c void uinput_emit(uint16_t type, uint16_t code, int32_t val, bool syn_report); // Emit a key-down event for KEY_ENTER, followed by SYN_REPORT uinput_emit(EV_KEY, KEY_ENTER, 1, true); // Emit a key-up event for KEY_ENTER, followed by SYN_REPORT uinput_emit(EV_KEY, KEY_ENTER, 0, true); ``` -------------------------------- ### YDOTOOL_SOCKET - Socket Path Configuration Source: https://context7.com/reimunotmoe/ydotool/llms.txt Configure the client to connect to a specific Unix domain socket path used by the ydotoold daemon. The client checks the YDOTOOL_SOCKET environment variable first, then default locations. ```APIDOC ## YDOTOOL_SOCKET ### Description This environment variable specifies the path to the Unix domain socket that the `ydotool` client will use to communicate with the `ydotoold` daemon. If not set, the client attempts to use `$XDG_RUNTIME_DIR/.ydotool_socket` or `/tmp/.ydotool_socket`. ### Usage ```bash export YDOTOOL_SOCKET= ``` ### Example ```bash # Set a custom socket path and then use ydotool export YDOTOOL_SOCKET=/run/ydotool.sock ydotool type 'Hello' # Use a custom socket for a single command without exporting YDOTOOL_SOCKET=/tmp/my.sock ydotool key 28:1 28:0 ``` ### Error Handling If the daemon is not running or the socket path is incorrect/inaccessible, `ydotool` will output an error message indicating connection failure. ``` -------------------------------- ### Close window using Alt+F4 Source: https://github.com/reimunotmoe/ydotool/blob/master/README.md This snippet shows how to close a window in a graphical environment by simulating the Alt+F4 key combination. ```bash ydotool key 56:1 62:1 62:0 56:0 ``` -------------------------------- ### Move to corner then click Source: https://context7.com/reimunotmoe/ydotool/llms.txt Combines absolute mouse movement to a specific coordinate with a subsequent left-click. ```bash ydotool mousemove --absolute -x 100 -y 100; ydotool click 0xC0 ``` -------------------------------- ### Generate Man Pages Conditionally Source: https://github.com/reimunotmoe/ydotool/blob/master/manpage/CMakeLists.txt Conditionally calls the man_page function to generate man pages for ydotool and ydotoold if documentation building is enabled. ```cmake if(BUILD_DOCS) man_page(1 ydotool) man_page(8 ydotoold) endif() ``` -------------------------------- ### Move mouse wheel horizontally Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates scrolling the mouse wheel horizontally. Positive X scrolls right, negative X scrolls left. ```bash ydotool mousemove --wheel -x 2 -y 0 ``` -------------------------------- ### Triple-click with delay Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates a triple-click with a 50ms delay between each click using --repeat and --next-delay flags. ```bash ydotool click --repeat 3 --next-delay 50 0xC0 ``` -------------------------------- ### Left button full click Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates a full left mouse button click using the hexadecimal code 0xC0. ```bash ydotool click 0xC0 ``` -------------------------------- ### ydotool key Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates keyboard key presses and releases. Supports keycodes, hex keycodes, and delays between events. ```APIDOC ## ydotool key Simulates keyboard key presses and releases. ### Usage ```bash ydotool key [--key-delay ] ``` ### Key Definitions Key definitions are in the format `keycode:state` where state is `1` for press and `0` for release. Multiple key definitions can be chained for complex shortcuts. ### Examples Press and release Enter (keycode 28): ```bash ydotool key 28:1 28:0 ``` Press Ctrl+C (keycode 29=Ctrl, 46=C): ```bash ydotool key 29:1 46:1 46:0 29:0 ``` Switch to TTY1: Ctrl+Alt+F1 (29=Ctrl, 56=Alt, 59=F1): ```bash ydotool key 29:1 56:1 59:1 59:0 56:0 29:0 ``` Close window with Alt+F4 (56=Alt, 62=F4): ```bash ydotool key 56:1 62:1 62:0 56:0 ``` Type "LOL": Shift+L, O, Shift+L (42=LShift, 38=L, 24=O): ```bash ydotool key 42:1 38:1 38:0 24:1 24:0 38:1 38:0 42:0 ``` Press Escape (keycode 1): ```bash ydotool key 1:1 1:0 ``` Use hex keycodes (0x1c = 28 = Enter): ```bash ydotool key 0x1c:1 0x1c:0 ``` Slow down keypresses to 50ms between events: ```bash ydotool key --key-delay 50 28:1 28:0 ``` Pause mid-sequence using an unparseable token (acts as a delay slot): ```bash ydotool key 29:1 0 46:1 46:0 29:0 ``` Press Super/Meta key (125=KEY_LEFTMETA) then 'd' (32) to show desktop: ```bash ydotool key 125:1 32:1 32:0 125:0 ``` ``` -------------------------------- ### Perform repeating left clicks Source: https://github.com/reimunotmoe/ydotool/blob/master/README.md This snippet demonstrates how to perform multiple left clicks with a delay between each click. The `--repeat` option specifies the number of clicks, and `--next-delay` sets the interval. ```bash ydotool click --repeat 5 --next-delay 25 0xC0 ``` -------------------------------- ### Emit Relative Mouse Movement Events Source: https://context7.com/reimunotmoe/ydotool/llms.txt Shows how to emit relative mouse movement for X and Y axes. `syn_report=false` is used for X to batch it with Y, which then triggers the SYN_REPORT. ```c // Emit relative mouse X movement without SYN (batch with Y) uinput_emit(EV_REL, REL_X, 100, false); // Emit relative mouse Y movement WITH SYN (flushes both X and Y together) uinput_emit(EV_REL, REL_Y, 50, true); ``` -------------------------------- ### Press Ctrl+C Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates pressing and releasing the Ctrl+C key combination. Keycodes for Ctrl (29) and C (46) are used. ```bash ydotool key 29:1 46:1 46:0 29:0 ``` -------------------------------- ### Press and release Enter key Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates pressing and releasing the Enter key using its keycode (28). ```bash ydotool key 28:1 28:0 ``` -------------------------------- ### Slow repeated left click Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates five left clicks with a 100ms delay between each click using --repeat and --next-delay. ```bash ydotool click --repeat 5 --next-delay 100 0xC0 ``` -------------------------------- ### Slow down keypresses Source: https://context7.com/reimunotmoe/ydotool/llms.txt Configures a delay of 50ms between key press events to slow down the input simulation. ```bash ydotool key --key-delay 50 28:1 28:0 ``` -------------------------------- ### Relative mouse move (negative) Source: https://context7.com/reimunotmoe/ydotool/llms.txt Moves the mouse pointer by negative offsets (-100 on X, -50 on Y), effectively moving left and up. ```bash ydotool mousemove -x -100 -y -50 ``` -------------------------------- ### Repeat keyboard presses from stdin Source: https://github.com/reimunotmoe/ydotool/blob/master/README.md Allows ydotool to read keyboard input from standard input, which is useful for scenarios like SSH sessions where direct input is not possible. Ensure the input is formatted correctly for key presses. ```bash ydotool stdin ``` -------------------------------- ### Find scdoc Tool Source: https://github.com/reimunotmoe/ydotool/blob/master/manpage/CMakeLists.txt Finds the scdoc executable in the system's PATH. This is necessary for building documentation. ```cmake find_program(SCDOC scdoc) ``` -------------------------------- ### Configure Sway Input Layout Source: https://github.com/reimunotmoe/ydotool/blob/master/README.md Use this snippet in Sway to configure keyboard layout and options for a specific input device. The device identifier can be found using 'swaymsg -t get_inputs'. ```ini input "16700:8197:DELL_DELL_USB_Keyboard" { xkb_layout "us,us" xkb_variant "dvorak," xkb_options "grp:shifts_toggle, caps:swapescape" } ``` -------------------------------- ### Disable pointer acceleration on Wayland/Sway Source: https://context7.com/reimunotmoe/ydotool/llms.txt Configuration snippet for disabling pointer acceleration on Wayland/Sway by setting the accel_profile to 'flat' in the Sway config file. ```bash input "16700:26214:ydotoold_virtual_device" { accel_profile flat } ``` -------------------------------- ### Move mouse wheel vertically Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates scrolling the mouse wheel vertically. Positive Y scrolls down, negative Y scrolls up. ```bash ydotool mousemove --wheel -x 0 -y 3 ``` ```bash ydotool mousemove --wheel -x 0 -y -3 ``` -------------------------------- ### Click without action (delay) Source: https://context7.com/reimunotmoe/ydotool/llms.txt A click command with code 0x00 (no button specified, no up/down bits) acts as a delay mechanism. ```bash ydotool click 0x00 ``` -------------------------------- ### Type 'LOL' Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates typing the string 'LOL' by pressing Shift+L, O, and Shift+L. Uses keycodes for LShift (42), L (38), and O (24). ```bash ydotool key 42:1 38:1 38:0 24:1 24:0 38:1 38:0 42:0 ``` -------------------------------- ### ydotool type - Type Text Strings Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates typing text strings by converting characters into keyboard press and release events. Supports escape sequences and options for controlling typing speed and delays. ```APIDOC ## ydotool type ### Description Converts an ASCII string into a sequence of `EV_KEY` press/release events. Uppercase characters automatically trigger the `KEY_LEFTSHIFT` key. Supports standard escape sequences like `\n` and `\t`. ### Usage ```bash ydotool type [OPTIONS] [string2 ...] ``` ### Options * `--key-delay `: Delay in milliseconds between individual key events. * `--key-hold `: Duration in milliseconds each key is held down. * `--next-delay `: Delay in milliseconds between typing each string argument. * `--file `: Read strings from the specified file. Use `-` for stdin. Escape processing is disabled by default when reading from a file or stdin. * `--escape <0|1>`: Enable (1) or disable (0) escape sequence processing. Defaults to enabled for command line arguments, disabled for files/stdin. ### Examples ```bash # Type a simple string ydotool type 'Hello, World!' # Type with newline and tab escape sequences ydotool type 'Line1\nLine2\tTabbed' # Type with slow delays ydotool type --key-delay 100 --key-hold 50 'slow text' # Type multiple strings with a delay between them ydotool type --next-delay 500 'first string' 'second string' # Read from a file echo 'automated text' > /tmp/text.txt ydotool type --file /tmp/text.txt # Read from stdin echo 'piped text' | ydotool type --file - # Disable escape processing ydotool type --escape 0 'literal \n' ``` ``` -------------------------------- ### Explicit press & release click Source: https://context7.com/reimunotmoe/ydotool/llms.txt Uses the --press-release flag to explicitly generate a button down and button up event for a click. ```bash ydotool click --press-release 0xC0 ``` -------------------------------- ### Absolute mouse move (shorthand) Source: https://context7.com/reimunotmoe/ydotool/llms.txt Moves the mouse pointer to a specific screen coordinate (640, 480) using positional arguments for absolute mode. ```bash ydotool mousemove -- 640 480 ``` -------------------------------- ### Press Escape key Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates pressing and releasing the Escape key using its keycode (1). ```bash ydotool key 1:1 1:0 ``` -------------------------------- ### Double-click Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates a double-click by repeating the left-click sequence twice using the --repeat flag. ```bash ydotool click --repeat 2 0xC0 ``` -------------------------------- ### Right button up only Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates releasing the right mouse button, typically used after a drag operation. Uses code 0x81. ```bash ydotool click 0x81 ``` -------------------------------- ### Middle button full click Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates a full middle mouse button click using the hexadecimal code 0xC2. ```bash ydotool click 0xC2 ``` -------------------------------- ### Absolute mouse move (long-form) Source: https://context7.com/reimunotmoe/ydotool/llms.txt Moves the mouse pointer to a specific screen coordinate (1920, 1080) using long-form absolute options. ```bash ydotool mousemove --absolute --xpos 1920 --ypos 1080 ``` -------------------------------- ### ydotool type: Type Text Strings Source: https://context7.com/reimunotmoe/ydotool/llms.txt Converts ASCII strings into keyboard press/release events. Supports escape sequences and options for delays, reading from files, or stdin. Escape processing can be explicitly enabled or disabled. ```bash # Type a simple string ydotool type 'Hello, World!' ``` ```bash # Type with escape sequences: newline and tab ydotool type 'Line1\nLine2\tTabbed' ``` ```bash # Type with a specific hex character (copyright symbol workaround via tab/newline) ydotool type $'Cost: \x24100' ``` ```bash # Slow typing with 100ms between keys and 50ms hold time ydotool type --key-delay 100 --key-hold 50 'slow text' ``` ```bash # Type multiple strings with 500ms delay between each ydotool type --next-delay 500 'first string' 'second string' ``` ```bash # Read text from a file (escape processing disabled by default) echo 'automated text' > /tmp/text.txt ydotool type --file /tmp/text.txt ``` ```bash # Read text from stdin echo 'piped text' | ydotool type --file - ``` ```bash # Disable escape processing explicitly on the command line ydotool type --escape 0 'backslash-n is literal: \n' ``` ```bash # Enable escape processing when reading from file ydotool type --file /tmp/text.txt --escape 1 ``` ```bash # Practical: fill a form field in a running GUI application ydotool type 'user@example.com' ``` -------------------------------- ### ydotool mousemove Source: https://context7.com/reimunotmoe/ydotool/llms.txt Emits relative or absolute mouse movement events. Supports pointer movement and mouse wheel scrolling. ```APIDOC ## ydotool mousemove — Move Mouse Pointer `mousemove` emits `EV_REL` (relative) or simulated absolute movement events. In relative mode (default) the pointer moves by the specified offset. In absolute mode (`--absolute`), the daemon first emits `REL_X=INT32_MIN` and `REL_Y=INT32_MIN` to move to the top-left corner, then emits the target coordinates as relative offsets. Mouse pointer acceleration must be disabled for accurate absolute positioning. ### Usage ```bash ydotool mousemove [--absolute] [--wheel] [-x ] [-y ] [--xpos ] [--ypos ] [-- ] ``` ### Options - `--absolute`: Use absolute positioning mode. - `--wheel`: Simulate mouse wheel movement. - `-x `: Offset or absolute X coordinate. - `-y `: Offset or absolute Y coordinate. - `--xpos `: Absolute X coordinate (long form). - `--ypos `: Absolute Y coordinate (long form). - `-- `: Shorthand for positional arguments (x y). ### Examples Relative move: shift pointer by +100 on X, +200 on Y: ```bash ydotool mousemove -x 100 -y 200 ``` Relative move with negative values (move left and up): ```bash ydotool mousemove -x -100 -y -50 ``` Absolute move to screen coordinate (500, 300): ```bash ydotool mousemove --absolute -x 500 -y 300 ``` Absolute using long-form options: ```bash ydotool mousemove --absolute --xpos 1920 --ypos 1080 ``` Positional arguments shorthand (x y): ```bash ydotool mousemove -- 640 480 ``` Move mouse wheel: horizontal (x) and vertical (y) scroll: ```bash ydotool mousemove --wheel -x 0 -y 3 # scroll down 3 ticks ydotool mousemove --wheel -x 0 -y -3 # scroll up 3 ticks ydotool mousemove --wheel -x 2 -y 0 # scroll right 2 ticks ``` Disable pointer acceleration on X11 for accurate absolute movement: ```bash xinput --set-prop "ydotoold virtual device" "libinput Accel Profile Enabled" 0 1 # (ydotoold does this automatically on startup if DISPLAY is set and xinput is found) ``` Disable acceleration on Wayland/Sway via config: ``` # In ~/.config/sway/config: # input "16700:26214:ydotoold_virtual_device" { accel_profile flat } ``` Move to corner, then click: ```bash ydotool mousemove --absolute -x 100 -y 100; ydotool click 0xC0 ``` ``` -------------------------------- ### Pause mid-sequence Source: https://context7.com/reimunotmoe/ydotool/llms.txt Uses an unparseable token (0) as a delay slot within a key sequence to pause between events. ```bash ydotool key 29:1 0 46:1 46:0 29:0 ``` -------------------------------- ### Emit Left Mouse Button Down Event Source: https://context7.com/reimunotmoe/ydotool/llms.txt This snippet demonstrates emitting a left mouse button down event. BTN_LEFT is a specific code for the left mouse button. ```c // Emit left mouse button down uinput_emit(EV_KEY, BTN_LEFT, 1, true); // BTN_LEFT = 0x110 ``` -------------------------------- ### Perform a mouse right click Source: https://github.com/reimunotmoe/ydotool/blob/master/README.md Executes a single mouse right click using the specified button code. The code 0xC1 typically represents the right mouse button. ```bash ydotool click 0xC1 ``` -------------------------------- ### Absolute mouse move Source: https://context7.com/reimunotmoe/ydotool/llms.txt Moves the mouse pointer to a specific screen coordinate (500, 300) using absolute positioning. ```bash ydotool mousemove --absolute -x 500 -y 300 ``` -------------------------------- ### ydotool click Source: https://context7.com/reimunotmoe/ydotool/llms.txt Sends mouse button events using a hexadecimal bitmask encoding. Supports full clicks, press/release only, and repeated clicks. ```APIDOC ## ydotool click — Mouse Button Click `click` sends mouse button events using a hexadecimal bitmask encoding. The lower nibble (bits 0–3) selects the button (0=LEFT, 1=RIGHT, 2=MIDDLE, etc.). Bit 6 (`0x40`) means "button down" and bit 7 (`0x80`) means "button up". A full click uses `0xC0`–`0xC7`. The `--press-release` flag simplifies this by always generating a full down+up pair. ### Usage ```bash ydotool click [--repeat ] [--next-delay ] [--press-release] ``` ### Button Masks - `0xC0`: Left button full click - `0xC1`: Right button full click - `0xC2`: Middle button full click - `0x41`: Right button down only - `0x81`: Right button up only - `0x00`: No action (acts as a delay) ### Options - `--repeat `: Repeat the click sequence `n` times. - `--next-delay `: Delay in milliseconds between repeated events. - `--press-release`: Explicitly generate a press and release event. ### Examples Left button full click (0xC0 = down 0x40 | up 0x80 | button 0x00): ```bash ydotool click 0xC0 ``` Right button full click (0xC1 = 0x40 | 0x80 | 0x01): ```bash ydotool click 0xC1 ``` Middle button full click: ```bash ydotool click 0xC2 ``` Right button down only (for drag operations): ```bash ydotool click 0x41 ``` Right button up only (release after drag): ```bash ydotool click 0x81 ``` Double-click: repeat the sequence 2 times: ```bash ydotool click --repeat 2 0xC0 ``` Triple-click (select word) with 50ms between events: ```bash ydotool click --repeat 3 --next-delay 50 0xC0 ``` Slow repeated left click (5x with 100ms between each): ```bash ydotool click --repeat 5 --next-delay 100 0xC0 ``` Use --press-release flag for explicit press & release: ```bash ydotool click --press-release 0xC0 ``` Scroll wheel up (0xC5 = FORWARD button as scroll in some configs) - Note: For actual scroll wheel, use `mousemove --wheel` instead: ```bash ydotool click 0xC5 ``` Click without action (0x00 = left button, no up/down bits) - acts as a delay: ```bash ydotool click 0x00 ``` Chaining: right-click, wait, then left-click: ```bash ydotool click 0xC1; sleep 0.1; ydotool click 0xC0 ``` ``` -------------------------------- ### Fatal Error if scdoc is Missing Source: https://github.com/reimunotmoe/ydotool/blob/master/manpage/CMakeLists.txt Checks if documentation building is enabled and the scdoc tool was not found. If both conditions are true, it raises a fatal error. ```cmake if(BUILD_DOCS AND NOT SCDOC) message(FATAL_ERROR "build documentation selected, but scdoc could not be found") endif() ``` -------------------------------- ### Relative mouse move Source: https://context7.com/reimunotmoe/ydotool/llms.txt Moves the mouse pointer by a specified offset (+100 on X, +200 on Y) from its current position. ```bash ydotool mousemove -x 100 -y 200 ``` -------------------------------- ### Right button down only Source: https://context7.com/reimunotmoe/ydotool/llms.txt Simulates pressing the right mouse button down without releasing it, useful for drag operations. Uses code 0x41. ```bash ydotool click 0x41 ``` -------------------------------- ### Disable pointer acceleration on X11 Source: https://context7.com/reimunotmoe/ydotool/llms.txt Command to disable pointer acceleration on X11 for accurate absolute mouse movement. This is often handled automatically by ydotoold. ```bash xinput --set-prop "ydotoold virtual device" "libinput Accel Profile Enabled" 0 1 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.