wmgtemp: Add verson 1.1 to repository.

From
http://fluxcode.net/files/wmgtemp-1.1.tar.gz
This commit is contained in:
Doug Torrance 2017-02-01 21:51:55 -05:00 committed by Carlos R. Mafra
parent 4474efbed2
commit bdaf5fd1f6
21 changed files with 2946 additions and 0 deletions

131
wmgtemp/Artistic Normal file
View file

@ -0,0 +1,131 @@
The "Artistic License"
Preamble
The intent of this document is to state the conditions under which a
Package may be copied, such that the Copyright Holder maintains some
semblance of artistic control over the development of the package,
while giving the users of the package the right to use and distribute
the Package in a more-or-less customary fashion, plus the right to make
reasonable modifications.
Definitions:
"Package" refers to the collection of files distributed by the
Copyright Holder, and derivatives of that collection of files
created through textual modification.
"Standard Version" refers to such a Package if it has not been
modified, or has been modified in accordance with the wishes
of the Copyright Holder as specified below.
"Copyright Holder" is whoever is named in the copyright or
copyrights for the package.
"You" is you, if you're thinking about copying or distributing
this Package.
"Reasonable copying fee" is whatever you can justify on the
basis of media cost, duplication charges, time of people involved,
and so on. (You will not be required to justify it to the
Copyright Holder, but only to the computing community at large
as a market that must bear the fee.)
"Freely Available" means that no fee is charged for the item
itself, though there may be fees involved in handling the item.
It also means that recipients of the item may redistribute it
under the same conditions they received it.
1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.
2. You may apply bug fixes, portability fixes and other modifications
derived from the Public Domain or from the Copyright Holder. A Package
modified in such a way shall still be considered the Standard Version.
3. You may otherwise modify your copy of this Package in any way, provided
that you insert a prominent notice in each changed file stating how and
when you changed that file, and provided that you do at least ONE of the
following:
a) place your modifications in the Public Domain or otherwise make them
Freely Available, such as by posting said modifications to Usenet or
an equivalent medium, or placing the modifications on a major archive
site such as uunet.uu.net, or by allowing the Copyright Holder to include
your modifications in the Standard Version of the Package.
b) use the modified Package only within your corporation or organization.
c) rename any non-standard executables so the names do not conflict
with standard executables, which must also be provided, and provide
a separate manual page for each non-standard executable that clearly
documents how it differs from the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
4. You may distribute the programs of this Package in object code or
executable form, provided that you do at least ONE of the following:
a) distribute a Standard Version of the executables and library files,
together with instructions (in the manual page or equivalent) on where
to get the Standard Version.
b) accompany the distribution with the machine-readable source of
the Package with your modifications.
c) give non-standard executables non-standard names, and clearly
document the differences in manual pages (or equivalent), together
with instructions on where to get the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
5. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this
Package. You may not charge a fee for this Package itself. However,
you may distribute this Package in aggregate with other (possibly
commercial) programs as part of a larger (possibly commercial) software
distribution provided that you do not advertise this Package as a
product of your own. You may embed this Package's interpreter within
an executable of yours (by linking); this shall be construed as a mere
form of aggregation, provided that the complete Standard Version of the
interpreter is so embedded.
6. The scripts and library files supplied as input to or produced as
output from the programs of this Package do not automatically fall
under the copyright of this Package, but belong to whoever generated
them, and may be sold commercially, and may be aggregated with this
Package. If such scripts or library files are aggregated with this
Package via the so-called "undump" or "unexec" methods of producing a
binary executable image, then distribution of such an image shall
neither be construed as a distribution of this Package nor shall it
fall under the restrictions of Paragraphs 3 and 4, provided that you do
not represent such an executable image as a Standard Version of this
Package.
7. C subroutines (or comparably compiled subroutines in other
languages) supplied by you and linked into this Package in order to
emulate subroutines and variables of the language defined by this
Package shall not be considered part of this Package, but are the
equivalent of input as in Paragraph 6, provided these subroutines do
not change the language in any way that would cause it to fail the
regression tests for the language.
8. Aggregation of this Package with a commercial distribution is always
permitted provided that the use of this Package is embedded; that is,
when no overt attempt is made to make this Package's interfaces visible
to the end user of the commercial distribution. Such use shall not be
construed as a distribution of this Package.
9. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.
10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
The End

0
wmgtemp/BUGS Normal file
View file

13
wmgtemp/CREDITS Normal file
View file

@ -0,0 +1,13 @@
Here are a list of people that have contributed to the project
and whose help and advice is greatly appreciated.
Damian Kramer <psiren@hibernaculum.demon.co.uk>
Jon Kinred <compart@one.net.au> - W83781D, W83627HF support.
William Martin <bill@dunfoamin.org> - AS99127F support.
Dennis Schneider <sdans@web.de> - ADM1021 support.
Per Larsson <albatorsk@comatosehitmen.com> IT87 support.
Antti Pyykko <pyksy@pyksy.fi> - lm_sensors3 support, -c option.
Ben Spencer <dangerous.ben@gmail.com> - drawing fix.
Robert Cernansky <hslists@zoznam.sk> - testing.
Ludwig Nussel <lugwig.nussell@web.de> - removed usleep, bugfixes.

323
wmgtemp/ChangeLog Normal file
View file

