Search this site


Page 1 of 3  [next]

Metadata

Articles

Projects

Presentations

xdotool 2.20100818.3004

Here's a new xdotool release. This one includes lots of new features and some bug fixes. All of the tests pass in the test suite (225 tests, 2779 assertions, 173 seconds).

New commands:

  • get_desktop_viewport and set_desktop_viewport. Window managers (like compiz) use viewports instead of the standard 'virtual desktop' model. This means there is usually one big desktop area that you have a small view on, and switching desktops means moving that view.
  • selectwindow. This command lets you pick a window by clicking on it. Useful for chaining to other commands.
  • windowreparent. Change which window parents another. Useful if you want to move a window to be inside another.
  • windowkill. Kills a window.
  • getwindowname. Prints the window name (title).
  • behave. Allows you to bind additional xdotool commands to run based on certain window events. See the manpage for examples.

Download: xdotool-2.20100818.3004.tar.gz

As usual, if you find problems or have feature requests, please file bugs or send an email to the list. The changelist from the previously-announced release:

2.20100818.*
  - New commands: 'get_desktop_viewport' and 'set_desktop_viewport'. Some
    window managers don't actually do 'multiple desktops' but instead show
    workspaces as views on a large desktop. For example, Compiz Fusion does
    this, which is why you may see 4 or more desktops, but 'xdotool
    get_num_desktops' reports only one.
  - New command: 'selectwindow' command which picks a window by clicking on it.
  - New command: 'windowreparent' with original patch by Markus Opitz.
  - New command: 'windowkill' will kill a window and the client that owns it
    (via XKillClient)
  - New command: 'getwindowname' for printing the name (title) of a window.
    Requested by Dominik Reichl for KeePass.
  - New command: 'behave'. This allows you to run xdotool commands on window
    events. For example, you can achieve 'mouse-follows-focus' with this:
      xdotool search --class xterm behave %@ mouse-enter windowfocus
    This will find all xterms and, upon mouse entering, will focus that window.
    Not really sure what I wanted with this feature, but it can grow as needed.
  - Support percentages in 'windowsize'. Percentages are relative to the size
    of the screen the window is on. 'windowsize 12345 100% 50%' will make the
    window the full width and half height of the screen.
  - When typing, if we can't find a character in the existing keymap, try
    looking up in keysym_charmap (xdo_util.h) and binding a key if we find one
    that matches. Reported by Victor Baulac on the mailing list. This allows
    us to type '@', for example, even if the current keymap does not have
    this key.

2.20100701.*:
  - No functional changes.
  - Add missing file 'Doxyfile' to the release package so the xdo docs can be
    built from a release tarball. (Reported by Daniel Kahn Gillmor)
  - Skip 'getwindowfocus' misc test if we don't have a windowmanager due to
    a bug/feature in Xvfb and Xephyr if there is only one client and no wm.

xdotool 2.20100623.2949 released

The latest release of xdotool includes a few bug fixes, minor improvements, and one major feature addition. All of the tests pass in the test suite (156 tests, 1892 assertions, 126 seconds).

The major feature is the new command chaining. That is, you can use multiple commands from the same xdotool invocation. Any window querying (search, getactivewindow, getwindowfocus) will save the result for use with future commands on the same invocation. For a simple example, we can resize the current window by doing this:

% xdotool getactivewindow windowsize 600 400
You can also activate the first Firefox window found:
% xdotool search --class firefox windowactivate
Or move all gimp windows to a specific desktop and then activate (switch to) gimp:
% xdotool search --class gimp set_desktop_for_window %@ 2 windowactivate %@

# the "%@" means all windows found in the search. The default when you do not
# specify a window is always "%1" aka the first window found by the search.
This idea for this feature came primarily from detailed suggestions by Henning Bekel. Huge thanks for dumping ideas my way :)

In addition, libxdo is now documented with Doxygen and is available here. Remember, if you have a feature request, it can't hurt to ask (or send patches!). If I have time/energy to work on it, I'll do what I can.

Download: xdotool-2.20100623.2949.tar.gz

As usual, if you find problems or have feature requests, please file bugs or send an email to the list. Changelist from previously-announced release:

