Window manager with infinite desktop, infinite zoom and infinite window resolution
The InfiniteGlass python library wraps the python-xlib library.
InfiniteGlass.keysyms dictionary X keysyms and their values
InfiniteGlass.symkeys reverse dictionary of keysyms above.
InfiniteGlass.eventmask.event_mask_map dictionary from event name to
list of event mask names that cover said event.
Event handlers can be registered on displays and on windows. See
display.on(), window.on() and with display: below.
Content is encoded as an 32bit IEEE float.
JSON data is encode like STRING, but the content is guaranteed to be a valid JSON string.
InfiniteGlass extends (monkey patches) many python-xlib objects with short cut syntaxes for common problems, e.g. window property manipulation.
Xlib.display.Display objects are extended with the followin methods:
display.root the root windows of screen 0 of the display.
display.peek_event like display.next_event but does not remove the
returned event from the event queue.
@display.on(event="PropertyNotify", mask=None)
def handler(display, event):
pass
Register a andler for an event. Additional filter rules can be added
as keyword arguments. If e.g. a keyword named button with value 1 is
supplied, only event objects with a property named button with a
value of 1 will trigger the event handler.
with display: at the exit of the block, process events and call
event handlers until there are no registered event handlers any more.
display.keycode("KEYSYM_NAME") look up a keycode for a display by a
keysym specified with its string name.
display.mask_to_keysym dictionary from mask name to list of keysyms
that set the mask on events when pressed. Example: ShiftMask':
['XK_Shift_L', 'XK_Shift_R']
Xlib.xobject.drawable.Window objects are extended with the following
syntaxes:
window.keys() list of all property names (as strings).
"MY_PROPERTY" in window check if perty is set on window.
window["MY_PROPERTY"] or window.get("MY_PROPERTY", default=None)
retrieves a property value.
window.items() retrievs al properties, as a list of tuples of names
and values.
window["MY_PROPERTY"] = value sets a property to a value.
Window values will be returned as
Xlib.xobject.drawable.Window objects, ATOMs will be returned as
string values. STRING values are returned as byte sequences.
del window["MY_PROPERTY"] unsets a property.
Type conversions when getting and setting values:
Xlib.xobject.drawable.Window: WINDOW{"window": window} and set value to return value.@window.on(event="ButtonPress", mask=None, **filter)
def handler(window, event):
pass
or
@window.on(mask=None, **filter)
def ButtonPress(window, event):
pass
Register an event handler for an event, with some event mask on the
window. Additional filter rules can be added as keyword arguments. If
e.g. a keyword named button with value 1 is supplied, only event
objects with a property named button with a value of 1 will trigger
the event handler.
@window.require("MY_PROPERTY")
def handler(self, value):
pass
Call an event handler once when a property with a particular name is first set on a window.
window.send(destination_window, client_type, *values) send a
ClientMessage to a window. client_type should be an atom name as a
string, values will be converted the same way as for window
properties.