@ -0,0 +1,323 @@
Project Version : rel-1_1
2010-06-21 11:54 kronos
* src/: wmgtemp-interface.xpm, wmgtemp.c: applied patch from Ludwig
Nussell re: t flag and degree drawing
2010-06-21 11:54 kronos
* CREDITS: applied path from Ludwig Nussell re: t flag and degree
drawing
2010-03-26 21:27 kronos
* CREDITS: dev
2010-03-26 21:22 kronos
* BUGS: rc segfault bug fixed
2010-03-26 21:21 kronos
* CREDITS: minor update
2010-03-26 21:15 kronos
* wmgtemp.1: update man page
2010-03-26 21:09 kronos
* CREDITS, src/wmgtemp.c, src/wmgeneral/wmgeneral.c: fixed segfault
in wmgeneral. compiles with lm_sensors3, can now specify the
sensors config. added chip selection option
2007-06-14 11:01 kronos
* Makefile, wmgtemp.1, src/Makefile, src/wmgtemp.c: merged patch
from Josip Rodin and Lugwig Nussel
2003-06-10 19:33 kronos
* src/wmgtemp.c: added version to help screen
2003-06-10 19:29 kronos
* README, wmgtemp.1, examples/wmgtemprc, src/wmgtemp.c: added
feature1/2 options, added quiet option
2003-03-12 00:57 kronos
* CREDITS, src/wmgtemp.c: removed multiline string literal,
deprecated in gcc-3.2
2002-06-14 02:21 kronos
* README, src/Makefile: now usiing dynamic chipset detection
2002-02-24 21:27 kronos
* wmgtemp.1: removed suported sensors stuff
2002-02-24 21:24 kronos
* CREDITS: fixed typo in email
2002-02-24 21:19 kronos
* src/wmgtemp.c: switched t autodetection of chips
2001-06-09 03:49 kronos
* CREDITS, README, wmgtemp.1, src/wmgtemp.c: merged in ADM1021
support re Dennis Schneider <sdans@wed.de>. Added temperature
swapping
2001-04-17 01:53 kronos
* README: added AS99127F to sensor lis
2001-04-17 01:48 kronos
* src/wmgtemp.1x: removed coz i wrote a better one and added it
somewhere else and forgot about this one
2001-04-17 01:45 kronos
* Makefile: Modified manpage install - actually works this time,
that'll teach me for doing it at work and not testing it ;)
2001-04-17 01:45 kronos
* wmgtemp.1: HELP for ckable tempscale indicator - cycling.
2001-04-17 01:44 kronos
* src/wmgtemp.c: Added clickable tempscale indicator - cycling.
2001-04-13 15:29 kronos
* INSTALL, Makefile: Added manpage install
2001-04-13 02:04 kronos
* wmgtemp.1: Initial add of manpage
2001-04-13 02:02 kronos
* CREDITS, src/wmgtemp.c: Added support for AS99127F and fixed the
bug that stopped the temps being displayed in other scales
2001-02-28 20:55 kronos
* src/wmgtemp.c: Corrected help screen defailt temps for min and
max
2001-02-28 20:53 kronos
* TODO: updated with doneness
2001-02-28 20:41 kronos
* src/wmgtemp-interface.xpm: Changed high temp viewing indicator
light to amber
2001-02-28 20:34 kronos
* src/wmgtemp.c: Fixed typo in help, removed extra -h flag on help
screen, correct processing of -u flag.
2001-02-28 16:50 kronos
* src/wmgtemp.c: Changed summink to test email notification
2001-02-28 16:47 kronos
* src/wmgtemp.c: testing email notifications
2001-02-28 14:48 kronos
* src/wmgtemp.c: Fixed lagging screen drawing
2001-02-28 14:47 kronos
* examples/wmgtemprc: Initial add
2001-02-28 14:46 kronos
* BUGS: added blurb
2001-02-27 20:57 kronos
* README: Added guff
2001-02-27 20:34 kronos
* BUGS: Added
2001-02-27 20:28 kronos
* src/: wmgtemp-interface.xpm, wmgtemp.c: Changed commandline
processing to getopt, Added rcfile processing, Added MAX temp
viewing indicator light
2001-02-26 20:45 kronos
* src/: wmgtemp-interface.xpm, wmgtemp.c: Last commit added support
for W83781D and W83627HF. This: Added support for optional
displaying of CPU/SYS temp on graph.
2001-02-26 17:15 kronos
* src/: wmgtemp-interface.xpm, wmgtemp.c: Added HIGH temp
displaying, execing of command at given temp
2001-02-26 14:15 kronos
* CREDITS: Added note for Jon Kinred <compart@one.net.au>
2001-02-26 14:14 kronos
* src/wmgtemp.c: W83781D, W83627HF support.
2001-02-23 21:01 kronos
* src/wmgtemp.1x: Added manpage
2001-02-22 21:13 kronos
* INSTALL: updated instructions
2001-02-22 21:12 kronos
* Makefile: Added missing install option
2001-02-22 21:08 kronos
* TODO: checked off completed ideas
2001-02-22 20:57 kronos
* src/wmgtemp.c: Converted to use signals - xevents weren't being
handled in a timely manner
2001-02-22 20:22 kronos
* src/wmgtemp.c: Code cleanup
2001-02-21 20:38 kronos
* src/wmgtemp.c: moved drawing of range lines
2001-02-21 20:05 kronos
* src/: wmgtemp-interface.xpm, wmgtemp.c: Revamped graph rescaling,
not so zoomy
2001-02-16 19:42 kronos
* src/wmgtemp.c: Updated usage
2001-02-16 19:40 kronos
* src/Makefile: Added 'depend' back in, oops!
2001-02-16 19:40 kronos
* src/.deps: New
2001-02-16 19:33 kronos
* src/wmgtemp.c: tidied a few things
2001-02-16 19:29 kronos
* src/Makefile: removed 'depend', not needed
2001-02-16 19:23 kronos
* src/: .xvpics/wmgtemp-interface.xpm, .xvpics/wmlm_master.xpm,
.deps: Removed, shouldn't be maintained by cvs
2001-02-16 19:06 kronos
* CREDITS: Initial
2001-02-16 18:56 kronos
* TODO: Checked off completed items
2001-02-16 18:53 kronos
* src/wmgtemp.h: Removed coz it ain't needed
2001-02-16 18:48 kronos
* src/: wmgtemp.c: Added CPU temp warning lights
2001-02-16 14:55 kronos
* src/wmgtemp.c: Got rid of a few of the if's in temperature
scaling
2001-02-16 14:46 kronos
* src/: wmgtemp.c, wmgtemp.h: Modified graph to scale on the fly
depending on temperature ranges of displayed values.
2001-02-09 21:52 kronos
* src/wmgtemp.c: added checking for invalid delay
2001-02-09 21:50 kronos
* src/wmgtemp.c: corrected update delay message
2001-02-09 21:46 kronos
* src/wmgtemp.c: changed error message for unsupported chip
2001-02-09 21:40 kronos
* src/: wmgtemp-interface.xpm, wmgtemp.c, wmgtemp.h: Adding
structure to make supporting other chipssets easier
2001-02-07 18:58 kronos
* TODO: added ideas while i still remember them
2001-02-07 18:52 kronos
* src/wmgtemp.c: added usage for block and line
2001-02-07 18:51 kronos
* TODO: added ideas while i still remember them
2001-02-07 18:47 kronos
* Artistic, INSTALL, README, TODO: Initial
2001-02-07 18:34 kronos
* src/: wmgtemp.c, wmgtemp.h: added rudimentary graph drawing
2001-02-07 17:28 kronos
* Makefile, src/.deps, src/Makefile,
src/wmgtemp-interface-mask.xbm, src/wmgtemp-interface.xpm,
src/wmgtemp.c, src/wmgtemp.h, src/wmgeneral/misc.c,
src/wmgeneral/misc.h, src/wmgeneral/wmgeneral.c,
src/wmgeneral/wmgeneral.h, src/wmgeneral/list.c,
src/wmgeneral/list.h, src/.xvpics/wmgtemp-interface.xpm,
src/.xvpics/wmlm_master.xpm: Initial revision
2001-02-07 17:28 kronos
* Makefile, src/.deps, src/Makefile,
src/wmgtemp-interface-mask.xbm, src/wmgtemp-interface.xpm,
src/wmgtemp.c, src/wmgtemp.h, src/wmgeneral/misc.c,
src/wmgeneral/misc.h, src/wmgeneral/wmgeneral.c,
src/wmgeneral/wmgeneral.h, src/wmgeneral/list.c,
src/wmgeneral/list.h, src/.xvpics/wmgtemp-interface.xpm,
src/.xvpics/wmlm_master.xpm: initial import of tidied up version

