ruby-wmii community: plugins and configurations
Latest news [2007-12-04] ruby-wmii updated for use with wmii 3.6 The previous code has been moved to the -3.1 branches, and both head and branch-ruby-ixp work with 3.6. Still no tarball release, and the documentation on this site has yet to be updated. The standard plugins are being converted (some bugs remain), 3rd party plugins might require modifications.
Plugins
Yes, some people actually use ruby-wmii and have written plugins for it :-) Several applets in the standard distribution were contributed by others, but there are a few other external resources you might find of interest:
- several plugins by Nathan Howell:
- support for .desktop files from Gnome, KDE, ROX, XFCE in the program menu
- listing of connectable ssh hosts in the program menu
- pushing/pulling selected client from/to current view
- menu-based music controller supporting:
- totem
- banshee
- rhythmbox
- beep-media-player
- mpc/mpd
- squeezebox
- FreeBSD status bar and xmms control by Andy Gimblett.
- A mail plugin written by _why, on redhanded.
- A few wmii3 hacks, also by _why
- a simple plugin to execute yubnub commands (also see www.yubnub.org), by Thomas Neumann
- a simple plugin to show system events in statusbar, with examples on how to integrate it with micq, remind and procmail, by Hannes Schulz
- a few plugins including a weather plugin, a clipboard and an amarok-now-playing plugin, by Olli Heins. (the page is in german, but the code is in ruby ;-)
- a wifi signal strength monitor in applet, by lucas
- another gnome menu emulator by Brad Phelan. It keeps the menu groups
- feel free to complete this list (I know of half a dozen plugins out there, but don't have the links handy atm. -- mfp)
Configuration
you can share your snippets here
Intelligent client retagging
A note about client retagging: it's been pointed out to me that the 'rules' at the start of the wmiirc-config.rb can be used as an easier method of autotagging. I had not realized this, and I guess the only advantage to using my example is if for some reason you want a little more control, as with the way I title my terminal windows and then tag them by parts of their titles by looking at /client/n/name. I don't know if 'rules' looks at /client/n/class or name, though...
I messed around with wmiirc-config.rb to get it to auto-tag some of my clients (like the default browser-tagged-as-web bit). I wrote about it here: on my blog, but here's the code snip:
# these are tags for particular apps that I want to have
# new tags - note, they won't get appended to their current tag
tag_for_apps = {
"irc" => "Xchat",
"gaim" => "Gaim",
"web" => "Firefox",
"4-jedit" => "jedit"
}
# these are terminals that I've given specific titles to
# so they can be tagged
tag_for_named_terms = {
"2-consoles" => "console:",
"3-logs" => "log:",
"1-terms" => "term:"
}
# now when a new client comes up, check for an autotag
on_createclient do |cid|
LOGGER.info "checking for autotag on class: #{read("/client/#{cid}/class")} " +
"and name: #{read("/client/#{cid}/name")} "
# if this client is a terminal, check the 'name'
if /terminal/ =~ read("/client/#{cid}/class")
tag_for_named_terms.each do |tfn|
names_re = /#{tfn[1]}/
if names_re =~ read("/client/#{cid}/name")
write("/client/#{cid}/tags", tfn[0])
LOGGER.info " ... autotag'd #{tfn[1]} with #{tfn[0]}!"
end
end
# not a terminal, so go by the 'class'
else
tag_for_apps.each do |tfa|
apps_re = /#{tfa[1]}/
if apps_re =~ read("/client/#{cid}/class")
write("/client/#{cid}/tags", tfa[0])
LOGGER.info " ... autotag'd #{tfa[1]} with #{tfa[0]}!"
end
end
end
end
# ... rest of wmiirc-config.rb
As I mentioned in my blog post, I wonder if this would be a candidate for a plugin. I had a tough time figuring out how to go about setting it up as a plugin, however, so I'd love to hear any hints.
- Jason L
Fast switching (frame zooming) between max and default modes
When I want more space in terminal frame for scrollback, I press MODKEY-h. It's very simple, but I missed this feature somehow.
In my eo-plugins.rb file:
binding("toggle-view", "MODKEY-h") do |wmii, keyhandler|
mode = case wmii.read("/view/sel/mode")
when "default" then "max"
when "max" then "default"
when "stack" then "default"
end
wmii.write("/view/sel/mode", mode)
- <xeox at xaoizorax xorgx> (Remove all x's, please.)
Tagging new windows from the shell
Ctrl-Alt-y works well for starting new apps from wmiimenu, but sometimes you want or need to start something from a shell prompt. Here's a simple hack to do that:
To wmiirc-config.rb, add:
# Hack to tag "next" window from shell or elsewhere
@nexttag = ""
register("NextWindowTags", nil, nil) {|tag,| @nexttag = tag }
on_createclient do |cid|
if @nexttag != ""
write("/client/#{cid}/tags", @nexttag )
@nexttag = ""
end
end
To your .bashrc or equivalent, add:
function on () {
TAG=$1
shift
echo "NextWindowTags $TAG" | wmiir write /event
$*
}
Reload your wmiirc, and source the bash function, and you should now be able to automatically tag new windows from the shell. For example:
$ on email xterm -e mutt & $ on irc xterm -e irssi & $ on code+work vim /path/to/some/code.c &
- Dave O'Neill (<dmo@dmo.ca>)
- 16 http://planetruby.0x42.net
- 13 http://www.artima.com/forums/flat.jsp?forum=123&thread=172021
- 8 http://www.artima.com/forums/flat.jsp?forum=123&thread=173133
- 5 http://offtheline.net
- 5 http://ie.search.msn.com/results.aspx?srch=3&q=xeox&first=21&FORM=PERE2
- 3 http://offtheline.net/2006/9/1/wmii-auto-tagging
- 3 http://del.icio.us/tag/wmii?setcount=100
- 2 http://www.google.es/custom?q=wmii kde&sa=Buscar&client=pub-3225298916884765&forid=1&channel=7487108496&ie=ISO-8859-1&oe=ISO-8859-1&cof=GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1;&hl=es
- 2 http://www.rojo.com/story/5e-OE2AIOTH8QLN0
- 2 http://offtheline.net/misc
Keyword(s):[ruby] [wmii] [contrib]
References:[ruby-wmii 0.3.1: bookmark manager, generalized menus, view history...] [Extending the wmii WM with more plugins; thanks, Nathan] [Opening up my hiki wiki: bliki.rb plugin] [ruby-wmii: Ruby configuration/scripting for the wmii window manager] [Running your tests automatically with autotest + wmii, emacs and ratpoison]