2.20100623.*:
  - Added 'window stack' and 'command chaining' support. Basically lets you
    include multiple commands on a single xdotool invocation and saves the last
    window result from search, getactivewindow, and getwindowfocus. For example,
    the default window selector is "%1" meaning the first window. 'xdotool
    search --class xterm windowsize 500 500' will resize the first xterm found.
    All commands that take window arguments (as flags or otherwise) now default to
    "%1" if unspecified. See xdotool(1) manpage sections 'COMMAND CHAINING'
    and 'WINDOW STACK' for more details. This feature was suggested (with great
    detail) by Henning Bekel.
  - To simplify command chaining, all options now terminate at the first
    non-option argument. See getopt(3) near 'POSIXLY_CORRECT' for details.
  - Add --sync support to windowsize.
  - Update docs and output to indicate that 'search --title' is deprecated (but
    still functions). Use --name instead.
  - Fix mousemove --screen problem due to bug in XTEST. Reported by
    Philipp Specht, http://code.google.com/p/semicomplete/issues/detail?id=35
  - Fix segfault when invoking xdotool with an invalid command.
    http://code.google.com/p/semicomplete/issues/detail?id=34
    Reported by: Bruce Jerrick, Sven Lankes, Daniel Kahn Gillmor, and Thomas
    Schwery.
  - Fix bug --clearmodifiers bug caused by an uninitialized value being
    interpreted as the 'modmask' causing us to try to clear invalid modifiers.
    Reported by Hong-Leong Ong on the mailing list.
  - Lots of internal refactoring and documentation improvements.
  - Testing additions for several commands in addition to command chaining.
  - Documented libxdo through xdo.h. Docs can be generated by 'make docs'
    from the xdotool release.
  - libxdo: xdo_window_translate_with_sizehint
  - libxdo: xdo_window_wait_for_size

xdotool 2.20100601 release

Thanks to some early testing and feedback from the previous xdotool release, I've put together a new release that fixes a few minor problems.

Download: xdotool-2.20100601.2912.tar.gz

As usual, if you find problems or have feature requests, please file bugs or send an email to the list.

Changelist since previous announcement:

2.20100601.*:
  - Add --sync and --clearmodifiers support to mousemove_relative
  - Fix bug in mousemove_relative --polar (Reported by Paul S via mailing list)
  - Change polar coordinates to be 'north'-oriented (0 is up, 90 is right...)
    (Requested by Paul S via mailing list)
  - Changed xdotool search flags. '--title' now means '--name' to match the
    window name (shown in the window manager title bar for the window).
    Related: http://code.google.com/p/semicomplete/issues/detail?id=33
    --title still works, but you will get a warning about deprecation.
  - Walked through all commands and tried to make sure the manpage reflects
    reality and has more detail where needed.

2.20100525.*:
  - Skip certain tests when the requirements aren't met (ie; no such window manager, etc)
    Reported by Daniel Kahn Gillmor.

xdotool 2.20100524 release

New xdotool for your enjoyment.

Download: http://semicomplete.googlecode.com/files/xdotool-2.20100524.2888.tar.gz

Major changes:

  • xdotool getmouselocation now supports --shell for outputting something you can simply eval into your shell
  • Added 'sync' support to several commands. The --sync flag, if supported, will wait until the requested operation has completed before exiting.
  • Added --polar (polar coordinate) support to mousemove
  • Fixed some keymap bugs

As usual, if you find problems or have feature requests, please file bugs or send an email to the list.

Changelist since previous announcement:

2.20100524.*:
  - Add --sync flag to many commands. This flag will make any supporting command
    block until the operation completes. For example, a 'windowmove --sync' will
    only exit once the window has moved. Commands supported:
    * windowactivate
    * windowfocus
    * windowmap
    * windowmove
    * windowunmap
  - Fix http://code.google.com/p/semicomplete/issues/detail?id=21
    Multiple keyboard layouts are now supported better. Added unit tests
    to ensure consistency in typing across releases.
  - Added polar coordinate support to mouse movement. 'mousemove' and
    'mousemove_relative' support this. Flag is --polar. 'x' becomes angle (degrees)
    and 'y' becomes distance. The default origin is screen center. If you specify
    a window (to mousemove) then the origin is the center of that window.
    Requested by Paul S on the xdotool-users mailing list.
  - internal: Reworked testing to be less flakey
    http://code.google.com/p/semicomplete/issues/detail?id=30
  - internal: split commands into one per C file
  - API changes that required a version bump.
    * xdo_keysequence and friends now take a delay.
  - New libxdo functions:
    * xdo_window_wait_for_map_state
    * xdo_window_wait_for_active
    * xdo_get_window_location
    * xdo_window_wait_for_focus


1.20100415.*:
  - Add support for searching classnames (not just class)
  - Support switched xkbmaps. We do this by checking if the keycode found for a keysym
    has that keysym as the first or second (normal or with shift-key) mapping, if not
    we pretend we didn't find it and request it be bound as if the keysym wasn't mapped
    to any key.

    This is a hack to avoid knowing what other modifiers are required to type
    keysyms mapped at indexes 2 or beyond (0 is normal, 1 is shift, 2 and beyond
    are unknown).
    Verified fixes this: http://code.google.com/p/semicomplete/issues/detail?id=13
    Should fix some of this: http://code.google.com/p/semicomplete/issues/detail?id=21
  - Add --shell flag to getmouselocation. This will output data you can safely
    eval in your shell.
  - Add platform detection for Darwin when building.
    Should fix: http://code.google.com/p/semicomplete/issues/detail?id=28