5
wmgtemp/INSTALL Normal file
View file

@ -0,0 +1,5 @@
1. make depend
2. make
3. su root
4. make install
5. make install.man (optional)

17
wmgtemp/Makefile Normal file
View file

@ -0,0 +1,17 @@
INSTALL=install
MANINSTDIR=/usr/local/man/man1
MANPAGE=wmgtemp.1
all:
( cd src && $(MAKE) )
depend:
( cd src && $(MAKE) depend )
install:
( cd src && $(MAKE) install INSTDIR=$(INSTDIR) )
$(INSTALL) -d $(MANINSTDIR)
$(INSTALL) -m 755 -c $(MANPAGE) $(MANINSTDIR)/$(MANPAGE)
clean:
( cd src && $(MAKE) clean)

42
wmgtemp/README Normal file
View file

@ -0,0 +1,42 @@
-------------------------------------------------------------------------
You may distribute this program under the terms of the Artistic
License.
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 Artistic
License for more details.
-------------------------------------------------------------------------
wmgtemp is a dock app intended for use with WindowMaker.
It displays the CPU and SYS temperatures (both in numerically and
graphically) of motherboards that use the VIA686A chipset. Currently
this is the only chipset that is supported but I have the intention of
adding support for other chipsets in the future.
Interface Features:
Clicking on the temperature toggles displaying of maximum reached
temperature. This mode is indicated by a green upward pointing
arrow to the left of the temperature.
Clicking on CPU or SYS toggles displaying of that temperature
type on the graph. The temperature value will still be displayed
numerically however.
Clicking on the Graph area will cycle through the graph types.
When the bounds of the graph are exceeded the graph will be rescaled
the show the current temperature and a line will be drawn to indicate
the bound(red for upper bound, blue for lower bound). As soon as
all temperatures being displayed are within a bound, the graph will
be rescaled back to normal size.
Supported Sensors:
Unlike other versions, this version tries to auto detects sensors.
This means it should work with any sensors that lm_sensors supports.
Send any bug reports and ideas to:
Roger Dunce (kronos@fluxcode.net)

14
wmgtemp/TODO Normal file
View file

@ -0,0 +1,14 @@
o Make the graph scalable. - DONE
o Add temperature range indicators. - DONE (warning lights)
o Add support for windowmaker properties rather than crappy command line
flags that are used currently.
o Put proper installation together.
o Add support for more chipsets
o Add abitily to change graph types by clicking on graph area. - DONE
o Add max reached temps, eg click CPU and temp is displayed in a different
colour and displays the maximum temp.(possibly draws a horizontal line in
the graph too to indcate where that lies on current graph) - DONE:
Simply changes the colour of the temperature value to red.
Independant clicking of CPU and SYS temps.
o Add ability to exec a program when a given temp is reached. - DONE

View file

@ -0,0 +1,22 @@
# Graph style, 'block' or 'line', 'b' and 'l' for the lazy
graph: block
# Scale type, 'celcius', 'fahrenheit' or 'kelvin', 'c', 'f' or 'k' for the lazy.
scale: celcius
# High CPU temperature (red light)
high: 50
# Warning CPU temperature(amber light)
warn: 45
# Upper bound of graph
max: 35
# Lower bound of graph
min: 20
# Execute a command at this temperature
execat: 80
# What to execute at the above temperature.
exec: xmessage "Ouch, I'm HOT!"
# Update delay in seconds
update: 2
# Use temp3 for second sensor
feature2:temp3
# Be quiet
quiet:y

2
wmgtemp/src/.deps Executable file
View file

@ -0,0 +1,2 @@
wmgtemp.o: wmgtemp.c wmgeneral/wmgeneral.h wmgeneral/misc.h \
wmgtemp-interface.xpm wmgtemp-interface-mask.xbm

32
wmgtemp/src/Makefile Normal file
View file

