The Journalist's Cage

And this gray spirit yearning in desire to follow knowledge like a sinking star...

HomeBlogTagsArticles

Calendar

January 2007
SuMoTuWeThFrSa
 123456
78910111213
14151617181920
21222324252627
28293031

Recent Bookmarks

Tags

Archives


RSS

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.


Posted on 2005-02-261 comments



Comments

very cool

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

Posted by Sy Ali at Tue Aug 21 23:42:53 PDT 2007

Add a Comment

Name:

E-mail: (Optional, Not shown)

Subject: (Optional)

Text in image:

Comment: