libxdo
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
xdo.h File Reference

Go to the source code of this file.

Data Structures

struct  charcodemap
 
struct  xdo
 The main context. More...
 
struct  xdo_search
 The window search query structure. More...
 

Typedefs

typedef struct charcodemap charcodemap_t
 
typedef struct xdo xdo_t
 The main context.
 
typedef struct xdo_search xdo_search_t
 The window search query structure.
 

Enumerations

enum  XDO_FEATURES { XDO_FEATURE_XTEST }
 

Functions

xdo_txdo_new (const char *display)
 Create a new xdo_t instance.
 
xdo_txdo_new_with_opened_display (Display *xdpy, const char *display, int close_display_when_freed)
 Create a new xdo_t instance with an existing X11 Display instance.
 
const char * xdo_version (void)
 Return a string representing the version of this library.
 
void xdo_free (xdo_t *xdo)
 Free and destroy an xdo_t instance.
 
int xdo_move_mouse (const xdo_t *xdo, int x, int y, int screen)
 Move the mouse to a specific location.
 
int xdo_move_mouse_relative_to_window (const xdo_t *xdo, Window window, int x, int y)
 Move the mouse to a specific location relative to the top-left corner of a window.
 
int xdo_move_mouse_relative (const xdo_t *xdo, int x, int y)
 Move the mouse relative to it's current position.
 
int xdo_mouse_down (const xdo_t *xdo, Window window, int button)
 Send a mouse press (aka mouse down) for a given button at the current mouse location.
 
int xdo_mouse_up (const xdo_t *xdo, Window window, int button)
 Send a mouse release (aka mouse up) for a given button at the current mouse location.
 
int xdo_get_mouse_location (const xdo_t *xdo, int *x, int *y, int *screen_num)
 Get the current mouse location (coordinates and screen number).
 
int xdo_get_window_at_mouse (const xdo_t *xdo, Window *window_ret)
 Get the window the mouse is currently over.
 
int xdo_get_mouse_location2 (const xdo_t *xdo, int *x_ret, int *y_ret, int *screen_num_ret, Window *window_ret)
 Get all mouse location-related data.
 
int xdo_wait_for_mouse_move_from (const xdo_t *xdo, int origin_x, int origin_y)
 Wait for the mouse to move from a location.
 
int xdo_wait_for_mouse_move_to (const xdo_t *xdo, int dest_x, int dest_y)
 Wait for the mouse to move to a location.
 
int xdo_click_window (const xdo_t *xdo, Window window, int button)
 Send a click for a specific mouse button at the current mouse location.
 
int xdo_click_window_multiple (const xdo_t *xdo, Window window, int button, int repeat, useconds_t delay)
 Send a one or more clicks for a specific mouse button at the current mouse location.
 
int xdo_enter_text_window (const xdo_t *xdo, Window window, const char *string, useconds_t delay)
 Type a string to the specified window.
 
int xdo_send_keysequence_window (const xdo_t *xdo, Window window, const char *keysequence, useconds_t delay)
 Send a keysequence to the specified window.
 
int xdo_send_keysequence_window_up (const xdo_t *xdo, Window window, const char *keysequence, useconds_t delay)
 Send key release (up) events for the given key sequence.
 
int xdo_send_keysequence_window_down (const xdo_t *xdo, Window window, const char *keysequence, useconds_t delay)
 Send key press (down) events for the given key sequence.
 
int xdo_send_keysequence_window_list_do (const xdo_t *xdo, Window window, charcodemap_t *keys, int nkeys, int pressed, int *modifier, useconds_t delay)
 Send a series of keystrokes.
 
int xdo_get_active_keys_to_keycode_list (const xdo_t *xdo, charcodemap_t **keys, int *nkeys)
 Get a list of active keys.
 
int xdo_wait_for_window_map_state (const xdo_t *xdo, Window wid, int map_state)
 Wait for a window to have a specific map state.
 
int xdo_wait_for_window_size (const xdo_t *xdo, Window window, unsigned int width, unsigned int height, int flags, int to_or_from)
 