@ -0,0 +1,32 @@
CC = gcc
INSTALL = /usr/bin/install
LIB = lib
LDFLAGS = -L/usr/X11R6/$(LIB) -lXpm -lXext -lX11 -lsensors
BINARY = wmgtemp
CCFLAGS = -Wall -g
INSTDIR = /usr/local/bin
OFILES = wmgtemp.o \
./wmgeneral/wmgeneral.o \
./wmgeneral/misc.o \
./wmgeneral/list.o
%.o:
$(CC) $(CCFLAGS) -c $*.c -o $*.o
$(BINARY): $(OFILES)
$(CC) $(OFILES) $(LDFLAGS) -o $(BINARY)
clean:
@ $(RM) $(OFILES) *~ "#"* $(BINARY)
install::
$(INSTALL) -m 755 -c $(BINARY) $(INSTDIR)/$(BINARY)
depend:
@ $(CC) -MM *.c > .deps
count:
@ wc -l *.c *.h | sort
include .deps

View file

@ -0,0 +1,169 @@
/* Generic single linked list to keep various information
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
Author: Kresten Krab Thorup
Many modifications by Alfredo K. Kojima
This file is part of GNU CC.
GNU CC 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, or (at your option)
any later version.
GNU CC 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 GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "list.h"
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <stdlib.h>
/* Return a cons cell produced from (head . tail) */
INLINE LinkedList*
list_cons(void* head, LinkedList* tail)
{
LinkedList* cell;
cell = (LinkedList*)malloc(sizeof(LinkedList));
cell->head = head;
cell->tail = tail;
return cell;
}
/* Return the length of a list, list_length(NULL) returns zero */
INLINE int
list_length(LinkedList* list)
{
int i = 0;
while(list)
{
i += 1;
list = list->tail;
}
return i;
}
/* Return the Nth element of LIST, where N count from zero. If N
larger than the list length, NULL is returned */
INLINE void*
list_nth(int index, LinkedList* list)
{
while(index-- != 0)
{
if(list->tail)
list = list->tail;
else
return 0;
}
return list->head;
}
/* Remove the element at the head by replacing it by its successor */
INLINE void
list_remove_head(LinkedList** list)
{
if (!*list) return;
if ((*list)->tail)
{
LinkedList* tail = (*list)->tail; /* fetch next */
*(*list) = *tail; /* copy next to list head */
free(tail); /* free next */
}
else /* only one element in list */
{
free(*list);
(*list) = 0;
}
}
/* Remove the element with `car' set to ELEMENT */
/*
INLINE void
list_remove_elem(LinkedList** list, void* elem)
{
while (*list)
{
if ((*list)->head == elem)
list_remove_head(list);
*list = (*list ? (*list)->tail : NULL);
}
}*/
INLINE LinkedList *
list_remove_elem(LinkedList* list, void* elem)
{
LinkedList *tmp;
if (list) {
if (list->head == elem) {
tmp = list->tail;
free(list);
return tmp;
}
list->tail = list_remove_elem(list->tail, elem);
return list;
}
return NULL;
}
/* Return element that has ELEM as car */
INLINE LinkedList*
list_find(LinkedList* list, void* elem)
{
while(list)
{
if (list->head == elem)
return list;
list = list->tail;
}
return NULL;
}
/* Free list (backwards recursive) */
INLINE void
list_free(LinkedList* list)
{
if(list)
{
list_free(list->tail);
free(list);
}
}
/* Map FUNCTION over all elements in LIST */
INLINE void
list_mapcar(LinkedList* list, void(*function)(void*))
{
while(list)
{
(*function)(list->head);
list = list->tail;
}
}

View file

