WMALMS - WM Another LM_Sensors applet

Content

 What is wmalms ?
What wmalms  can do ?
What wmalms cannot do ?
What wmalms might be able to do ?..


Installation.

Installing  i2c drivers and lm_sensors
Xpm library
Installing wmalms...
        From a tarball (tar.gz)    From RPM package
Testing wmalms


Customizing.

Window location and appearance.
    -display    -wmode   icon title (-itind)
    -geometry    -transient    -font
    -bg    -led     -fg
Sensor values
     -device     -pages      temperature scale (-cent -fahr)
     -alarm     -value

Timing
     -refresh     -shift      -beep

Miscellaneous
     -help     -save


Starting wmalms  as a dockable / swallowed applet.

Window Maker   BlackBox, FluxBox and clones
Gnome   KDE (kwm + kpanel)    FVWM and clones
Controlling  wmalms at  run time

License

Credits

Where and Who


What is wmalms ?


wmalms stands for "Another LM_Sensors",  since the application needs lm_sensors package for its functionality (see Installation ). The application was designed as a window maker dockable applet (this is how wm sneaked into its name), but you can also run it as a swallowed application with any window or desktop manager  that supports swallowing, including gnome, kwm (kde), fvwm and its clones. Alternatively, you can run it as a normal window  with any window manager.

wmalms displays the values obtained from a 'health monitoring device', or  in plain words, a sensor chip,  installed on an i2c or SMBus compatible bus. Usually sensor data include voltage, temperature, fan speed. If you use a Pentium II+ or AMD K7 there is a considerable chance the the sensor chip is present on your motherboard.

What wmalms can do ?

What wmalms cannot do ?

wmalms cannot modify sensors' parameters, because this normally requires administrator access, while the alpplication was NOT designed for running as suid root.. However the application can either aquire the limits from the sensor, or  use custom limits (effective for wmalms only) for evaluating alarm status.

What wmalms might be able to do if I could spend more time on it ?

        You contribution is welcomed!


Installation.

Installing lm_sensors

You  need a recent kernel (Linux 2.4 is recommended), X11R6 - compatible server (like XFree86 3+) and  supported hardware.  The list of supported i2c bus devices and sensor chips is located at http://www.netroedge.com/~lm78/supported.html .  If unsure, follow the hints below ...  good luck!

Obtain i2c drivers and lm_sensors package from  http://www.netroedge.com/~lm78/download.html anf follow instruction  in QUICKSTART .  See if  your hardware is detected by  sensors-detect,  if it is, you have nothing to worry about !  Change /etc/rc.d/rc.modules and /etc/modules.conf as suggested by sensors-detect, restart the system (unless you know how to avoid that),  and type  'sensors'. If you get something long and hardly readable :=) you've done it!
 

Xpm library

It's almost impossible to imagine now X11 without libXpm. It for some reasons you don't have it, try
http://www.inria.fr/koala/lehors/xpm.html
ftp://avahi.inria.fr/pub/xpm
This is where it used to be a while ago, I hope it's still available.

Recent comments (Oct  2003): Now Xpm library comes with  XFree86, so that you don't have to worry about it.

Installing wmalms

From a tarball (tar.gz)

Just do:
tar -xzf wmalms-1.1.0.tar.gz
cd wmalms-1.1.0
./configure
make
After the application is built, log in as root and type
make install
................

As usually,  ./configure  recognises  --prefix    parameter
and accepts environment variables  CC and CFLAGS.

You can also specify location of documents, using --docdir  parameter.
Default locations

prefix: /usr/local
docdir:  ${datadir}/doc/wmalms-
             (usually  /usr/local/share/doc/wmalms-)


The use of parameters is shown by the following example:

export CC=gcc3
export CFLAGS='-march=athlon -mcpu=athlon -O6 '
./configure --prefix=/usr/X11R6  --docdir=/usr/share/doc/wmalms
.....


The following make scripts might also be useful:

make clean    - removes all object (.o) files forcing full recompilation
make wipe     - removes all generated files (objects, binaries, Makefile, cache, etc)
The installed package includes the following files:
${prefix}/bin/wmalms
${docdir}/README
${docdir}/manual.html
.

From RPM package

Log in as root.

With a binary package skip this  paragraph,  if you use a source distribution, you need to say