int xdo_move_window (const xdo_t *xdo, Window wid, int x, int y)
 Move a window to a specific location.
 
int xdo_translate_window_with_sizehint (const xdo_t *xdo, Window window, unsigned int width, unsigned int height, unsigned int *width_ret, unsigned int *height_ret)
 Apply a window's sizing hints (if any) to a given width and height.
 
int xdo_set_window_size (const xdo_t *xdo, Window wid, int w, int h, int flags)
 Change the window size.
 
int xdo_set_window_property (const xdo_t *xdo, Window wid, const char *property, const char *value)
 Change a window property.
 
int xdo_set_window_class (const xdo_t *xdo, Window wid, const char *name, const char *_class)
 Change the window's classname and or class.
 
int xdo_set_window_urgency (const xdo_t *xdo, Window wid, int urgency)
 Sets the urgency hint for a window.
 
int xdo_set_window_override_redirect (const xdo_t *xdo, Window wid, int override_redirect)
 Set the override_redirect value for a window.
 
int xdo_focus_window (const xdo_t *xdo, Window wid)
 Focus a window.
 
int xdo_raise_window (const xdo_t *xdo, Window wid)
 Raise a window to the top of the window stack.
 
int xdo_get_focused_window (const xdo_t *xdo, Window *window_ret)
 Get the window currently having focus.
 
int xdo_wait_for_window_focus (const xdo_t *xdo, Window window, int want_focus)
 Wait for a window to have or lose focus.
 
int xdo_get_pid_window (const xdo_t *xdo, Window window)
 Get the PID owning a window.
 
int xdo_get_focused_window_sane (const xdo_t *xdo, Window *window_ret)
 Like xdo_get_focused_window, but return the first ancestor-or-self window * having a property of WM_CLASS.
 
int xdo_activate_window (const xdo_t *xdo, Window wid)
 Activate a window.
 
int xdo_wait_for_window_active (const xdo_t *xdo, Window window, int active)
 Wait for a window to be active or not active.
 
int xdo_map_window (const xdo_t *xdo, Window wid)
 Map a window.
 
int xdo_unmap_window (const xdo_t *xdo, Window wid)
 Unmap a window.
 
int xdo_minimize_window (const xdo_t *xdo, Window wid)
 Minimize a window.
 
int xdo_reparent_window (const xdo_t *xdo, Window wid_source, Window wid_target)
 Reparents a window.
 
int xdo_get_window_location (const xdo_t *xdo, Window wid, int *x_ret, int *y_ret, Screen **screen_ret)
 Get a window's location.
 
int xdo_get_window_size (const xdo_t *xdo, Window wid, unsigned int *width_ret, unsigned int *height_ret)
 Get a window's size.
 
int xdo_get_active_window (const xdo_t *xdo, Window *window_ret)
 Get the currently-active window.
 
int xdo_select_window_with_click (const xdo_t *xdo, Window *window_ret)
 Get a window ID by clicking on it.
 
int xdo_set_number_of_desktops (const xdo_t *xdo, long ndesktops)
 Set the number of desktops.
 
int xdo_get_number_of_desktops (const xdo_t *xdo, long *ndesktops)
 Get the current number of desktops.
 
int xdo_set_current_desktop (const xdo_t *xdo, long desktop)
 Switch to another desktop.
 
int xdo_get_current_desktop (const xdo_t *xdo, long *desktop)
 Get the current desktop.
 
int xdo_set_desktop_for_window (const xdo_t *xdo, Window wid, long desktop)
 Move a window to another desktop Uses _NET_WM_DESKTOP of the EWMH spec.
 
int xdo_get_desktop_for_window (const xdo_t *xdo, Window wid, long *desktop)
 Get the desktop a window is on.
 
int xdo_search_windows (const xdo_t *xdo, const xdo_search_t *search, Window **windowlist_ret, unsigned int *nwindows_ret)
 Search for windows.
 
unsigned char * xdo_get_window_property_by_atom (const xdo_t *xdo, Window window, Atom atom, long *nitems, Atom *type, int *size)
 Generic property fetch.
 
