Configuring Wmii's Status Bar
July 27th, 2007
I discovered the default status bar script while poking around and added a few lines to make it more useful on my laptop. I post the whole thing here to motivate anyone who has not tried wmii to give it a chance. The status bar script can be run without restarting wmii using MOD-a. I noticed that I sometimes wound up with a few instances running so an occasional kill wouldn’t hurt if you see strange things happening on the status bar.
There’s nothing stopping folks from using ruby, scheme, haskell, python, or compiled C to write these scripts since the interface to wmii is a p9 filesystem. Enough gushing. Here’s a shell script that shows battery info, system load, cpu speed, wireless info, and the time. Most of this code is the default install for wmii but the while loop has been edited. I should also note that it isn’t necessary to edit in /etc/X11/wmii-3/ as scripts in $HOME/.wmii-3/ of the same name are preferred.
$HOME/.wmii3/status or /etc/X11/wmii-3/status (on ubuntu at least)
#!/bin/sh
xwrite() {
file="$1"; shift
echo -n "$@" | wmiir write "$file"
}
wmiir remove /bar/status 2>/dev/null && sleep 2
wmiir create /bar/status
xwrite /bar/status/colors $WMII_NORMCOLORS
## Here is the place to customize
while xwrite /bar/status/data \
`acpi | sed 's/.*Battery .: //g; s/discharging/-/g; s/charging/+/g; s/charged//g; s/%.*/%/g; s/, //g'` \
`uptime | sed 's/.*: //; s/,//g; s/\s.*//g'` \
`cat /proc/cpuinfo | grep 'cpu MHz' | sed 's/.*: //g; s/\..*//g;'` \
`iwconfig eth1 | grep ESSID | sed 's/.*ESSID:"//g; s/"\s*$//g'` \
`iwconfig eth1 | grep 'Link Quality' | sed 's/\s*Link Quality=//; s/\s.*//'` \
`date +%H:%M:%S`
do
sleep 1
done
I still mouseclick the time and wireless info occasionally. Bad habit! The wmii way is MOD-Enter, cal, Ctrl-D. You have to love the way existing windows resize to accommodate the new terminal, then snap back to their previous position as it disappears. If the terminal contains an interesting dialog, just MOD-Shift-’number’ to tag it into a new workspace. I’ll be using vim’s shell execution a lot less.
Closing wmii tip: Set firefox to open new windows in a tab (Edit->Preferences->Tabs) or you’ll go nuts.
Sorry, comments are closed for this article.