[Pkg-wmaker-commits] [wmbattery] 01/241: Initial revision
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Mon Aug 24 23:37:17 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmbattery.
commit adb95e0f8de8e07bc70fc28a6a83a5eb21f98258
Author: joey <joey at a4a2c43b-8ac3-0310-8836-e0e880c912e2>
Date: Sun Sep 5 17:54:00 1999 +0000
Initial revision
---
COPYING | 339 ++++++++++++++++++++++++++++++++++++++++++++++
INSTALL | 11 ++
Makefile | 21 +++
README | 29 ++++
TODO | 7 +
battery_high.xpm | 19 +++
battery_low.xpm | 20 +++
battery_medium.xpm | 20 +++
battery_none.xpm | 18 +++
bigfont.xpm | 17 +++
charging.xpm | 19 +++
debian/changelog | 20 +++
debian/control | 23 ++++
debian/copyright | 26 ++++
debian/menu | 2 +
debian/rules | 76 +++++++++++
dial_bright.xpm | 41 ++++++
dial_dim.xpm | 41 ++++++
face.xpm | 73 ++++++++++
mask.xbm | 46 +++++++
nocharging.xpm | 18 +++
plugged.xpm | 17 +++
smallfont.xpm | 16 +++
unplugged.xpm | 17 +++
wmbattery.1 | 32 +++++
wmbattery.1x | 32 +++++
wmbattery.c | 391 +++++++++++++++++++++++++++++++++++++++++++++++++++++
wmbattery.h | 86 ++++++++++++
28 files changed, 1477 insertions(+)
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..a43ea21
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ 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.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..78d424c
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,11 @@
+Quickstart: run "make test" to compile and test the program.
+
+To install, you should first edit the Makefile - pay special attention to
+the setting for ICONDIR, this is a directory the icons used by this program
+will go in and defaults to /usr/share/icons/wmbattery.
+
+If the Makefile looks ok, install it like so:
+ make
+ make install
+
+Note that you will need libxpm to build and use the program.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0b29c35
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+ICONDIR = /usr/share/icons/wmbattery
+BINDIR = /usr/X11R6/bin
+MANDIR = /usr/X11R6/man/man1
+LIBDIR = -L/usr/X11R6/lib
+LIBS = -lXpm -lXext
+CFLAGS = -g -DICONDIR=\"$(ICONDIR)\" -O2 -Wall
+
+wmbattery: wmbattery.c wmbattery.h
+ $(CC) $(CFLAGS) $(LIBDIR) $(LIBS) wmbattery.c -o wmbattery
+
+clean:
+ rm -f wmbattery
+
+install: wmbattery
+ install -d $(PREFIX)/$(ICONDIR) $(PREFIX)/$(BINDIR) $(PREFIX)/$(MANDIR)
+ install -s wmbattery $(PREFIX)/$(BINDIR)
+ install -m 644 wmbattery.1 $(PREFIX)/$(MANDIR)
+ install -m 644 *.xpm $(PREFIX)/$(ICONDIR)
+
+test: wmbattery
+ ./wmbattery
diff --git a/README b/README
new file mode 100644
index 0000000..05f85f6
--- /dev/null
+++ b/README
@@ -0,0 +1,29 @@
+Wmbattery displays the status of your laptop's battery in a small icon. This
+includes if it is plugged in, if the battery is charging, how many minutes
+of battery life remain, battery life remaining (with both a percentage and a
+graph), and battery status (high - green, low - yellow, or critical - red).
+
+Wmbattery is based heavily on wmapm by Chris D. Faulhaber <jedgar at speck.ml.org>
+-- see the copyright file for more information.
+
+Wmapm is a nice program - why have I modified it into wmbattery? Here are
+some improvements in wmbattery:
+
+ - Improved icon layout. I crammed the same information into less space
+ while making the icon more elegant and visually pleasing (IMHO).
+ - Easier to drag onto dock.
+ - Displays 100% when your battery is full (wmapm is limited to 99% maximum).
+ - It consumes a little less memory.
+ - Uses only 8 colors.
+ - You can run in on a different display via -d (broken in wmapm).
+
+Conversely, here are some reasons to stick with wmapm:
+
+ - It's a more mature program.
+ - You like its look.
+ - It has a neat rainbow-colored progress bar.
+ - You need freebsd support (should be added to wmbattery eventually).
+
+The homepage for wmbattery is <http://kitenet.net/programs/wmbattery/>
+
+-- Joey Hess <joey at kitenet.net>
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..a442a1c
--- /dev/null
+++ b/TODO
@@ -0,0 +1,7 @@
+* The dial doesn't fill up/drain out very prettily. Add some code to special
+ case things so it looks better.
+* Can /proc/apm be kept open and rewound?
+* Make it load up the mask from file, not #include it.
+* Allow user-settable colors, like asclock does.
+* Allow the user to define when it should display different battery colors.
+* Also, allow flashing battery to be turned on for critical.
diff --git a/battery_high.xpm b/battery_high.xpm
new file mode 100644
index 0000000..034f8ed
--- /dev/null
+++ b/battery_high.xpm
@@ -0,0 +1,19 @@
+/* XPM */
+static char * battery_high_xpm[] = {
+"25 13 3 1",
+" c #208120812081",
+". c #2081B2CAAEBA",
+"X c #000049244103",
+" ..................... ",
+".X X. ",
+". . ",
+". XXX XXX . . ",
+". X X X X X . . . ...",
+". X X X X X . . ...",
+". XXX XXX . ...",
+". X X X X X . . ...",
+". X X X X X . . . ...",
+". XXX XXX . . ",
+". . ",
+".X X. ",
+" ..................... "};
diff --git a/battery_low.xpm b/battery_low.xpm
new file mode 100644
index 0000000..c707a75
--- /dev/null
+++ b/battery_low.xpm
@@ -0,0 +1,20 @@
+/* XPM */
+static char * battery_low_xpm[] = {
+"25 13 4 1",
+" c #208120812081",
+". c #FFFF00000000",
+"X c #000049244103",
+"o c #2081B2CAAEBA",
+" ..................... ",
+".X X. ",
+". . ",
+". XXX XXX o . ",
+". X X X X X o o o ...",
+". X X X X X o o ...",
+". XXX XXX o ...",
+". X X X X X o o ...",
+". X X X X X o o o ...",
+". XXX XXX o . ",
+". . ",
+".X X. ",
+" ..................... "};
diff --git a/battery_medium.xpm b/battery_medium.xpm
new file mode 100644
index 0000000..730f0ac
--- /dev/null
+++ b/battery_medium.xpm
@@ -0,0 +1,20 @@
+/* XPM */
+static char * battery_medium_xpm[] = {
+"25 13 4 1",
+" c #208120812081",
+". c #FFFFFFFF0000",
+"X c #000049244103",
+"o c #2081B2CAAEBA",
+" ..................... ",
+".X X. ",
+". . ",
+". XXX XXX o . ",
+". X X X X X o o o ...",
+". X X X X X o o ...",
+". XXX XXX o ...",
+". X X X X X o o ...",
+". X X X X X o o o ...",
+". XXX XXX o . ",
+". . ",
+".X X. ",
+" ..................... "};
diff --git a/battery_none.xpm b/battery_none.xpm
new file mode 100644
index 0000000..d97902f
--- /dev/null
+++ b/battery_none.xpm
@@ -0,0 +1,18 @@
+/* XPM */
+static char * battery_none_xpm[] = {
+"25 13 2 1",
+" c #208120812081",
+". c #000049244103",
+" ..................... ",
+".. .. ",
+". . ",
+". ... ... . . ",
+". . . . . . . . . ...",
+". . . . . . . . ...",
+". ... ... . ...",
+". . . . . . . . ...",
+". . . . . . . . . ...",
+". ... ... . . ",
+". . ",
+".. .. ",
+" ..................... "};
diff --git a/bigfont.xpm b/bigfont.xpm
new file mode 100644
index 0000000..c0ab6fd
--- /dev/null
+++ b/bigfont.xpm
@@ -0,0 +1,17 @@
+/* XPM */
+static char * bigfont_xpm[] = {
+"73 9 5 1",
+" c #208120812081",
+". c #2081B2CAAEBA",
+"X c #000049244103",
+"o c #104079E779E7",
+"O c #18618A288617",
+" .... XXXXo o....O o....o oXXXXo o....o o....O o....o o....O o....O ",
+". . X . X . X . . . . X . X X . . . . . XX",
+". . X . X . X . . . . X . X X . . . . . XX",
+". . X . X . X . . . . X . X X . . . . . ",
+"oXXXXo XXXXo o....o o....o o....o o....o o....o XXXXo o....o o....o ",
+". . X . . X X . X . X . . . X . . . X . ",
+". . X . . X X . X . X . . . X . . . X . XX",
+". . X . . X X . X . X . . . X . . . X . XX",
+" .... XXXXo o....o o....o XXXXo o....o o....o XXXXo o....o o....o "};
diff --git a/charging.xpm b/charging.xpm
new file mode 100644
index 0000000..29c5f40
--- /dev/null
+++ b/charging.xpm
@@ -0,0 +1,19 @@
+/* XPM */
+static char *charging[] = {
+/* width height num_colors chars_per_pixel */
+" 15 9 3 1",
+/* colors */
+". c #202020",
+"# c #004941",
+"a c #20b2ae",
+/* pixels */
+"........#a.....",
+".......#aaa#...",
+".......aaa#aa#.",
+"......#aa#..#aa",
+"......aaa......",
+"aa#..#aa#......",
+".#aa#aaa.......",
+"...#aaa#.......",
+"....#a#........"
+};
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..409b716
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,20 @@
+wmbattery (1.0) unstable; urgency=low
+
+ * First release.
+ .
+ * Started with wmapm 1.2 sources. Gutted it and cleaned it up extensively
+ and turned it into wmbattery.
+ * Drew new faceplate and graphics.
+ * Converted manpage to refer to new program name.
+ * Reorganized source tree.
+ * Split single xpm up into lots of small xpms, loaded seperately.
+ * Cleaned up Makefile.
+ * Removed README, TODO, INSTALL, etc; I'll write my own.
+ * Parse command line with getopt.
+ * Made -d work to set the display.
+
+ -- Joey Hess <joeyh at master.debian.org> Fri, 25 Dec 1998 18:03:21 -0500
+
+Local variables:
+mode: debian-changelog
+End:
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..377ab6e
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,23 @@
+Source: wmbattery
+Section: x11
+Priority: extra
+Maintainer: Joey Hess <joeyh at master.debian.org>
+Standards-Version: 2.4.1.3
+
+Package: wmbattery
+Architecture: any
+Depends: ${shlibs:Depends}
+Suggests: wmaker
+Description: Display laptop battery info, dockable in Windowmaker
+ Wmbattery displays the status of your laptop's battery in a small icon.
+ This includes if it is plugged in, if the battery is charging, how many
+ minutes of battery life remain, battery life remaining (with both a
+ percentage and a graph), and battery status (high - green, low - yellow,
+ or critical - red).
+ .
+ There's nothing in the program that makes it require WindowMaker, except
+ maybe the look. It can be docked in WindowMaker or Afterstep's dock.
+ .
+ To use this program you need to enable APM support for your kernel during
+ configuration; the corresponding questions are in the 'Character devices'
+ section. It will only work on laptops with an APM BIOS.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..b660b98
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,26 @@
+Wmbattery is copyright (C) 1998 by Joey Hess <joey at kitenet.net>
+
+Wmbattery uses code and images from the following sources:
+
+ wmapm - (C) 1998 Chris D. Faulhaber <jedgar at speck.ml.org>
+ libapm - Rik Faith <faith at cs.unc.edu>
+ wmmon and wmgeneral - Martijm Pieterse <pieterse at xs4all.nl> and
+ Antoine Nulle <warp at xs4all.nl>
+
+I would also like to thank Anna Hess for artistic guidance.
+
+The following copyright applies to this package:
+
+ 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.,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
diff --git a/debian/menu b/debian/menu
new file mode 100644
index 0000000..b67b300
--- /dev/null
+++ b/debian/menu
@@ -0,0 +1,2 @@
+?package(wmbattery):needs="x11" section="Apps/System" \
+ title="wmbattery" longtitle="wmbattery" command="wmbattery"
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..e0e5a33
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,76 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+ $(MAKE)
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp install-stamp
+ $(MAKE) clean
+ dh_clean
+
+install: install-stamp
+install-stamp: build-stamp
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+ $(MAKE) PREFIX=debian/tmp install
+ touch install-stamp
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+# dh_testversion
+ dh_testdir
+ dh_testroot
+ dh_installdocs TODO README
+ dh_installexamples
+ dh_installmenu
+# dh_installemacsen
+# dh_installinit
+ dh_installcron
+ dh_installmanpages
+# dh_undocumented
+ dh_installchangelogs
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_suidregister
+# dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+VERSION=$(shell expr "`dpkg-parsechangelog 2>/dev/null |grep Version:`" : '.*Version: \(.*\)')
+dist:
+ dpkg-buildpackage -rfakeroot -tc
+ if [ `hostname` = 'kite' ] ; then \
+ cp ../wmbattery_$(VERSION).tar.gz ../../public; \
+ rm /home/ftp/pub/code/wmbattery/* || true; \
+ cp debian/changelog /home/pub/programs/wmbattery/CHANGES; \
+ echo $(VERSION) > /home/pub/programs/wmbattery/LATEST-VERSION-IS; \
+ cd /home/ftp/pub/code/wmbattery; \
+ ln -sf ../debian/wmbattery_$(VERSION).tar.gz wmbattery_$(VERSION).tar.gz; \
+ ln -sf ../debian/wmbattery_$(VERSION).tar.gz wmbattery.tar.gz; \
+ fi
+
+source diff:
+ @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install dist
diff --git a/dial_bright.xpm b/dial_bright.xpm
new file mode 100644
index 0000000..292ebd1
--- /dev/null
+++ b/dial_bright.xpm
@@ -0,0 +1,41 @@
+/* XPM */
+static char * dial_bright_xpm[] = {
+"56 31 7 1",
+" c #00000000FFFF",
+". c #000000000000",
+"X c #2081B2CAAEBA",
+"o c #96589A699658",
+"O c #FFFFFFFFFFFF",
+"+ c #208120812081",
+"@ c #000049244103",
+" .......... ",
+" ....XXXXXXXXXX.... ",
+" ...XXXXXXXXXXXXXXXXXX... ",
+" ..XXXXXXXXXXXXXXXXXXXXXXXX.. ",
+" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
+" ..XXXXXXXXXXOOOOOOOOOOXXXXXXXXXXoO ",
+" .XXXXXXXXXOOO OOOXXXXXXXXXO ",
+" .XXXXXXXXOO OOXXXXXXXXO ",
+" .XXXXXXXOO OOXXXXXXXO ",
+" .XXXXXXOO oXXXXXXXO ",
+" .XXXXXXO o.XXXXXXO ",
+" .XXXXXXO .XXXXXXO ",
+" .XXXXXO .XXXXXO ",
+" .XXXXXO .XXXXXO ",
+" .XXXXXO .XXXXXO ",
+" .XXXXXO .XXXXXO ",
+" .XXXXXO .XXXXXO ",
+" .XXXXO .................................... .XXXXO ",
+" .XXXXO .++++++++++++++++++++++++++++++++++O .XXXXO ",
+" .XXXXXO .++@@@@+++@@@@+++++++@@@@+++@@@@+++O .XXXXXO ",
+" .XXXXO .+ at ++++@+ at ++++@++X++ at ++++@+ at ++++@++O .XXXXO ",
+" .XXXXO .+ at ++++@+ at ++++@++X++ at ++++@+ at ++++@++O .XXXXXO",
+".XXXXXO .+ at ++++@+ at ++++@+++++ at ++++@+ at ++++@++O .XXXXXO",
+".XXXXO .++@@@@+++@@@@+++++++@@@@+++@@@@+++O .XXXXO",
+".XXXXO .+ at ++++@+ at ++++@+++++ at ++++@+ at ++++@++O .XXXXO",
+".XXXXO .+ at ++++@+ at ++++@++X++ at ++++@+ at ++++@++O .XXXXO",
+".XXXXO .+ at ++++@+ at ++++@++X++ at ++++@+ at ++++@++O .XXXXO",
+".XXXXO .++@@@@+++@@@@+++++++@@@@+++@@@@+++O .XXXXO",
+".XXXXO .++++++++++++++++++++++++++++++++++O .XXXXO",
+".XXXXO .++++++++++++++++++++++++++++++++++O .XXXXO",
+".OOOOO .OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO .OOOOO"};
diff --git a/dial_dim.xpm b/dial_dim.xpm
new file mode 100644
index 0000000..6982c8a
--- /dev/null
+++ b/dial_dim.xpm
@@ -0,0 +1,41 @@
+/* XPM */
+static char * dial_dim_xpm[] = {
+"56 31 7 1",
+" c #00000000FFFF",
+". c #000000000000",
+"X c #000049244103",
+"o c #96589A699658",
+"O c #FFFFFFFFFFFF",
+"+ c #208120812081",
+"@ c #2081B2CAAEBA",
+" .......... ",
+" ....XXXXXXXXXX.... ",
+" ...XXXXXXXXXXXXXXXXXX... ",
+" ..XXXXXXXXXXXXXXXXXXXXXXXX.. ",
+" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
+" ..XXXXXXXXXXOOOOOOOOOOXXXXXXXXXXoO ",
+" .XXXXXXXXXOOO OOOXXXXXXXXXO ",
+" .XXXXXXXXOO OOXXXXXXXXO ",
+" .XXXXXXXOO OOXXXXXXXO ",
+" .XXXXXXOO oXXXXXXXO ",
+" .XXXXXXO o.XXXXXXO ",
+" .XXXXXXO .XXXXXXO ",
+" .XXXXXO .XXXXXO ",
+" .XXXXXO .XXXXXO ",
+" .XXXXXO .XXXXXO ",
+" .XXXXXO .XXXXXO ",
+" .XXXXXO .XXXXXO ",
+" .XXXXO .................................... .XXXXO ",
+" .XXXXO .++++++++++++++++++++++++++++++++++O .XXXXO ",
+" .XXXXXO .++XXXX+++XXXX+++++++XXXX+++XXXX+++O .XXXXXO ",
+" .XXXXO .+X++++X+X++++X++ at ++X++++X+X++++X++O .XXXXO ",
+" .XXXXO .+X++++X+X++++X++ at ++X++++X+X++++X++O .XXXXXO",
+".XXXXXO .+X++++X+X++++X+++++X++++X+X++++X++O .XXXXXO",
+".XXXXO .++XXXX+++XXXX+++++++XXXX+++XXXX+++O .XXXXO",
+".XXXXO .+X++++X+X++++X+++++X++++X+X++++X++O .XXXXO",
+".XXXXO .+X++++X+X++++X++ at ++X++++X+X++++X++O .XXXXO",
+".XXXXO .+X++++X+X++++X++ at ++X++++X+X++++X++O .XXXXO",
+".XXXXO .++XXXX+++XXXX+++++++XXXX+++XXXX+++O .XXXXO",
+".XXXXO .++++++++++++++++++++++++++++++++++O .XXXXO",
+".XXXXO .++++++++++++++++++++++++++++++++++O .XXXXO",
+".OOOOO .OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO .OOOOO"};
diff --git a/face.xpm b/face.xpm
new file mode 100644
index 0000000..d6cf1ca
--- /dev/null
+++ b/face.xpm
@@ -0,0 +1,73 @@
+/* XPM */
+static char * face_xpm[] = {
+"64 64 6 1",
+" c None",
+". c #00000000FFFF",
+"X c #000000000000",
+"o c #000049244103",
+"O c #FFFFFFFFFFFF",
+"+ c #208120812081",
+" ",
+" .............................................................. ",
+" .............................................................. ",
+" .............................................................. ",
+" ..........................XXXXXXXXXX.......................... ",
+" ......................XXXXooooooooooXXXX...................... ",
+" ...................XXXooooooooooooooooooXXX................... ",
+" .................XXooooooooooooooooooooooooXX................. ",
+" ................XooooooooooooooooooooooooooooX................ ",
+" ..............XXooooooooooOOOOOOOOOOooooooooooXX.............. ",
+" .............XoooooooooOOO..........OOOoooooooooO............. ",
+" ............XooooooooOO................OOooooooooO............ ",
+" ...........XoooooooOO....................OOoooooooO........... ",
+" ..........XooooooOO........................OXooooooO.......... ",
+" .........XooooooO............................XooooooO......... ",
+" ........XooooooO..............................XooooooO........ ",
+" ........XoooooO................................XoooooO........ ",
+" .......XoooooO..................................XoooooO....... ",
+" ......XoooooO....................................XoooooO...... ",
+" ......XoooooO....................................XoooooO...... ",
+" .....XoooooO......................................XoooooO..... ",
+" .....XooooO..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..XooooO..... ",
+" .....XooooO..X++++++++++++++++++++++++++++++++++O..XooooO..... ",
+" ....XoooooO..X++oooo+++oooo+++++++oooo+++oooo+++O..XoooooO.... ",
+" ....XooooO...X+o++++o+o++++o++o++o++++o+o++++o++O...XooooO.... ",
+" ....XooooO...X+o++++o+o++++o++o++o++++o+o++++o++O...XoooooO... ",
+" ...XoooooO...X+o++++o+o++++o+++++o++++o+o++++o++O...XoooooO... ",
+" ...XooooO....X++oooo+++oooo+++++++oooo+++oooo+++O....XooooO... ",
+" ...XooooO....X+o++++o+o++++o+++++o++++o+o++++o++O....XooooO... ",
+" ...XooooO....X+o++++o+o++++o++o++o++++o+o++++o++O....XooooO... ",
+" ...XooooO....X+o++++o+o++++o++o++o++++o+o++++o++O....XooooO... ",
+" ...XooooO....X++oooo+++oooo+++++++oooo+++oooo+++O....XooooO... ",
+" ...XooooO....X++++++++++++++++++++++++++++++++++O....XooooO... ",
+" ...XooooO....X++++++++++++++++++++++++++++++++++O....XooooO... ",
+" ...XOOOOO....XOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO....XOOOOO... ",
+" .............................................................. ",
+" .............................................................. ",
+" .............................................................. ",
+" .............................................................. ",
+" ...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... ",
+" ...X++++++++++++++++++++++++++++++++++++++++++++++++++++++O... ",
+" ...X++++++++++++++++++++++++++++++++++++++++++++++++++++++O... ",
+" ...X+++++++++++++++++++++++++++++ooooooooooooooooooooo++++O... ",
+" ...X+++++++++++++++++++++o++++++o+++++++++++++++++++++o+++O... ",
+" ...X++++++++++++++++++++ooo+++++o+++++++++++++++++++++o+++O... ",
+" ...X+++++oooo++++++++++ooo+oo+++o++++ooo+++ooo+++o++++o+++O... ",
+" ...X++++o+++ooo++++++++oo++++oo+o+o+o+++o+o+++o+o+o+o+ooo+O... ",
+" ...X++++o+++o+++++++++ooo+++++++o+o+o+++o+o+++o++o+o++ooo+O... ",
+" ...X++ooo+++o+++oo++++oo++++++++o++++ooo+++ooo++++o+++ooo+O... ",
+" ...X+o++o+++ooo+++oo+ooo++++++++o+o+o+++o+o+++o++o+o++ooo+O... ",
+" ...X+o+++oooo+++++++ooo+++++++++o+o+o+++o+o+++o+o+o+o+ooo+O... ",
+" ...X+o+++++++++++++++o++++++++++o++++ooo+++ooo+++++o++o+++O... ",
+" ...X+o++++++++++++++++++++++++++o+++++++++++++++++++++o+++O... ",
+" ...X++++++++++++++++++++++++++++o+++++++++++++++++++++o+++O... ",
+" ...X+++++++++++++++++++++++++++++ooooooooooooooooooooo++++O... ",
+" ...X++++++++++++++++++++++++++++++++++++++++++++++++++++++O... ",
+" ...X++++++++++++++++++++++++++++++++++++++++++++++++++++++O... ",
+" ...X++++++++++++++++++++++++++++++++++++++++++++++++++++++O... ",
+" ...XOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO... ",
+" .............................................................. ",
+" .............................................................. ",
+" .............................................................. ",
+" .............................................................. ",
+" "};
diff --git a/mask.xbm b/mask.xbm
new file mode 100644
index 0000000..5541159
--- /dev/null
+++ b/mask.xbm
@@ -0,0 +1,46 @@
+#define mask_width 64
+#define mask_height 64
+static unsigned char mask_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8,
+ 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0xf0, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff,
+ 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00,
+ 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xc0, 0xff, 0x07,
+ 0xe0, 0xff, 0x03, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0xff, 0x07, 0x00,
+ 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xf8, 0x0f, 0x00,
+ 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0xc0, 0x3f, 0x00,
+ 0x00, 0xfe, 0x01, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0xfe, 0x00, 0x00,
+ 0x00, 0x00, 0x7f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00,
+ 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x80, 0x3f, 0x00, 0x00,
+ 0x00, 0x00, 0xfc, 0x01, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x03,
+ 0xc0, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x03, 0xc0, 0xcf, 0xff, 0xff,
+ 0xff, 0xff, 0xf3, 0x03, 0xe0, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x07,
+ 0xe0, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x07, 0xe0, 0xc7, 0xff, 0xff,
+ 0xff, 0xff, 0xe3, 0x0f, 0xf0, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x0f,
+ 0xf0, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x0f, 0xf0, 0xc3, 0xff, 0xff,
+ 0xff, 0xff, 0xc3, 0x0f, 0xf0, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x0f,
+ 0xf0, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x0f, 0xf0, 0xc3, 0xff, 0xff,
+ 0xff, 0xff, 0xc3, 0x0f, 0xf0, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x0f,
+ 0xf0, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x0f, 0xf0, 0xc3, 0xff, 0xff,
+ 0xff, 0xff, 0xc3, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
diff --git a/nocharging.xpm b/nocharging.xpm
new file mode 100644
index 0000000..29c8838
--- /dev/null
+++ b/nocharging.xpm
@@ -0,0 +1,18 @@
+/* XPM */
+static char *nocharging[] = {
+/* width height num_colors chars_per_pixel */
+" 15 9 2 1",
+/* colors */
+". c #202020",
+"# c #004941",
+/* pixels */
+".........#.....",
+"........###....",
+".......###.##..",
+".......##....##",
+"......###......",
+"##....##.......",
+"..##.###.......",
+"....###........",
+".....#........."
+};
diff --git a/plugged.xpm b/plugged.xpm
new file mode 100644
index 0000000..e62a263
--- /dev/null
+++ b/plugged.xpm
@@ -0,0 +1,17 @@
+/* XPM */
+static char *plugged[] = {
+/* width height num_colors chars_per_pixel */
+" 10 8 2 1",
+/* colors */
+". c #202020",
+"# c #20b2ae",
+/* pixels */
+"....####..",
+"...#...###",
+"...#...#..",
+".###...#..",
+"#..#...###",
+"#...####..",
+"#.........",
+"#........."
+};
diff --git a/smallfont.xpm b/smallfont.xpm
new file mode 100644
index 0000000..52077af
--- /dev/null
+++ b/smallfont.xpm
@@ -0,0 +1,16 @@
+/* XPM */
+static char * smallfont_xpm[] = {
+"67 7 6 1",
+" c #208120812081",
+". c #2081B2CAAEBA",
+"X c #000049244103",
+"o c #18618A288617",
+"O c #000079E771C6",
+"+ c #104079E779E7",
+" ... XXXo o...o o...o oXXXo o...o o...o o...o o...o o...o X o",
+". . X . X . X . . . . X . X X . . . . . X X X .",
+". . X . X . X . . . . X . X X . . . . . X X .",
+"oXXXo XXXo o...o ...o o...o O...o o...o XXXo o...o +...o X o",
+". . X . . X X . X . X . . . X . . . X . X X .",
+". . X . . X X . X . X . . . X . . . X . X X X .",
+" ... XXX. o...o o...o XXXo o...o o...o XXXO o...o o...o X ."};
diff --git a/unplugged.xpm b/unplugged.xpm
new file mode 100644
index 0000000..7b74879
--- /dev/null
+++ b/unplugged.xpm
@@ -0,0 +1,17 @@
+/* XPM */
+static char *unplugged[] = {
+/* width height num_colors chars_per_pixel */
+" 10 8 2 1",
+/* colors */
+". c #202020",
+"# c #004941",
+/* pixels */
+"....####..",
+"...#...###",
+"...#...#..",
+".###...#..",
+"#..#...###",
+"#...####..",
+"#.........",
+"#........."
+};
diff --git a/wmbattery.1 b/wmbattery.1
new file mode 100644
index 0000000..d862d1f
--- /dev/null
+++ b/wmbattery.1
@@ -0,0 +1,32 @@
+.TH WMBATTERY 1 "25 December 98"
+.SH NAME
+WMBATTERY \- Dockable APM/Battery Monitor
+.SH SYNOPSIS
+.B wmbattery
+[-h] [-d display]
+.SH DESCRIPTION
+.PP
+.B wmbattery
+is an APM/Battery Monitor. It is used to visually display and
+the APM/Battery status from the system's BIOS via the Linux kernel.
+.PP
+Currently, wmbattery is only supported on Linux platforms as it interprets
+APM/Battery information directly from /proc/apm. wmbattery is dockable
+using WindowMaker and AfterStep window-managers; under other
+window-managers, wmbattery appears as a nicely-sized 64x64 application.
+.PP
+wmbattery displays the status of your laptop's battery in a small icon.
+This includes if it is plugged in, if the battery is charging, how many
+minutes of battery life remain, battery life remaining (with both a
+percentage and a graph), and battery status (high - green, low - yellow,
+or critical - red).
+.SH OPTIONS
+.TP
+.B \-h
+Display list of command-line options.
+.TP
+.B \-d [display]
+Use the designated X display.
+.SH AUTHOR
+Joey Hess <joey at kitenet.net>, based on wmapm by
+Chris D. Faulhaber <jedgar at speck.ml.org>
diff --git a/wmbattery.1x b/wmbattery.1x
new file mode 100644
index 0000000..d862d1f
--- /dev/null
+++ b/wmbattery.1x
@@ -0,0 +1,32 @@
+.TH WMBATTERY 1 "25 December 98"
+.SH NAME
+WMBATTERY \- Dockable APM/Battery Monitor
+.SH SYNOPSIS
+.B wmbattery
+[-h] [-d display]
+.SH DESCRIPTION
+.PP
+.B wmbattery
+is an APM/Battery Monitor. It is used to visually display and
+the APM/Battery status from the system's BIOS via the Linux kernel.
+.PP
+Currently, wmbattery is only supported on Linux platforms as it interprets
+APM/Battery information directly from /proc/apm. wmbattery is dockable
+using WindowMaker and AfterStep window-managers; under other
+window-managers, wmbattery appears as a nicely-sized 64x64 application.
+.PP
+wmbattery displays the status of your laptop's battery in a small icon.
+This includes if it is plugged in, if the battery is charging, how many
+minutes of battery life remain, battery life remaining (with both a
+percentage and a graph), and battery status (high - green, low - yellow,
+or critical - red).
+.SH OPTIONS
+.TP
+.B \-h
+Display list of command-line options.
+.TP
+.B \-d [display]
+Use the designated X display.
+.SH AUTHOR
+Joey Hess <joey at kitenet.net>, based on wmapm by
+Chris D. Faulhaber <jedgar at speck.ml.org>
diff --git a/wmbattery.c b/wmbattery.c
new file mode 100644
index 0000000..50ad4b7
--- /dev/null
+++ b/wmbattery.c
@@ -0,0 +1,391 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <X11/xpm.h>
+#include <X11/extensions/shape.h>
+#include <getopt.h>
+#include <stdarg.h>
+#include "wmbattery.h"
+#include "mask.xbm"
+
+Pixmap images[NUM_IMAGES];
+Window root, iconwin, win;
+int screen;
+XpmIcon icon;
+Display *display;
+GC NormalGC;
+
+void error(const char *fmt, ...) {
+ va_list arglist;
+
+ va_start(arglist, fmt);
+ fprintf(stderr, "Error: ");
+ vfprintf(stderr, fmt, arglist);
+ fprintf(stderr, "\n");
+ va_end(arglist);
+
+ exit(1);
+}
+
+int apm_read(apm_info *i) {
+ FILE *str;
+ char units[10];
+ char buffer[100];
+
+ if (!(str = fopen("/proc/apm", "r")))
+ return 0;
+ fgets(buffer, sizeof(buffer) - 1, str);
+ buffer[sizeof(buffer) - 1] = '\0';
+ sscanf(buffer, "%s %d.%d %x %x %x %x %d%% %d %s\n",
+ (char *)i->driver_version,
+ &i->apm_version_major,
+ &i->apm_version_minor,
+ &i->apm_flags,
+ &i->ac_line_status,
+ &i->battery_status,
+ &i->battery_flags,
+ &i->battery_percentage,
+ &i->battery_time,
+ units);
+ i->using_minutes = !strncmp(units, "min", 3) ? 1 : 0;
+ if (i->driver_version[0] == 'B') { /* old style. argh. */
+ strcpy((char *)i->driver_version, "pre-0.7");
+ i->apm_version_major = 0;
+ i->apm_version_minor = 0;
+ i->apm_flags = 0;
+ i->ac_line_status = 0xff;
+ i->battery_status = 0xff;
+ i->battery_flags = 0xff;
+ i->battery_percentage = -1;
+ i->battery_time = -1;
+ i->using_minutes = 1;
+ sscanf(buffer, "BIOS version: %d.%d",
+ &i->apm_version_major, &i->apm_version_minor);
+ fgets(buffer, sizeof(buffer) - 1, str);
+ sscanf(buffer, "Flags: 0x%02x", &i->apm_flags);
+ if (i->apm_flags & APM_32_BIT_SUPPORT) {
+ fgets(buffer, sizeof(buffer) - 1, str);
+ fgets(buffer, sizeof(buffer) - 1, str);
+ if (buffer[0] != 'P') {
+ if (!strncmp(buffer+4, "off line", 8))
+ i->ac_line_status = 0;
+ else if (!strncmp(buffer+4, "on line", 7))
+ i->ac_line_status = 1;
+ else if (!strncmp(buffer+4, "on back", 7))
+ i->ac_line_status = 2;
+ fgets(buffer, sizeof(buffer) - 1, str);
+ if (!strncmp(buffer+16, "high", 4))
+ i->battery_status = 0;
+ else if (!strncmp(buffer+16, "low", 3))
+ i->battery_status = 1;
+ else if (!strncmp(buffer+16, "crit", 4))
+ i->battery_status = 2;
+ else if (!strncmp(buffer+16, "charg", 5))
+ i->battery_status = 3;
+ fgets(buffer, sizeof(buffer) - 1, str);
+ if (strncmp(buffer+14, "unknown", 7))
+ i->battery_percentage = atoi(buffer + 14);
+ if (i->apm_version_major >= 1 && i->apm_version_minor >= 1) {
+ fgets(buffer, sizeof(buffer) - 1, str);
+ sscanf(buffer, "Battery flag: 0x%02x", &i->battery_flags);
+ fgets(buffer, sizeof(buffer) - 1, str);
+ if (strncmp(buffer+14, "unknown", 7))
+ i->battery_time = atoi(buffer + 14);
+ }
+ }
+ }
+ }
+
+ /*
+ * Fix possible kernel bug -- percentage
+ * set to 0xff (==255) instead of -1.
+ */
+ if (i->battery_percentage > 100)
+ i->battery_percentage = -1;
+
+ fclose(str);
+ return 1;
+}
+
+int apm_exists() {
+ apm_info i;
+
+ if (access("/proc/apm", R_OK))
+ return 0;
+ return apm_read(&i);
+}
+
+/* Load up the images this program uses. */
+void load_images() {
+ int x;
+ char fn[128]; /* enough? */
+
+ for(x=0; x < NUM_IMAGES; x++) {
+ sprintf(fn, "%s/%s.xpm", ICONDIR, image_info[x].filename);
+ if (XpmReadFileToPixmap(display, root, fn, &images[x], NULL, NULL)) {
+ /* Check in current direcotry for fallback. */
+ sprintf(fn, "%s.xpm", image_info[x].filename);
+ if (XpmReadFileToPixmap(display, root, fn, &images[x], NULL, NULL)) {
+ error("Failed to load %s\n",fn);
+ }
+ }
+ }
+}
+
+/* Returns the display to run on (or NULL for default). */
+char *parse_commandline(int argc, char *argv[]) {
+ int c=0;
+ char *ret=NULL;
+ extern char *optarg;
+
+ while (c != -1) {
+ c=getopt(argc, argv, "hd:");
+ switch (c) {
+ case 'h':
+ printf("\nUsage: wmbattery [options]\n");
+ printf("\t-d <display>\tselects target display\n");
+ printf("\t-h\t\tdisplay this help\n\n");
+ exit(0);
+ break;
+ case 'd':
+ ret=optarg;
+ }
+ }
+
+ return ret;
+}
+
+/* Sets up the window and icon and all the nasty X stuff. */
+void make_window(char *display_name, int argc, char *argv[]) {
+ XClassHint classhint;
+ char *wname = argv[0];
+ XTextProperty name;
+ XGCValues gcv;
+ int dummy=0, borderwidth = 1;
+ XSizeHints sizehints;
+ XWMHints wmhints;
+ Pixel back_pix, fore_pix;
+ Pixmap pixmask;
+
+ if (!(display = XOpenDisplay(display_name)))
+ error("can't open display %s",XDisplayName(display_name));
+
+ screen=DefaultScreen(display);
+ root=RootWindow(display, screen);
+
+ /* Create window. */
+ sizehints.flags = USSize | USPosition;
+ sizehints.x = 0;
+ sizehints.y = 0;
+ XWMGeometry(display, screen, "", NULL, borderwidth,
+ &sizehints, &sizehints.x, &sizehints.y,
+ &sizehints.width, &sizehints.height, &dummy);
+
+ sizehints.width = 64;
+ sizehints.height = 64;
+ back_pix = WhitePixel(display, screen);
+ fore_pix = BlackPixel(display, screen);
+ win = XCreateSimpleWindow(display, root, sizehints.x, sizehints.y,
+ sizehints.width, sizehints.height,
+ borderwidth, fore_pix, back_pix);
+ iconwin = XCreateSimpleWindow(display, win, sizehints.x,
+ sizehints.y, sizehints.width,
+ sizehints.height, borderwidth,
+ fore_pix, back_pix);
+
+ /* Activate hints */
+ XSetWMNormalHints(display, win, &sizehints);
+ classhint.res_name = wname;
+ classhint.res_class = wname;
+ XSetClassHint(display, win, &classhint);
+
+ if (! XStringListToTextProperty(&wname, 1, &name))
+ error("Can't allocate window name.");
+
+ XSetWMName(display, win, &name);
+
+ /* Create GC for drawing */
+ gcv.foreground = fore_pix;
+ gcv.background = back_pix;
+ gcv.graphics_exposures = 0;
+ NormalGC = XCreateGC(display, root,
+ GCForeground | GCBackground | GCGraphicsExposures,
+ &gcv);
+
+ pixmask = XCreateBitmapFromData(display, win, mask_bits,
+ mask_width,mask_height);
+ XShapeCombineMask(display, win, ShapeBounding, 0, 0,
+ pixmask, ShapeSet);
+ XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0,
+ pixmask, ShapeSet);
+
+ wmhints.initial_state = WithdrawnState;
+ wmhints.icon_window = iconwin;
+ wmhints.icon_x = sizehints.x;
+ wmhints.icon_y = sizehints.y;
+ wmhints.window_group = win;
+ wmhints.flags = StateHint | IconWindowHint |
+ IconPositionHint | WindowGroupHint;
+
+ XSetWMHints(display, win, &wmhints);
+ XSetCommand(display, win, argv, argc);
+ XMapWindow(display, win);
+}
+
+void flush_expose(Window w) {
+ XEvent dummy;
+
+ while (XCheckTypedWindowEvent(display, w, Expose, &dummy));
+}
+
+void redraw_window() {
+ flush_expose(iconwin);
+ XCopyArea(display, images[FACE], iconwin, NormalGC, 0, 0,
+ image_info[FACE].width, image_info[FACE].height, 0,0);
+ flush_expose(win);
+ XCopyArea(display, images[FACE], win, NormalGC, 0, 0,
+ image_info[FACE].width, image_info[FACE].height, 0,0);
+}
+
+/*
+ * Display an image, using XCopyArea. Can display only part of an image,
+ * located anywhere.
+ */
+void copy_image(int image, int xoffset, int yoffset,
+ int width, int height, int x, int y) {
+ XCopyArea(display, images[image], images[FACE], NormalGC,
+ xoffset, yoffset, width, height, x, y);
+}
+
+/*
+ * Display a letter in one of two fonts, at the specified x position.
+ * Note that 10 is passed for special characters `:' or `1' at the
+ * end of the font.
+ */
+void draw_letter(int letter, int font, int x) {
+ copy_image(font, image_info[font].charwidth * letter, 0,
+ image_info[font].charwidth, image_info[font].height,
+ x, image_info[font].y);
+}
+
+/* Display an image at its normal location. */
+void draw_image(int image) {
+ copy_image(image, 0, 0,
+ image_info[image].width, image_info[image].height,
+ image_info[image].x, image_info[image].y);
+}
+
+int main(int argc, char *argv[]) {
+ apm_info cur_info;
+ int time_left, hour_left, min_left, digit, x;
+ unsigned long sleep_time = DELAY;
+
+ make_window(parse_commandline(argc, argv), argc ,argv);
+
+ /* Check for APM support */
+ if (! apm_exists)
+ error("No APM support in kernel.");
+
+ load_images();
+
+ while (1) {
+ if (! apm_read(&cur_info))
+ error("Cannot read APM information.");
+
+ /* Display if it's plugged in. */
+ switch (cur_info.ac_line_status) {
+ case 1:
+ draw_image(PLUGGED);
+ break;
+ default:
+ draw_image(UNPLUGGED);
+ }
+
+ /* Display the appropriate color battery. */
+ switch (cur_info.battery_status) {
+ case 0: /* high */
+ case 3: /* charging */
+ draw_image(BATTERY_HIGH);
+ break;
+ case 1:
+ draw_image(BATTERY_MEDIUM);
+ break;
+ case 2:
+ draw_image(BATTERY_LOW);
+ break;
+ default:
+ draw_image(BATTERY_NONE);
+ }
+
+ /* Show if the battery is charging. */
+ switch (cur_info.battery_status) {
+ case 3:
+ draw_image(CHARGING);
+ break;
+ default: /* Not charging */
+ draw_image(NOCHARGING);
+ break;
+ }
+
+ /*
+ * Display the percent left dial. This has the side effect of
+ * clearing the time left field.
+ */
+ x=DIAL_MULTIPLIER * cur_info.battery_percentage;
+ if (x >= 0) {
+ /* Start by displaying bright on the dial. */
+ copy_image(DIAL_BRIGHT, 0, 0,
+ x, image_info[DIAL_BRIGHT].height,
+ image_info[DIAL_BRIGHT].x,
+ image_info[DIAL_BRIGHT].y);
+ }
+ /* Now display dim on the remainder of the dial. */
+ copy_image(DIAL_DIM, x, 0,
+ image_info[DIAL_DIM].width - x,
+ image_info[DIAL_DIM].height,
+ image_info[DIAL_DIM].x + x,
+ image_info[DIAL_DIM].y);
+
+ /* Show time left */
+ if (cur_info.battery_time >= 0) {
+ if (cur_info.using_minutes)
+ time_left = cur_info.battery_time;
+ else
+ time_left = cur_info.battery_time / 60;
+ hour_left = time_left / 60;
+ min_left = time_left % 60;
+ digit = hour_left / 10;
+ draw_letter(digit,BIGFONT,HOURS_TENS_OFFSET);
+ digit = hour_left % 10;
+ draw_letter(digit,BIGFONT,HOURS_ONES_OFFSET);
+ digit = min_left / 10;
+ draw_letter(digit,BIGFONT,MINUTES_TENS_OFFSET);
+ digit = min_left % 10;
+ draw_letter(digit,BIGFONT,MINUTES_ONES_OFFSET);
+ }
+
+ /* Show percent remaining */
+ if (cur_info.battery_percentage >= 0) {
+ digit = cur_info.battery_percentage / 10;
+ if (digit == 10) {
+ /* 11 is the `1' for the hundreds place. */
+ draw_letter(11,SMALLFONT,HUNDREDS_OFFSET);
+ digit=0;
+ }
+ draw_letter(digit,SMALLFONT,TENS_OFFSET);
+ digit = cur_info.battery_percentage % 10;
+ draw_letter(digit,SMALLFONT,ONES_OFFSET);
+ }
+ else {
+ /* There is no battery, so we need to dim out the
+ * colon and percent sign that are normally bright. */
+ draw_letter(10,SMALLFONT,PERCENT_OFFSET);
+ draw_letter(10,BIGFONT,COLON_OFFSET);
+ }
+
+ /* Redraw and wait for next update */
+ redraw_window();
+ usleep(sleep_time);
+ }
+}
diff --git a/wmbattery.h b/wmbattery.h
new file mode 100644
index 0000000..730e7fe
--- /dev/null
+++ b/wmbattery.h
@@ -0,0 +1,86 @@
+#define DELAY 1250000 /* Delay between refreshes (in microseconds) */
+
+typedef struct {
+ Pixmap pixmap;
+ Pixmap mask;
+ XpmAttributes attributes;
+} XpmIcon;
+
+typedef struct apm_info {
+ const char driver_version[10];
+ int apm_version_major;
+ int apm_version_minor;
+ int apm_flags;
+ int ac_line_status;
+ int battery_status;
+ int battery_flags;
+ int battery_percentage;
+ int battery_time;
+ int using_minutes;
+} apm_info;
+
+typedef struct image_info_type {
+ const char* filename;
+ const int width;
+ const int height;
+ const int x;
+ const int y;
+ const int charwidth;
+} image_info_type;
+
+#ifndef APM_32_BIT_SUPPORT
+#define APM_32_BIT_SUPPORT 0x0002
+#endif
+
+/* Assign reference numbers to all images that are loaded. */
+#define SMALLFONT 0
+#define BIGFONT 1
+#define BATTERY_HIGH 2
+#define BATTERY_MEDIUM 3
+#define BATTERY_LOW 4
+#define BATTERY_NONE 5
+#define UNPLUGGED 6
+#define PLUGGED 7
+#define NOCHARGING 8
+#define CHARGING 9
+#define DIAL_BRIGHT 10
+#define DIAL_DIM 11
+#define FACE 12
+
+#define NUM_IMAGES 13
+
+/*
+ * An array of the filenames of all images to load (minus .xpm extention),
+ * plus the size of the image, where to draw it on the icon, etc
+ */
+static struct image_info_type image_info[] = {
+ {"smallfont",7,67,0,45,6},
+ {"bigfont",9,73,0,23,7},
+ {"battery_high",25,13,33,42,0},
+ {"battery_medium",25,13,33,42,0},
+ {"battery_low",25,13,33,42,0},
+ {"battery_none",25,13,33,42,0},
+ {"unplugged",10,8,6,45,0},
+ {"plugged",10,8,6,45,0},
+ {"nocharging",15,9,17,43,0},
+ {"charging",15,9,17,43,0},
+ {"dial_bright",56,31,4,4,0},
+ {"dial_dim",56,31,4,4,0},
+ {"face",64,64,0,0,0},
+};
+
+/* TODO: get rid of this. */
+#define DIAL_MULTIPLIER 0.56
+
+/* Locations of letters in the percent remaining display. */
+#define HUNDREDS_OFFSET 35
+#define TENS_OFFSET 37
+#define ONES_OFFSET 43
+#define PERCENT_OFFSET 49
+
+/* Locations of letters in the time remaining display. */
+#define HOURS_TENS_OFFSET 15
+#define HOURS_ONES_OFFSET 23
+#define COLON_OFFSET 30
+#define MINUTES_TENS_OFFSET 34
+#define MINUTES_ONES_OFFSET 41
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbattery.git
More information about the Pkg-wmaker-commits
mailing list