int xdo_get_window_property (const xdo_t *xdo, Window window, const char *property, unsigned char **value, long *nitems, Atom *type, int *size)
 Get property of window by name of atom.
 
unsigned int xdo_get_input_state (const xdo_t *xdo)
 Get the current input state.
 
const char ** xdo_get_symbol_map (void)
 If you need the symbol map, use this method.
 
int xdo_get_active_modifiers (const xdo_t *xdo, charcodemap_t **keys, int *nkeys)
 Get a list of active keys.
 
int xdo_clear_active_modifiers (const xdo_t *xdo, Window window, charcodemap_t *active_mods, int active_mods_n)
 Send any events necessary to clear the active modifiers.
 
int xdo_set_active_modifiers (const xdo_t *xdo, Window window, charcodemap_t *active_mods, int active_mods_n)
 Send any events necessary to make these modifiers active.
 
int xdo_get_desktop_viewport (const xdo_t *xdo, int *x_ret, int *y_ret)
 Get the position of the current viewport.
 
int xdo_set_desktop_viewport (const xdo_t *xdo, int x, int y)
 Set the position of the current viewport.
 
int xdo_kill_window (const xdo_t *xdo, Window window)
 Kill a window and the client owning it.
 
int xdo_close_window (const xdo_t *xdo, Window window)
 Close a window without trying to kill the client.
 
int xdo_find_window_client (const xdo_t *xdo, Window window, Window *window_ret, int direction)
 Find a client window (child) in a given window.
 
int xdo_get_window_name (const xdo_t *xdo, Window window, unsigned char **name_ret, int *name_len_ret, int *name_type)
 Get a window's name, if any.
 
void xdo_disable_feature (xdo_t *xdo, int feature)
 Disable an xdo feature.
 
void xdo_enable_feature (xdo_t *xdo, int feature)
 Enable an xdo feature.
 
int xdo_has_feature (xdo_t *xdo, int feature)
 Check if a feature is enabled.
 
int xdo_get_viewport_dimensions (xdo_t *xdo, unsigned int *width, unsigned int *height, int screen)
 Query the viewport (your display) dimensions.
 

Typedef Documentation

◆ xdo_search_t

typedef struct xdo_search xdo_search_t

The window search query structure.

See also
xdo_search_windows

Function Documentation

◆ xdo_activate_window()

int xdo_activate_window ( const xdo_t xdo,
Window  wid 
)

Activate a window.

This is generally a better choice than xdo_focus_window for a variety of reasons, but it requires window manager support:

  • If the window is on another desktop, that desktop is switched to.
  • It moves the window forward rather than simply focusing it

Requires your window manager to support this. Uses _NET_ACTIVE_WINDOW from the EWMH spec.

Parameters
widthe window to activate

◆ xdo_clear_active_modifiers()

int xdo_clear_active_modifiers ( const xdo_t xdo,
Window  window,
charcodemap_t active_mods,
int  active_mods_n 
)

Send any events necessary to clear the active modifiers.

For example, if you are holding 'alt' when xdo_get_active_modifiers is called, then this method will send a key-up for 'alt'

◆ xdo_click_window()

int xdo_click_window ( const xdo_t xdo,
Window  window,
int  button 
)

Send a click for a specific mouse button at the current mouse location.

Parameters
windowThe window you want to send the event to or CURRENTWINDOW
buttonThe mouse button. Generally, 1 is left, 2 is middle, 3 is right, 4 is wheel up, 5 is wheel down.

◆ xdo_click_window_multiple()

int xdo_click_window_multiple ( const xdo_t xdo,
Window  window,
int  button,
int  repeat,
useconds_t  delay 
)

Send a one or more clicks for a specific mouse button at the current mouse location.

Parameters
windowThe window you want to send the event to or CURRENTWINDOW
buttonThe mouse button. Generally, 1 is left, 2 is middle, 3 is right, 4 is wheel up, 5 is wheel down.

◆ xdo_disable_feature()

void xdo_disable_feature ( xdo_t xdo,
int  feature 
)

Disable an xdo feature.

This function is mainly used by libxdo itself, however, you may find it useful in your own applications.

See also
XDO_FEATURES

