diff options
author | Michael Stapelberg <michael+x200@stapelberg.de> | 2008-10-07 15:25:41 +0200 |
---|---|---|
committer | Michael Stapelberg <michael+x200@stapelberg.de> | 2008-10-07 15:25:41 +0200 |
commit | b9948793a5f02a649f1baf700baefab40e044567 (patch) | |
tree | 04240d53f3e6b9d7d39ef8c146bdf4067dcef7ca | |
parent | a49ff50578c3527634ff7cad11c8a2878403fde8 (diff) |
Add manpage, ignore spaces in tokens, introduce interval
-rw-r--r-- | config.c | 9 | ||||
-rw-r--r-- | config.h | 1 | ||||
-rw-r--r-- | wmiistatus.1 | 99 | ||||
-rw-r--r-- | wmiistatus.c | 2 |
4 files changed, 109 insertions, 2 deletions
@@ -19,10 +19,11 @@ const char *wmii_path; const char *time_format; const char *battery_path; bool use_colors; -const char *wmii_normcolors; +const char *wmii_normcolors = "#222222 #333333"; char order[MAX_ORDER][2]; const char **run_watches; unsigned int num_run_watches; +int interval = 1; void die(const char *fmt, ...); @@ -152,6 +153,8 @@ int load_configuration(const char *configfile) { SET_ORDER("load", ORDER_LOAD); SET_ORDER("time", ORDER_TIME); token = walk; + while (isspace((int)(*token))) + token++; } } OPT("color") @@ -162,6 +165,10 @@ int load_configuration(const char *configfile) { { wmii_normcolors = strdup(dest_value); } + OPT("interval") + { + interval = atoi(dest_value); + } else { result = -2; @@ -15,6 +15,7 @@ extern const char **run_watches; extern unsigned int num_run_watches; extern const char *wmii_normcolors; extern const char order[MAX_ORDER][2]; +extern int interval; extern bool use_colors; #endif diff --git a/wmiistatus.1 b/wmiistatus.1 new file mode 100644 index 0000000..fe7e725 --- /dev/null +++ b/wmiistatus.1 @@ -0,0 +1,99 @@ +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. + +.TH wmiistatus 1 "OCTOBER 2008" Linux "User Manuals" + +.SH NAME +wmiistatus \- fill wmii's status bar +.SH SYNOPSIS +.B wmiistatus +.RB [\|\-c +.IR configfile \|] + +.SH DESCRIPTION + +.B wmiistatus +is a small program for filling wmii's status bar via its 9P pseudo filesystem. It is designed to be very efficient by issuing a very small number of systemcalls (as the bar should be updated every second or at your specified interval). + +.SH CONFIGURATION +.TP +.B wlan +Specifies the name of your WLAN interface (e.g. wlan0 or ath0 or eth1). Don't specify if you don't have a WLAN interface or if it should not be displayed. + +.TP +.B eth +Specifies the name of your ethernet interface (e.g. eth0). Don't specify if you don't have an ethernet interface or if it should not be displayed. + +.TP +.B wmii_path +Specifies the path to the rbar-folder of your mounted wmii pseudo file system (e.g. /mnt/wmii/rbar/). It has to be terminated by a slash. + +.TP +.B time_format +Format for the time/date to be displayed. See strftime(3) or date(1). Don't specify it if you don't want the time to be shown. + +.TP +.B battery_path +The path to your battery's uevent file in /sys, e.g. /sys/class/power_supply/BAT0/uevent. Only interesting for you if you have more than one battery. Don't specify if you don't have a battery. + +.TP +.B run_watch +You can specify this directive multiple times. Each line first has a name (one word, separated by space) followed by a path (can contain wildcards, given to glob(3)). The path is the path to a PID-file which contains just the process ID of a process. wmiistatus will then check if the process is still running and displays "yes" or "no" depending on the status. This is useful for displaying if your VPN is running, or dhclient for DHCP and so on... + +.TP +.B order +Followed by a comma separated list of the modules (run, wlan, eth, battery, load, time) this directive specifies the order of the information which should be displayed. An order is accomplished by prefixing the files in wmii's /rbar directory with a number, that is 0VPN, 1DHCP, 2time and so on.. + +.TP +.B color +If specified, color mode is on. This affects WLAN which will be displayed red if WLAN is down and the run_watch system which will display the status in red/green. + +.TP +.B normcolors +Specifies the colors for background/border in the same format (html colorcodes) as wmii's configuration, that is #222222 #333333 for example. + +.TP +.B interval +Specifies the interval in which the status bar will be updated. If you got a very slow system or feel you don't need so much information, you may want to increase it. + +.SH FILES +.TP +.B /etc/wmiistatus.conf +System-wide configuration file. + +.SH EXAMPLE CONFIGURATION +.PP +.Vb 10 +\&wlan wlan0 +\ð eth0 +\&wmii_path /mnt/wmii/rbar/ +\&time_format %d.%m.%Y %H:%M:%S +\&battery_path /sys/class/power_supply/BAT0/uevent +\&run_watch DHCP /var/run/dhclient*.pid +\&run_watch VPN /var/run/vpnc*.pid +\&order run,wlan,eth,battery,load,time +\&normcolors #000000 #333333 +\&color +.Ve + +.SH MOUNTING WMII'S PSEUDO FILESYSTEM +As of now (October 2008, Linux 2.6.27) you can mount wmii's 9P pseudo filesystem using: +.PP +.Vb 1 +mount -t 9p -o rw,trans=unix,uname=michael,dfltuid=1000,dfltgid=50,name=michael,noauto,noextend /tmp/ns.michael.:0/wmii /mnt/wmii +.Ve + +.SH SEE ALSO +.BR strftime (3), +.BR date (1), +.BR glob (3) + +.SH AUTHOR +Michael Stapelberg <michael+wmiistatus at stapelberg dot de> diff --git a/wmiistatus.c b/wmiistatus.c index a658f81..714da1a 100644 --- a/wmiistatus.c +++ b/wmiistatus.c @@ -380,6 +380,6 @@ int main(void) { write_to_statusbar(concat(order[ORDER_TIME], "time"), part); } - sleep(1); + sleep(interval); } } |