1.20100325.*:
  - Fix bug in search where --name wasn't working. Test written to cover this.
    http://code.google.com/p/semicomplete/issues/detail?id=25

1.20100318.*:
  - Bug fixes only this release
  - Rewrote tests to use ruby and will now test against Xvfb and Xephyr using:
    no window manager, openbox, and then gnome.
  - Fix build problems on Arch linux (or gentoo?)
    Fixes: http://code.google.com/p/semicomplete/issues/detail?id=20
  - Fix searching for only visible windows.
    Fixes: http://code.google.com/p/semicomplete/issues/detail?id=22
  - Fix xdotool search flags: --title, --name, --class
  - Add include for keysym.h to fix compile errors reported on the mailing
    list.

Headless wrapper for ephemeral X servers

For various projects I'm doing right now, I need an easy way to automatically run code in an X server that may not necessarily be the active display. This code may even run on servers in production that don't have video cards or monitors attached.

For some history on this, check out this post on xvfb and firefox. You can solve the problem in that post by simply launching firefox with the tool below, and your X server will exit when firefox exits.

To solve my need for automated headless Xserver shenanigans, I wrote a script that will wrap execution with a temporary X server of your choosing. For xdotool tests I generally use Xephyr and Xvfb.

What's so special about this script? It picks an unused display number reliably and runs your command with that set as DISPLAY. This is a major win because you don't have to pre-allocate X servers (headless or otherwise) before you start your programs. ephemeral-x.sh will pick the first unused display, just as binding a socket to port 0 will pick an unused port. Finally, when your process exits, the xserver and windowmanagers are killed. Example usage:

% ./ephemeral-x.sh firefox
Trying :0

Fatal server error:
Server is already active for display 0
        If this server is no longer running, remove /tmp/.X0-lock
        and start again.

Trying :1
Xvfb looks healthy. Moving on.
Using display: :1
Running: firefox
It does health checks to make sure the X server is actually up and running before continuing.

You can also specify a window manager to run:

% ./ephemeral-x.sh -w openbox-session firefox
...
Trying :1
Xvfb looks healthy. Moving on.
Using display: :1
Starting window manager: openbox-session
Waiting for window manager 'openbox-session' to be healthy.
... startup messages from openbox ...
openbox-session looks healthy. Moving on.
Running: firefox
The default X server is Xvfb. You can use Xvnc, Xephyr, or any X server. Here we run Xephyr with some options:
% sh ephemeral-x.sh -x "Xephyr -ac -screen 1280x720x24" -w openbox-session firefox www.google.com
...
Xephyr looks healthy. Moving on.
Using display: :1
Starting window manager: openbox-session
Waiting for window manager 'openbox-session' to be healthy.
...
openbox-session looks healthy. Moving on.
Running: firefox www.google.com
Screenshot of what this looks like is here: xephyr-ephemeral-x-example.png

I use this script to run my xdotool tests. Additionally, parallelizing test execution can often lead to faster tests. Wrapping each test run with ephemeral-x.sh ensure that each test suite runs in a clean environment, untainted by any previous test, allowing me to run all test suites in parallel. Prior to writing this script, I would run each test suite in serial on the same X server instance.

I use a similar technique at work to start ephemeral X servers for running WebDriver tests in hadoop. Each mapper starts its own X server, safely, and kills it when it is completed. This is implemented in java, instead of shell, since the mappers all launch from java and mapreduce launch differently than a standard command would in your shell.

Code lives here: ephemeral-x.sh
xdotool tests: xdotool/t

xdotool 1.20100302 release

Thanks to some early testing and feedback from the previous xdotool release, I've put together a new release that fixes a few minor problems.

Download: xdotool-1.20100302.2708.tar.gz

As usual, if you find problems or have feature requests, please file bugs or send an email to the list.

Changelist since previous announcement:

1.20100302.*:
  - Some test fixes suggested by Daniel Kahn Gillmor
  - Don't use isatty(0) anymore as it isn't totally reliable in determining if
    we should try to read from stdin.

1.20100301.*:
  - Minor libxdo patch to avoid exporting unnecessary symbols (Daniel Kahn Gillmor)
  - Minor Makefile fix to only link libxdo (and not xdotool) against libX11 and
    libXtst (also Daniel Kahn Gillmor)
  - Some test cleanup patches by Daniel Kahn Gillmor
  - Fixed the 'type hello' test that would fail sometimes when run in Xephyr.
  - Fix a minor bug in xdo_window_setclass that incorrectly aborts when
    XGetClassHint fails.

