Ruby Window Management Library
In my article on innovations in window management, I mention the wmctrl utility, which allows users to manage X11 windows from the command line. It is compatible with most netwm/gnome compliant window managers, and it supports the vast majority of the EWMH specification. I'm fascinated by the capabilities of this helpful little utility, but I'm frustrated with some of its limitations.
Using the source code for wmctrl as a guide, I have constructed a window management library for Ruby in C. This library provides users with an intuitive and concise syntax for window management and control. Here are some simple examples:
Window.each do |w| w.close if w.winclass == "gaim" and w.title != "Buddy List" end Window.filter {|w| w != /Mozilla/} Window.current.desktop = (Window//terminal/)[0].desktop Window.each do |w| puts "#{w.title} - #{w.winclass} - #{w.desktop}" end
Eventually, I hope it will be comprehensive enough to provide any window manager with all the Sawfish features i've become accustomed to using. At that point I plan to construct a daemon that will allow me to associate keyboard shortcuts with individual Ruby functions. I'll be able to utilize my keyboard-fu with a more featureful window manager. Right now i'm thinking about switching to Flux, or something else with window tab support.
Tags: ruby, programming, libwm
Posted on 2005-02-261 comments

very cool
I love wmctrl, and this library could be very useful! It's been a couple of years since this post though.. =/