rpm --rebuild wmalms-1.0.0-1.src.rpm
and this will create a binary package in  usr/src/redhat/RPMS/i586 (it could be i386 or i486 ).
so that you need  to change directory:
cd usr/src/redhat/RPMS/i586


The final step and the only one if you use binary package:

    rpm -Uvh wmalms-1.0.0-1.i586.rpm

 

Testing wmalms


After installation is complete, drop the administrator privileges and try running:
 

wmalms -bg navy &
Non-transparent background will make the wndow more visible.

You most probably will need to customize it for to your hardware window manager and taste -
see instructions below.


Customizing.

wmalms takes parameters from the following sources, listed in preference order form lowest to highest:
  1. Global resource file:  /usr/lib/X11/app-defaults/WMalms or  /etc/X11/app-defaults/WMalms
  2. User resource file:.WMalms (note leading dot) in user's home directory
  3. Command line arguments.
It is highly recomended to use -save   argument for creating/updating  the resource files, rather than editing manually.

The description of command line  arguments follows
 

Window  location and appearance.

-display  name

  Not available as a resource

   Specifies display name (e.g. grumpy.mynet.net:0),  default display is used is omitted.

-wmode  mode 
-docked
-iconic
-wnd

Run application as a window or as an icon.  Possible mode values are:

Docked
Run as a docked icon (main window is withdrawn). Suits WindowMaker, BlackBox and clones
Window
Run in window mode (main window is mapped, icon is not created). Suits gnome, kde, fvwm, or in case docking/swallowing is not required.
Iconic
Start with main window iconified. Normally used in combination with Icon Title  specification
Guess (default)
The application will try to figure out which mode (Docked or Window) will be the best for your window manager.
-docked  -iconic  and -wnd  are equivalent to -wmode d , -wmode i,  and -wmode w  respectively.



Icon Title
-itind <indices>
-noitind

Show particular values specified by its order number (see SensorValues ) as icon title.  Some window managers (FluxBox,  fvwm) display icon names for iconified applications, so that you can monitor a particluar value when the application runs as an icon. To start the application as an icon use -wmode  i.

Icon values are numbered from  1 to maximum index .  You can specify up to 8 indices separated with spaces or commas.

Example:
        wmalms -wmode i  -itind "2,5"  -value2 "temp1"  -value5 "fan2"

wmalms starts in iconic mode and shows temp1 and fan2 values in icon name.

-noitind  disable using icon name for values.


-geometry  geometry
-nogeometry

As is common for an X11 application, geometry specfifies size and/or position of the window in format:

[=][<size>][{+-}<xoffset>{+-}<yoffset>]


Size is 64(default) or 48.

In order to specify window location, you need to include bothxoffset and yoffset. Each of these values is interpreted as an offset from left / top screen border, if positive, or from  right / bottom border , if negative. The offset is always evaluated from the nearest window boundary

-nogeometry disables geometry, specified as a resource. This implies size 64 x 64 and default location.

Examples:

    -geom  48            window size 48x48, use default location
    -geom  +100+5   size 48, locate at x=100,  y=5
    -geom  -50+5     align to right (leave gap of 50) y=5
    -geom   -0-0      align to bottom right corner

Hint. Explicitly specified window position normally results  in suppressing window manager placement policy. This might be useful if a window manager is configured for manual (mouse) placement, especially with fvwm: GoodStuff will naively attempt mouse placement even for a swallowed window !

Another example when explicit location is needed for a swallowed application is related to FvwmButtons module (used most often with fvwm2).  With an old version of FvwmButtons  (I hope this has been fixed by now !) the application window will appear on the desktop for a short time during  FvwmButtons initialization. If that annoys you,  you just need to set  location in an off-screen area (-geometry  48-2000-1500).

-transient
-notransient

Apply/don't apply transient hint to the application window. This might affect window decoration. Some WM (like kwm)  hide iconify button for a transient window, that allows seing the caption, some others (fvwm and clone) can be configured not to draw a caption for a transient window. Default: -notransient

-font

Font name used for the labels,  given in HPCE  format (e.g. . "-*-fixed-medium-*-*--8-80-*-*-*-50-*-*")
or as an alias (e.g. "5x8").  Default font : 5x8 for size 64x64,  5x7 for size 48x48