◆ xdo_enable_feature()

void xdo_enable_feature ( xdo_t xdo,
int  feature 
)

Enable an xdo feature.

This function is mainly used by libxdo itself, however, you may find it useful in your own applications.

See also
XDO_FEATURES

◆ xdo_enter_text_window()

int xdo_enter_text_window ( const xdo_t xdo,
Window  window,
const char *  string,
useconds_t  delay 
)

Type a string to the specified window.

If you want to send a specific key or key sequence, such as "alt+l", you want instead xdo_send_keysequence_window(...).

Parameters
windowThe window you want to send keystrokes to or CURRENTWINDOW
stringThe string to type, like "Hello world!"
delayThe delay between keystrokes in microseconds. 12000 is a decent choice if you don't have other plans.

◆ xdo_find_window_client()

int xdo_find_window_client ( const xdo_t xdo,
Window  window,
Window *  window_ret,
int  direction 
)

Find a client window (child) in a given window.

Useful if you get the window manager's decorator window rather than the client window.

◆ xdo_focus_window()

int xdo_focus_window ( const xdo_t xdo,
Window  wid 
)

Focus a window.

See also
xdo_activate_window
Parameters
widthe window to focus.

◆ xdo_free()

void xdo_free ( xdo_t xdo)

Free and destroy an xdo_t instance.

If close_display_when_freed is set, then we will also close the Display.

◆ xdo_get_active_keys_to_keycode_list()

int xdo_get_active_keys_to_keycode_list ( const xdo_t xdo,
charcodemap_t **  keys,
int *  nkeys 
)

Get a list of active keys.

Uses XQueryKeymap.

Parameters
keysPointer to the array of charcodemap_t that will be allocated by this function.
nkeysPointer to integer where the number of keys will be stored.

◆ xdo_get_active_modifiers()

int xdo_get_active_modifiers ( const xdo_t xdo,
charcodemap_t **  keys,
int *  nkeys 
)

Get a list of active keys.

Uses XQueryKeymap.

Parameters
keysPointer to the array of charcodemap_t that will be allocated by this function.
nkeysPointer to integer where the number of keys will be stored.

◆ xdo_get_active_window()

int xdo_get_active_window ( const xdo_t xdo,
Window *  window_ret 
)

Get the currently-active window.

Requires your window manager to support this. Uses _NET_ACTIVE_WINDOW from the EWMH spec.

Parameters
window_retPointer to Window where the active window is stored.

◆ xdo_get_current_desktop()

int xdo_get_current_desktop ( const xdo_t xdo,
long *  desktop 
)

Get the current desktop.

Uses _NET_CURRENT_DESKTOP of the EWMH spec.

Parameters
desktoppointer to long where the current desktop number is stored.

◆ xdo_get_desktop_for_window()

int xdo_get_desktop_for_window ( const xdo_t xdo,
Window  wid,
long *  desktop 
)

Get the desktop a window is on.

Uses _NET_WM_DESKTOP of the EWMH spec.

If your desktop does not support _NET_WM_DESKTOP, then '*desktop' remains unmodified.

Parameters
widthe window to query
desktopointer to long where the desktop of the window is stored

◆ xdo_get_desktop_viewport()

int xdo_get_desktop_viewport ( const xdo_t xdo,
int *  x_ret,
int *  y_ret 
)

Get the position of the current viewport.

This is only relevant if your window manager supports _NET_DESKTOP_VIEWPORT

◆ xdo_get_focused_window()

int xdo_get_focused_window ( const xdo_t xdo,
Window *  window_ret 
)

Get the window currently having focus.

Parameters
window_retPointer to a window where the currently-focused window will be stored.

◆ xdo_get_focused_window_sane()

int xdo_get_focused_window_sane ( const xdo_t xdo,
Window *  window_ret 
)

Like xdo_get_focused_window, but return the first ancestor-or-self window * having a property of WM_CLASS.

This allows you to get the "real" or top-level-ish window having focus rather than something you may not expect to be the window having focused.

Parameters
window_retPointer to a window where the currently-focused window will be stored.

◆ xdo_get_input_state()

