Skip to content

jordansissel/xdotool

Folders and files

NameName
Last commit message
Last commit date
Dec 24, 2023
Jan 3, 2011
Sep 13, 2022
Jul 5, 2018
May 1, 2023
Mar 17, 2017
Oct 22, 2021
Jun 9, 2009
Jun 12, 2010
Sep 13, 2022
Jan 17, 2024
May 1, 2023
May 30, 2011
Oct 22, 2021
Feb 13, 2021
Oct 24, 2021
Oct 24, 2021
Aug 4, 2021
Oct 24, 2021
Jan 2, 2011
Jan 2, 2011
Mar 9, 2011
Aug 4, 2021
Jan 2, 2011
Jun 7, 2012
Feb 13, 2021
Feb 13, 2021
Jun 7, 2012
Aug 5, 2016
May 22, 2012
Jun 7, 2012
Sep 3, 2016
Oct 24, 2021
Jun 20, 2024
Aug 4, 2021
Oct 24, 2021
Oct 24, 2021
Aug 4, 2021
Jun 19, 2010
Jul 6, 2010
Jun 13, 2010
Jun 7, 2012
Aug 4, 2021
Aug 4, 2021
Jun 7, 2012
Aug 4, 2021
May 17, 2015
Aug 4, 2021
Jun 7, 2012
May 1, 2023
Aug 4, 2021
Aug 4, 2021
Aug 4, 2021
Feb 13, 2021
Jun 7, 2012
Aug 4, 2021
Aug 4, 2021
Aug 4, 2021
Aug 4, 2021
Aug 2, 2016
Feb 13, 2021
Jun 30, 2022
Aug 3, 2021
Oct 16, 2024
May 1, 2023
Oct 24, 2021
Jul 17, 2021
Aug 3, 2021
Oct 22, 2021
May 1, 2023
May 1, 2023
May 1, 2023

Repository files navigation

xdotool - x11 automation tool

xdotool lets you simulate keyboard input and mouse activity, move and resize windows, etc. It does this using X11’s XTEST extension and other Xlib functions.

⚠ Note: If you are using Wayland, please be aware this software will not work correctly. See the 'Wayland' section below for more detail.

With xdotool, you can search for windows and move, resize, hide, and modify window properties like the title. If your window manager supports it, you can use xdotool to switch desktops, move windows between desktops, and change the number of desktops.

Also in this repository is libxdo, a C library for doing the same.

You may view the user documentation in xdotool.pod

Installation

You may find xdotool in your distribution packaging:

  • Debian and Ubuntu: apt-get install xdotool
  • Fedora: dnf install xdotool
  • FreeBSD: pkg install xdotool
  • macOS: brew install xdotool or sudo port install xdotool
  • OpenSUSE: zypper install xdotool

Basic Usage

Typing

From your terminal, run:

xdotool type "Hello world"

Sending keys

xdotool key ctrl+l

The above will simulate the keystrokes as if you pressed the control key, then the "L" key, and then released both. This is useful for simulating hotkeys.

Closing a window

xdotool selectwindow windowclose

This will close the first window you click on.

Cool Tricks

Bring up Firefox and focus the URL bar

xdotool search "Mozilla Firefox" windowactivate --sync key --clearmodifiers ctrl+l

Resize all visible gnome-terminal windows

xdotool search --onlyvisible --classname "gnome-terminal" windowsize %@ 500
500

Wayland

Wayland is a very different graphics system than X11 (which you might know as Xorg or X). Wayland has some X11 compatibility, but for the purposes of xdotool, many things do not work correctly. Typing, window searching, and many other functions of xdotool do not work, and it is unclear if they could ever work.

Some other tools that might help you if you use Wayland are:

  • ydotool - a tool for sending mouse and keyboard events using Linux's uinput sytem
  • dotool - a tool for sending mouse and keyboard events using Linux's uinput sytem

Building / Compiling

Prerequisites:

  • X11 libraries: xlib, xtst, xi, xkbcommon, xinerama

How to compile and install:

  • Compile: make
  • Install: make install
  • Remove: make uninstall

You may have to set 'PREFIX' to the location you want to install to. The default PREFIX is /usr/local

For packagers, there's also support for DESTDIR for staged install.

Also, see the manpage, which you can generate by running:

  make showman

Note: the manpage will be installed during 'make install'