XDo::Window
Represents an XDo view of an X11 window.
win.move_mouse 0, 0
puts "typing inside #{win["WM_NAME"]}"
win.type "hello!"
Constructors
Instance methods
Get the value associated with the property property.
NOTE: Always returns a string, regardless of the underlying X11 atom. As a result, this method can return "garbage" strings for some property names.
Set the window's property property to value.
# change the window's title-bar name
win["WM_NAME"] = "my custom window name"
Activates the window. Requires _NET_ACTIVE_WINDOW from EWMH.
See #focus! for WMs without _NET_ACTIVE_WINDOW.
# switch to the window's desktop and raise it
win.activate!
Set the window's class (WM_CLASS class name) to klass.
win.class = "my-custom-class"
Set the window's class name (WM_CLASS instance name) to name.
win.class_name = "my-custom-instance"
Click the given mouse button repeat times, with delay between each click.
Closes a window without trying to kill its client.
To kill the client while closing a window, see #kill!.
Send some keys (down + up) to the window, with delay between them.
win.keys "Ctrl+s"
Send some key press (down) events for the given keys, with delay between them.
See #keys_up.
win.keys_down "Ctrl+o"
Send some key release (up) events for the given keys, with delay between them.
See #keys_down.
win.keys_up "Ctrl+o"
Kills a window and the client owning it.
To close a window without killing its client, see #close!.
Get the window's location, consisting of a tuple of width, height,
and Screen object
x, y, screen = win.location
Send a mouse-down event for the given mouse button to this window.
Attempt to move the window to x, y on the screen.
# try to put the window in the upper left corner
win.move 0, 0
Attempt to move the window to desktop.
# try to move the window to desktop #3
win.move 3
Wait for the window to become active or inactive, per want_active.
Wait for the window's dimensions to change, and yield self.
window.on_size_change do
puts "my new size is: #{window.size}"
end
Wait for the window's dimensions to change from width x height to something else.
If use_hints is set to true, the supplied dimensions are measured according to the window's size hints (not necessarily pixels).
Wait for the window's dimensions to change to width x height from something else.
If use_hints is set to true, the supplied dimensions are measured according to the window's size hints (not necessarily pixels).
Set the window's override-redirect flag.
win.override_redirect = true
Attempt to change the window's size to width x height, scaled by flags.
# make the window 100px by 100px
win.resize 100, 100
# make the window 500 by 500 size-hint units
win.resize 500, 500, ResizeFlag::UseHints
Attempt to apply the window's sizing hints with the given width and height.
Uses XGetWMNormalHints() internally to determine the resize increment and base size.
win.translate_with_hint 100, 100
Send some text to the window, with delay between the keystrokes.
win.type "hello from Crystal!"
Set the window's urgency hint.
# tell the WM to indicate the window's urgency to the user
win.urgent = true
Wait for the window to become active or inactive, per want_active.
Wait for the window to gain or lose focus, per want_focus.
Wait for the window's dimensions to change from width x height to something else.
If use_hints is set to true, the supplied dimensions are measured according to the window's size hints (not necessarily pixels).
Wait for the window's dimensions to change to width x height from something else.
If use_hints is set to true, the supplied dimensions are measured according to the window's size hints (not necessarily pixels).