unsigned int xdo_get_input_state ( const xdo_t xdo)

Get the current input state.

This is a mask value containing any of the following: ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, or Mod5Mask.

Returns
the input mask

◆ xdo_get_mouse_location()

int xdo_get_mouse_location ( const xdo_t xdo,
int *  x,
int *  y,
int *  screen_num 
)

Get the current mouse location (coordinates and screen number).

Parameters
xinteger pointer where the X coordinate will be stored
yinteger pointer where the Y coordinate will be stored
screen_numinteger pointer where the screen number will be stored

◆ xdo_get_mouse_location2()

int xdo_get_mouse_location2 ( const xdo_t xdo,
int *  x_ret,
int *  y_ret,
int *  screen_num_ret,
Window *  window_ret 
)

Get all mouse location-related data.

If null is passed for any parameter, we simply do not store it. Useful if you only want the 'y' coordinate, for example.

Parameters
xinteger pointer where the X coordinate will be stored
yinteger pointer where the Y coordinate will be stored
screen_numinteger pointer where the screen number will be stored
windowWindow pointer where the window/client the mouse is over will be stored.

◆ xdo_get_number_of_desktops()

int xdo_get_number_of_desktops ( const xdo_t xdo,
long *  ndesktops 
)

Get the current number of desktops.

Uses _NET_NUMBER_OF_DESKTOPS of the EWMH spec.

Parameters
ndesktopspointer to long where the current number of desktops is stored

◆ xdo_get_pid_window()

int xdo_get_pid_window ( const xdo_t xdo,
Window  window 
)

Get the PID owning a window.

Not all applications support this. It looks at the _NET_WM_PID property of the window.

Parameters
windowthe window to query.
Returns
the process id or 0 if no pid found.

◆ xdo_get_symbol_map()

const char ** xdo_get_symbol_map ( void  )

If you need the symbol map, use this method.

The symbol map is an array of string pairs mapping common tokens to X Keysym strings, such as "alt" to "Alt_L"

Returns
array of strings.

◆ xdo_get_viewport_dimensions()

int xdo_get_viewport_dimensions ( xdo_t xdo,
unsigned int *  width,
unsigned int *  height,
int  screen 
)

Query the viewport (your display) dimensions.

If Xinerama is active and supported, that api internally is used. If Xineram is disabled, we will report the root window's dimensions for the given screen.

◆ xdo_get_window_at_mouse()

int xdo_get_window_at_mouse ( const xdo_t xdo,
Window *  window_ret 
)

Get the window the mouse is currently over.

Parameters
window_retWinter pointer where the window will be stored.

◆ xdo_get_window_location()

int xdo_get_window_location ( const xdo_t xdo,
Window  wid,
int *  x_ret,
int *  y_ret,
Screen **  screen_ret 
)

Get a window's location.

Parameters
widthe window to query
x_retpointer to int where the X location is stored. If NULL, X is ignored.
y_retpointer to int where the Y location is stored. If NULL, X is ignored.
screen_retPointer to Screen* where the Screen* the window on is stored. If NULL, this parameter is ignored.

◆ xdo_get_window_name()

int xdo_get_window_name ( const xdo_t xdo,
Window  window,
unsigned char **  name_ret,
int *  name_len_ret,
int *  name_type 
)

Get a window's name, if any.

TODO(sissel): Document

http://standards.freedesktop.org/wm-spec/1.3/ar01s05.html Prefer _NET_WM_NAME if available, otherwise use WM_NAME If no WM_NAME, set name_ret to NULL and set len to 0

◆ xdo_get_window_property()

int xdo_get_window_property ( const xdo_t xdo,
Window  window,
const char *  property,
unsigned char **  value,
long *  nitems,
Atom *  type,
int *  size 
)

Get property of window by name of atom.

Parameters
windowthe window to query
propertythe name of the atom
nitemsthe number of items
typethe type of the return
sizethe size of the type
Returns
data consisting of 'nitems' items of size 'size' and type 'type' will need to be cast to the type before using.

◆ xdo_get_window_property_by_atom()

