Proposal to Improve the python-xlib API

I admit that I only concern myself with certain aspects of the API, but I believe that the current xlib API can be vastly improved by making it more ‘pythonic’.

General Improvements:

Don’t make the application programmer worry about the underlying types used in the protocol, convert to python friendly types (Card8 Card16 etc, they’re all ints to a python programmer)

The Window class

I propose that the following things be added to the Window API, the old API can be maintained for compatibility:

  • Window
    • parent
      • get: Window.query_tree()
      • set: ReparentWindow
    • children
      • get: Window.query_tree()
      • set: unimplemented (undesirable?)
    • root
      • get: Window.query_tree()
      • set: is it needed?
    • properties
      • As a custom class implementing __getitem__ which queries the existing property system

There’s much more which could benefit from some attention, but I’m going to get coding for the moment 🙂

python-xlib’s Homepage

My Git Repository

Advertisements
Proposal to Improve the python-xlib API