XDo
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.
The easiest way to use XDo is via XDo.act:
XDo.act do
active_window do |win|
win.type "hello from Crystal!"
end
end
Constants
Constructors
Class methods
Yields a block with an XDo instance, providing a DSL for interaction.
XDo.act do
select_window do |win|
win.unmap!
sleep 1
win.map!
win.type "hello"
end
desktop = 3
end
Returns a Hash(String, String) indicating the current symbol map.
XDo.symbol_map # => {"alt" => "Alt_L", "ctrl" => "Control_L"}
Instance methods
Returns a list of XDo::LibXDo::Charcodemaps indicating all active modifier keys.
Returns the Window that currently has focus.
When sane is set to true, returns the first ancestor-or-self window
with the WM_CLASS property. When set to false, returns the actual focused
window (which may not be the application's top-level window).
Returns the Window that currently has focus.
When sane is set to true, returns the first ancestor-or-self window
with the WM_CLASS property. When set to false, returns the actual focused
window (which may not be the application's top-level window).
Returns the mouse's current position as a tuple of x and y coordinates,
the screen it's on, and the Window it's over.
x, y, screen, win = xdo.mouse_location
Takes a Search and runs it, returning a list of Windows matching the search.
XDo.act do
query = XDo::Search.build { window_name "Firefox" }
winds = search(query)
puts winds
end
Like #search(query), but yields a block to build the query directly.
XDo.act do
winds = search { window_name "Firefox" }
puts winds
end
Sets the desktop viewport (only relevant if _NET_DESKTOP_VIEWPORT is supported).
XDo.act do
viewport = {x, y}
end
Gets the dimensions of the given screen's viewport as a width, height tuple.