unsigned char * xdo_get_window_property_by_atom ( const xdo_t xdo,
Window  window,
Atom  atom,
long *  nitems,
Atom *  type,
int *  size 
)

Generic property fetch.

Parameters
windowthe window to query
atomthe Atom to request
nitemsthe number of items
typethe type of the return
sizethe size of the type
Returns
data consisting of 'nitems' items of size 'size' and type 'type' will need to be cast to the type before using.

◆ xdo_get_window_size()

int xdo_get_window_size ( const xdo_t xdo,
Window  wid,
unsigned int *  width_ret,
unsigned int *  height_ret 
)

Get a window's size.

Parameters
widthe window to query
width_retpointer to unsigned int where the width is stored.
height_retpointer to unsigned int where the height is stored.

◆ xdo_has_feature()

int xdo_has_feature ( xdo_t xdo,
int  feature 
)

Check if a feature is enabled.

This function is mainly used by libxdo itself, however, you may find it useful in your own applications.

See also
XDO_FEATURES

◆ xdo_map_window()

int xdo_map_window ( const xdo_t xdo,
Window  wid 
)

Map a window.

This mostly means to make the window visible if it is not currently mapped.

Parameters
widthe window to map.

◆ xdo_mouse_down()

int xdo_mouse_down ( const xdo_t xdo,
Window  window,
int  button 
)

Send a mouse press (aka mouse down) for a given button at the current mouse location.

Parameters
windowThe window you want to send the event to or CURRENTWINDOW
buttonThe mouse button. Generally, 1 is left, 2 is middle, 3 is right, 4 is wheel up, 5 is wheel down.

◆ xdo_mouse_up()

int xdo_mouse_up ( const xdo_t xdo,
Window  window,
int  button 
)

Send a mouse release (aka mouse up) for a given button at the current mouse location.

Parameters
windowThe window you want to send the event to or CURRENTWINDOW
buttonThe mouse button. Generally, 1 is left, 2 is middle, 3 is right, 4 is wheel up, 5 is wheel down.

◆ xdo_move_mouse()

int xdo_move_mouse ( const xdo_t xdo,
int  x,
int  y,
int  screen 
)

Move the mouse to a specific location.

Parameters
xthe target X coordinate on the screen in pixels.
ythe target Y coordinate on the screen in pixels.
screenthe screen (number) you want to move on.

◆ xdo_move_mouse_relative()

int xdo_move_mouse_relative ( const xdo_t xdo,
int  x,
int  y 
)

Move the mouse relative to it's current position.

Parameters
xthe distance in pixels to move on the X axis.
ythe distance in pixels to move on the Y axis.

◆ xdo_move_mouse_relative_to_window()

int xdo_move_mouse_relative_to_window ( const xdo_t xdo,
Window  window,
int  x,
int  y 
)

Move the mouse to a specific location relative to the top-left corner of a window.

Parameters
xthe target X coordinate on the screen in pixels.
ythe target Y coordinate on the screen in pixels.

◆ xdo_move_window()

int xdo_move_window ( const xdo_t xdo,
Window  wid,
int  x,
int  y 
)

Move a window to a specific location.

The top left corner of the window will be moved to the x,y coordinate.

Parameters
widthe window to move
xthe X coordinate to move to.
ythe Y coordinate to move to.

◆ xdo_new()

xdo_t * xdo_new ( const char *  display)

Create a new xdo_t instance.

Parameters
displaythe string display name, such as ":0". If null, uses the environment variable DISPLAY just like XOpenDisplay(NULL).
Returns
Pointer to a new xdo_t or NULL on failure

◆ xdo_new_with_opened_display()

xdo_t * xdo_new_with_opened_display ( Display *  xdpy,
const char *  display,
int  close_display_when_freed 
)

Create a new xdo_t instance with an existing X11 Display instance.

Parameters
xdpythe Display pointer given by a previous XOpenDisplay()
displaythe string display name
close_display_when_freedIf true, we will close the display when xdo_free is called. Otherwise, we leave it open.

◆ xdo_raise_window()

int xdo_raise_window ( const xdo_t xdo,
Window  wid 
)

Raise a window to the top of the window stack.