-bg  colour_list

List of colours used for window background. Can specify a separate colour for each page  separated with comas (,),
or a single colour for all pages,  Special colour name none is used for transparent background.  Default: none

-led  led colour

Colours for sensor readings ("leds")  in normal and alarm state.  Specified as two coma-separated colour names.
Default:  green,red

-fg colour list

Colour for label for each page coma separated. If omitted, the default value is substituted,
Default: yellow,cyan.magenta,white
 

Sensor values.

-device device_name

Usually a motherbord has only a single sensor device, and this device will be processed (wmalms skips the device named eepromsince EEPROM data themselves are not of much use in our case). However it can be a situation when explicitly specified chip name can avoid confusion. You can specified a just chip name (-device w83782d), or a full lm_sensors name including bus and slot (-device w83782d-i2c-0-2d).

-pages count

Number of display pages (1 - 4) . Each page has 4 values. Pages are changing at a regular interval of time or on request.
Default: 2.

-cent
-fahr

Show temperatures using Centigrade (default) or Fahrenheit scale.

-alarm
-noalarm

Alarm mode:  if some pages are in alarm state,  only alarmed pages are shown and sound signal can be generated regularly (see beep ).
Non-alarm mode (default):  always show all pages is sequence

A page is in alarmed state, if at least one value on this pages is beyond the limits, and is not marked as alarm-insignificant (see value parameters below)

-value1  settings
-value2  settings
.  .   .
-value16  settings

These iare probably the most important wmalms parameters that specify which sensor value is displayed at each place.
The values are numbered from 1 to 16:  page 1  has values 1 to 4,   values 4 to 8 are located on page 2, etc.

For each value you can specify the following parameters, separated by a coma (,):

name,title,decimals,min_value,max_value,alarm_significant

If you are satisfied with default, you can skip any value (so that several comas appear one after another),  and even drop the whole tail: no need to code trailing comas.  Don't forget to put the list in quotes ("...") if special characters (like semicolons) or spaces appear inside it !

Here are the fields:

Comments: it appears that for negative values (e.g. -12V) the chip hardware does not follow standard arithmetic rules, i.e. the sensor believes that -13 is greater than -11 !   For this reason wmalms using a compromise: whatever you think it will take actual minimum as min(min_value, max_value), and actual maxmum as max(min_value, max_value).

Example:  the following lines are equivalent for my chip:

-value8  "in6,,2,-4.2,-7.4"
-value8 "-5V,,2,-7.4,-4.2,1"
In first case the internal name is specified, while lm_sensors label is used for the second line.

Another example:

             -value1 =  ",sysT,2"

Sets wmalms title for value1 to sysT (system temperature) and increases number of decimal places to 2. Hardware limits are used.
 

Timing

-refresh  interval

    Specifies interval (in seconds) between consequtive data updates as an integer in range 1 to 60. Default 4.

-shift  interval

 Specifies interval (in seconds) between consequtive automatic page changes, in range  4 to 600. Default 60.
shift value cannot be less than refresh value. if it happens refresh value is set to be also shift value.
 For efficiency it is recomended (though not necessary) to take shift as a multiple of refresh
 (i.e  shift / refresh is an integer)

-beep  interval
       -nobeep

Specifies interval (in seconds) between consequtive sound signals in alarm state, (e.g.. how annoying is the
alarm) in range  automatic page changes, in range  0 to 30.
Value 0 (default), or  -nobeep disables sound.  A positive -beep interval implicitly turns on alarm processing  (specified by  -alarm   command line argument)

shift value cannot be less than refresh value. if it happens refresh value is set to be also shift value.
In case sound is enabled, for efficiency it is recomended (though not necessary) to select beep interval as a multiple of refresh interval and/or vice versa.
 

Miscellaneous options.

-help

Display list of command line arguments and quit. The list is sent to standard output file.
Help pages is also displayed incase of command line error, where is is followed by an error message.
 

-save

Include this command line argument to create or update user resource file. The existing resource parameters (if any) are combined with command line arguments (which can overwrite resource settings) and the combined set of parameters  is stored in the user resource file.

Example:

 wmalms -save  -geometry -0+5 -refresh 2  -beep 4  -shift 20  -fg "black,dark green,maroon"
Next time you just type  'wmalms' and your settings are recovered.