New xdotool (1.20100227.2679) released!

It's time for another xdotool release.

Lots of big fixes and changes in the latest release of xdotool. Many of the improvements in this release incorporate feedback I've received on this list and in bugs filed. Please enjoy :)

Download: http://semicomplete.googlecode.com/files/xdotool-1.20100227.2679.tar.gz

Full changelist since previously-announced release:

1.20100227.*:
  - Bump major version since there were lots of libxdo changes (now libxdo.so.1)
  - Support '--pid NUM' for searching for windows by pid:
    Fixes http://code.google.com/p/semicomplete/issues/detail?id=10
    Example: xdotool search --pid 12345
    Example: xdotool search --pid 12345 "hello world"
  - Add 'xdotool getwindowpid' command to get the pid that owns a window.
  - Add --window to xdotool mousemove, click, mousedown, and mouseup
  - Add --screen to xdotool mousemove
  - The --clearmodifiers flag now clears mouse buttons, too.
    Part of http://code.google.com/p/semicomplete/issues/detail?id=6
  - The --clearmodifiers flag now clears caps lock.
    Fixes http://code.google.com/p/semicomplete/issues/detail?id=4
  - Have 'make install' create all required directories
    Fixes http://code.google.com/p/semicomplete/issues/detail?id=17
  - Support multiple screens in searches. Default is to search all screens.
    Fixes http://code.google.com/p/semicomplete/issues/detail?id=11
    Example: 'xdotool search --screen N' specifies a single screen to search.
  - Support reading a list of xdotool commands via stdin or a file. Usages:
    * read from stdin:
      xdotool -
    * read from stdin (use isatty(0) to detect redirection):
      xdotool < somefile
    * An executable script also works when it has this at the top:
      #!/path/to/xdotool

0.20100118.*:
  - Slight change in how we present versions. Now versions have major, date,
    and svn revision. The main addition was to add the major which maps to the
    libxdo library abi version (libxdo.so.0).
  - Add 'xdotool version' for querying version
  - libxdo now has xdo_version function for fetching the library version.
  - Allow typing keys that are not mapped to any keyboard button.
    For example, you can type the euro symbol like this, even if you don't have
    a key on your keyboard that can do it:
      xdotool key EuroSign
    http://code.google.com/p/semicomplete/issues/detail?id=16
  - Fixed some pod errors in the manpage

new xdotool version available (20091231)

A new release of xdotool is available. This release has only minor changes based on changes needed to help Debian and other folks package this. Speaking of which: thanks to Daniel Kahn Gillmor and Wen-Yen Chuang for helping maintain the Debian packages for xdotool and keynav and for working with me on these changes.

Hop on over to the xdotool project page and download the new version.

The changelist follows:

20091231.02:
  No functional changes.
  - fix linking problems and just use $(CC) for build and linking
  - Make the tests headless (requires Xvfb and GNOME)
  - Make the t/run.sh test runner exit-code friendly

20091231.01:
  No xdotool changes.
  libxdo changes:
    * Rename keysymcharmap -> keysym_charmap
    * Expose keysym_charmap and symbol_map as xdo_keysym_charmap()
      and xdo_symbol_map()

xdotool-20091231.02

new xdotool version available (20090815)

Hop on over to the xdotool project page and download the new version.

The changelist from the previous announced release is as follows:

20090815:
* Incorporate patch from Henning Bekel which adds a new ability to change
  window properties such as window name, icon name, class, role, etc.  New
  command: xdotool set_window
* Add --maxdepth to 'xdotool search' to limit the traversal depth

new xdotool version available (20090710)

Looking at svn logs for xdotool shows that the project is now just over 2 years old. Crazy!

Hop on over to the xdotool project page and download the new version.

The changelist from the previous announced release is as follows:

20090710:
  * You can clear keyboard modifiers during typing now with --clearmodifiers
    When used, this flag causes physical keyboard modifiers (alt, control, etc)
    that are currently active to be ignored during typing.
    This is supported in: xdotool key, keyup, keydown, and type.
    
    Example: 
      xdotool type 'hello world' results in 'HELLO WORLD' while holding shift.
      xdotool type --clearmodifiers 'hello world' results in 'hello world'
        regardless of you holding shift.

    The 'reset' only happens at the beginning of typing and the modifiers are
    restored at the end. If you press a modifier key *during* typing it will 
    act as if --clearmodifiers was not present.
    (http://code.google.com/p/semicomplete/issues/detail?id=6)

  * You can now specify literal keycodes for any key command.
    Example: xdotool key 38   (types 'a' with my keyboard)
    (requested via mailing list)

  * Regression fix: 'xdotool type' now properly obeys capitalization, again.
  * Bug fix: 'xdotool key --window' now works properly