.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "XDOTOOL 1" .TH XDOTOOL 1 "2010-06-23" "" "" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" xdotool \- command\-line X11 automation tool .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBxdotool\fR \fIcmd\fR \fIargs...\fR .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBxdotool\fR lets you programatically (or manually) simulate keyboard input and mouse activity, move and resize windows, etc. It does this using X11's \&\s-1XTEST\s0 extension and other Xlib functions. .PP There is some support for Extended Window Manager Hints (aka \s-1EWMH\s0 or NetWM). See the \*(L"\s-1EXTENDED\s0 \s-1WINDOW\s0 \s-1MANAGER\s0 \s-1HINTS\s0\*(R" section for more information. .SH "KEYBOARD COMMANDS" .IX Header "KEYBOARD COMMANDS" .IP "\fBkey\fR \fI[options]\fR \fIkeystroke\fR [\fIkeystroke\fR ...]" 4 .IX Item "key [options] keystroke [keystroke ...]" Options: .RS 4 .IP "\fB\-\-window window\fR" 4 .IX Item "--window window" Send keystrokes to a specific window id. . You can use \&\*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" references like \*(L"%1\*(R" and \*(L"%@\*(R" here. If there is a window stack, then \*(L"%1\*(R" is the default, otherwise the current window is used. .Sp See also: \*(L"\s-1SENDEVENT\s0 \s-1NOTES\s0\*(R" and \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" .IP "\fB\-\-clearmodifiers\fR" 4 .IX Item "--clearmodifiers" Clear modifiers before sending keystrokes. See \s-1CLEARMODIFIERS\s0 below. .IP "\fB\-\-delay milliseconds\fR" 4 .IX Item "--delay milliseconds" Delay between keystrokes. Default is 12ms. .RE .RS 4 .Sp Type a given keystroke. Examples being \*(L"alt+r\*(R", \*(L"Control_L+J\*(R", \&\*(L"ctrl+alt+n\*(R", \*(L"BackSpace\*(R". .Sp Generally, any valid X Keysym string will work. Multiple keys are separated by '+'. Aliases exist for \*(L"alt\*(R", \*(L"ctrl\*(R", \*(L"shift\*(R", \*(L"super\*(R", and \*(L"meta\*(R" which all map to Foo_L, such as Alt_L and Control_L, etc. .Sp In cases where your keyboard doesn't actually have the key you want to type, xdotool will automatically find an unused keycode and use that to type the key. .Sp With respect to \*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R", this command consumes the remainder of the arguments or until a new xdotool command is seen, because no xdotool commands are valid keystrokes. .Sp Example: Send the keystroke \*(L"F2\*(R" xdotool key F2 .Sp Example: Send 'a' with an accent over it (not on english keyboards, but still works with xdotool) xdotool key Aacute .Sp Example: Send ctrl+l and then BackSpace as separate keystrokes: xdotool key ctrl+l BackSpace .Sp Example: Send ctrl+c to all windows matching title 'gdb' (See \*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R") xdotool search \-\-name gdb key ctrl+c .RE .IP "\fBkeydown\fR \fI[options]\fR \fIkeystroke\fR" 4 .IX Item "keydown [options] keystroke" Same as above, except only keydown events are sent. .IP "\fBkeyup\fR \fIkeystroke\fR" 4 .IX Item "keyup keystroke" Same as above, except only keyup events are sent. .IP "\fBtype\fR \fI[options]\fR \fIsomething to type\fR" 4 .IX Item "type [options] something to type" Options: .RS 4 .IP "\fB\-\-window windowid\fR" 4 .IX Item "--window windowid" Send keystrokes to a specific window id. See \*(L"\s-1SENDEVENT\s0 \s-1NOTES\s0\*(R" below. The default, if no window is given, depends on the window stack. If the window stack is empty the current window is typed at using \s-1XTEST\s0. Otherwise, the default is \*(L"%1\*(R" (see \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R"). .IP "\fB\-\-delay milliseconds\fR" 4 .IX Item "--delay milliseconds" Delay between keystrokes. Default is 12ms. .IP "\fB\-\-clearmodifiers\fR" 4 .IX Item "--clearmodifiers" Clear modifiers before sending keystrokes. See \s-1CLEARMODIFIERS\s0 below. .RE .RS 4 .Sp Types as if you had typed it. Supports newlines and tabs (\s-1ASCII\s0 newline and tab). Each keystroke is separated by a delay given by the delay option. .Sp With respect to \*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R", this command consumes the remainder of the arguments and types them. That is, no commands can chain after 'type'. .Sp Example: to type 'Hello world!' you would do: xdotool type 'Hello world!' .RE .SH "MOUSE COMMANDS" .IX Header "MOUSE COMMANDS" .IP "\fBmousemove\fR \fI[options]\fR \fIx\fR \fIy\fR" 4 .IX Item "mousemove [options] x y" Move the mouse to the specific X and Y coordinates on the screen. .RS 4 .IP "\fB\-\-window \s-1WINDOW\s0\fR" 4 .IX Item "--window WINDOW" Specify a window to move relative to. Coordinates 0,0 are at the top left of the window you choose. .Sp \&\*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" references are valid here, such as \f(CW%1\fR and %@. Though, using %@ probably doesn't make sense. .IP "\fB\-\-screen \s-1SCREEN\s0\fR" 4 .IX Item "--screen SCREEN" Move the mouse to the specified screen to move to. This is only useful if you have multiple screens and \s-1ARE\s0 \s-1NOT\s0 using Xinerama. .Sp The default is the current screen. If you specify \-\-window, the \-\-screen flag is ignored. .IP "\fB\-\-polar\fR" 4 .IX Item "--polar" Use polar coordinates. This makes 'x' an angle (in degrees, 0\-360, etc) and 'y' the distance. .Sp Rotation starts at 'up' (0 degrees) and rotates clockwise: 90 = right, 180 = down, 270 = left. .Sp The origin defaults to the center of the current screen. If you specify a \-\-window, then the origin is the center of that window. .IP "\fB\-\-clearmodifiers\fR" 4 .IX Item "--clearmodifiers" See \s-1CLEARMODIFIERS\s0 .IP "\fB\-\-sync\fR" 4 .IX Item "--sync" After sending the mouse move request, wait until the mouse is actually moved. If no movement is necessary, we will not wait. This is useful for scripts that depend on actions being completed before moving on. .Sp Note: We wait until the mouse moves at all, not necessarily that it actually reaches your intended destination. Some applications lock the mouse cursor to certain regions of the screen, so waiting for any movement is better in the general case than waiting for a specific target. .RE .RS 4 .RE .IP "\fBmousemove_relative\fR [options] \fIx\fR \fIy\fR" 4 .IX Item "mousemove_relative [options] x y" Move the mouse x,y pixels relative to the current position of the mouse cursor. .RS 4 .IP "\fB\-\-polar\fR" 4 .IX Item "--polar" Use polar coordinates. This makes 'x' an angle (in degrees, 0\-360, etc) and 'y' the distance. .Sp Rotation starts at 'up' (0 degrees) and rotates clockwise: 90 = right, 180 = down, 270 = left. .IP "\fB\-\-sync\fR" 4 .IX Item "--sync" After sending the mouse move request, wait until the mouse is actually moved. If no movement is necessary, we will not wait. This is useful for scripts that depend on actions being completed before moving on. .Sp Note that we wait until the mouse moves at all, not necessarily that it actually reaches your intended destination. Some applications lock the mouse cursor to certain regions of the screen, so waiting for any movement is better in the general case than waiting for a specific target. .IP "\fB\-\-clearmodifiers\fR" 4 .IX Item "--clearmodifiers" See \s-1CLEARMODIFIERS\s0 .RE .RS 4 .RE .IP "\fBclick\fR \fI[options]\fR \fIbutton\fR" 4 .IX Item "click [options] button" Send a click, that is, a mousedown followed by mouseup for the given button with a short delay between the two (currently 12ms). .Sp Buttons generally map this way: Left mouse is 1, middle is 2, right is 3, wheel up is 4, wheel down is 5. .RS 4 .IP "\fB\-\-clearmodifiers\fR" 4 .IX Item "--clearmodifiers" Clear modifiers before clicking. See \s-1CLEARMODIFIERS\s0 below. .IP "\fB\-\-window\fR \s-1WINDOW\s0" 4 .IX Item "--window WINDOW" Specify a window to send a click to. See \*(L"\s-1SENDEVENT\s0 \s-1NOTES\s0\*(R" below for caveats. Uses the current mouse position when generating the event. .Sp The default, if no window is given, depends on the window stack. If the window stack is empty the current window is typed at using \s-1XTEST\s0. Otherwise, the default is \*(L"%1\*(R" (see \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R"). .RE .RS 4 .RE .IP "\fBmousedown\fR \fI[options]\fR \fIbutton\fR" 4 .IX Item "mousedown [options] button" Same as \fBclick\fR, except only a mouse down is sent. .IP "\fBmouseup\fR \fI[options]\fR \fIbutton\fR" 4 .IX Item "mouseup [options] button" Same as \fBclick\fR, except only a mouse up is sent. .IP "\fBgetmouselocation\fR \fI[\-\-shell]\fR" 4 .IX Item "getmouselocation [--shell]" Outputs the x, y, and screen location of the mouse cursor. Screen numbers will be nonzero if you have multiple monitors and are not using Xinerama. .RS 4 .IP "\fB\-\-shell\fR" 4 .IX Item "--shell" This makes getmouselocation output shell data you can eval. Example: .Sp .Vb 4 \& % xdotool getmouselocation \-\-shell \& X=880 \& Y=443 \& SCREEN=0 \& \& % eval $(xdotool getmouselocation \-\-shell) \& % echo $X,$Y \& 714,324 .Ve .RE .RS 4 .RE .SH "WINDOW COMMANDS" .IX Header "WINDOW COMMANDS" .IP "\fBsearch\fR \fI[options]\fR \fIpattern\fR" 4 .IX Item "search [options] pattern" Search for windows with titles, names, or classes with a regular expression pattern. The output is line-delimited list of X window identifiers. If you are using \*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R", the search command will only write window ids to stdout if it is the last (or only) command in the chain; otherwise, it is silent. .Sp The result is saved to the window stack for future chained commands. See \&\*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" and \*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R" for details. .Sp The options available are: .RS 4 .IP "\fB\-\-class\fR" 4 .IX Item "--class" Match against the window class. .IP "\fB\-\-classname\fR" 4 .IX Item "--classname" Match against the window classname. .IP "\fB\-\-maxdepth\fR N" 4 .IX Item "--maxdepth N" Set recursion/child search depth. Default is \-1, meaning infinite. 0 means no depth, aka no results. If you only want toplevel windows, set maxdepth of 1. .IP "\fB\-\-name\fR" 4 .IX Item "--name" Match against the window name. This is the same string that is displayed in the window titlebar. .IP "\fB\-\-onlyvisible\fR" 4 .IX Item "--onlyvisible" Show only visible windows in the results. This means ones with map state IsViewable. .IP "\fB\-\-pid \s-1PID\s0\fR" 4 .IX Item "--pid PID" Match windows that belong to a specific process id. This may not work for some X applications that do not set this metadata on its windows. .IP "\fB\-\-screen N\fR" 4 .IX Item "--screen N" Select windows only on a specific screen. Default is to search all screens. Only meaningful if you have multiple displays and are not using Xinerama. .IP "\fB\-\-title\fR" 4 .IX Item "--title" \&\s-1DEPRECATED\s0. See \-\-name. .IP "\fB\-\-all\fR" 4 .IX Item "--all" Require that all conditions be met. For example: .Sp .Vb 1 \& xdotool search \-\-all \-\-pid 1424 \-\-name "Hello World" .Ve .Sp This will match only windows that have \*(L"Hello World\*(R" as a name and are owned by pid 1424. .IP "\fB\-\-any\fR" 4 .IX Item "--any" Match windows that match any condition (logically, 'or'). This is on by default. For example: .Sp .Vb 1 \& xdotool search \-\-any \-\-pid 1424 \-\-name "Hello World" .Ve .Sp This will match any windows owned by pid 1424 or windows with name \*(L"Hello World\*(R" .RE .RS 4 .Sp The default options are \f(CW\*(C`\-\-name \-\-class \-\-classname\*(C'\fR .RE .IP "\fBgetwindowpid\fR \fI[window=%1]\fR" 4 .IX Item "getwindowpid [window=%1]" Output the \s-1PID\s0 owning a given window. This requires effort from the application owning a window and may not work for all windows. This uses _NET_WM_PID property of the window. See \*(L"\s-1EXTENDED\s0 \s-1WINDOW\s0 \s-1MANAGER\s0 \s-1HINTS\s0\*(R" below for more information. .Sp If no window is given, the default is '%1'. If no windows are on the stack, then this is an error. See \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" for more details. .Sp Example: Find the \s-1PID\s0 for all xterms: xdotool search \-\-class xterm getwindowpid %@ .IP "\fBgetwindowfocus\fR [\-f]" 4 .IX Item "getwindowfocus [-f]" Prints the window id of the currently focused window. Saves the result to the window stack. See \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" for more details. .Sp If the current window has no \s-1WM_CLASS\s0 property, we assume it is not a normal top-level window and traverse up the parents until we find a window with a \&\s-1WM_CLASS\s0 set and return that window id. .Sp If you really want the window currently having focus and don't care if it has a \&\s-1WM_CLASS\s0 setting, then use 'getwindowfocus \-f' .IP "\fBwindowsize\fR [options] [window=%1] width height" 4 .IX Item "windowsize [options] [window=%1] width height" Set the window size of the given window. If no window is given, \f(CW%1\fR is the default. See \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" and \*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R" for more details. .Sp The options available are: .RS 4 .IP "\fB\-\-usehints\fR" 4 .IX Item "--usehints" Use window sizing hints (when available) to set width and height. This is useful on terminals for setting the size based on row/column of text rather than pixels. .IP "\fB\-\-sync\fR" 4 .IX Item "--sync" After sending the window size request, wait until the window is actually resized. If no change is necessary, we will not wait. This is useful for scripts that depend on actions being completed before moving on. .Sp Note: Because many window managers may ignore or alter the original resize request, we will wait until the size changes from its original size, not necessary to the requested size. .RE .RS 4 .Sp Example: To set a terminal to be 80x24 characters, you would use: xdotool windowsize \-\-usehints \fIsome_windowid\fR 80 24 .RE .IP "\fBwindowmove\fR \fI[options]\fR \fI[window=%1]\fR \fIx\fR \fIy\fR" 4 .IX Item "windowmove [options] [window=%1] x y" Move the window to the given position. If no window is given, \f(CW%1\fR is the default. See \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" and \*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R" for more details. .RS 4 .IP "\fB\-\-sync\fR" 4 .IX Item "--sync" After sending the window move request, wait until the window is actually moved. If no movement is necessary, we will not wait. This is useful for scripts that depend on actions being completed before moving on. .RE .RS 4 .RE .IP "\fBwindowfocus\fR \fI[options]\fR \fI[window=%1]\fR" 4 .IX Item "windowfocus [options] [window=%1]" Focus a window. If no window is given, \f(CW%1\fR is the default. See \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" and \*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R" for more details. .Sp Uses XSetInputFocus which may be ignored by some window managers or programs. .RS 4 .IP "\fB\-\-sync\fR" 4 .IX Item "--sync" After sending the window focus request, wait until the window is actually focused. This is useful for scripts that depend on actions being completed before moving on. .RE .RS 4 .RE .IP "\fBwindowmap\fR \fI[options]\fR \fI[window=%1]\fR" 4 .IX Item "windowmap [options] [window=%1]" Map a window. In X11 terminology, mapping a window means making it visible on the screen. If no window is given, \f(CW%1\fR is the default. See \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" and \&\*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R" for more details. .RS 4 .IP "\fB\-\-sync\fR" 4 .IX Item "--sync" After requesting the window map, wait until the window is actually mapped (visible). This is useful for scripts that depend on actions being completed before moving on. .RE .RS 4 .RE .IP "\fBwindowraise\fR \fI[window_id=%1]\fR" 4 .IX Item "windowraise [window_id=%1]" Raise the window to the top of the stack. This may not work on all window managers. If no window is given, \f(CW%1\fR is the default. See \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" and \&\*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R" for more details. .IP "\fBwindowunmap\fR \fI[options]\fR \fI[window_id=%1]\fR" 4 .IX Item "windowunmap [options] [window_id=%1]" Unmap a window, making it no longer appear on your screen. If no window is given, \f(CW%1\fR is the default. See \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" and \*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R" for more details. .RS 4 .IP "\fB\-\-sync\fR" 4 .IX Item "--sync" After requesting the window unmap, wait until the window is actually unmapped (hidden). This is useful for scripts that depend on actions being completed before moving on. .RE .RS 4 .RE .IP "\fBset_window\fR \fI[options]\fR \fI[windowid=%1]\fR" 4 .IX Item "set_window [options] [windowid=%1]" Set properties about a window. If no window is given, \f(CW%1\fR is the default. See \&\*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" and \*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R" for more details. .Sp Options: .RS 4 .IP "\fB\-\-name newname\fR" 4 .IX Item "--name newname" Set window \s-1WM_NAME\s0 (the window title, usually) .IP "\fB\-\-icon\-name newiconname\fR" 4 .IX Item "--icon-name newiconname" Set window \s-1WM_ICON_NAME\s0 (the window title when minimized, usually) .IP "\fB\-\-role newrole\fR" 4 .IX Item "--role newrole" Set window \s-1WM_WINDOW_ROLE\s0 .IP "\fB\-\-classname newclassname\fR" 4 .IX Item "--classname newclassname" Set window class name (not to be confused with window class) .IP "\fB\-\-class newclass\fR" 4 .IX Item "--class newclass" Set window class (not to be confused with window class name) .RE .RS 4 .RE .SH "DESKTOP AND WINDOW COMMANDS" .IX Header "DESKTOP AND WINDOW COMMANDS" These commands follow the \s-1EWMH\s0 standard. See the section \*(L"\s-1EXTENDED\s0 \s-1WINDOW\s0 \&\s-1MANAGER\s0 \s-1HINTS\s0\*(R" for more information. .IP "\fBwindowactivate\fR \fI[options]\fR \fI[window=%1]\fR" 4 .IX Item "windowactivate [options] [window=%1]" Activate the window. This command is different from windowfocus: if the window is on another desktop, we will switch to that desktop. It also uses a different method for bringing the window up. I recommend trying this command before using windowfocus, as it will work on more window managers. .Sp If no window is given, \f(CW%1\fR is the default. See \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" and \&\*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R" for more details. .RS 4 .IP "\fB\-\-sync\fR" 4 .IX Item "--sync" After sending the window activation, wait until the window is actually activated. This is useful for scripts that depend on actions being completed before moving on. .RE .RS 4 .RE .IP "\fBgetactivewindow\fR" 4 .IX Item "getactivewindow" Output the current active window. This command is often more reliable than getwindowfocus. The result is saved to the window stack. See \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" for more details. .IP "\fBset_num_desktops\fR \fInumber\fR" 4 .IX Item "set_num_desktops number" Changes the number of desktops or workspaces. .IP "\fBget_num_desktops\fR" 4 .IX Item "get_num_desktops" Output the current number of desktops. .IP "\fBset_desktop\fR \fIdesktop_number\fR" 4 .IX Item "set_desktop desktop_number" Change the current view to the specified desktop. .IP "\fBget_desktop\fR" 4 .IX Item "get_desktop" Output the current desktop in view. .IP "\fBset_desktop_for_window\fR \fI[window=%1]\fR \fIdesktop_number\fR" 4 .IX Item "set_desktop_for_window [window=%1] desktop_number" Move a window to a different desktop. If no window is given, \f(CW%1\fR is the default. See \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" and \*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R" for more details. .IP "\fBget_desktop_for_window\fR \fI[window=%1]\fR" 4 .IX Item "get_desktop_for_window [window=%1]" Output the desktop currently containing the given window. Move a window to a different desktop. If no window is given, \f(CW%1\fR is the default. See \s-1WINDOW\s0 \&\s-1STACK\s0 and \*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R" for more details. .SH "SCRIPTS" .IX Header "SCRIPTS" xdotool can read a list of commands via stdin or a file if you want. A script will fail when any command fails. .PP Truthfully, 'script' mode isn't very well fleshed out and may fall below your expectations. If you have suggestions, please email the list or file a bug (See \&\s-1CONTACT\s0) .IP "\(bu" 4 Read commands from a file: .Sp .Vb 1 \& xdotool filename .Ve .IP "\(bu" 4 Read commands from stdin: .Sp .Vb 1 \& xdotool \- .Ve .IP "\(bu" 4 Read commands from a redirected file .Sp .Vb 1 \& xdotool \- < myfile .Ve .PP You can also write scripts that only execute xdotool. Example: .PP .Vb 5 \& #!/usr/local/bin/xdotool \& windowactivate $WINDOWID \& mousemove \-window $WINDOWID 50 50 \& click 1 \& click 1 .Ve .PP All commands are run as if you had typed 'xdotool ' via /bin/sh. This means any shell magic should work here, too, including the use of environment variables. For above, here's how you'd set the value of \s-1WINDOWID:\s0 .PP .Vb 1 \& % WINDOWID=1234 ./myscript .Ve .SH "CLEARMODIFIERS" .IX Header "CLEARMODIFIERS" Any command taking the \fI\-\-clearmodifiers\fR flag will attempt to clear any active input modifiers during the command and restore them afterwards. .PP For example, if you were to run this command: xdotool key a .PP The result would be 'a' or 'A' depending on whether or not you were holding the shift key on your keyboard. Often it is undesirable to have any modifiers active, so you can tell xdotool to clear any active modifiers. .PP The order of operations if you hold shift while running 'xdotool key \-\-clearmodifiers a' is this: .IP "1. Query for all active modifiers (finds shift, in this case)" 4 .IX Item "1. Query for all active modifiers (finds shift, in this case)" .PD 0 .IP "2. Try to clear shift by sending 'key up' for the shift key" 4 .IX Item "2. Try to clear shift by sending 'key up' for the shift key" .IP "3. Runs normal 'xdotool key a'" 4 .IX Item "3. Runs normal 'xdotool key a'" .IP "4. Restore shift key by sending 'key down' for shift" 4 .IX Item "4. Restore shift key by sending 'key down' for shift" .PD .PP The \fI\-\-clearmodifiers\fR flag can currently clear of the following: .IP "\(bu" 4 any key in your active keymap that has a modifier associated with it. (See \fIxmodmap\fR\|(1)'s 'xmodmap \-pm' output) .IP "\(bu" 4 mouse buttons (1, 2, 3, 4, and 5) .IP "\(bu" 4 caps lock .SH "SENDEVENT NOTES" .IX Header "SENDEVENT NOTES" If you are trying to send key input to a specific window, and it does not appear to be working, then it's likely your application is ignoring the events xdotool is generating. This is fairly common. .PP Sending keystrokes to a specific window uses a different \s-1API\s0 than simply typing to the active window. If you specify 'xdotool type \-\-window 12345 hello' xdotool will generate key events and send them directly to window 12345. However, X11 servers will set a special flag on all events generated in this way (see XEvent.xany.send_event in X11's manual). Many programs observe this flag and reject these events. .PP It is important to note that for key and mouse events, we only use XSendEvent when a specific window is targeted. Otherwise, we use \s-1XTEST\s0. .PP Some programs can be configured to accept events even if they are generated by xdotool. Seek the documentation of your application for help. .PP Specific application notes (from the author's testing): * Firefox 3 seems to ignore all input when it does not have focus. * xterm can be configured while running with ctrl+leftclick, 'Allow SendEvents' * gnome-terminal appears to accept generated input by default. .SH "WINDOW STACK" .IX Header "WINDOW STACK" Certain commands (search, getactivewindow, getwindowfocus) will find windows for you. These results generally printed to stdout, but they are also saved to memory for future use during the lifetime of the xdotool process. See \&\*(L"\s-1COMMAND\s0 \s-1CHAINING\s0\*(R" for more information. .PP The only modifications support for the window stack are to replace it. That is, two of two sequential searches, only the last one's results will be the window stack. .SH "COMMAND CHAINING" .IX Header "COMMAND CHAINING" xdotool supports running multiple commands on a single invocation. Generally, you'll start with a search command (see \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R") and then perform a set of actions on those results. .PP To query the window stack, you can use special notation \*(L"%N\*(R" where N is a number or the '@' symbol. If \f(CW%N\fR is given, the Nth window will be selected from the window stack. Generally you will only want the first window or all windows. Note that the order of windows in the window stack corresponds to the window stacking order, i.e. the bottom-most window will be reported first (see \&\fIXQueryTree\fR\|(3)). Thus the order of the windows in the window stack may not be consistent across invocations. .PP The notation described above is used as the \*(L"window\*(R" argument for any given command. .PP For example, to resize all xterms to 80x24: .PP .Vb 1 \& xdotool search \-\-class xterm \-\- windowsize \-\-usehints %@ 80 24 .Ve .PP Resize move the current window: .PP .Vb 1 \& xdotool getactivewindow windowmove 0 0 .Ve .PP In all cases, the default window argument, if omitted, will default to \*(L"%1\*(R". It is obviously an error if you omit the window argument and the window stack is empty. If you try to use the window stack and it is empty, it is also an error. .PP To activate the first firefox window found: .PP .Vb 1 \& xdotool search \-\-class firefox windowactivate .Ve .PP These would error: .PP .Vb 3 \& xdotool windowactivate \& xdotool windowactivate %1 \& xdotool windowactivate %@ .Ve .PP When xdotool exits, the current window stack is lost. .PP Additinally, commands that modify the \*(L"\s-1WINDOW\s0 \s-1STACK\s0\*(R" will not print the results if they are not the last command. For example: .PP .Vb 3 \& # Output the active window: \& % xdotool getactivewindow \& 20971533 \& \& # Output the pid of the active window, but not the active window id: \& % xdotool getactivewindow getwindowpid \& 4686 .Ve .SH "EXTENDED WINDOW MANAGER HINTS" .IX Header "EXTENDED WINDOW MANAGER HINTS" The following pieces of the \s-1EWMH\s0 standard are supported: .IP "_NET_SUPPORTED" 4 .IX Item "_NET_SUPPORTED" Asks the window manager what is supported .IP "_NET_CURRENT_DESKTOP" 4 .IX Item "_NET_CURRENT_DESKTOP" Query and set the current desktop. Support for this enables these commands: \&\f(CW\*(C`set_desktop\*(C'\fR, \f(CW\*(C`get_desktop\*(C'\fR. .IP "_NET_WM_DESKTOP" 4 .IX Item "_NET_WM_DESKTOP" Query and set what desktop a window is living in. Support for this enables these commands: \f(CW\*(C`set_desktop_for_window\*(C'\fR, \f(CW\*(C`get_desktop_for_window\*(C'\fR. .IP "_NET_ACTIVE_WINDOW" 4 .IX Item "_NET_ACTIVE_WINDOW" Allows you to query and set the active window by asking the window manager to bring it forward. Support for this enables these commands: \f(CW\*(C`windowactivate\*(C'\fR, \f(CW\*(C`getactivewindow\*(C'\fR. .IP "_NET_WM_PID" 4 .IX Item "_NET_WM_PID" This feature is application dependent, not window-manager dependent. Query the \&\s-1PID\s0 owning a given window. Support for this enables these commands: \&\f(CW\*(C`getwindowpid\*(C'\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIxprop\fR\|(1), \fIxwininfo\fR\|(1), .PP Project site: .PP Google Code: .PP \&\s-1EWMH\s0 specification: http://standards.freedesktop.org/wm\-spec/wm\-spec\-1.3.html .SH "CONTACT" .IX Header "CONTACT" Please send questions to xdotool\-users@googlegroups.com. File bugs and feature requests at the following \s-1URL:\s0 .PP .PP Alternately, if you prefer email, feel free to file bugs by emailing the list. What works for you :) .SH "AUTHOR" .IX Header "AUTHOR" xdotool was written by Jordan Sissel. .PP This manual page was written originally by Daniel Kahn Gillmor for the Debian project (but may be used by others). It is maintained by Jordan Sissel.