Crystal bindings for libxdo (xdotool)
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


Build Status

XDo is a Crystal interface for libxdo, the C library that backs xdotool.

It exposes most of the functionality of xdotool, allowing users to write Crystal programs that manage windows in an X11 instance.


Add this to your application's shard.yml:

    github: woodruffw/

libxdo is required. On Debian-based systems, it can be installed via:

$ sudo apt install libxdo-dev


require "x_do"

XDo.act do
  active_window do |win|
    win.type "hello from Crystal!"

Check out the examples folder for some practical examples.


The unit tests make the following assumptions:

  • You're running an instance of X11
  • You're running a window manager that's (mostly) ICCCM and EWMH compliant
  • You have xlogo installed

To run the unit tests on the default X11 display (DISPLAY, falling back on :0):

$ crystal spec

Alternatively, the tests can be run on another X11 display, like a Xephyr or Xvfb instance:

# replace "99" with your display number
$ DISPLAY=:99 crystal spec

The util/xvfb-spec script can be used to run the tests inside a temporary Xvfb instance running Openbox:

$ ./util/xvfb-spec


  • Complete bindings (grep "implement me!")
  • Add error conditions (check return value of libxdo calls)


  1. Fork it ( )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request


  • woodruffw William Woodruff - creator, maintainer