xdotool X11 input automation
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
xdotool key ctrl+l
xdotool type "<text>"
xdotool mousemove <x> <y>
xdotool click 1xdotool search --name <regex>
xdotool windowactivate <id>
xdotool getactivewindow
xdotool getmouselocation
Concepts
- search / getactivewindow fills the stack
- Window stack lives for one run
- windowactivate, key, ... act on %1 by default
Keyboard
xdotool key <keys>
xdotool key ctrl+shift+t
xdotool key Return Tab
xdotool type "<text>"
xdotool type --delay <ms>
"<text>"
xdotool key --clearmodifiers <keys>
xdotool key --window <id> <keys>
xdotool keydown <key>
xdotool keyup <key>
xdotool key --delay <ms> <keys>
Mouse
xdotool mousemove <x> <y>
xdotool click <button>
xdotool click 4xdotool getmouselocation
xdotool mousemove_relative -- <dx> <dy>
xdotool click --repeat <n> --delay <ms> 1
xdotool mousedown <button>
xdotool mouseup <button>
xdotool mousemove --window <id> <x>
<y>
xdotool getmouselocation --shell
Find windows
xdotool search --name <regex>
xdotool search --class <regex>
xdotool search --onlyvisible <regex>
xdotool getactivewindow
xdotool selectwindow
xdotool search --pid <pid>
xdotool search --sync --class <regex>
xdotool search --all --name <a> --class
<b>
xdotool getwindowname <id>
Window control
xdotool windowactivate <id>
xdotool windowactivate --sync <id>
xdotool windowfocus <id>
xdotool windowmove <x> <y>
xdotool windowsize <w> <h>
xdotool windowminimize <id>
xdotool windowraise <id>
xdotool windowclose <id>
xdotool windowquit <id>
xdotool windowkill <id>
xdotool windowstate --add FULLSCREEN <id>
xdotool windowmove x 100 <id>
xdotool getwindowgeometry --shell <id>
Desktops
xdotool get_desktop
xdotool set_desktop <n>
xdotool set_desktop --relative -- -1
xdotool get_num_desktops
xdotool get_desktop_for_window <id>
xdotool set_desktop_for_window <id> <n>
Scripting
xdotool exec <cmd>
xdotool exec --sync <cmd>
xdotool sleep <seconds>
xdotool <file>
Recipes
id=$(xdotool search --onlyvisible --class firefox | head -1)if [ -n "$id" ]; then xdotool windowactivate "$id"else firefox & fi
# stop with Ctrl+Cwhile :; do xdotool click 1; sleep 0.1; done
# for fields that block pastesleep 3 # focus the target nowxdotool type --delay 20 "$(xclip -o -selection clipboard)"
xdotool getactivewindow windowsize 50% 100% windowmove 0 0



