You were never here, you didn't see anything..

XFCE & Wireless Signal


Currently if you wish to monitor the wireless signal level and other stats from your WiFi card under XFCE your options are limited. There is only one panel plug-in that is part of the XFCE Goodies project called xfce4-wavelan-plugin. It is nice but not quite what I wanted. I don’t use wicd (for several reasons) nor network manager (also several reasons). For the most part I am old school and use wpa_cli or manual configuration file editing. So the hunt was on to find something better.

In the end I decided to do a little custom solution. One can display most any data using the xfce4-genmon-plugin. This plug-in allows you to display data from just about any application and if the output is xml formatted it can get creative, for example displaying icons, percent bars and a tool tip.

To get the output I wanted which to start will be a simple icon with a percent bar for signal quality and a tool tip containing some details I wrote a basic shell script. The script (below) pulls data from iw, iwconfig and/or wpa_cli, decides what to display and formats the output using the specified xml tags.

The script:

#!/bin/bash

if [ $(/usr/bin/wpa_cli status | grep COMPLETED) ]
    then
        link=$(/usr/sbin/iw wlan0 link)
        quality=$(/sbin/iwconfig wlan0 | grep Quality | awk '{ print $2 }' | cut -d = -f 2 | awk -F "/" '{ print $1" * 100 / "$2 }' | bc | awk '{ print " "$1 }')

        echo "/usr/share/icons/Tango/22x22/devices/network-wireless.png"
        echo ${link}${quality} | awk '{ print ""$7" \n Freq          = "$9" \n Signal Qlty = "$32" % \n Signal Lvl   = "$21" " $22" \n Rate = "$25" "$26"     " }'
        echo "${quality}"
    else
        /usr/bin/wpa_cli scan
        APS=$(/usr/bin/wpa_cli scan_results | tail -n +3 | awk '{ print $5 }')
        echo "/usr/share/icons/Tango/22x22/status/dialog-warning.png"
        echo $link | awk '{ print "${APS}" }'
        echo "0"
    fi

Interestingly even in code tags I can not get the script to display with the xml tags in it. Maybe it is this computer or maybe it is the CMS, I don;t know right now. However to make sure the full script can be viewed I uploaded it and you can get to it using THIS LINK.

Some screen shots of the results:

Wireless Signal
Wireless Signal
Wirelss Details
Wirelss Details

I plan to update the script at some point but for now it does what I want. Looks a lot like the wavelan plug-in, but gives a bit more details. Should I not be connected it should spit out a list of APs in range in the tool tip but for now this is untested.

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This blog is kept spam free by WP-SpamFree.

Most who fail…

Most who fail have yet to really try!