Search this site


Metadata

Articles

Projects

Presentations

xdotool 2.20110530release

It's been about 8 months since the last xdotool release, and I think it's long overdue! This release has a ton of new feature and fixes.

Download: xdotool-2.20110530.1.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.20110530.*
  - New set_window feature: --urgency. This lets you set the urgency flag on a
    window Window managers will interpret this as something about your window
    needing attention. It might flash in the taskbar, pop up, or other.
    Original patch and suggestion by ervandew.
    Issue: http://code.google.com/p/semicomplete/issues/detail?id=39
  - New function: xdo_window_seturgency (see above)
  - Hack in OS X support as it is missing a proper clock_gettime.
    Should fix http://code.google.com/p/semicomplete/issues/detail?id=37
    Reported by ryandesign.com
  - Add support for typing UTF-8 characters. Patch from Joseph Krahn.
  - Make all output call fflush to send data immediately (for pipes). Reported
    by Andreas Wagner on the mailing list.
  - Make 'get_desktop_viewport' output usable with 'set_desktop_viewport'
    http://code.google.com/p/semicomplete/issues/detail?id=47
  - You can now make 'libxdo.a' for embedding libxdo into your binary
    (Requested by psc on the mailing list).
  - Fixed a typing bug where the keymap changes unnecessarily 
  - Should now build cleanly in C++ environments (Reported by psc on the
    mailing list)
  - bugfix: xdotool should use command names first before trying file scripts. 
    See https://bbs.archlinux.org/viewtopic.php?pid=938309 for original report.
  - Add a 'sleep' command. (Requested by Joseph Krahn via mailing list)
  - Add --relative flag to windowmve. (Requested by Anthony Thyssen via mailing
  - Add --desktop flag to the search command. This lets you search for windows
    on specific desktop. Requires a window manager that supports multiple
    desktops in a way that EWMH supports.
    Fixes http://code.google.com/p/semicomplete/issues/detail?id=38
  - Add --limit flag to search. This allows you to break the search early after
    a certain number of matches. (Requested by Anthony Thyssen)
  - New command 'getwindowgeometry' for fetching window position and size
    (Requested by Anthony Thyssen via mailing list)
  - Add --sync flag to search command; blocks until results are found.
    xdotool will search every 0.5 seconds for results.
    http://code.google.com/p/semicomplete/issues/detail?id=42
  - windowmove can now move windows along an axis. Give literal 'x' or 'y'
    instead of a coordinate and it uses the current position. (Requested by
    etnlIcarus via mailing list)
  - Add '--args N' and '--terminator TERMINATOR' to the 'exec' command.
    Default terminator unless specified (or --args is) is ':' (Requested by
    Joseph Krahn and Henning Bekel via mailing list)
  - set_desktop now supports --relative flag (+N or -N to move relative)
    (Requested by Anthony Thyssen)
  - The mouse cursor now changes during 'xdotool selectwindow' (Requested by
    Anthony Thyssen via mailing list)
  - Added '--args N' and '--terminator TERMINATOR' to the 'type' command.
  - Add 'getdisplaygeometry' command for querying the size of your screen.
    (Requested by @rrwo via twitter)
  - Add xdo_get_viewport_dimensions function.

xdotool 2.20101012 release

New xdotool for your enjoyment. Lots of features and bug fixes. Huge thanks to folks who sent in bug reports, patches, or ideas. This version should be ABI compatible to the previous release. All tests are passing (270 tests, 2838 assertions).

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

Major changes:

  • New commands: behave_screen_edge, windowminimize, exec
  • Add static build ('make xdotool.static')
  • Add 'restore' feature to 'mousemove'.
  • Improvements to xdotool 'script' behavior. Patch from Henning Bekel.

Cool tool: With the new screen edge behavior, added examples/leftconsole.sh. This takes a selected window (by click) and hides it until the mouse hits the left-side of the screen. The window will hide again when the mouse leaves the window; the window will be full-height and slide in from the left. When hiding it, it will slide left, off of the screen. If you run this and want to restore the window, just ctrl+c the script, rerun it, and hit ctrl+c again before clicking on a new window.

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.20101012.*
  - New command: 'windowminimize' for minimizing windows.
  - New command: 'behave_screen_edge' to attach commands to edge and corner activities.
    For example, to lock your screen when the mouse hits the top-right corner
    for more than 2 seconds:
      xdotool behave_screen_edge --delay 2000 top-right exec xscreensaver-command -lock
    'xscreensaver-command' comes with the xscreensaver package.
  - New command: 'exec' for executing commands. Useful with behave_screen_edge.
  - Bug fix: Catch pointer grab failures in selectwindow (xdo_window_select)
    and abort if we can't grab it and report an error message.
  - Add  --delay and --repeat flags to click. This allows you to easily
    double-click (or more) in a single command. Requested by meenakshi sundaram
    via the mailing list.
  - Add new option to mouse move 'restore'. This will restore the mouse position
    to the last known position prior to the most recent move. That is:
      xdotool mousemove 0 0 mousemove restore
    the above will move the mouse to 0,0 then move the mouse back to the
    position it was before. Requested by luc le rumeur and suffian amjad on the
    mailing list.
  - Add 'static' and 'install-static' targets. Requested by Anthony
    Thyssen on the mailing list.
  - Fix bug in xdotool getmouselocation that didn't search for the client window
    correctly.
  - New function: xdo_mousewindow, which lets you get the window the mouse is
    currently over.
  - New function: xdo_mouselocation2, which is an extended version of
    xdo_mouselocation and includes the window the mouse is currently over.
  - New function: xdo_window_minimize, which minimizes a window.
  - Add patch from Henning Bekel that greatly improves xdotool's script
    feature. Scripts now no longer invoke /bin/sh for each line, but instead
    build a command chain to execute. Further, positional arguments ($1, $2,
    etc) and environment variables ($FOO, $WINDOWID, etc) work as expected
    despite the removal of /bin/sh.

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.

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 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

xdotool 20090126 available

A new release of xdotool is available. It fixes two bugs that were moderately annoying.
20090126:
  * Change the default behavior of 'getwindowfocus' to get the first
    ancestor-or-self window that has WM_CLASS set. WM_CLASS will be set on
    (all?) top-level windows and it's possible that the currently focused window
    according to X is not a top-level window. To use the previous behavior, use
    'getwindowfocus -f'
  * Make 'xdotool key at' work correctly. 'at' is usually Shift+2, for example.
    Now all shifted characters should work, but I've only tested on a US
    keyboard.
  * Minor Makefile fixes for package maintainers.
I've tested it in GNOME and Ion-3 with success.

Download: xdotool-20090126.tar.gz

Xvfb + Firefox

Resig has a bunch of unit tests he does to make sure jQuery works properly on whatever browser. Manually running and checking unit test results is annoying and time consuming. Let's automate this.

Update (May 2010): See this post for more details on automating xserver startup without having to worry about display numbers (:1, :2, etc).

Combine something simple like Firefox and Xvfb (X Virtual Frame Buffer), and you've got a simple way to run Firefox without a visible display.

Let's start Xvfb:

startx -- `which Xvfb` :1 -screen 0 1024x768x24

# Or with Xvnc (also headless)
startx -- `which Xvnc` :1 -geometry 1024x768x24

# Or with Xephyr (nested X server, requires X)
startx -- `which Xephyr` :1 -screen 1024x768x24

This starts Xvfb running on :1 with a screen size of 1024x768 and 24bits/pixel color depth. Now, let's run firefox:
DISPLAY=:1 firefox

# Or, if you run csh or tcsh
env DISPLAY=:1 firefox
Seems simple enough. What now? We want to tell firefox to go to google.com, perhaps.
DISPLAY=:1 firefox-remote http://www.google.com/
Now, let's take a screenshot (requires ImageMagick's import command):
DISPLAY=:1 import -window root googledotcom.png
Lets see what that looks like: googledotcom.png

While this isn't complicated, we could very easily automate lots of magic using something like the Selenium extension, all without requiring the use of a visual display (Monitor). Hopefully I'll find time to work on something cool using this soon.

Problems with screen scraping and other website interaction automation is that it almost always needs to be done without a browser. For instance, all of my screen scraping adventures have been using Perl. Browsers already know how to speak to the web, so why reinvent the wheel?

Firefox has lots of javascript-magic extensions such as greasemonkey and Selenium to let you execute browser-side javascript and activity automatically. Combine these together with Xvfb, and you can automate lots of things behind the scenes.

Tie this back to unit tests. Instead of simply displaying results of unit tests, have the page also report the results to a cgi script on the webserver. This will let you automatically test websites using a web browser and have it automatically report the results back to a server.