@ -0,0 +1,59 @@
/* Generic single linked list to keep various information
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
Author: Kresten Krab Thorup
This file is part of GNU CC.
GNU CC 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, or (at your option)
any later version.
GNU CC 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 GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
to be covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#ifndef __LIST_H_
#define __LIST_H_
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# define INLINE inline
#else
# define INLINE
#endif
typedef struct LinkedList {
void *head;
struct LinkedList *tail;
} LinkedList;
INLINE LinkedList* list_cons(void* head, LinkedList* tail);
INLINE int list_length(LinkedList* list);
INLINE void* list_nth(int index, LinkedList* list);
INLINE void list_remove_head(LinkedList** list);
INLINE LinkedList *list_remove_elem(LinkedList* list, void* elem);
INLINE void list_mapcar(LinkedList* list, void(*function)(void*));
INLINE LinkedList*list_find(LinkedList* list, void* elem);
INLINE void list_free(LinkedList* list);
#endif

View file

@ -0,0 +1,164 @@
/* dock.c- built-in Dock module for WindowMaker
*
* WindowMaker window manager
*
* Copyright (c) 1997 Alfredo K. Kojima
*
* 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.
*/
#include <stdlib.h>
#include <string.h>
#include "list.h"
#include "misc.h"
/*
*----------------------------------------------------------------------
* parse_command--
* Divides a command line into a argv/argc pair.
*----------------------------------------------------------------------
*/
#define PRC_ALPHA 0
#define PRC_BLANK 1
#define PRC_ESCAPE 2
#define PRC_DQUOTE 3
#define PRC_EOS 4
#define PRC_SQUOTE 5
typedef struct {
short nstate;
short output;
} DFA;
static DFA mtable[9][6] = {
{{3,1},{0,0},{4,0},{1,0},{8,0},{6,0}},
{{1,1},{1,1},{2,0},{3,0},{5,0},{1,1}},
{{1,1},{1,1},{1,1},{1,1},{5,0},{1,1}},
{{3,1},{5,0},{4,0},{1,0},{5,0},{6,0}},
{{3,1},{3,1},{3,1},{3,1},{5,0},{3,1}},
{{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
{{6,1},{6,1},{7,0},{6,1},{5,0},{3,0}},
{{6,1},{6,1},{6,1},{6,1},{5,0},{6,1}},
{{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
};
char*
next_token(char *word, char **next)
{
char *ptr;
char *ret, *t;
int state, ctype;
t = ret = malloc(strlen(word)+1);
ptr = word;
state = 0;
*t = 0;
while (1) {
if (*ptr==0)
ctype = PRC_EOS;
else if (*ptr=='\\')
ctype = PRC_ESCAPE;
else if (*ptr=='"')
ctype = PRC_DQUOTE;
else if (*ptr=='\'')
ctype = PRC_SQUOTE;
else if (*ptr==' ' || *ptr=='\t')
ctype = PRC_BLANK;
else
ctype = PRC_ALPHA;
if (mtable[state][ctype].output) {
*t = *ptr; t++;
*t = 0;
}
state = mtable[state][ctype].nstate;
ptr++;
if (mtable[state][0].output<0) {
break;
}
}
if (*ret==0)
t = NULL;
else
t = strdup(ret);
free(ret);
if (ctype==PRC_EOS)
*next = NULL;
else
*next = ptr;
return t;
}
extern void
parse_command(char *command, char ***argv, int *argc)
{
LinkedList *list = NULL;
char *token, *line;
int count, i;
line = command;
do {
token = next_token(line, &line);
if (token) {
list = list_cons(token, list);
}
} while (token!=NULL && line!=NULL);
count = list_length(list);
*argv = malloc(sizeof(char*)*count);
i = count;
while (list!=NULL) {
(*argv)[--i] = list->head;
list_remove_head(&list);
}
*argc = count;
}
extern pid_t
execCommand(char *command)
{
pid_t pid;
char **argv;
int argc;
parse_command(command, &argv, &argc);
if (argv==NULL) {
return 0;
}
if ((pid=fork())==0) {
char **args;
int i;
args = malloc(sizeof(char*)*(argc+1));
if (!args)
exit(10);
for (i=0; i<argc; i++) {
args[i] = argv[i];
}
args[argc] = NULL;
execvp(argv[0], args);
exit(10);
}
return pid;
}

View file

@ -0,0 +1,9 @@
#ifndef __MISC_H
#define __MISC_H
#include <unistd.h>
extern void parse_command(char *, char ***, int *);
extern pid_t execCommand(char *);
#endif /* __MISC_H */

View file

@ -0,0 +1,483 @@
/*
Best viewed with vim5, using ts=4
wmgeneral was taken from wmppp.
It has a lot of routines which most of the wm* programs use.
------------------------------------------------------------
Author: Martijn Pieterse (pieterse@xs4all.nl)
---
CHANGES:
---
14/09/1998 (Dave Clark, clarkd@skyia.com)
* Updated createXBMfromXPM routine
* Now supports >256 colors
11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
* Removed a bug from parse_rcfile. You could
not use "start" in a command if a label was
also start.
* Changed the needed geometry string.
We don't use window size, and don't support
negative positions.
03/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
* Added parse_rcfile2
02/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
* Added -geometry support (untested)
28/08/1998 (Martijn Pieterse, pieterse@xs4all.nl)
* Added createXBMfromXPM routine
* Saves a lot of work with changing xpm's.
02/05/1998 (Martijn Pieterse, pieterse@xs4all.nl)
* changed the read_rc_file to parse_rcfile, as suggested by Marcelo E. Magallon
* debugged the parse_rc file.
30/04/1998 (Martijn Pieterse, pieterse@xs4all.nl)
* Ripped similar code from all the wm* programs,
and put them in a single file.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <stdarg.h>
#include <X11/Xlib.h>
#include <X11/xpm.h>
#include <X11/extensions/shape.h>
#include "wmgeneral.h"
/*****************/
/* X11 Variables */
/*****************/
Window Root;
int screen;
int x_fd;
int d_depth;
XSizeHints mysizehints;
XWMHints mywmhints;
Pixel back_pix, fore_pix;
char *Geometry = "";
Window iconwin, win;
GC NormalGC;
XpmIcon wmgen;
Pixmap pixmask;
/*****************/
/* Mouse Regions */
/*****************/
typedef struct {
int enable;
int top;
int bottom;
int left;
int right;
} MOUSE_REGION;
MOUSE_REGION mouse_region[MAX_MOUSE_REGION];
/***********************/
/* Function Prototypes */
/***********************/
static void GetXPM(XpmIcon *, char **);
static Pixel GetColor(char *);
void RedrawWindow(void);
void AddMouseRegion(int, int, int, int, int);
int CheckMouseRegion(int, int);
/*******************************************************************************\
|* parse_rcfile *|
\*******************************************************************************/
void parse_rcfile(const char *filename, rckeys *keys) {
char *p,*q, *t;
char temp[128];
char *tokens = " :\t\n";
FILE *fp;
int i,key;
fp = fopen(filename, "r");
if (fp) {
while (fgets(temp, 128, fp)) {
key = 0;
q = strdup(temp);
t = strtok(q, tokens);
if(t) {
while (key >= 0 && keys[key].label) {
if ((!strcmp(t, keys[key].label))) {
p = strstr(temp, keys[key].label);
p += strlen(keys[key].label);
p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p);
key = -1;
} else key++;
}
}
free(q);
}
fclose(fp);
}
}
/*******************************************************************************\
|* parse_rcfile2 *|
\*******************************************************************************/
void parse_rcfile2(const char *filename, rckeys2 *keys) {
char *p;
char temp[128];
char *tokens = " :\t\n";
FILE *fp;
int i,key;
char *family = NULL;
fp = fopen(filename, "r");
if (fp) {
while (fgets(temp, 128, fp)) {
key = 0;
while (key >= 0 && keys[key].label) {
if ((p = strstr(temp, keys[key].label))) {
p += strlen(keys[key].label);
p += strspn(p, tokens);
if ((i = strcspn(p, "#\n"))) p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p);
key = -1;
} else key++;
}
}
fclose(fp);
}
free(family);
}
/*******************************************************************************\
|* GetXPM *|
\*******************************************************************************/
static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
XWindowAttributes attributes;
int err;
/* For the colormap */
XGetWindowAttributes(display, Root, &attributes);
wmgen->attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
err = XpmCreatePixmapFromData(display, Root, pixmap_bytes, &(wmgen->pixmap),
&(wmgen->mask), &(wmgen->attributes));
if (err != XpmSuccess) {
fprintf(stderr, "Not enough free colorcells.\n");
exit(1);
}
}
/*******************************************************************************\
|* GetColor *|
\*******************************************************************************/
static Pixel GetColor(char *name) {
XColor color;
XWindowAttributes attributes;
XGetWindowAttributes(display, Root, &attributes);
color.pixel = 0;
if (!XParseColor(display, attributes.colormap, name, &color)) {
fprintf(stderr, "wm.app: can't parse %s.\n", name);
} else if (!XAllocColor(display, attributes.colormap, &color)) {
fprintf(stderr, "wm.app: can't allocate %s.\n", name);
}
return color.pixel;
}
/*******************************************************************************\
|* flush_expose *|
\*******************************************************************************/
static int flush_expose(Window w) {
XEvent dummy;
int i=0;
while (XCheckTypedWindowEvent(display, w, Expose, &dummy))
i++;
return i;
}
/*******************************************************************************\
|* RedrawWindow *|
\*******************************************************************************/
void RedrawWindow(void) {
flush_expose(iconwin);
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
flush_expose(win);
XCopyArea(display, wmgen.pixmap, win, NormalGC,
0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
}
/*******************************************************************************\
|* RedrawWindowXY *|
\*******************************************************************************/
void RedrawWindowXY(int x, int y) {
flush_expose(iconwin);
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
flush_expose(win);
XCopyArea(display, wmgen.pixmap, win, NormalGC,
x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
}
/*******************************************************************************\
|* AddMouseRegion *|
\*******************************************************************************/
void AddMouseRegion(int index, int left, int top, int right, int bottom) {
if (index < MAX_MOUSE_REGION) {
mouse_region[index].enable = 1;
mouse_region[index].top = top;
mouse_region[index].left = left;
mouse_region[index].bottom = bottom;
mouse_region[index].right = right;
}
}
/*******************************************************************************\
|* CheckMouseRegion *|
\*******************************************************************************/
int CheckMouseRegion(int x, int y) {
int i;
int found;
found = 0;
for (i=0; i<MAX_MOUSE_REGION && !found; i++) {
if (mouse_region[i].enable &&
x <= mouse_region[i].right &&
x >= mouse_region[i].left &&
y <= mouse_region[i].bottom &&
y >= mouse_region[i].top)
found = 1;
}
if (!found) return -1;
return (i-1);
}
/*******************************************************************************\
|* createXBMfromXPM *|
\*******************************************************************************/
void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j,k;
int width, height, numcol, depth;
int zero=0;
unsigned char bwrite;
int bcount;
int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
for (k=0; k!=depth; k++)
{
zero <<=8;
zero |= xpm[1][k];
}
for (i=numcol+1; i < numcol+sy+1; i++) {
bcount = 0;
bwrite = 0;
for (j=0; j<sx*depth; j+=depth) {
bwrite >>= 1;
curpixel=0;
for (k=0; k!=depth; k++)
{
curpixel <<=8;
curpixel |= xpm[i][j+k];
}
if ( curpixel != zero ) {
bwrite += 128;
}
bcount++;
if (bcount == 8) {
*xbm = bwrite;
xbm++;
bcount = 0;
bwrite = 0;
}
}
}
}
/*******************************************************************************\
|* copyXPMArea *|
\*******************************************************************************/
void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) {
XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
}
/*******************************************************************************\
|* copyXBMArea *|
\*******************************************************************************/
void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) {
XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
}
/*******************************************************************************\
|* setMaskXY *|
\*******************************************************************************/
void setMaskXY(int x, int y) {
XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet);
XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet);
}
/*******************************************************************************\
|* openXwindow *|
\*******************************************************************************/
void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, int pixmask_width, int pixmask_height) {
unsigned int borderwidth = 1;
XClassHint classHint;
char *display_name = NULL;
char *wname = argv[0];
XTextProperty name;
XGCValues gcv;
unsigned long gcm;
char *geometry = NULL;
int dummy=0;
int i, wx, wy;
for (i=1; argv[i]; i++) {
if (!strcmp(argv[i], "-display")) {
display_name = argv[i+1];
i++;
}
if (!strcmp(argv[i], "-geometry")) {
geometry = argv[i+1];
i++;
}
}
if (!(display = XOpenDisplay(display_name))) {
fprintf(stderr, "%s: can't open display %s\n",
wname, XDisplayName(display_name));
exit(1);
}
screen = DefaultScreen(display);
Root = RootWindow(display, screen);
d_depth = DefaultDepth(display, screen);
x_fd = XConnectionNumber(display);
/* Convert XPM to XImage */
GetXPM(&wmgen, pixmap_bytes);
/* Create a window to hold the stuff */
mysizehints.flags = USSize | USPosition;
mysizehints.x = 0;
mysizehints.y = 0;
back_pix = GetColor("white");
fore_pix = GetColor("black");
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
mysizehints.width = 64;
mysizehints.height = 64;
win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
/* Activate hints */
XSetWMNormalHints(display, win, &mysizehints);
classHint.res_name = wname;
classHint.res_class = wname;
XSetClassHint(display, win, &classHint);
XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
if (XStringListToTextProperty(&wname, 1, &name) == 0) {
fprintf(stderr, "%s: can't allocate window name\n", wname);
exit(1);
}
XSetWMName(display, win, &name);
/* Create GC for drawing */
gcm = GCForeground | GCBackground | GCGraphicsExposures;
gcv.foreground = fore_pix;
gcv.background = back_pix;
gcv.graphics_exposures = 0;
NormalGC = XCreateGC(display, Root, gcm, &gcv);
/* ONLYSHAPE ON */
pixmask = XCreateBitmapFromData(display, win, pixmask_bits, pixmask_width, pixmask_height);
XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask, ShapeSet);
XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet);
/* ONLYSHAPE OFF */
mywmhints.initial_state = WithdrawnState;
mywmhints.icon_window = iconwin;
mywmhints.icon_x = mysizehints.x;
mywmhints.icon_y = mysizehints.y;
mywmhints.window_group = win;
mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
XSetWMHints(display, win, &mywmhints);
XSetCommand(display, win, argv, argc);
XMapWindow(display, win);
if (geometry) {
if (sscanf(geometry, "+%d+%d", &wx, &wy) != 2) {
fprintf(stderr, "Bad geometry string.\n");
exit(1);
}
XMoveWindow(display, win, wx, wy);
}
}

