Useful scripts for wmii on laptops

wmii has been the my window manager of choice ever since I first saw it. I recently got a shiny Dell M1330 and as anyone can guess Vista did not live longer than 2 hours on it. I had never used wmii on a laptop before and I saw that the default scripts are were obviously coded with desktop user in mind.

  • There is no battery indicator
  • You can't watch the CPU temperature
  • and you can't set the CPU frequency governor


Of course you can use gkrellm for the first two but it does not play nicely with dynamic window managers like wmii. If I wanted to drag windows around I'd use Gnome, thank you. It is much nicer to change the right side of the status bar to show current temperature and battery status. 

Beware! This change is for the sh script version of wmiirc. If you are using the other version this may not work.

In file: ~/.wmii-3.5/wmiirc change the part that says

Code:
# Status Bar Info
status() {
        echo -n $(uptime | sed 's/.*://; s/,//g') '|' $(date)
}

to

Code:
# Status Bar Info
status() {
	BAT=`acpi -b`
	LEFT=`echo $BAT | cut -d ',' -f 2`
	TEMP=`acpi -t -B -c | cut -d ',' -f 2 | cut -d "." -f 1`
	LOAD=$(uptime | sed 's/.*://; s/,//g')
	DATE=`date +"%d/%m/%y %R:%S"`
	echo -n T: $TEMP '|' B: $LEFT '|' $LOAD '|' $DATE
}

You can of course keep the longer date format by changing "$DATE" to $(date) but I like it shorter.

Now on to the Frequency Governor! You can download the script below and put it in ~/.wmii-3.5 . Don't forget to make it executable.

cpufreq @ SymbolEngine

Now when you run the cpufreq action you will be asked for your password. This is because CPU governor can only be changed by root user. After that you'll get a nice dmenu on top of the screen to choose a governor.

I hope you find these scripts useful.

Popularity: 14% [?]

  1. It was helpful for me!
    Battery indicator works right!
    Thanks!

    • guru sahibi
    • April 19th, 2011

    What about a wireless connection menu?

  2. I don’t really use wmii anymore, and moved on to i3. Current version of i3 has a system tray, so you can use the network manager tray app from whichever desktop environment you fancy.

  1. No trackbacks yet.