1XDOTOOL(1) XDOTOOL(1)
2
3
4
6 xdotool - command-line X11 automation tool
7
9 xdotool cmd args...
10
11 Notation: Some documentation uses [window=%1] to denote an optional
12 argument. This case means that the argument, if not present, will
13 default to %1.
14
16 xdotool lets you programatically (or manually) simulate keyboard input
17 and mouse activity, move and resize windows, etc. It does this using
18 X11's XTEST extension and other Xlib functions.
19
20 There is some support for Extended Window Manager Hints (aka EWMH or
21 NetWM). See the "EXTENDED WINDOW MANAGER HINTS" section for more
22 information.
23
25 key [options] keystroke [keystroke ...]
26 Options:
27
28 --window window
29 Send keystrokes to a specific window id. You can use "WINDOW
30 STACK" references like "%1" and "%@" here. If there is a window
31 stack, then "%1" is the default, otherwise the current window
32 is used.
33
34 See also: "SENDEVENT NOTES" and "WINDOW STACK"
35
36 --clearmodifiers
37 Clear modifiers before sending keystrokes. See CLEARMODIFIERS
38 below.
39
40 --delay milliseconds
41 Delay between keystrokes. Default is 12ms.
42
43 Type a given keystroke. Examples being "alt+r", "Control_L+J",
44 "ctrl+alt+n", "BackSpace".
45
46 Generally, any valid X Keysym string will work. Multiple keys are
47 separated by '+'. Aliases exist for "alt", "ctrl", "shift",
48 "super", and "meta" which all map to Foo_L, such as Alt_L and
49 Control_L, etc.
50
51 In cases where your keyboard doesn't actually have the key you want
52 to type, xdotool will automatically find an unused keycode and use
53 that to type the key.
54
55 With respect to "COMMAND CHAINING", this command consumes the
56 remainder of the arguments or until a new xdotool command is seen,
57 because no xdotool commands are valid keystrokes.
58
59 Example: Send the keystroke "F2"
60 xdotool key F2
61
62 Example: Send 'a' with an accent over it (not on english keyboards,
63 but still works with xdotool)
64 xdotool key Aacute
65
66 Example: Send ctrl+l and then BackSpace as separate keystrokes:
67 xdotool key ctrl+l BackSpace
68
69 Example: Send ctrl+c to all windows matching title 'gdb' (See
70 "COMMAND CHAINING")
71 xdotool search --name gdb key ctrl+c
72
73 keydown [options] keystroke
74 Same as above, except only keydown (press) events are sent.
75
76 keyup keystroke
77 Same as above, except only keyup (release) events are sent.
78
79 type [options] something to type
80 Options:
81
82 --window windowid
83 Send keystrokes to a specific window id. See "SENDEVENT NOTES"
84 below. The default, if no window is given, depends on the
85 window stack. If the window stack is empty the current window
86 is typed at using XTEST. Otherwise, the default is "%1" (see
87 "WINDOW STACK").
88
89 --delay milliseconds
90 Delay between keystrokes. Default is 12ms.
91
92 --clearmodifiers
93 Clear modifiers before sending keystrokes. See CLEARMODIFIERS
94 below.
95
96 Types as if you had typed it. Supports newlines and tabs (ASCII
97 newline and tab). Each keystroke is separated by a delay given by
98 the --delay option.
99
100 With respect to "COMMAND CHAINING", this command consumes the
101 remainder of the arguments and types them. That is, no commands can
102 chain after 'type'.
103
104 Example: to type 'Hello world!' you would do:
105 xdotool type 'Hello world!'
106
108 mousemove [options] x y OR 'restore'
109 Move the mouse to the specific X and Y coordinates on the screen.
110
111 You can move the mouse to the previous location if you specify
112 'restore' instead of an X and Y coordinate. Restoring only works if
113 you have moved previously in this same command invocation. Further,
114 it does not work with the --window option.
115
116 For example, to click the top-left corner of the screen and move
117 the mouse to the original position before you moved it, use this:
118 xdotool mousemove 0 0 click 1 mousemove restore
119
120 --window WINDOW
121 Specify a window to move relative to. Coordinates 0,0 are at
122 the top left of the window you choose.
123
124 "WINDOW STACK" references are valid here, such as %1 and %@.
125 Though, using %@ probably doesn't make sense.
126
127 --screen SCREEN
128 Move the mouse to the specified screen to move to. This is only
129 useful if you have multiple screens and ARE NOT using Xinerama.
130
131 The default is the current screen. If you specify --window, the
132 --screen flag is ignored.
133
134 --polar
135 Use polar coordinates. This makes 'x' an angle (in degrees,
136 0-360, etc) and 'y' the distance.
137
138 Rotation starts at 'up' (0 degrees) and rotates clockwise: 90 =
139 right, 180 = down, 270 = left.
140
141 The origin defaults to the center of the current screen. If you
142 specify a --window, then the origin is the center of that
143 window.
144
145 --clearmodifiers
146 See CLEARMODIFIERS
147
148 --sync
149 After sending the mouse move request, wait until the mouse is
150 actually moved. If no movement is necessary, we will not wait.
151 This is useful for scripts that depend on actions being
152 completed before moving on.
153
154 Note: We wait until the mouse moves at all, not necessarily
155 that it actually reaches your intended destination. Some
156 applications lock the mouse cursor to certain regions of the
157 screen, so waiting for any movement is better in the general
158 case than waiting for a specific target.
159
160 mousemove_relative [options] x y
161 Move the mouse x,y pixels relative to the current position of the
162 mouse cursor.
163
164 --polar
165 Use polar coordinates. This makes 'x' an angle (in degrees,
166 0-360, etc) and 'y' the distance.
167
168 Rotation starts at 'up' (0 degrees) and rotates clockwise: 90 =
169 right, 180 = down, 270 = left.
170
171 --sync
172 After sending the mouse move request, wait until the mouse is
173 actually moved. If no movement is necessary, we will not wait.
174 This is useful for scripts that depend on actions being
175 completed before moving on.
176
177 Note that we wait until the mouse moves at all, not necessarily
178 that it actually reaches your intended destination. Some
179 applications lock the mouse cursor to certain regions of the
180 screen, so waiting for any movement is better in the general
181 case than waiting for a specific target.
182
183 --clearmodifiers
184 See CLEARMODIFIERS
185
186 click [options] button
187 Send a click, that is, a mousedown followed by mouseup for the
188 given button with a short delay between the two (currently 12ms).
189
190 Buttons generally map this way: Left mouse is 1, middle is 2, right
191 is 3, wheel up is 4, wheel down is 5.
192
193 --clearmodifiers
194 Clear modifiers before clicking. See CLEARMODIFIERS below.
195
196 --repeat REPEAT
197 Specify how many times to click. Default is 1. For a double-
198 click, use '--repeat 2'
199
200 --delay MILLISECONDS
201 Specify how long, in milliseconds, to delay between clicks.
202 This option is not used if the --repeat flag is set to 1
203 (default).
204
205 --window WINDOW
206 Specify a window to send a click to. See "SENDEVENT NOTES"
207 below for caveats. Uses the current mouse position when
208 generating the event.
209
210 The default, if no window is given, depends on the window
211 stack. If the window stack is empty the current window is typed
212 at using XTEST. Otherwise, the default is "%1" (see "WINDOW
213 STACK").
214
215 mousedown [options] button
216 Same as click, except only a mouse down is sent.
217
218 mouseup [options] button
219 Same as click, except only a mouse up is sent.
220
221 getmouselocation [--shell]
222 Outputs the x, y, screen, and window id of the mouse cursor. Screen
223 numbers will be nonzero if you have multiple monitors and are not
224 using Xinerama.
225
226 --shell
227 This makes getmouselocation output shell data you can eval.
228 Example:
229
230 % xdotool getmouselocation --shell
231 X=880
232 Y=443
233 SCREEN=0
234 WINDOW=16777250
235
236 % eval $(xdotool getmouselocation --shell)
237 % echo $X,$Y
238 714,324
239
240 behave_screen_edge [options] where command ...
241 Bind an action to events when the mouse hits the screen edge or
242 corner.
243
244 Options are:
245
246 --delay MILLISECONDS
247 Delay in milliseconds before running the command. This allows
248 you to require a given edge or corner to be held for a short
249 period before your command will run. If you leave the edge or
250 corner before the delay expires then the time will reset.
251
252 --quiesce MILLISECONDS
253 Delay in milliseconds before the next command will run. This
254 helps prevent accidentally running your command extra times;
255 especially useful if you have a very short --delay (like the
256 default of 0).
257
258 Event timeline
259
260 * Mouse hits an edge or corner.
261 * If delay is nonzero, the mouse must stay in this edge or corner until delay time expires.
262 * If still in the edge/corner, trigger.
263 * If quiesce is nonzero, then there is a cool-down period where the next
264 trigger cannot occur
265
266 Valid 'where' values are:
267
268 left
269 top-left
270 top
271 top-right
272 right
273 bottom-left
274 bottom
275 bottom-right
276
277 Examples:
278 # Activate google-chrome when you move the mouse to the bottom-
279 left corner:
280 xdotool behave_screen_edge bottom-left \
281 search --class google-chrome windowactivate
282
283 # Go to the next workspace (right). Known to work in GNOME (metacity and compiz)
284 xdotool behave_screen_edge --delay 500 bottom-right key XF86Forward
285
286 # Activate firefox and do a web search in a new tab for text in your clipboard
287 xdotool behave_screen_edge --delay 1000 top-left \
288 search --classname Navigator \
289 windowactivate --sync key --delay 250 ctrl+t ctrl+k ctrl+v Return
290
292 search [options] pattern
293 Search for windows with titles, names, or classes with a regular
294 expression pattern. The output is line-delimited list of X window
295 identifiers. If you are using "COMMAND CHAINING", the search
296 command will only write window ids to stdout if it is the last (or
297 only) command in the chain; otherwise, it is silent.
298
299 The result is saved to the window stack for future chained
300 commands. See "WINDOW STACK" and "COMMAND CHAINING" for details.
301
302 The options available are:
303
304 --class
305 Match against the window class.
306
307 --classname
308 Match against the window classname.
309
310 --maxdepth N
311 Set recursion/child search depth. Default is -1, meaning
312 infinite. 0 means no depth, aka no results. If you only want
313 toplevel windows, set maxdepth of 1.
314
315 --name
316 Match against the window name. This is the same string that is
317 displayed in the window titlebar.
318
319 --onlyvisible
320 Show only visible windows in the results. This means ones with
321 map state IsViewable.
322
323 --pid PID
324 Match windows that belong to a specific process id. This may
325 not work for some X applications that do not set this metadata
326 on its windows.
327
328 --screen N
329 Select windows only on a specific screen. Default is to search
330 all screens. Only meaningful if you have multiple displays and
331 are not using Xinerama.
332
333 --title
334 DEPRECATED. See --name.
335
336 --all
337 Require that all conditions be met. For example:
338
339 xdotool search --all --pid 1424 --name "Hello World"
340
341 This will match only windows that have "Hello World" as a name
342 and are owned by pid 1424.
343
344 --any
345 Match windows that match any condition (logically, 'or'). This
346 is on by default. For example:
347
348 xdotool search --any --pid 1424 --name "Hello World"
349
350 This will match any windows owned by pid 1424 or windows with
351 name "Hello World"
352
353 The default options are "--name --class --classname"
354
355 selectwindow
356 Get the window id (for a client) by clicking on it. Useful for
357 having scripts query you humans for what window to act on. For
358 example, killing a window by clicking on it:
359
360 xdotool selectwindow windowkill
361
362 behave window action command ...
363 Bind an action to an event on a window. This lets you run
364 additional xdotool commands whenever a matched event occurs.
365
366 The command run as a result of the behavior is run with %1 being
367 the window that was acted upon. Examples follow after the event
368 list.
369
370 The following are valid events:
371
372 mouse-enter
373 Fires when the mouse enters a window. This is similar to 'mouse
374 over' events in javascript, if that helps.
375
376 mouse-leave
377 Fires when the mouse leaves a window. This is the opposite of
378 'mouse-enter'
379
380 mouse-click
381 Fires when the mouse is clicked. Specifically, when the mouse
382 button is released.
383
384 focus
385 Fires when the window gets input focus.
386
387 blur
388 Fires when the window loses focus.
389
390 Examples:
391
392 # Print the cursor location whenever the mouse enters a currently-visible
393 # window:
394 xdotool search --onlyvisible . behave %@ mouse-enter getmouselocation
395
396 # Print the window title and pid whenever an xterm gets focus
397 xdotool search --class xterm behave %@ focus getwindowname getwindowpid
398
399 # Emulate focus-follows-mouse
400 xdotool search . behave %@ mouse-enter windowfocus
401
402 getwindowpid [window=%1]
403 Output the PID owning a given window. This requires effort from the
404 application owning a window and may not work for all windows. This
405 uses _NET_WM_PID property of the window. See "EXTENDED WINDOW
406 MANAGER HINTS" below for more information.
407
408 If no window is given, the default is '%1'. If no windows are on
409 the stack, then this is an error. See "WINDOW STACK" for more
410 details.
411
412 Example: Find the PID for all xterms:
413 xdotool search --class xterm getwindowpid %@
414
415 getwindowname [window=%1]
416 Output the name of a given window, also known as the title. This is
417 the text displayed in the window's titlebar by your window manager.
418
419 If no window is given, the default is '%1'. If no windows are on
420 the stack, then this is an error. See "WINDOW STACK" for more
421 details.
422
423 getwindowfocus [-f]
424 Prints the window id of the currently focused window. Saves the
425 result to the window stack. See "WINDOW STACK" for more details.
426
427 If the current window has no WM_CLASS property, we assume it is not
428 a normal top-level window and traverse up the parents until we find
429 a window with a WM_CLASS set and return that window id.
430
431 If you really want the window currently having focus and don't care
432 if it has a WM_CLASS setting, then use 'getwindowfocus -f'
433
434 windowsize [options] [window=%1] width height
435 Set the window size of the given window. If no window is given, %1
436 is the default. See "WINDOW STACK" and "COMMAND CHAINING" for more
437 details.
438
439 Percentages are valid for width and height. They are relative to
440 the geometry of the screen the window is on. For example, to make a
441 window the full width of the screen, but half height:
442
443 xdotool windowsize I<window> 100% 50%
444
445 Percentages are valid with --usehints and still mean pixel-width
446 relative to the screen size.
447
448 The options available are:
449
450 --usehints
451 Use window sizing hints (when available) to set width and
452 height. This is useful on terminals for setting the size based
453 on row/column of text rather than pixels.
454
455 --sync
456 After sending the window size request, wait until the window is
457 actually resized. If no change is necessary, we will not wait.
458 This is useful for scripts that depend on actions being
459 completed before moving on.
460
461 Note: Because many window managers may ignore or alter the
462 original resize request, we will wait until the size changes
463 from its original size, not necessary to the requested size.
464
465 Example: To set a terminal to be 80x24 characters, you would use:
466 xdotool windowsize --usehints some_windowid 80 24
467
468 windowmove [options] [window=%1] x y
469 Move the window to the given position. If no window is given, %1 is
470 the default. See "WINDOW STACK" and "COMMAND CHAINING" for more
471 details.
472
473 --sync
474 After sending the window move request, wait until the window is
475 actually moved. If no movement is necessary, we will not wait.
476 This is useful for scripts that depend on actions being
477 completed before moving on.
478
479 windowfocus [options] [window=%1]
480 Focus a window. If no window is given, %1 is the default. See
481 "WINDOW STACK" and "COMMAND CHAINING" for more details.
482
483 Uses XSetInputFocus which may be ignored by some window managers or
484 programs.
485
486 --sync
487 After sending the window focus request, wait until the window
488 is actually focused. This is useful for scripts that depend on
489 actions being completed before moving on.
490
491 windowmap [options] [window=%1]
492 Map a window. In X11 terminology, mapping a window means making it
493 visible on the screen. If no window is given, %1 is the default.
494 See "WINDOW STACK" and "COMMAND CHAINING" for more details.
495
496 --sync
497 After requesting the window map, wait until the window is
498 actually mapped (visible). This is useful for scripts that
499 depend on actions being completed before moving on.
500
501 windowminimize [options] [window=%1]
502 Minimize a window. In X11 terminology, this is called 'iconify.'
503 If no window is given, %1 is the default. See "WINDOW STACK" and
504 "COMMAND CHAINING" for more details.
505
506 --sync
507 After requesting the window minimize, wait until the window is
508 actually minimized. This is useful for scripts that depend on
509 actions being completed before moving on.
510
511 windowraise [window_id=%1]
512 Raise the window to the top of the stack. This may not work on all
513 window managers. If no window is given, %1 is the default. See
514 "WINDOW STACK" and "COMMAND CHAINING" for more details.
515
516 windowreparent [source_window=%1] destination_window
517 Reparent a window. This moves the source_window to be a child
518 window of destination_window. If no source is given, %1 is the
519 default. "WINDOW STACK" window references (like %1) are valid for
520 both source_window and destination_window See "WINDOW STACK" and
521 "COMMAND CHAINING" for more details.
522
523 windowkill [window=%1]
524 Kill a window. This action will destroy the window and kill the
525 client controlling it. If no window is given, %1 is the default.
526 See WINDOW STACK and "COMMAND CHAINING" for more details.
527
528 windowunmap [options] [window_id=%1]
529 Unmap a window, making it no longer appear on your screen. If no
530 window is given, %1 is the default. See "WINDOW STACK" and "COMMAND
531 CHAINING" for more details.
532
533 --sync
534 After requesting the window unmap, wait until the window is
535 actually unmapped (hidden). This is useful for scripts that
536 depend on actions being completed before moving on.
537
538 set_window [options] [windowid=%1]
539 Set properties about a window. If no window is given, %1 is the
540 default. See "WINDOW STACK" and "COMMAND CHAINING" for more
541 details.
542
543 Options:
544
545 --name newname
546 Set window WM_NAME (the window title, usually)
547
548 --icon-name newiconname
549 Set window WM_ICON_NAME (the window title when minimized,
550 usually)
551
552 --role newrole
553 Set window WM_WINDOW_ROLE
554
555 --classname newclassname
556 Set window class name (not to be confused with window class)
557
558 --class newclass
559 Set window class (not to be confused with window class name)
560
561 --overrideredirect value
562 Set window's override_redirect value. This value is a hint to
563 the window manager for whether or not it should be managed. If
564 the redirect value is 0, then the window manager will draw
565 borders and treat this window normally. If the value is 1, the
566 window manager will ignore this window.
567
568 If you change this value, your window manager may not notice
569 the change until the window is mapped again, so you may want to
570 issue 'windowunmap' and 'windowmap' to make the window manager
571 take note.
572
574 These commands follow the EWMH standard. See the section "EXTENDED
575 WINDOW MANAGER HINTS" for more information.
576
577 windowactivate [options] [window=%1]
578 Activate the window. This command is different from windowfocus: if
579 the window is on another desktop, we will switch to that desktop.
580 It also uses a different method for bringing the window up. I
581 recommend trying this command before using windowfocus, as it will
582 work on more window managers.
583
584 If no window is given, %1 is the default. See "WINDOW STACK" and
585 "COMMAND CHAINING" for more details.
586
587 --sync
588 After sending the window activation, wait until the window is
589 actually activated. This is useful for scripts that depend on
590 actions being completed before moving on.
591
592 getactivewindow
593 Output the current active window. This command is often more
594 reliable than getwindowfocus. The result is saved to the window
595 stack. See "WINDOW STACK" for more details.
596
597 set_num_desktops number
598 Changes the number of desktops or workspaces.
599
600 get_num_desktops
601 Output the current number of desktops.
602
603 get_desktop_viewport [--shell]
604 Report the current viewport's position. If --shell is given, the
605 output is friendly to shell eval.
606
607 Viewports are sometimes used instead of 'virtual desktops' on some
608 window managers. A viewport is simply a view on a very large
609 desktop area.
610
611 set_desktop_viewport x y
612 Move the viewport to the given position. Not all requests will be
613 obeyed - some windowmangers only obey requests that align to
614 workspace boundaries, such as the screen size.
615
616 For example, if your screen is 1280x800, you can move to the 2nd
617 workspace by doing:
618 xdotool set_desktop_viewport 1280 0
619
620 set_desktop desktop_number
621 Change the current view to the specified desktop.
622
623 get_desktop
624 Output the current desktop in view.
625
626 set_desktop_for_window [window=%1] desktop_number
627 Move a window to a different desktop. If no window is given, %1 is
628 the default. See "WINDOW STACK" and "COMMAND CHAINING" for more
629 details.
630
631 get_desktop_for_window [window=%1]
632 Output the desktop currently containing the given window. Move a
633 window to a different desktop. If no window is given, %1 is the
634 default. See WINDOW STACK and "COMMAND CHAINING" for more details.
635
637 exec [options] command [...]
638 Execute a program. This is often useful when combined with
639 behave_screen_edge to do things like locking your screen.
640
641 Options:
642
643 --sync
644 Block until the child process exits. The child process exit
645 status is then passed to the parent process (xdotool) which
646 copies it.
647
648 Examples:
649 # Lock the screen when the mouse sits in the top-right corner
650 xdotool behave_screen_edge --delay 1000 top-right \
651 exec gnome-screensaver-command --lock
652 # Substitute 'xscreensaver-command -lock' if you use that program.
653
654 # The following will fail to move the mouse because we use '--sync' and
655 # /bin/false exits nonzero:
656 xdotool exec --sync /bin/false mousemove 0 0
657
658 # This succeeds, though, since we do not use --sync on the exec command.
659 xdotool exec /bin/false mousemove 0 0
660
662 xdotool can read a list of commands via stdin or a file if you want. A
663 script will fail when any command fails.
664
665 Truthfully, 'script' mode isn't fully fleshed out and may fall below
666 your expectations. If you have suggestions, please email the list or
667 file a bug (See CONTACT).
668
669 Scripts can use positional arguments (Represented by $1, $2, ...) and
670 environment variables (like $HOME or $WINDOWID). Quoting arguments
671 should work as expected.
672
673 Scripts are processed for parameter and environment variable expansion
674 and then run as if you had invoked xdotool with the entire script on
675 one line (using COMMAND CHAINING).
676
677 · Read commands from a file:
678
679 xdotool filename
680
681 · Read commands from stdin:
682
683 xdotool -
684
685 · Read commands from a redirected file
686
687 xdotool - < myfile
688
689 You can also write scripts that only execute xdotool. Example:
690
691 #!/usr/local/bin/xdotool
692 search --onlyvisible --classname $1
693
694 windowsize %@ $2 $3
695 windowraise %@
696
697 windowmove %1 0 0
698 windowmove %2 $2 0
699 windowmove %3 0 $3
700 windowmove %4 $2 $3
701
702 This script will take all windows matched by the classname query given
703 by arg1 ($1) and sizes/moves them into a 2x2 grid with windows sized by
704 the 2nd and 3rd parameters.
705
706 Here's an example usage:
707
708 % ./myscript xterm 600 400
709
710 Running it like this will take 4 visible xterms, raise them, and move
711 them into a 2x2 tile grid with each window 600x400 pixels in size.
712
714 Any command taking the --clearmodifiers flag will attempt to clear any
715 active input modifiers during the command and restore them afterwards.
716
717 For example, if you were to run this command:
718 xdotool key a
719
720 The result would be 'a' or 'A' depending on whether or not you were
721 holding the shift key on your keyboard. Often it is undesirable to have
722 any modifiers active, so you can tell xdotool to clear any active
723 modifiers.
724
725 The order of operations if you hold shift while running 'xdotool key
726 --clearmodifiers a' is this:
727
728 1. Query for all active modifiers (finds shift, in this case)
729 2. Try to clear shift by sending 'key up' for the shift key
730 3. Runs normal 'xdotool key a'
731 4. Restore shift key by sending 'key down' for shift
732
733 The --clearmodifiers flag can currently clear of the following:
734
735 · any key in your active keymap that has a modifier associated with
736 it. (See xmodmap(1)'s 'xmodmap -pm' output)
737
738 · mouse buttons (1, 2, 3, 4, and 5)
739
740 · caps lock
741
743 If you are trying to send key input to a specific window, and it does
744 not appear to be working, then it's likely your application is ignoring
745 the events xdotool is generating. This is fairly common.
746
747 Sending keystrokes to a specific window uses a different API than
748 simply typing to the active window. If you specify 'xdotool type
749 --window 12345 hello' xdotool will generate key events and send them
750 directly to window 12345. However, X11 servers will set a special flag
751 on all events generated in this way (see XEvent.xany.send_event in
752 X11's manual). Many programs observe this flag and reject these events.
753
754 It is important to note that for key and mouse events, we only use
755 XSendEvent when a specific window is targeted. Otherwise, we use XTEST.
756
757 Some programs can be configured to accept events even if they are
758 generated by xdotool. Seek the documentation of your application for
759 help.
760
761 Specific application notes (from the author's testing): * Firefox 3
762 seems to ignore all input when it does not have focus. * xterm can be
763 configured while running with ctrl+leftclick, 'Allow SendEvents' *
764 gnome-terminal appears to accept generated input by default.
765
767 Certain commands (search, getactivewindow, getwindowfocus) will find
768 windows for you. These results generally printed to stdout, but they
769 are also saved to memory for future use during the lifetime of the
770 xdotool process. See "COMMAND CHAINING" for more information.
771
772 The only modifications support for the window stack are to replace it.
773 That is, two of two sequential searches, only the last one's results
774 will be the window stack.
775
777 xdotool supports running multiple commands on a single invocation.
778 Generally, you'll start with a search command (see "WINDOW STACK") and
779 then perform a set of actions on those results.
780
781 To query the window stack, you can use special notation "%N" where N is
782 a number or the '@' symbol. If %N is given, the Nth window will be
783 selected from the window stack. Generally you will only want the first
784 window or all windows. Note that the order of windows in the window
785 stack corresponds to the window stacking order, i.e. the bottom-most
786 window will be reported first (see XQueryTree(3)). Thus the order of
787 the windows in the window stack may not be consistent across
788 invocations.
789
790 The notation described above is used as the "window" argument for any
791 given command.
792
793 For example, to resize all xterms to 80x24:
794
795 xdotool search --class xterm -- windowsize --usehints %@ 80 24
796
797 Resize move the current window:
798
799 xdotool getactivewindow windowmove 0 0
800
801 In all cases, the default window argument, if omitted, will default to
802 "%1". It is obviously an error if you omit the window argument and the
803 window stack is empty. If you try to use the window stack and it is
804 empty, it is also an error.
805
806 To activate the first firefox window found:
807
808 xdotool search --class firefox windowactivate
809
810 These would error:
811
812 xdotool windowactivate
813 xdotool windowactivate %1
814 xdotool windowactivate %@
815
816 When xdotool exits, the current window stack is lost.
817
818 Additinally, commands that modify the "WINDOW STACK" will not print the
819 results if they are not the last command. For example:
820
821 # Output the active window:
822 % xdotool getactivewindow
823 20971533
824
825 # Output the pid of the active window, but not the active window id:
826 % xdotool getactivewindow getwindowpid
827 4686
828
830 The following pieces of the EWMH standard are supported:
831
832 _NET_SUPPORTED
833 Asks the window manager what is supported
834
835 _NET_CURRENT_DESKTOP
836 Query and set the current desktop. Support for this enables these
837 commands: "set_desktop", "get_desktop".
838
839 _NET_WM_DESKTOP
840 Query and set what desktop a window is living in. Support for this
841 enables these commands: "set_desktop_for_window",
842 "get_desktop_for_window".
843
844 _NET_ACTIVE_WINDOW
845 Allows you to query and set the active window by asking the window
846 manager to bring it forward. Support for this enables these
847 commands: "windowactivate", "getactivewindow".
848
849 _NET_WM_PID
850 This feature is application dependent, not window-manager
851 dependent. Query the PID owning a given window. Support for this
852 enables these commands: "getwindowpid".
853
855 xprop(1), xwininfo(1),
856
857 Project site: <http://www.semicomplete.com/projects/xdotool>
858
859 Google Code: <http://semicomplete.googlecode.com/>
860
861 EWMH specification:
862 http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html
863 <http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html>
864
866 Please send questions to xdotool-users@googlegroups.com. File bugs and
867 feature requests at the following URL:
868
869 <http://code.google.com/p/semicomplete/issues/list>
870
871 Alternately, if you prefer email, feel free to file bugs by emailing
872 the list. What works for you :)
873
875 xdotool was written by Jordan Sissel.
876
877 This manual page was written originally by Daniel Kahn Gillmor
878 <dkg@fifthhorseman.net> for the Debian project (but may be used by
879 others). It is maintained by Jordan Sissel.
880
881 Patches, ideas, and other contributions by many, nice folks. See the
882 CHANGELIST file for who provided what.
883
885 Hey! The above document had some coding errors, which are explained
886 below:
887
888 Around line 783:
889 '=item' outside of any '=over'
890
891 Around line 812:
892 You forgot a '=back' before '=head1'
893
894
895
896 2010-10-12 XDOTOOL(1)