summaryrefslogtreecommitdiffstats
path: root/accessibility/ydotool/ydotool.1
blob: a6dd2fc30a50ff4f8ba6f7f7a2b50898f9475b7d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
.\" Generated by scdoc 1.11.1
.\" Complete documentation for this program is not available as a GNU info page
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.nh
.ad l
.\" Begin generated content:
.TH "YDOTOOL" "1" "2022-02-01"
.P
.SH NAME
.P
ydotool - command-line \fI/dev/uinput\fR automation tool
.P
.SH SYNOPSIS
.P
\fBydotool\fR \fBcmd\fR \fIargs.\&.\&.\&\fR
.P
\fBydotool\fR \fBcmd\fR --help
.P
.SH DESCRIPTION
.P
\fBydotool\fR lets you programmatically (or manually) simulate keyboard input and mouse activity, etc.\& It does this by writing directly to \fI/dev/uinput\fR so it generally needs to run as root.\&
.P
Currently implemented command(s):
.P
\fBtype\fR
.RS 4
Type a string
.RE
\fBkey\fR
.RS 4
Press keys
.RE
\fBmousemove\fR
.RS 4
Move mouse pointer to absolute position
.RE
\fBmousemove_relative\fR
.RS 4
Move mouse pointer to relative position
.RE
\fBclick\fR
.RS 4
Click on mouse buttons
.RE
\fBrecorder\fR
.RS 4
Record/replay input events
.RE
\fBmouseup\fR
.RS 4
Send a mouse up event.\&
.RE
\fBmousedown\fR
.RS 4
Send a mouse down event.\&
.P
.RE
.SH KEYBOARD COMMANDS
\fBkey\fR [\fB--up\fR] [\fB--down\fR] [\fB--delay\fR \fI<ms>\fR] [\fB--key-delay\fR \fI<ms>\fR] [\fB--repeat\fR \fI<times>\fR] [\fB--repeat-delay <ms>\fR] [\fB--persist-delay <ms>\fR] \fI<key sequence>\fR
.P
.RS 4
Type a given keystroke.\& Examples being "alt+r", "ctrl+J",
"ctrl+alt+n", "backspace".\&
.P
Options:
.P
\fB--up\fR
.RS 4
Only keyup
.P
.RE
\fB--down\fR
.RS 4
Only keydown
.P
.RE
\fB--delay\fR \fI<ms>\fR
.RS 4
Delay before starting to output keystrokes.\& Default 100ms.\&
.P
.RE
\fB--key-delay\fR \fI<ms>\fR
.RS 4
Delay time between keystrokes.\& Default 12ms.\&
.P
.RE
\fB--repeat\fR \fI<times>\fR
.RS 4
Times to repeat the key sequence.\&
.P
.RE
\fB--repeat-delay\fR \fI<ms>\fR
.RS 4
Delay time between repetitions.\& Default 0ms.\&
.P
.RE
\fB--persist-delay\fR \fI<ms>\fR
.RS 4
Keep virtual device alive for \fI<ms>\fR ms.\& Should be used in conjunction with \fB--down\fR or \fB--up\fR
.P
.RE
Generally, any valid name from \fI/usr/include/linux/input-event-codes.\&h\fR will work.\& Multiple keys are separated by '+'.\&
.P
Each key sequence can be any number of modifiers and keys, separated by plus (+)
For example: alt+r Alt+F4 CTRL+alt+f3 aLT+1+2+3 ctrl+Backspace 
.P
Since we are emulating keyboard input, combinations like Shift+# is invalid because typing a `#' involves pressing Shift and 3.\&
.P
Example: Switch to tty1:
.RS 4
ydotool key ctrl+alt+f1
.P
.RE
Example: Close a window in graphical environment:
.RS 4
ydotool key Alt+F4
.P
.RE
.RE
\fBtype\fR [\fB--delay\fR \fI<ms>\fR] [\fB--key-delay\fR \fI<ms>\fR] [\fB--args\fR \fI<N>\fR] [\fB--file\fR \fI<filepath>\fR] "\fIsomething to type\fR"
.P
.RS 4
Types text as if you had typed it on the keyboard.\&
.P
Options:
.P
\fB--delay\fR \fI<ms>\fR
.RS 4
Delay before starting typing.\& Default 100ms.\&
.P
.RE
\fB--key-delay\fR \fI<ms>\fR
.RS 4
Delay time between keystrokes.\& Default 12ms.\&
.P
.RE
\fB--args\fR \fI<N>\fR
.RS 4
?\&?\&?\&?\&
.P
.RE
\fB--file\fR \fI<filepath>\fR
.RS 4
Specify a file, the contents of which will be typed as if passed as an argument.\& The filepath may also be '-' to read from stdin.\&
.P
.RE
Example: to type 'Hello world!\&' you would do:
.RS 4
ydotool type 'Hello world!\&'
.P
.RE
.RE
.SH MOUSE COMMANDS
.P
\fBmousemove\fR [\fB--delay\fR \fI<ms>\fR] \fI<x> <y>\fR
.RS 4
Move the mouse to the specific X and Y coordinates on the screen.\&
.P
Options:
\fB--delay\fR \fI<ms>\fR
.RS 4
Delay before starting move.\& Default 100ms.\&
.P
.RE
Example: to move the cursor to absolute coordinates (100,100):
.RS 4
ydotool mousemove 100 100
.P
.RE
.RE
\fBmousemove_relative\fR [\fB--delay\fR \fI<ms>\fR] \fI<x>\fR \fI<y>\fR
.RS 4
Move the mouse x,y pixels relative to the current position of the mouse cursor.\&
.P
Options:
\fB--delay\fR \fI<ms>\fR
.RS 4
Delay before starting move.\& Default 100ms.\&
.P
.RE
Example: Relatively move mouse pointer to -100,100:
.RS 4
ydotool mousemove_relative -- -100 100
.P
.RE
.RE
\fBclick\fR  [\fB--delay\fR \fI<ms>\fR] \fIbutton\fR
.RS 4
Send a click.\& Buttons are: 1=left 2=right 3=middle
.P
Options:
.P
\fB--delay\fR \fI<ms>\fR
.RS 4
Delay before click.\& Default 100ms.\&
.P
.RE
Example: Mouse right click:
.RS 4
ydotool click 2
.P
.RE
.RE
\fBrecorder\fR [\fB--delay\fR \fI<ms>\fR] [\fB--record\fR \fI<devices>\fR] [\fB--replay\fR \fI<input files>\fR] [\fB--display\fR] [\fB--duration\fR \fI<ms>\fR]
.P
.RS 4
Options:
.P
\fB--delay\fR \fI<ms>\fR
.RS 4
Delay time before start recording/replaying.\& Default 5000ms.\&
.P
.RE
\fB--record\fR \fI<devices>\fR
.RS 4
Devices to record from.\& Default is all, including non-keyboard devices.\&
.P
.RE
\fB--replay\fR \fI<input files>\fR
.RS 4
The record file can't be replayed on an architecture with different endianness.\&
.P
.RE
\fB--display\fR
.RS 4
?\&?\&?\&?\&
.P
.RE
\fB--duration\fR \fI<ms>\fR
.RS 4
Record duration.\& Otherwise use SIGINT to stop recording.\&
.P
.RE
.RE
\fBmouseup\fR [\fB--delay\fR \fI<ms>\fR] \fIbutton\fR
.RS 4
Send a mouse up event.\&  Buttons are: 1=left 2=right 3=middle
.P
Options:
.P
\fB--delay\fR \fI<ms>\fR
.RS 4
Delay before click.\& Default 100ms.\&
.P
.RE
Example: Mouse right click:
.RS 4
ydotool click 2
.P
.RE
.RE
\fBmousedown\fR [\fB--delay\fR \fI<ms>\fR] \fIbutton\fR
.RS 4
Send a mouse down event.\&  Buttons are: 1=left 2=right 3=middle
.P
Options:
.P
\fB--delay\fR \fI<ms>\fR
.RS 4
Delay before click.\& Default 100ms.\&
.P
.RE
Example: Mouse right click:
.RS 4
ydotool click 2
.P
.RE
.RE
.SH AUTHOR
.P
ydotool was written by ReimuNotMoe.\&
.P
This man page by bob.\&hepple@gmail.\&com
.P
.SH BUGS
.P
When \fBydotool\fR(1) runs and creates a virtual input device, it will take some time for your graphical environment (eg X11/Wayland) to recognize and enable the virtual input device.\& (Usually done by udev)
.P
If the delay is too short, the virtual input device may not be recognized & enabled by the graphical environment in time.\&
.P
In order to solve this problem, there is a persistent background service, \fBydotoold\fR(1), to hold a persistent virtual device, and accept input from \fBydotool\fR(1).\& When \fBydotoold\fR(1) is unavailable, \fBydotool\fR(1) will work without it.\&
.P
.SH COPYRIGHT
MIT License
.P
.SH SEE ALSO
.P
\fBydotoold\fR(8)
.P
Project site: <https://github.\&com/ReimuNotMoe/ydotool>