This is also sometimes termed as bringing the window forward.

Parameters
widThe window to raise.

◆ xdo_reparent_window()

int xdo_reparent_window ( const xdo_t xdo,
Window  wid_source,
Window  wid_target 
)

Reparents a window.

Parameters
wid_sourcethe window to reparent
wid_targetthe new parent window

◆ xdo_search_windows()

int xdo_search_windows ( const xdo_t xdo,
const xdo_search_t search,
Window **  windowlist_ret,
unsigned int *  nwindows_ret 
)

Search for windows.

Parameters
searchthe search query.
windowlist_retthe list of matching windows to return
nwindows_retthe number of windows (length of windowlist_ret)
See also
xdo_search_t

◆ xdo_select_window_with_click()

int xdo_select_window_with_click ( const xdo_t xdo,
Window *  window_ret 
)

Get a window ID by clicking on it.

This function blocks until a selection is made.

Parameters
window_retPointer to Window where the selected window is stored.

◆ xdo_send_keysequence_window()

int xdo_send_keysequence_window ( const xdo_t xdo,
Window  window,
const char *  keysequence,
useconds_t  delay 
)

Send a keysequence to the specified window.

This allows you to send keysequences by symbol name. Any combination of X11 KeySym names separated by '+' are valid. Single KeySym names are valid, too.

Examples: "l" "semicolon" "alt+Return" "Alt_L+Tab"

If you want to type a string, such as "Hello world." you want to instead use xdo_enter_text_window.

Parameters
windowThe window you want to send the keysequence to or CURRENTWINDOW
keysequenceThe string keysequence to send.
delayThe delay between keystrokes in microseconds.

◆ xdo_send_keysequence_window_down()

int xdo_send_keysequence_window_down ( const xdo_t xdo,
Window  window,
const char *  keysequence,
useconds_t  delay 
)

Send key press (down) events for the given key sequence.

See also
xdo_send_keysequence_window

◆ xdo_send_keysequence_window_list_do()

int xdo_send_keysequence_window_list_do ( const xdo_t xdo,
Window  window,
charcodemap_t keys,
int  nkeys,
int  pressed,
int *  modifier,
useconds_t  delay 
)

Send a series of keystrokes.

Parameters
windowThe window to send events to or CURRENTWINDOW
keysThe array of charcodemap_t entities to send.
nkeysThe length of the keys parameter
pressed1 for key press, 0 for key release.
modifierPointer to integer to record the modifiers activated by the keys being pressed. If NULL, we don't save the modifiers.
delayThe delay between keystrokes in microseconds.

◆ xdo_send_keysequence_window_up()

int xdo_send_keysequence_window_up ( const xdo_t xdo,
Window  window,
const char *  keysequence,
useconds_t  delay 
)

Send key release (up) events for the given key sequence.

See also
xdo_send_keysequence_window

◆ xdo_set_active_modifiers()

int xdo_set_active_modifiers ( const xdo_t xdo,
Window  window,
charcodemap_t active_mods,
int  active_mods_n 
)

Send any events necessary to make these modifiers active.

This is useful if you just cleared the active modifiers and then wish to restore them after.

◆ xdo_set_current_desktop()

int xdo_set_current_desktop ( const xdo_t xdo,
long  desktop 
)

Switch to another desktop.

Uses _NET_CURRENT_DESKTOP of the EWMH spec.

Parameters
desktopThe desktop number to switch to.

◆ xdo_set_desktop_for_window()

int xdo_set_desktop_for_window ( const xdo_t xdo,
Window  wid,
long  desktop 
)

Move a window to another desktop Uses _NET_WM_DESKTOP of the EWMH spec.

Parameters
widthe window to move
desktopthe desktop destination for the window

◆ xdo_set_desktop_viewport()

int xdo_set_desktop_viewport ( const xdo_t xdo,
int  x,
int  y 
)

Set the position of the current viewport.

This is only relevant if your window manager supports _NET_DESKTOP_VIEWPORT

◆ xdo_set_number_of_desktops()

int xdo_set_number_of_desktops ( const xdo_t xdo,
long  ndesktops 
)

