Top

xpybutil module

import xcb, xcb.xproto

try:
    conn = xcb.connect()
    root = conn.get_setup().roots[0].root
except xcb.ConnectException:
    conn = None
    root = None

Module variables

var conn

var root

Sub-modules

xpybutil.cursor

Provides a listing of all built-in X cursors, and provides a function 'create_font_cursor' to create one. This object can then be directly used in a call to CreateWindow or ChangeWindowAttributes.

xpybutil.event

A module that can send client events to windows. It also allows registering callback functions to particular events. It can also run the main event loop.

xpybutil.ewmh

Implements the entire EWMH spec. The spec can be found here: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html

xpybutil's primary purpose was to make accessing ICCCM and EWMH related information extremely easy. This can be done by using the ewmh or icccm modules. Here's a quick example (...

xpybutil.font

This module is pretty inadequate. Mostly because if you find yourself wanting to use this module, you're probably doing something wrong. (i.e., use pycairo or PIL.)

This module will likely be removed in the future.

xpybutil.icccm

Implements most of the ICCCM spec. The ICCCM spec can be found at: http://tronche.com/gui/x/icccm/

See the EWMH module for some relevant information that also generally applies to this module.

xpybutil.keybind

A set of functions devoted to binding key presses and registering callbacks. This will automatically hook into the event callbacks in event.py.

The two functions of interest here are 'bind_global_key' and 'bind_key'. Most of the other functions facilitate the use of those two, but you may need them...

xpybutil.keysymdef

A module that creates a dictionary mapping from an english string of a key, to a keysym (an X data type) in keysyms.

The module also creates a reverse mapping called keysym_strings that maps a keysym to a list of english string versions of that keysym. (There are more string representa...

xpybutil.motif

Implements a subset of the Motif spec. This module exists because some window managers still use this as the only way of toggling window decorations via events.

xpybutil.mousebind

A set of functions to faciliate binding to mouse button presses.

This is basically the companion module of 'keybind.py'. The good news is that we don't have to deal with the complexity of X's keysym table. The bad news is that mice binding and dragging comes with its own hairball of complexity.

TO...

xpybutil.rect

This module has a few utility functions that perform math on rectangles.

For example, finding the area of intersection of two rectangles with rect_intersect_area, or getting the rectangle of a monitor after accounting for struts with monitor_rects.

xpybutil.render

I once used the help of this module to implement a basic compositing manager using xpyb. It only did transparency, and not well. (Performance was actually quite nice.) It's called pycompmgr.

This is meant to be a very close translation to the corresponding xcb-util module. Mostly because I lack a d...

xpybutil.util

A vast assortment of utility functions. The ones of interest to you are probably 'get_atom' and 'get_atom_name'. The rest are heavily used throughout the rest of xpybutil.

xpybutil.window

A few utility functions related to client windows. In particular, getting an accurate geometry of a client window including the decorations (this can vary with the window manager). Also, a functon to move and/or resize a window accurately by the top-left corner. (Also can change based on the curren...

xpybutil.xinerama

A couple of functions that support retrieving information about all active physical heads. This is done through the Xinerama extension, which implicitly supports RandR and TwinView.

The 'get_physical_mapping' function will produce a list of monitor indices in a physical ordering (left to right, top...