Atspi

This is a ruby gem that lets you comfortably call the Assistive Technology Service Provider Interface on Linux.

It wraps Gnome's libatspi and exposes it as high level ruby objects.

Installation

Add this line to your application's Gemfile:

gem 'atspi'

And then execute:

$ bundle

Or install it yourself as:

$ gem install atspi

Getting Started

# Get the desktop
desktop = ATSPI.desktops.first

# Get an application on the desktop (here Gnome Terminal)
application = desktop.applications.last

# Get the first window of the application
window = application.windows.first

# Get the window's tabs
tabs = window.descendants.where(role: :page_tab)
tabs.count # => 3

# Get the selected tab
selected_tab = tabs.where(state: :selected).first
selected_tab.index # => 0

# Select the first tab
tabs.last.select

# Get the selected tab
selected_tab = tabs.where(state: :selected).first
selected_tab.index # => 2

Documentation

Detailed documentation can be found at http://www.rubydoc.info/gems/atspi.

Especially:

Todo

Not supported yet are:

  • Event listeners
  • (Editable) text attributes