View file

@ -0,0 +1,59 @@
#ifndef WMGENERAL_H_INCLUDED
#define WMGENERAL_H_INCLUDED
/***********/
/* Defines */
/***********/
#define MAX_MOUSE_REGION (16)
/************/
/* Typedefs */
/************/
typedef struct _rckeys rckeys;
struct _rckeys {
const char *label;
char **var;
};
typedef struct _rckeys2 rckeys2;
struct _rckeys2 {
const char *family;
const char *label;
char **var;
};
typedef struct {
Pixmap pixmap;
Pixmap mask;
XpmAttributes attributes;
} XpmIcon;
/*******************/
/* Global variable */
/*******************/
Display *display;
/***********************/
/* Function Prototypes */
/***********************/
void AddMouseRegion(int index, int left, int top, int right, int bottom);
int CheckMouseRegion(int x, int y);
void openXwindow(int argc, char *argv[], char **, char *, int, int);
void RedrawWindow(void);
void RedrawWindowXY(int x, int y);
void createXBMfromXPM(char *, char **, int, int);
void copyXPMArea(int, int, int, int, int, int);
void copyXBMArea(int, int, int, int, int, int);
void setMaskXY(int, int);
void parse_rcfile(const char *, rckeys *);
#endif

View file

@ -0,0 +1,46 @@
/* Created with The GIMP */
#define wmgtemp_interface_mask_width 62
#define wmgtemp_interface_mask_height 62
static unsigned char wmgtemp_interface_mask_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x3f };

