I was looking for a way to hack my window manager in Python. I want to use special piece of code to handle the window placement, or display stuffs in the background..
It looks like pyxfce meet my needs, so I decided to give it a try. The first thing to do is to build the latest svn of xfce. Next step play with the python wrapper.
Update: You don’t need the latest version (svn) of xfce. pyxfce works w/ xfce 4.2.1. The debian package is broken, as rely on a old libxfcegui (4.1)
Update 2: Debian package is fixed right now :)
Here is a little example of what you can do without too much pain. This script wait for every new window, and stack it on the same workspace as previous other windows of the same app. For example, the emacs windows is launched of the workspace ’4′, all other emacs windows will be displayed on this workspace.
import sys import xfce4 import gtk black_list = ['xfrun4','Terminal'] def newWinHandler(screen,win): name = win.get_resource_name() if name not in black_list: for w in screen.get_windows(): if w != win and w.get_resource_name() == name: dest = w.get_workspace() win.move_to_workspace( dest ) break screen = xfce4.netk.screen_get_default() screen.connect("window-opened",newWinHandler) gtk.main()
The major issue of pyxfce is the lack of documentation, you can do a lot of stuffs with it like creating custom xfce applications, but i didn’t find anything about this.
Why not just use kahakai or some such (something already implemented in python)? Then you can hack away to your heart’s content.
Perhaps because, I already use xfce on all my computers because it’s small, efficient and now scriptable
let me teach how to run this programm