1YDOTOOL(1) General Commands Manual YDOTOOL(1)
2
3
4
6 ydotool - command-line /dev/uinput automation tool
7
9 ydotool cmd args...
10
11 ydotool cmd --helpfR
12
14 ydotool lets you programatically (or manually) simulate keyboard input
15 and mouse activity, etc. It does this by writing directly to /dev/uin‐
16 put so it generally needs to run as root.
17
18 Currently implemented command(s):
19
20 type
21 Type a string
22 key
23 Press keys
24 mousemove
25 Move mouse pointer to absolute position
26 mousemove_relative
27 Move mouse pointer to relative position
28 click
29 Click on mouse buttons
30 recorder
31 Record/replay input events
32 mouseup
33 Send a mouse up event.
34 mousedown
35 Send a mouse down event.
36
38 key [--up] [--down] [--delay <ms>] [--key-delay <ms>] [--repeat
39 <times>] [--repeat-delay <ms>] [--persist-delay <ms>] <key sequence>
40
41 Type a given keystroke. Examples being "alt+r", "ctrl+J",
42 "ctrl+alt+n", "backspace".
43
44 Options:
45
46 --up
47 Only keyup
48
49 --down
50 Only keydown
51
52 --delay <ms>
53 Delay before starting to output keystrokes. Default 100ms.
54
55 --key-delay <ms>
56 Delay time between keystrokes. Default 12ms.
57
58 --repeat <times>
59 Times to repeat the key sequence.
60
61 --repeat-delay <ms>
62 Delay time between repetitions. Default 0ms.
63
64 --persist-delay <ms>
65 Keep virtual device alive for <ms> ms. Should be used in con‐
66 junction with --down or --up
67
68 Generally, any valid name from /usr/include/linux/input-event-
69 codes.h will work. Multiple keys are separated by '+'.
70
71 Each key sequence can be any number of modifiers and keys, sepa‐
72 rated by plus (+) For example: alt+r Alt+F4 CTRL+alt+f3 aLT+1+2+3
73 ctrl+Backspace
74
75 Since we are emulating keyboard input, combinations like Shift+# is
76 invalid because typing a `#' involves pressing Shift and 3.
77
78 Example: Switch to tty1:
79 ydotool key ctrl+alt+f1
80
81 Example: Close a window in graphical environment:
82 ydotool key Alt+F4
83
84 type [--delay <ms>] [--key-delay <ms>] [--args <N>] [--file <filepath>]
85 "something to type"
86
87 Types text as if you had typed it on the keyboard.
88
89 Options:
90
91 --delay <ms>
92 Delay before starting typing. Default 100ms.
93
94 --key-delay <ms>
95 Delay time between keystrokes. Default 12ms.
96
97 --args <N>
98 ????
99
100 --file <filepath>
101 Specify a file, the contents of which will be be typed as if
102 passed as an argument. The filepath may also be '-' to read
103 from stdin.
104
105 Example: to type 'Hello world!' you would do:
106 ydotool type 'Hello world!'
107
109 mousemove [--delay <ms>] <x> <y>
110 Move the mouse to the specific X and Y coordinates on the screen.
111
112 Options: --delay <ms>
113 Delay before starting move. Default 100ms.
114
115 Example: to move the cursor to absolute coordinates (100,100):
116 ydotool mousemove 100 100
117
118 mousemove_relative [--delay <ms>] <x> <y>
119 Move the mouse x,y pixels relative to the current position of the
120 mouse cursor.
121
122 Options: --delay <ms>
123 Delay before starting move. Default 100ms.
124
125 Example: Relatively move mouse pointer to -100,100:
126 ydotool mousemove_relative -- -100 100
127
128 click [--delay <ms>] button
129 Send a click. Buttons are: 1=left 2=right 3=middle
130
131 Options:
132
133 --delay <ms>
134 Delay before click. Default 100ms.
135
136 Example: Mouse right click:
137 ydotool click 2
138
139 recorder [--delay <ms>] [--record <devices>] [--replay <input files>]
140 [--display] [--duration <ms>]
141
142 Options:
143
144 --delay <ms>
145 Delay time before start recording/replaying. Default 5000ms.
146
147 --record <devices>
148 Devices to record from. Default is all, including non-keyboard
149 devices.
150
151 --replay <input files>
152 The record file can't be replayed on an architecture with dif‐
153 ferent endianness.
154
155 --display
156 ????
157
158 --duration <ms>
159 Record duration. Otherwise use SIGINT to stop recording.
160
161 mouseup [--delay <ms>] button
162 Send a mouse up event. Buttons are: 1=left 2=right 3=middle
163
164 Options:
165
166 --delay <ms>
167 Delay before click. Default 100ms.
168
169 Example: Mouse right click:
170 ydotool click 2
171
172 mousedown [--delay <ms>] button
173 Send a mouse down event. Buttons are: 1=left 2=right 3=middle
174
175 Options:
176
177 --delay <ms>
178 Delay before click. Default 100ms.
179
180 Example: Mouse right click:
181 ydotool click 2
182
184 ydotool was written by ReimuNotMoe.
185
186 This man page by bob.hepple@gmail.com
187
189 When ydotool(1) runs and creates a virtual input device, it will take
190 some time for your graphical environment (eg X11/Wayland) to recognize
191 and enable the virtual input device. (Usually done by udev)
192
193 If the delay is too short, the virtual input device may not be recog‐
194 nized & enabled by the graphical environment in time.
195
196 In order to solve this problem, there is a persistent background ser‐
197 vice, ydotoold(1), to hold a persistent virtual device, and accept
198 input from ydotool(1). When ydotoold(1) is unavailable, ydotool(1) will
199 work without it.
200
202 MIT License
203
205 ydotoold(8)
206
207 Project site: <https://github.com/ReimuNotMoe/ydotool>
208
209
210
211 2020-04-05 YDOTOOL(1)