[dev][wmii] My simple wmii tweaks

From: loz.accs <loz.accs_AT_gmail.com>
Date: Fri, 11 Feb 2011 14:23:05 +0900

Hi, wmii is the first wm I really wanted to customize. I like plan9
ideas and scripting wmii is very easy and handy =)

The first thing - status bar, default all-in-one bar is cool, but I
don't like "|" separators, especially when we can have many bars.

So, my simple solution looks like this:

# add one status
add_status() {
    # $1 = status suffix, will be appended to string 'status-'
    # $2 = status colors
    # $3 = fill command
    echo "$2" | wmiir create /rbar/status-"$1"
    # for some reasons we must use echo `eval $3`
    while echo `eval "$3"` | wmiir write /rbar/status-"$1"; do
        sleep 1

# remove all statuses
remove_statuses() {
    statuses="$(wmiir ls /rbar | grep status)"
    for i in $statuses; do
        wmiir remove /rbar/"$i" 2>/dev/null
    sleep 2 # sure that all statuses removed?

# fill commands for add_status example:
# get free memory in MB
get_mem() {
    free -m | awk '/Mem/ { print $3-$7"MB" }' # used - cached

and after "Action status" in wmiirc we don't need standart status-commands now:

Action status
        set +xv
        add_status 49 "$WMII_STATUSCOLORS" "get_processes_cpu" &
        add_status 50 "$WMII_STATUSCOLORS" "get_temp" &
        add_status 51 "$WMII_STATUSCOLORS" "get_mem" &
        # etc

The number - first argument to add_status - defines status position
among other statuses.
So, you can use different colors and refresh time for every status-bar.

Only problem here - fill funtions that can return nothing, for example
my get_processes_cpu returns processes that takes more than 10% cpu,
and empty bar with borders is annoying.

And second thing I made - simple native wmii notifications through status bar.
I pasted script here: http://paste.pocoo.org/raw/336248/
It runs program with all arguments you give to it and when program
finished blinked notify appears =)
One thing - you need to define $WMII_STATUSCOLORS, it used to create
highlighted colors.

I'm using it to notify me when I'm installing packets, syncing packets
repository and etc.

Here is my full wmiirc: http://paste.pocoo.org/raw/336250/
And screenshot of all things together:

And a question to wmii-developers, what language is preffered to use
in future wmii versions? Still sh or python, ruby? How far are we from
wmii-4? =)

btw, I can help with wmii development, but I don't know where to start.
Received on Fri Feb 11 2011 - 06:23:05 CET

This archive was generated by hypermail 2.2.0 : Fri Feb 11 2011 - 06:24:02 CET