2

I'm writing a simple window manager as a hobby project, and I've chosen python and xlib to implement it. I'd like to have some fancy effects like windows sliding from left and right, and from what I've been able to dig up, the best way to go about this is to use the composite extension to render windows to offscreen buffers, and then manipulate those buffers and paint them however I want.

However, with python-xlib documentation somewhat lacking, I found no way to do this, and I haven't found any examples of using python-xlib with the composite extension. Where can I find this information, and has anyone used python-xlib with composite?

I suppose I could always switch to xcb which seems to support composite for python, but I'd prefer not having to rewrite the whole thing and figure out a different API with somewhat lacking python documentation.

To summarize, my questions are:

  • Is there a way to use composite with python-xlib?
  • Would it be a better idea to switch to xcb for this?

Any additional suggestions and advice are welcome.

migimunz
  • 928
  • 1
  • 6
  • 12

1 Answers1

2

Yes, there is support for Composite extension in python-xlib. Take a look at extension client implementation You'll probably need composite_redirect_window and composite_name_window_pixmap

Andrey Sidorov
  • 24,905
  • 4
  • 62
  • 75
  • You're absolutely right, it does have composite. However, xfixes is only partially implemented and 'damage' is completely missing. I might look into implementing these myself and contributing to python-xlib. Thank you for your answer! – migimunz Oct 02 '13 at 10:15
  • 1
    I've implemented composite and damage for https://github.com/sidorares/node-x11 - you can use it as a reference https://github.com/sidorares/node-x11/blob/master/lib/ext/damage.js Example of mirroring window on the surface of another window: https://github.com/sidorares/node-x11/blob/master/examples/smoketest/compositetest.js – Andrey Sidorov Oct 02 '13 at 11:03
  • 1
    Hey thanks! Your implementation looks awesome, I think I'll actually rewrite the whole thing and use node.js. – migimunz Oct 02 '13 at 11:39
  • 1
    take a look at higher level api (and feel free to add missing functionality) - https://github.com/sidorares/ntk – Andrey Sidorov Oct 02 '13 at 13:03