Update (2008/11/20): Some basic information added to "Customizing WMII".
Preparing for the move to a university, I began setting up a mousless Linux
system, that will be comfortable when I finally manage to buy a notepad
(in the near future, hopefully). Mouseless editors I've been using for a long
time, no problem there. Browser: check (Vimperator or Conkeror will do nicely).
Music player: check (mpd + keybindings in the WM). What remains is the DE/WM
itself. I've been keeping an eye on tabbing window managers for a while and
decided to give WMII a go.
I have to say, I'm seriously in love.
It's lightweight and does everything I need from a WM.
Customizing WMII
WMII has a rather unique (compared to Gnome/KDE) and refreshing
attitude to settings. It provides a Plan9 virtual filesystem for interacting
with all the features. This means you can write customizations in anything from
sh to Python, compiled C or even PHP.
It has to be an executable, and it has to manipulate this virtual filesystem.
The way to do so is through wmiir, a wrapper around ixpc
to directly access the WMII filesystem. See wmiir (without arguments)
or man ixpc for the details.
The first thing you can do to shape your WMII the way you want is modify your wmiirc or
rc.wmii. See the WMII homepage for details on
which to choose. Whenever you see wmiirc in the following, you can safely read "wmiirc
or rc.wmii".
The system default is usually found in /etc/wmii-$version or /etc/X11/wmii-$version.
A file with the same name in your ~/.wmii-$version overrides this, so copy the default there
and get hacking. This is a shell script, but as mentiond above, it could be any executable. And I mean
executable, that is chmod +x wmiirc.
You can also create custom scripts run by the WM, actions in WMII lingo.
These should be in the same directory as the wmiirc executable. They must
themselves be executable, that is in /etc/[X11]/wmii-$version,
and just like your wmiirc, they can be anything from a shell script to compiled C++.
If there's a way to automatically start one on WMII startup, I haven't found it;
I currently include them in my wmiirc.
Pitfall: don't forget to add an & after anything you launch from your wmiirc, even in keybindings. It will otherwise wait for the new process to finish before processing anything else.
Examples
One thing I missed at first was a notification area for my music player and Pidgin.
The Pidgin problem I haven't solved yet, but the music player is nicely covered. There's
mention of a status-mpd script in several places, but I couldn't find a
downloadable version anywhere. Well, except for in a malformed cat output in some Russian
forum. The result of some tinkering is that I now have the following in in my statusbar:
[p] Metallica - Attitude 0:31/5:16I can also switch tracks with
Alt-Shift-n and Alt-Shift-p, and
pause/continue playing with Alt-Shift-w, thanks to mpc.
The somewhat modified status-mpd:
#!/bin/sh
xwrite() {
file="$1";
shift
echo -n "$@" | wmiir write "$file"
}
wmiir remove /rbar/mpd 2>/dev/null && sleep 2
wmiir create /rbar/mpd
while [ 1 ]
do
FILE=`mpc | sed -n '1p'`
STATUS=`mpc | sed -n '2s/\[\(.*\)\].*/\1/;2s/playing/p/p;2s/paused/s/p;2s/stopped/t/p'`
TIME=`mpc | sed -n '2s/.* \([^ ]*\).*/\1/p'`
xwrite /rbar/mpd "[$STATUS] $FILE $TIME"
sleep 1
done
And the lines that take care of the keybindings controlling mpd (add them below the default Key stuff):
Key $MODKEY-Shift-n mpc next > /dev/null Key $MODKEY-Shift-p mpc prev > /dev/null Key $MODKEY-Shift-w mpc toggle > /dev/null
The first listing, btw, was this time created by the VIM :TOhtml command.