All  arguments cant be stored as resources, apart from the following: -display-help -save .


Starting wmalms as a dockable / swallowed applet.

Actually I am not a window manager guru and keep rather old versions of kde, gnome and fvwm.
I simply sassume that having silly instructions is better than having none.
 

Window Maker

Just start   wmalms &  and drag application icon to the dock. Can you imagine something simpler ?
You will be able to control the icon in run time.

BlackBox, FluxBox and clones

Type   wmalms &

If it doesn't go to slit, try    wmalms -docked  &

With some styles you might need to use a -bg and/or -fg,  to improve the appearence.

To get the application started automatically with X, you need to add  the line to ~/.xinitrc  (I hope some clones can handle that in a neater way).

Gnome

Right click on the panel.  and  select Add Swallowed app, which brings up 'Create swallowed applet' window.
In the window type:
    Title:  wmalms
    Command:  wmalms  -geom 48 -fg "dark blue,dark red,dark green"
    Width and height 48 or more  (For me 48x48 looks squashy, while 56x56 is fine)
    Press OK and hopefully the window appears.

You can control windows in run time.

Tested with  gpanel 1.0.55 and enlightenment 0.15.5.

Gnome 2 does not support running swallowed applications.

KDE (kwm + kpanel)

Right click on the desktop. In the popup menu select New|Application
In the  appearing window, select
    New Application:   wmalms.kdelnk

In the appearing kfm form, select Execute tab and type a text similar to the following:

Execute  (on top)
    wmalms -bg "dark blue" -transient -geometry -0+5 -wnd

Swallowing on panel
    Execute:  wmalms -geom 48 -fg "dark blue,dark red,dark green"
    Window Title: wmalms

Run in terminal: NOT ticked.

Select OK to create a new icon on the desktop
Drag the icon to panel  and wait till the aplication start.

You can't control the applet in run time, but you can use swallowed icon as a link: clicking it with left button starts the application in non-swallowed mode.

Tested with kwm 0.14 and kpanel 0.20

KDE 2 and 3  do not support running swallowed applications. Get


FVWM and clones

Can we miss  the swallowing pioneer  fvwm? If you still use it  with GoodStuff,  just add  to ~/.fvwmrc something similar to the following (tested with fvwm 1.24r):

*GoodStuff wmalms  None   Swallow "wmalms" wmalms -fg DarkSlateGray,navy,maroon -geom 48+0+0 &

If you use  fvwm2 or fvwm95 and  FvwmButtons module  with normal icon size (e.g.   Module FvwmButtons  appear in InitFunction list without MiniButtons parameter), add the following line to ~/.fvwm2rc ( ~/.fvwm95rc for fvwm95):

*FvwmButtons wmalms  NULL Swallow "WMalms" Exec wmalms -geometry 48-2000-1500

(See comments regarding  -geometry  above ).

For all fvwm versions you should be able control the window in run time.


Controlling wmalms at run time.

There isn't a lot you can do with the application during run time. Where you run it in a swallowed mode there is a chance that your window manager wiill trap all mouse clicks.  In any case when transparent background (-bg none) is used, try  clicking on the value window , because a pixel outside it might belong to transparent area, which is inaccessible for the application:

The following key + mouse button combinations force changing displayed page:

    Shift key + left mouse  - go to the previous (previous alarmed) page
    Shift key + right mouse - go to the next (next alarmed) page

This is a safe way to quit wmalms:
    Ctrl key + right mouse - quit.

Another way of safe quit is  "Close Window"  (appearing also as  "Delete",  or  x button)
Avoid "Kill Window" where possible !


License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the

Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA.


Credits

It all was started from wmbp6 - a nifty dockable applet written by Red Seb.
Though it didn't work for me (as BTW all other lm_sensors applets I tried), it must be looking really cool, as the pixmap suggests.  Substantial part of size 64 pixmap  (including led numbers) is shamelessly borrowed from there.
 


Where and Who.

wmalms is available  from  http://www.geocities.com/wmalms/

Please send comments (of any kind!)  to me (Michael Glickman): wmalms@yahoo.com .
If you do that, please include 'wmalms' into the subject to help me filter it out of junk mail.

Check Web for my other GNU Linux and X11 applications:  ifrac   sadp   itetris .