Loading...
Searching...
No Matches
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_t * | xdo_new (const char *display)
| Create a new xdo_t instance.
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.
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

  wid | the 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

  window | The window you want to send the event to or CURRENTWINDOW
  button | The 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

  window | The window you want to send the event to or CURRENTWINDOW
  button | The 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

  window | The window you want to send keystrokes to or CURRENTWINDOW
  string | The string to type, like "Hello world!"
  delay | The 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

  wid | the 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

  keys | Pointer to the array of charcodemap_t that will be allocated by this function.
  nkeys | Pointer 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

  keys | Pointer to the array of charcodemap_t that will be allocated by this function.
  nkeys | Pointer 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_ret | Pointer 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

  desktop | pointer 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

  wid | the window to query
  deskto | pointer 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_ret | Pointer 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_ret | Pointer 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

  x | integer pointer where the X coordinate will be stored
  y | integer pointer where the Y coordinate will be stored
  screen_num | integer 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

  x | integer pointer where the X coordinate will be stored
  y | integer pointer where the Y coordinate will be stored
  screen_num | integer pointer where the screen number will be stored
  window | Window 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

  ndesktops | pointer 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

  window | the 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_ret | Winter 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

  wid | the window to query
  x_ret | pointer to int where the X location is stored. If NULL, X is ignored.
  y_ret | pointer to int where the Y location is stored. If NULL, X is ignored.
  screen_ret | Pointer 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

  window | the window to query
  property | the name of the atom
  nitems | the number of items
  type | the type of the return
  size | the 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

  window | the window to query
  atom | the Atom to request
  nitems | the number of items
  type | the type of the return
  size | the 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

  wid | the window to query
  width_ret | pointer to unsigned int where the width is stored.
  height_ret | pointer 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

  wid | the 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

  window | The window you want to send the event to or CURRENTWINDOW
  button | The 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

  window | The window you want to send the event to or CURRENTWINDOW
  button | The 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

  x | the target X coordinate on the screen in pixels.
  y | the target Y coordinate on the screen in pixels.
  screen | the 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

  x | the distance in pixels to move on the X axis.
  y | the 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

  x | the target X coordinate on the screen in pixels.
  y | the 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

  wid | the window to move
  x | the X coordinate to move to.
  y | the Y coordinate to move to.

## xdo_new()

xdo_t * xdo_new | ( | const char * | display | ) |

Create a new xdo_t instance.

Parameters

  display | the 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

  xdpy | the Display pointer given by a previous XOpenDisplay()
  display | the string display name
  close_display_when_freed | If 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

  wid | The 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_source | the window to reparent
  wid_target | the 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

  search | the search query.
  windowlist_ret | the list of matching windows to return
  nwindows_ret | the 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_ret | Pointer 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

  window | The window you want to send the keysequence to or CURRENTWINDOW
  keysequence | The string keysequence to send.
  delay | The 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

  window | The window to send events to or CURRENTWINDOW
  keys | The array of charcodemap_t entities to send.
  nkeys | The length of the keys parameter
  pressed | 1 for key press, 0 for key release.
  modifier | Pointer to integer to record the modifiers activated by the keys being pressed. If NULL, we don't save the modifiers.
  delay | The 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

  desktop | The 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

  wid | the window to move
  desktop | the 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

  ndesktops | the 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

  name | The new class name. If NULL, no change.
  _class | The 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

  wid | The window to change a property of.
  property | the string name of the property.
  value | the 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

  wid | the window to resize
  w | the new desired width
  h | the new desired height
  flags | if 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

  window | the window to use
  width | the unit width you want to translate
  height | the unit height you want to translate
  width_ret | the return location of the translated width
  height_ret | the return location of the translated height

## xdo_unmap_window()

int xdo_unmap_window | ( | const xdo_t * | xdo,
|  | Window | wid )

Unmap a window.

Parameters

  wid | the 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_x | the X position you expect the mouse to move from
  origin_y | the 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_x | the X position you expect the mouse to move to
  dest_y | the 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

  window | the window to wait on
  active | If 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

  window | The window to wait on
  want_focus | If 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

  wid | the window you want to wait for.
  map_state | the state to wait for.