Set the number of desktops.

Uses _NET_NUMBER_OF_DESKTOPS of the EWMH spec.

Parameters
ndesktopsthe new number of desktops to set.

◆ xdo_set_window_class()

int xdo_set_window_class ( const xdo_t xdo,
Window  wid,
const char *  name,
const char *  _class 
)

Change the window's classname and or class.

Parameters
nameThe new class name. If NULL, no change.
_classThe new class. If NULL, no change.

◆ xdo_set_window_override_redirect()

int xdo_set_window_override_redirect ( const xdo_t xdo,
Window  wid,
int  override_redirect 
)

Set the override_redirect value for a window.

This generally means whether or not a window manager will manage this window.

If you set it to 1, the window manager will usually not draw borders on the window, etc. If you set it to 0, the window manager will see it like a normal application window.

◆ xdo_set_window_property()

int xdo_set_window_property ( const xdo_t xdo,
Window  wid,
const char *  property,
const char *  value 
)

Change a window property.

Example properties you can change are WM_NAME, WM_ICON_NAME, etc.

Parameters
widThe window to change a property of.
propertythe string name of the property.
valuethe string value of the property.

◆ xdo_set_window_size()

int xdo_set_window_size ( const xdo_t xdo,
Window  wid,
int  w,
int  h,
int  flags 
)

Change the window size.

Parameters
widthe window to resize
wthe new desired width
hthe new desired height
flagsif 0, use pixels for units. If SIZE_USEHINTS, then the units will be relative to the window size hints.

◆ xdo_translate_window_with_sizehint()

int xdo_translate_window_with_sizehint ( const xdo_t xdo,
Window  window,
unsigned int  width,
unsigned int  height,
unsigned int *  width_ret,
unsigned int *  height_ret 
)

Apply a window's sizing hints (if any) to a given width and height.

This function wraps XGetWMNormalHints() and applies any resize increment and base size to your given width and height values.

Parameters
windowthe window to use
widththe unit width you want to translate
heightthe unit height you want to translate
width_retthe return location of the translated width
height_retthe return location of the translated height

◆ xdo_unmap_window()

int xdo_unmap_window ( const xdo_t xdo,
Window  wid 
)

Unmap a window.

Parameters
widthe window to unmap

◆ xdo_wait_for_mouse_move_from()

int xdo_wait_for_mouse_move_from ( const xdo_t xdo,
int  origin_x,
int  origin_y 
)

Wait for the mouse to move from a location.

This function will block until the condition has been satisfied.

Parameters
origin_xthe X position you expect the mouse to move from
origin_ythe Y position you expect the mouse to move from

◆ xdo_wait_for_mouse_move_to()

int xdo_wait_for_mouse_move_to ( const xdo_t xdo,
int  dest_x,
int  dest_y 
)

Wait for the mouse to move to a location.

This function will block until the condition has been satisfied.

Parameters
dest_xthe X position you expect the mouse to move to
dest_ythe Y position you expect the mouse to move to

◆ xdo_wait_for_window_active()

int xdo_wait_for_window_active ( const xdo_t xdo,
Window  window,
int  active 
)

Wait for a window to be active or not active.

Requires your window manager to support this. Uses _NET_ACTIVE_WINDOW from the EWMH spec.

Parameters
windowthe window to wait on
activeIf 1, wait for active. If 0, wait for inactive.

◆ xdo_wait_for_window_focus()

int xdo_wait_for_window_focus ( const xdo_t xdo,
Window  window,
int  want_focus 
)

Wait for a window to have or lose focus.

Parameters
windowThe window to wait on
want_focusIf 1, wait for focus. If 0, wait for loss of focus.

◆ xdo_wait_for_window_map_state()

int xdo_wait_for_window_map_state ( const xdo_t xdo,
Window  wid,
int  map_state 
)

Wait for a window to have a specific map state.

State possibilities: IsUnmapped - window is not displayed. IsViewable - window is mapped and shown (though may be clipped by windows on top of it) IsUnviewable - window is mapped but a parent window is unmapped.

Parameters
widthe window you want to wait for.
map_statethe state to wait for.