eigenclass logo
MAIN  Index  Search  Changes  PageRank  Login

ruby-wmii 0.3.0: extensibility via plugins, easier upgrades, new applets (MPD, battery monitor)...

For those who like scripting their window manager, the most notable change in ruby-wmii 0.3.0 is the new configuration system which preserves your settings across upgrades and allows for extensibility via plugins. Implemented as explained in an earlier posting where I showed the basics of a plugin framework for Ruby apps, the new plugin functionality looks like this:

from "standard"  do
  use_bar_applet "volume", 999
  use_bar_applet "mode", 900
  use_bar_applet "status", 100
  #use_bar_applet "cpuinfo", 150
  use_bar_applet "mpd", 10
  #use_bar_applet "battery-monitor

  use_binding "dict-lookup", "MODKEY-x"   # override default keybinding
  use_binding "execute-program-with-tag"
  use_binding "execute-action"
  use_binding "execute-program"
  (0..9).each{|k| use_binding "numeric-jump-#{k}"  }


(in a separate file under the plugin directory)

Plugin.define "standard" do 
  author "Mauricio Fernandez <mfp@acm.org>"

# # {{{ CPU info applet
  bar_applet("cpuinfo", 800) do |wmii, bar|
    Thread.new do
      loop do
        cpuinfo = IO.readlines("/proc/cpuinfo")[6].split[-1].sub(/\..*$/,'')
        bar.data = cpuinfo.chomp + " Mhz"
        sleep 5
# ...

  binding("dict-lookup", "MODKEY-Control-d") do |wmii,|
    LOGGER.debug "dict-lookup called!!!"
    Thread.new do
      wmii.wmiimenu([]) do |phrase|
        system "dcop kdict KDictIface definePhrase '#{phrase}'"
      end.value  # block until we get the word
      wmii.set_curr_view "dict"



As usual, the latest version is available here.

Change summary

update.png The mpd and battery-monitor applets were originally written by Jeff Mickey (codemac). They were incorrectly attributed to Wael Nasreddine but we got this cleared up.


  • extensibility via plugins and separate configuration in wmiirc-config.rb (preserved on upgrade)
  • modal keyboard input: normal and "raw" modes, so you don't have to worry about keybindings conflicting with seldom used applications (standard:mode applet)
  • user-specified events are supported
  • new applets: mpd (Music Player Daemon), battery-monitor
  • configurable standard:status applet


  • fixed numerical retagging
  • wmiirc.log doesn't get filled with MBs worth of lines when something goes wrong
  • wmiisetsid used consistently to launch external programs
  • many other bugs

Typo? - Pawel (2006-10-08 (Sun) 16:41:38)

In the block of ruby code on this page (and also in my own wmiirc-config.rb) there is no closing quote after '#use_bar_applet "battery-monitor' - this got me when I tried to uncomment it.

Backporting wmii-4 nicety - Constantine Evans (2006-08-10 (Thr) 21:30:29)

My favourite new change in wmii-4 is the ability to go to new spaces that don't have any windows yet. Since I don't particularly want to port ruby-wmii to wmii-4 on my own, and it makes wmii so much nicer, is there some way that this could be done in ruby-wmii?

mfp 2006-08-12 (Sat) 16:38:08

AFAIK that cannot be done with wmii 3, the closest you can get is maybe the MODKEY-Control-y binding (run a prog in the specified view).

Jeremy Maitin-Shepard reported on the wmii ML that he's "ported" ruby-wmii to wmii 4, so a release compatible with wmii's devel branch might not be too far away.

Low Battery - Constantine Evans (2006-08-08 (Tue) 14:05:34)

The low battery notification with the battery-monitor comes up every second, which is rather annoying.

mfp 2006-08-08 (Tue) 14:26:40

hmm, will try to look into this. I didn't write battery-monitor originally (and don't use it either) so I can't guarantee anything :-|

mfp 2006-08-10 (Thr) 05:40:43

OK, should be fixed in the darcs repository at http://eigenclass.org/repos/ruby-wmii/

Please give it a try.


Constantine Evans 2006-08-12 (Sat) 15:51:58

It works properly now. Thank you.

mfp 2006-08-12 (Sat) 16:39:14

alright, 0.3.1 around Mon or Tue then

Bug reports here? - anonymous (2006-08-07 (Mon) 13:06:29)

Thank you for ruby-wmii, I love it! ;)

I have one problem though. After I quit wmii, ruby-wmii keeps running forever in the same loop, creating new processes and writing the following error again and again to the log file:

wmiir: cannot connect server
D, [2006-08-07T20:40:24.136322 #32110] DEBUG -- : Executing foreach, using process 1933
D, [2006-08-07T20:40:24.136889 #32110] DEBUG -- : Opening /event
D, [2006-08-07T20:40:24.137067 #32110] DEBUG -- : Connecting to unix!/tmp/ns.jorda.:0/wmii

Looks like the open() in wmiirc doesn't handle errors very well... I have the same problem with both 0.3 and 0.3.1 (from darcs).

mfp 2006-08-08 (Tue) 14:33:32

hehe, I didn't notice that since my X sessions last "forever". I'm fixing that and releasing 0.3.1 shortly after. Thank you for the bugreport.

PS: somewhat better "BTS" coming soon

mfp 2006-08-10 (Thr) 05:42:16

Fixed in the darcs repository.

If there's no problem with the last few bugfixes, I'll be releasing 0.3.1 in short.

anonymous 2006-08-11 (Fri) 00:01:55

Yeah, it works fine now, thanks! ;)

beat me to it - technomancy (2006-07-13 (Thr) 09:34:32)

Hah; I had a patch ready to send you to add customizeable key bindings to wmii-ruby-0.2. (Icky vi keys!) Oh well, onwards and upwards; that's no longer a problem.

just got a chance - _why (2006-07-06 (Thr) 21:45:06)

I just got a chance to play with this. It's excellent. The letter-jump is just wonderful. The RAW/NORMAL mode is a really nice touch as well.

Where did you get that mpd and battery-monitor? - codemac (2006-07-04 (Tue) 16:54:05)

I'm not trying to be an ass, but you should at least put a comment in saying where you got those mpd and battery monitoring script. Using my code is one thing, distributing it as yours is another.

Wael Nasreddine 2006-07-04 (Tue) 22:41:43

As I said here http://bbs.archlinux.org/viewtopic.php?t=22592&start=40 , it's my fault not mpd's fault, I forgot to mention the code of these 2 applets came from you codemac, so i guess problem kinda solved unless there's something else to add.

Again for both of you I apologize about forgetting to mention that it's your code :)

mfp 2006-07-05 (Wed) 01:57:50

Sorry, I thought it was Wael's code, as I acknowledged in the comments and THANKS:

Wael Nasreddine
* contributed battery-monitor and mpd

I hope there's no problem with this being distributed under the terms of the Ruby license; in that case, I'll credit you in THANKS. Otherwise, I'd see if there's any of the original code left and rewrite it ;-)

No Title - Dan (2006-07-04 (Tue) 12:09:10)

Very cool. I've been running an earlier version of this from your Darcs repository for a few days now, and it's a great upgrade. This is becoming quite a capable enhancement to the window manager -- I don't think I'd be nearly as intersted in wmii if not for wmii-ruby.

Dan 2006-07-04 (Tue) 12:11:00


Last modified:2006/07/04 04:08:58
Keyword(s):[blog] [ruby] [frontpage] [wmii] [0.3.0] [release] [plugin]
References:[ruby-wmii: Ruby configuration/scripting for the wmii window manager]