Anyone know a library, preferably for ruby or python, that will let you access a list of open applications and let you manipulate them? All I really want to be able to do is change their geometry and minimize or close them. I've been messing around with ruby-gnome2 a bit but haven't found anything for manipulating windows other than the ones of your own process.
I'm using 10.10.
The easiest way to do this would be using wmctrl. You can read
man wmctrl
to see how to use it.You could basically bind the command line to a 'Window' class and add methods to it that use wmctrl commands in the background.
That should be a good starting point. It's not tested or anything but you should be able to work it out from here. You could now add instance methods, eg.
change_geometry
, which could utilise the-r <WIN> -e <MVARG>
option.You should familiarise your self with pipes and IO in general before doing this.
Perhaps when you have accomplished what you need to, you can distribute this as a ruby library and package it for Debian/Ubuntu.
You can use the Extended Window Manager Hints spec to tell the WM to change some windows. This is the trick that wmctrl uses.
Usually you need to use XLib to use EWMH, but for python there is this nice project: PyTile. It's a python program to tile the windows. Not only is it a nice example, it has wrapped the most important functionality into one class. Just download the source and take a look at Probe.py, it does most of what you ask.
This example maximizes all the windows:
Hey there, have a look at wmctrl. It's not an actual library, but a command line script that allows window manipulation via command line switches. You'd certainly be able to call it via system.
I use it in many shell scripts, and sometimes perl scripts using system()
hth