View file

@ -0,0 +1,120 @@
/* XPM */
static char * wmgtemp_interface_xpm[] = {
"83 90 27 1",
" c None",
". c #0000FF",
"+ c #202020",
"@ c #00FFFF",
"# c #1C8C8C",
"$ c #004941",
"% c #000000",
"& c #333133",
"* c #666366",
"= c #202322",
"- c #999599",
"; c #22332F",
"> c #20B2AE",
", c #188A86",
"' c #212F2C",
") c #C7C3C7",
"! c #202121",
"~ c #0D4039",
"{ c #202423",
"] c #06443D",
"^ c #FF0000",
"/ c #451A1A",
"( c #07C907",
"_ c #00FF00",
": c #D99800",
"< c #E0BA00",
"[ c #AA0000",
".............................................................. +@#$ $$ ",
".%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&* +@#$ $$ ",
".%++++++++++++++++++++++++++++++++++++++=+++=+=++++++++=+++++- +@#$ >> ",
".%+++++++++;>>>,+,>>>,+,$$$,+++$++;$$$;+;$$$;+'$$$;+>>+'$$$;+) +@#$ >> ",
".%+++;$;+++>+++$+>+++>+>+++>++;$;+$+++$+$+++$+$+++$+>>+$+++$+) +@#$ ",
".%++;$$$;++>+++$+>+++>+>+++>++$$$+$+++$+$+++$!~+++$++++$+++~!) +@#$ ",
".%++$$$$$++,$$$;+,>>>,+,$$$,++++++;$$$;=;$$$;!;$$$;=++='$$$;{) +@#$ ",
".%++;$$$;++>+++$+>+++$+>+++>++++++$+++$+$+++$+$+++$++++$+++$+) +@#$ ",
".%+++;$;+++>+++$+>+++$+>+++>++++++]+++$+$+++$+$+++$++++$+++$+) +@#$ ",
".%+++++++++;>>>,+,$$$;+,>>>,++++++'$$$;+;$$$;='$$$;=+++;$$$;+) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) +@#$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) ;>>>,+,>>>,+,$$$, ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) >+++$+>+++>+>+++> ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) >+++$+>+++>+>+++> ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) ,$$$;+,>>>,+,$$$, ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) >+++$+>+++$+>+++> ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) >+++$+>+++$+>+++> ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) ;>>>,+,$$$;+,>>>, ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) ,>>>,+,$$$,+,>>>, ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) >+++$+>+++>+>+++$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) >+++$+>+++>+>+++$ ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) ,>>>,+,>>>,+,>>>, ",
".%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$) $+++>+$+>+$+$+++> ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) $+++>+$+>+$+$+++> ",
".%+++++++++,>>>,+,$$$,+,>>>,+++$++;$$$;+;$$$;+;$$$;+>>+;$$$;+) ,>>>,+;$>$;+,>>>, ",
".%+++;$;+++>+++$+>+++>+>+++$++;$;+$+++$+$+++$+$+++$+>>+$+++$+) ",
".%++;$$$;++>+++$+>+++>+>+++$++$$$+$+++$+$+++$+$+++$++++$+++$+) ",
".%++$$$$$++,>>>,+,>>>,+,>>>,++++++;$$$;+;$$$;+;$$$;++++;$$$;+) ",
".%++;$$$;++$+++>+$+>+$+$+++>++++++$+++$+$+++$+$+++$++++$+++$+) ",
".%+++;$;+++$+++>+$+>+$+$+++>++++++$+++$+$+++$+$+++$++++$+++$+) ",
".%+++++++++,>>>,+;$>$;+,>>>,++++++;$$$;+;$$$;+;$$$;++++;$$$;+) ",
".%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++) ",
".&-))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ",
" ",
" ",
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
"+;>>>;+;$$$,+,>>>,+,>>>,+,$$$,+,>>>,+,>>>,+,>>>,+,>>>,+,>>>,+;>>>,+,>>>,+,$$$,;$$$;",
"+>+++>+$+++>+$+++>+$+++>+>+++>+>+++$+>+++$+$+++>+>+++>+>+++>+>+++$+>+++$+>+++>$+++$",
"+>+++>+$+++>+$+++>+$+++>+>+++>+>+++$+>+++$+$+++>+>+++>+>+++>+>+++$+>+++$+>+++>$+++$",
"+,$$$,+;$$$,+,>>>,+;>>>,+,>>>,+,>>>,+,>>>,+;$$$,+,>>>,+,>>>,+,$$$;+,>>>;+,>>>;;$$$;",
"+>+++>+$+++>+>+++$+$+++>+$+++>+$+++>+>+++>+$+++>+>+++>+$+++>+>+++$+>+++$+>+++>$+++$",
"+>+++>+$+++>+>+++$+$+++>+$+++>+$+++>+>+++>+$+++>+>+++>+$+++>+>+++$+>+++$+>+++>$+++$",
"+;>>>;+;$$$,+,>>>,+,>>>,+;$$$,+,>>>,+,>>>,+;$$$,+,>>>,+,>>>,+;>>>,+,$$$;+,$$$,;$$$;",
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ",
"........................................................... ",
"/;$;/+(_(++:<:+/[^[/++$+++<+ ",
";$$$;(___(:<<<:[^^^[+;$;+:<: ",
"$$$$$_____<<<<<^^^^^+$$$+<<< ",
";$$$;(___(:<<<:[^^^[ ",
"/;$;/+(_(++:<:+/[^[/ ",
"+++++++++++++++++++ ",
"+;>$>;+;>>>;+,;;;,+ ",
"+>+>+>+>+++>+>+++>+ ",
"+>+>+>+>+++>+>+++>+ ",
"+,$$$,+,>>>,+;>>>;+ ",
"+>+++>+>+++>+>+++>+ ",
"+>+++>+>+++>+>+++>+ ",
"+,;;;,+,$$$,+,;;;,+ ",
"+++++++++++++++++++ ",
" "};

1083
wmgtemp/src/wmgtemp.c Normal file

File diff suppressed because it is too large Load diff

153
wmgtemp/wmgtemp.1 Normal file
View file

@ -0,0 +1,153 @@
.\" Hey, Emacs! This is an -*- nroff -*- source file.
.TH "wmgtemp" 1 "February 2001" ""
.SH NAME
wmgtemp \- Temperature sensor dock app for Window Maker
.SH SYNOPSIS
.B wmgtemp
.I "[options]"
.SH "DESCRIPTION"
wmgtemp is a dock-app for Window Maker that graphically displays the CPU and
System temperatures using the lm_sensors package. It displays the CPU and
System temperature values, a scaling graph of temperature history,
high-temperature warning lights and temperatures in degrees Celsius,
Fahrenheit or Kelvin.
.PP
The temperature graph is auto scaling, meaning that if the max or min temperature boundary is crossed the graph will be scaled to display the temperature. A red line marks the upper boundary whereas a blue line indicates the lower boundary. When all the temperatures being displayed are within the boundaries the graph will be scaled back to the preset values for min/max and the boundary indicator lines will be removed.
.PP
The high temperature warning lights located on the left of the temperature type indicators show amber or red when the warning or high temperatures are reached respectively. Normal operating temperature is indicated by no light.
.SH "OPTIONS"
.TP
.B \-h, \-\-help
display the usage information
.TP
.B \-s, \-\-scale=SCALE
show temperatures using SCALE temperature scale. SCALE=celcius, fahrenheit or kelvin.
.br
\fBDefault\fP: celcius
.TP
.B \-S, \-\-sensorconf=PATH
specify the PATH to the lm_sensors config
.br
\fBDefault\fP: /etc/sensors.conf
.TP
.B \-g, \-\-graph=STYLE
display graph as STYLE. STYLE=line or block.
.br
\fBDefault\fP: line
.TP
.B \-H, \-\-high=TEMP
display red warning light at TEMP degrees celcius.
.br
\fBDefault\fP: 50
.TP
.B \-w, \-\-warn=TEMP
display amber warning light at TEMP degrees celcius.
.br
\fBDefault\fP: 45
.TP
.B \-u, \-\-update=SEC
update the display every SEC seconds.
.br
\fBDefault\fP: 1
.TP
.B \-m, \-\-min=TEMP
set the lower bound of the graph to TEMP degrees celcius.
.br
\fBDefault\fP: 20
.TP
.B \-M, \-\-max=TEMP
set the upper bound of the graph to TEMP degrees celcius.
.br
\fBDefault\fP: 35
.TP
.B \-1, \-\-feature1=F1
set the feature for CPU
.br
\fBDefault\fP: temp1
.TP
.B \-2, \-\-feature2=F2
set the feature for SYS
.br
\fBDefault\fP: temp2
.TP
.B \-c, \-\-chip=CHIP
specify the chip sensor to use
.br
\fBDefault\fP: auto
.TP
.B \-a, \-\-execat=TEMP
execute a command at TEMP degrees celcius.
.br
\fBDefault\fP: none
.TP
.B \-e, \-\-exec=COMMAND
execute COMMAND when the 'execat' temperature is reached.
.br
\fBDefault\fP: none
.TP
.B \-t, \-\-swap
swap/transpose temperature values
.TP
.B \-q, \-\-quiet
Don't display any messages
.PP
.SH FILES
~/.wmgtemprc User configuration.
.PP
The format of this file is:
.nf
.IP
# wmgtemp example config
scale:celcius
graph:line
high:50
warn:45
update:1
min:25
max:35
execat:80
exec:shutdown -h 10
swap:n
quiet:y
feature1:temp1
feature2:temp2
.PP
.SH USAGE
.SS Graph
You can cycle through the graph types by clicking on the graph display area.
.PP
.SS High Temperature Toggle
You can toggle the displaying of high temperatures by click on the temperature for the corrosponding temperature. The viewing of high temperatures is indicated by an amber arrow to the left of the temperature. The current temperatures will continue to be displayed on the graph.
.PP
.SH
.SS Temperature display TOGGLE
You may toggle the displaying of a temperature on the graph by clicking on the corrosponding type. e.g To toggle the display of the CPU temperature click on CPU. The type indicator (CPU or SYS) will disappear and the temperature will not be displayed on the graph, although the temperature value will continue to be displayed.
.PP
.SH
.SS Temperature Scale Cycling
You may change the scale the temperatures are displayed in by clicking on either of the CPU or SYS scale indicators. The cycle order is \fBC\fP -> \fBK\fP -> \fBF\fP
.PP
.SH BUGS
Blank lines in the config file cause a Segmentation Fault.
.PP
.SH SEE ALSO
.BR sensors.conf (5),
.BR libsensors (3),
.BR wmaker (1x)
.SH AUTHOR
wmgtemp was written by Roger Dunce <kronos@fluxcode.net>