dockapps/000077500000000000000000000000001251075456100126705ustar00rootroot00000000000000dockapps/AUTHORS000066400000000000000000000002111251075456100137320ustar00rootroot00000000000000Main Author: Mark Staggs Based largely on work on WMMemMon and WMCPULoad done by: Seiichi SATO dockapps/COPYING000066400000000000000000000432541251075456100137330ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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 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. Copyright (C) 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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) year 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. , 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 Lesser General Public License instead of this License. dockapps/ChangeLog000066400000000000000000000027611251075456100144500ustar00rootroot000000000000002015 April 7 * Use sysctl for swap usage information in FreeBSD. Use sysctl instead of kvm_getswapinfo() to read the swap usage information in FreeBSD. This removes the need for a dependency on libkvm and for a setgid binary. Based on the Debian patch [1]. * Release version 0.1.8. [1] https://sources.debian.net/src/wmmemload/0.1.7-2/debian/patches/sysctl_swap.patch/ 2014 October 9 * Use sysctl to get memory usage in FreeBSD. * Recognize GNU/kFreeBSD as possible OS during configure. * Fix compiler warnings. * Use consistent formatting in source code. * Update for Linux kernels >= 3.14. * Release version 0.1.7. 2014 October 7 * Fix FTBFS on the Hurd (submitted by Svante Signell). 2014 October 4 * Now maintained by Window Maker Developers Team * Fix autotools warnings. * Fix errors in the manpage. * Fix version check for kernel 3.0 (submitted by Guillermo Indalecio Fernandez). 2003 November 3 * Fixed problem with buffers/cache on Linux 2.6.* 2002 June 24 * Fixed backlight background (submitted by Pete ???) 2002 April 11 * Minor clean-up 2002 April 10 * version 0.1.2 released. * Fixed missing middle 0 in 100% for swap and memory (found by Callum M. Duncan) * Removed unnecessary icons directory * Removed unnecessary stamp-h 2002 April 09 * version 0.1.1 released. * Added doc directory to configure.ac (found by Sren Boll Overgaard) 2002 April 03 * version 0.1.0 released. (Initial Release) dockapps/Makefile.am000066400000000000000000000000231251075456100147170ustar00rootroot00000000000000 SUBDIRS = src doc dockapps/NEWS000066400000000000000000000000001251075456100133550ustar00rootroot00000000000000dockapps/README000066400000000000000000000024731251075456100135560ustar00rootroot00000000000000__ __ __ __ __ __ ____ __ __ _ ____ ____ ____ \ \/\/ /| \/ || \/ || ===|| \/ || |__ / () \ / () \ | _) \ \_/\_/ |_|\/|_||_|\/|_||____||_|\/|_||____|\____//__/\__\|____/ ================================================================================ Homepage: http://windowmaker.org/dockapps/?name=wmmemload Git: http://repo.or.cz/dockapps.git Original Author: Mark Staggs Currently maintained by: Window Maker Developers Team ================================================================================ wmmemload is a program to monitor memory/swap usages. It is a dockapp that is supported by X window managers such as Window Maker, AfterStep, BlackBox, and Enlightenment. The current memory usage is displayed in the top half. The swap usage is in the bottom half. It has an LCD look-alike user interface. The back-light may be turned on/off by clicking the mouse button over the appliacation. If the usage hits a certain threshold, an alarm-mode will alert you by turning on back-light. Run `wmmemload --help` or `man wmmemload` for more information. wmmemload is licensed under the GNU General Public License, version 2, or (at your option) any greater version. See COPYING for the complete text of the license. dockapps/THANKS000066400000000000000000000001371251075456100136040ustar00rootroot00000000000000For creating WMMemMon and WMCPULoad for which this is based: Seiichi SATO dockapps/configure.ac000066400000000000000000000071711251075456100151640ustar00rootroot00000000000000dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.52) dnl AC_INIT(src/main.c) AC_INIT(wmmemload, 0.1.8, wmaker-dev@lists.windowmaker.org) AC_CANONICAL_HOST AC_CANONICAL_TARGET AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR(src/main.c) AM_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_AWK AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S dnl dnl Specify paths to look for libraries and headers dnl =============================================== AC_ARG_WITH(libs-from, [ --with-libs-from pass compiler flags to look for libraries], [lib_search_path="$withval $lib_search_path"]) AC_ARG_WITH(incs-from, [ --with-incs-from pass compiler flags to look for header files], [inc_search_path="$withval $inc_search_path"]) dnl =========================================== dnl Stuff that uses X dnl =========================================== AC_PATH_XTRA X_LIBRARY_PATH=$x_libraries XCFLAGS="$X_CFLAGS" XLFLAGS="$X_LIBS" XLIBS="-lX11 $X_EXTRA_LIBS" lib_search_path="$lib_search_path $XLFLAGS -L/usr/local/lib" inc_search_path="$inc_search_path $XCFLAGS -I/usr/local/include" AC_SUBST(X_LIBRARY_PATH) dnl Shape extension dnl =============== AC_CHECK_LIB(Xext, XShapeCombineMask, [XLIBS="$XLIBS -lXext"], [echo "The shape extension stuff could not be found in the X client libraries" exit 1], $X_LIBS $X_EXTRA_LIBS -lX11) dnl XPM library dnl =========== AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [XLIBS="$XLIBS -lXpm"], [echo "The libXpm library was not found, but is necessary to build this library" exit 1], $X_LIBS $X_EXTRA_LIBS -lX11) AC_SUBST(XCFLAGS) AC_SUBST(XLFLAGS) AC_SUBST(XLIBS) AC_SUBST(X_EXTRA_LIBS) dnl =============================================== dnl End of stuff that uses X dnl =============================================== dnl ========= dnl Debugging dnl ========= AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=on]],,enable_debug=no) if test "$enable_debug" = yes; then DFLAGS="-Wall -g -ansi -pedantic" AC_DEFINE(DEBUG, 1, [use debug code]) fi AC_SUBST(DFLAGS) dnl ============ dnl Check for OS dnl ============ ignore_buffers=no ignore_cached=no ignore_wired=no case ${host_os} in linux*) OS=linux ignore_buffers=yes ignore_cached=yes ;; *freebsd*) OS=freebsd ignore_wired=yes ignore_cached=yes ;; openbsd*) OS=openbsd ;; solaris*) OS=solaris ;; gnu*) OS=gnu ignore_buffers=yes ignore_cached=yes ;; *) echo "" echo "Sorry, ${host_os} is not supported yet" echo "" exit 1 ;; esac AC_SUBST(OS) AC_SUBST(SETGID_FLAGS) AC_SUBST(LIBS) if test "$ignore_buffers" = yes; then AC_DEFINE(IGNORE_BUFFERS, 1, [use '--ignore-buffers' option]) fi if test "$ignore_cached" = yes; then AC_DEFINE(IGNORE_CACHED, 1, [use '--ignore-cached' option]) fi if test "$ignore_wired" = yes; then AC_DEFINE(IGNORE_WIRED, 1, [use '--ignore-wired' option]) fi dnl ============================= dnl Checks for library functions. dnl ============================= LIBRARY_SEARCH_PATH="$lib_search_path" HEADER_SEARCH_PATH="$inc_search_path" AC_SUBST(LIBRARY_SEARCH_PATH) AC_SUBST(HEADER_SEARCH_PATH) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h memory.h stddef.h stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T AC_HEADER_TIME dnl Checks for library functions. AC_FUNC_MALLOC AC_CHECK_FUNCS(select strtoul uname) AC_CONFIG_FILES(Makefile src/Makefile doc/Makefile) dnl icons/Makefile \ dnl contrib/Makefile \ dnl contrib/wmmemmon.spec) AC_OUTPUT dockapps/doc/000077500000000000000000000000001251075456100134355ustar00rootroot00000000000000dockapps/doc/Makefile.am000066400000000000000000000000621251075456100154670ustar00rootroot00000000000000 man_MANS = wmmemload.1 EXTRA_DIST = $(man_MANS) dockapps/doc/wmmemload.1000066400000000000000000000056061251075456100155100ustar00rootroot00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH WMMEMLOAD 1 "April 3, 2002" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME wmmemload \- A dockapp to monitor memory/swap usages .SH SYNOPSIS .B wmmemload [options] .SH DESCRIPTION This manual page documents briefly the .B wmmemload command. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. \fBWMMemLoad\fP is a program to monitor memory/swap usages. It is a dockapp that is supported by X window managers such as Window Maker, AfterStep, BlackBox, and Enlightenment. The current memory usage is displayed in the top half. The swap usage is in the bottom half. It has an LCD look-alike user interface. The back-light may be turned on/off by clicking the mouse button over the appliacation. If the usage hits a certain threshold, an alarm-mode will alert you by turning on back-light. .SH OPTIONS This program follows the usual GNU command line syntax, with long options starting with two dashes (`\-'). A summary of options is included below. .TP .B \-d, \-\-display Attempt to open a window on the named X display. In the absence of this option, the display specified by the .B DISPLAY environment variable is used. .TP .B \-bl, \-\-backlight turn on back-light. .TP .B \-lc, \-\-light\-color back-light color. (rgb:6E/C6/3B is default) .TP .B \-i, \-\-interval number of secs between updates. (1 is default) .TP .B \-b, \-\-ignore\-buffers ignore buffers. (GNU/Linux) .TP .B \-c, \-\-ignore\-cached ignore cached pages. (GNU/Linux / FreeBSD) .TP .B \-wr, \-\-ignore\-wired ignore wired pages. (FreeBSD) .TP .B \-h, \-\-help show help text and exit. .TP .B \-v, \-\-version show program version and exit. .TP .B \-w, \-\-windowed run the application in windowed mode .TP .B \-bw, \-\-broken\-wm activate broken window manager fix .TP .B \-am, \-\-alarm\-mem activate alarm mode of memory. is threshold of percentage from 0 to 100.(90 is default) .TP .B \-as, \-\-alarm\-swap activate alarm mode of swap. is threshold of percentage from 0 to 100.(50 is default) .SH AUTHOR WMMemLoad was assembled by Mark Staggs . It is largely based on WMMemMon and WMCPULoad by Seiichi SATO . dockapps/src/000077500000000000000000000000001251075456100134575ustar00rootroot00000000000000dockapps/src/.xvpics/000077500000000000000000000000001251075456100150515ustar00rootroot00000000000000dockapps/src/.xvpics/backlight_off.xpm000066400000000000000000000065461251075456100203740ustar00rootroot00000000000000P7 332 #IMGINFO:58x58 RGB (3806 bytes) #END_OF_COMMENTS 58 58 255 I$$$$IHI$%$$$$$$$$$$%$$IMIHJHIIIHMIIIIHIIIMDNHIIIHIIMIIHIIIIHNHIIIHIIIMELIIIIIIrrmqrmqqqnrqnrrrmqrmqqqnrqnrrrIrrrqrqIurrqrI)(IIurrqrI)HIIIumqnqrqnmnqqmrqrqH)(IqmqnmmqnmqnmmrnrqH%qIqnnqnqrmmmrmrqIqnnqnqrmmmrmrD)IHIIqnnqnqrmmmrmrDrIqnnqnqrmmmrmrD)IqIqnnqnqrmmmrmrDrIqnnqnqrmmmrmrD)IHIIqnnqnqrmmmrmrqIqmqnmmqnmqnmmrnrqH)(IIumqnqrqnmnqqmrqrqH)IIHIqqrnrmmmrD((IqnnqnqrmmmrmrD)qIqnnqnqrmmmrmrqIqnnqnqrmmmrmrrIqnnqnqrmmmrmruIqnnqnqrmmmrmqrIqnnqnqrmmmrmrqIqmqnmmqnmqnmmrnrqIumqnqrqnmnqqmrqIurrqrqI)HI)HI)ELE)IHI)HI)IHI)IH%MDI)IHI)IH)IIH)IH%MEH)III)HI)HI)ELE)IHI)HI)IHI)IH%MDI)IHI)IH)IIH)IH%MEH)IIqIqmrmrmmnqrmqmqmmmrqnqnqmnmqqmrmrmmnqrIurrqrqIurrqrI)HIIIurrqrIqIumqnqrqnmnqqmrqrqH)IIHIqmqnmmqnmqnmmrnrq%qIqnnqnqrmmmrmrD)IHIIqnnqnqrmmmrmrqIqnnqnqrmmmrmrD)qIqnnqnqrmmmrmrD%%IqnnqnqrmmmrmrD)IHIIqnnqnqrmmmrmrD)$IIqnnqnqrmmmrmrqIqmqnmmqnmqnmmrnrqH)IIHIumqnqrqnmnqqmrqrqH%qIqqrnrmmmrD-EHIIqnnqnqrmmmrmrDrIqnnqnqrmmmrmrqIqnnqnqrmmmrmrrIqnnqnqrmmmrmruIqnnqnqrmmmrmqrIqnnqnqrmmmrmrqIqmqnmmqnmqnmmrnrqIumqnqrqnmnqqmrqIurrqrqIurrqrqI$$$%I$$Idockapps/src/.xvpics/backlight_on.xpm000066400000000000000000000065461251075456100202360ustar00rootroot00000000000000P7 332 #IMGINFO:58x58 RGB (3805 bytes) #END_OF_COMMENTS 58 58 255 I$$$$IHI$%$$$$$$$$$$%$$IMIHJHIIIHMIIIIHIIIMDNHIIIHIIMIIHIIIIHNHIIIHIIIMELIIIIIIqqrqqruqqrqqqquqrqqqruqqqqqrquqqqurqqIquytyuxuytuytyuytyutyuxYyuuxuytyuxuuxuyuxuytuytyuyIuxuytyutyuytyuxuuxuytyuytuytyuxuUyuxuytyuty$-t)HyxIuxuytyutyuytyuxuuxuytyuytuytyuxuUyuxuytyuty$-(H)xuIuxuutUTYyuxuutuutQtyuxuutuutqytyuxuyuxuux)t) uIuTutuUuypyutyutuuTypyutyutuutuypyuxuyuxuux)tyu(tIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyuxuytuytIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyu(H()(xIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyu(TuxuIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyu(H(yuxuIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyu(TuxuIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyu(H()(xIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyuxuytuytIuTutuUuypyutyutuuTypyutyutuutuypyuxuyuxuux)(HyxIuxuutUTYyuxuutuutQtyuxuutuutqytyuxuyuxuux)(H()xuIuTuxuuxuytuypyuytyuxuutyutyuuxuytuytuytyuxYDy(y$yIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyu(T$yyIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyuxuytuytIuTytuytyupyutuytyuuxuutyqtyuxuytuutyytyyuxuuxuIuTytuytyupyutuytyuuxuutyqtyuxuytuutyyxuyuxuuxuytIuTytuytyupyutuytyuuxuutyqtyuxuytuutyyytyutyuxuIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuyytyuxuIuTutuUuypyutyutuuTypyutyutuutuypyuxuyuxyuytuytIuxuutUTYyuxuutuutQtyuxuutuutqytyuxyuyxuyuxuuIuxuytyutyuytyuxuuxuytyuytuytyuxuUyuxuytyutyuytyuxuIu(II)HE-DII)HI)IHI)HII)DM%IHI)HI)IHI)IHI)EL%IHI)IHyuIu(II)HE-DII)HI)IHI)HII)DM%IHI)HI)IHI)IHI)EL%IHI)IHuyIuxuQUTTUpuutuutuupuututuutqypuutuutuqtutUTUUIuxuytyutyuytyuxuuxuytyuytuytyuxuUyuxuytyutyuytyuxuIuxuytyutyuytyuxuuxuytyuytuytyuxuUyuxuytyuty$-(H)xuIuxuytyutyuytyuxuuxuytyuytuytyuxuUyuxuytyuty$}uuxuyIuxuutUTYyuxuutuutQtyuxuutuutqytyuxuyuxuux)(H()xuIuTutuUuypyutyutuuTypyutyutuutuypyuxuyuxuuxuyty$yyIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyu(H()(xIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyuxuytuytIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyu(T$yyIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyu((xuIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyu(H()(xIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyu(Hy((yuIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyuxuytuytIuTutuUuypyutyutuuTypyutyutuutuypyuxuyuxuux)(H()xuIuxuutUTYyuxuutuutQtyuxuutuutqytyuxuyuxuux)tyu(tIuTuxuuxuytuypyuytyuxuutyutyuuxuytuytuytyuxYD(),HyuIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyu(TuxuIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuuytyuxuytuytIuTytuytyupyutuytyuuxuutyqtyuxuytuutyytyyuxuuxuIuTytuytyupyutuytyuuxuutyqtyuxuytuutyyxuyuxuuxuytIuTytuytyupyutuytyuuxuutyqtyuxuytuutyyytyutyuxuIuTytuytyupyutuytyuuxuutyqtyuxuytuutyuxuyytyuxuIuTutuUuypyutyutuuTypyutyutuutuypyuxuyuxyuytuytIuxuutUTYyuxuutuutQtyuxuutuutqytyuxyuyxuyuxuuIuxuytyutyuytyuxuuxuytyuytuytyuxuUyuxuytyutyuytyuxuIuxuytyutyuytyuxuuxuytyuytuytyuxuUyuxuytyutyuytyuxI$$$%I$$Idockapps/src/Makefile.am000066400000000000000000000007111251075456100155120ustar00rootroot00000000000000bin_PROGRAMS = wmmemload wmmemload_SOURCES = \ main.c \ mem.h \ mem_@OS@.c \ dockapp.c \ dockapp.h \ backdrop_off.xpm \ backdrop_on.xpm \ parts_mem.xpm \ parts_swap.xpm EXTRA_wmmemload_SOURCES = \ mem_linux.c \ mem_freebsd.c \ mem_openbsd.c \ mem_solaris.c AM_CPPFLAGS = @DFLAGS@ @HEADER_SEARCH_PATH@ wmmemload_LDADD = @LIBRARY_SEARCH_PATH@ @XLIBS@ INSTALL_PROGRAM = \ @INSTALL_PROGRAM@ \ @SETGID_FLAGS@ \ $(AM_INSTALL_PROGRAM_FLAGS) dockapps/src/backlight_off.xpm000066400000000000000000000073361251075456100170000ustar00rootroot00000000000000/* XPM */ static char * backlight_off_xpm[] = { "58 58 10 1", " c None", ". c #020202", "+ c #0A0A0A", "@ c #484C46", "# c #DEDEDE", "$ c #7C827C", "% c #8E968A", "& c #444740", "* c #767C6F", "= c #3E463E", " ...................................................... ", " .++++++++++++++++++++++++++++++++++++++++++++++++++++++. ", ".++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.#", ".+@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$.#", ".+@$$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%.#", ".+@$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&%&&%%.#", ".+@$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&&&%%.#", ".+@$%%%******%%%%%%******%%%%%%******%%%%%%%%%%%%&%&%&%%.#", ".+@$%*%%****%%*%%*%%****%%*%%*%%****%%*%%%%%%%%%%&%%%&%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%%%%%%%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&&&&&%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&%%%%%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&&&%%%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&%%%%%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&&&&&%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%%%%%%%%.#", ".+@$%*%%****%%*%%*%%****%%*%%*%%****%%*%%%%%%%%%%&&%&&%%.#", ".+@$%%%******%%%%%%******%%%%%%******%%%%%%%%%%%%&&&&&%%.#", ".+@$%*%%%%%%%%*%%*%%%%%%%%*%%*%%%%%%%%*%%%%%%%%%%&%&%&%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&%%%&%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%%%%%%%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%...%%%.%%%%%%%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%.%.%%.%%%%%%%%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%...%.%%%%%%%%%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%.%...%%%%%%%.#", ".+@$%*%%****%%*%%*%%****%%*%%*%%****%%*%%%%.%%.%.%%%%%%%.#", ".+@$%%%******%%%%%%******%%%%%%******%%%%%.%%%...%%%%%%%.#", ".+@$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%.#", ".+@$%=================================================%%.#", ".+@$%=================================================*%.#", ".+@$%%*************************************************%.#", ".+@$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%.#", ".+@$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&&&%%.#", ".+@$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%%%.#", ".+@$%%%******%%%%%%******%%%%%%******%%%%%%%%%%%%&&&&&%%.#", ".+@$%*%%****%%*%%*%%****%%*%%*%%****%%*%%%%%%%%%%%%%%&%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&&&&&%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%%%%%%%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&%%%&%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&%&%&%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&&&&&%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&&%&&%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%%%%%%%%.#", ".+@$%*%%****%%*%%*%%****%%*%%*%%****%%*%%%%%%%%%%&&&&&%%.#", ".+@$%%%******%%%%%%******%%%%%%******%%%%%%%%%%%%&%%%&%%.#", ".+@$%*%%%%%%%%*%%*%%%%%%%%*%%*%%%%%%%%*%%%%%%%%%%&&&&&%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&%%%%%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%%%%%%%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%...%%%.%%%%%%%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%.%.%%.%%%%%%%%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%...%.%%%%%%%%%%.#", ".+@$%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%.%...%%%%%%%.#", ".+@$%*%%****%%*%%*%%****%%*%%*%%****%%*%%%%.%%.%.%%%%%%%.#", ".+@$%%%******%%%%%%******%%%%%%******%%%%%.%%%...%%%%%%%.#", ".+@$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%.#", ".+@$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%..#", " .......................................................# ", " ###################################################### "}; dockapps/src/backlight_on.xpm000066400000000000000000000073751251075456100166450ustar00rootroot00000000000000/* XPM */ static char * backlight_on_xpm[] = { "58 58 10 1", " c None", ". c #020202", "+ c #0A0A0A", "@ c #484C46 s Back1", "# c #DEDEDE", "$ c #779866", "% c #6EC63B s Back0", "& c #2E4C17 s Back1", "* c #6CB237 s Back1", "= c #3E463E", " ...................................................... ", " .%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%. ", ".%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#", ".%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#", ".%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#", ".%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&%&&%%%#", ".%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&&&%%%#", ".%%%%%%******%%%%%%******%%%%%%******%%%%%%%%%%%%&%&%&%%%#", ".%%%%*%%****%%*%%*%%****%%*%%*%%****%%*%%%%%%%%%%&%%%&%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%%%%%%%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&&&&&%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&%%%%%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&&&%%%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&%%%%%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&&&&&%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%%%%%%%%%#", ".%%%%*%%****%%*%%*%%****%%*%%*%%****%%*%%%%%%%%%%&&%&&%%%#", ".%%%%%%******%%%%%%******%%%%%%******%%%%%%%%%%%%&&&&&%%%#", ".%%%%*%%%%%%%%*%%*%%%%%%%%*%%*%%%%%%%%*%%%%%%%%%%&%&%&%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&%%%&%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%%%%%%%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%...%%%.%%%%%%%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%.%.%%.%%%%%%%%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%...%.%%%%%%%%%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%.%...%%%%%%%%#", ".%%%%*%%****%%*%%*%%****%%*%%*%%****%%*%%%%.%%.%.%%%%%%%%#", ".%%%%%%******%%%%%%******%%%%%%******%%%%%.%%%...%%%%%%%%#", ".%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#", ".%%%%=================================================%%%#", ".%%%%=================================================*%%#", ".%%%%%*************************************************%%#", ".%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#", ".%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&&&%%%#", ".%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%%%%#", ".%%%%%%******%%%%%%******%%%%%%******%%%%%%%%%%%%&&&&&%%%#", ".%%%%*%%****%%*%%*%%****%%*%%*%%****%%*%%%%%%%%%%%%%%&%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&&&&&%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%%%%%%%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&%%%&%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&%&%&%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&&&&&%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&&%&&%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%%%%%%%%%#", ".%%%%*%%****%%*%%*%%****%%*%%*%%****%%*%%%%%%%%%%&&&&&%%%#", ".%%%%%%******%%%%%%******%%%%%%******%%%%%%%%%%%%&%%%&%%%#", ".%%%%*%%%%%%%%*%%*%%%%%%%%*%%*%%%%%%%%*%%%%%%%%%%&&&&&%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%&%%%%%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%%%%%%%%%%%%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%...%%%.%%%%%%%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%.%.%%.%%%%%%%%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%...%.%%%%%%%%%%%#", ".%%%%**%%%%%%**%%**%%%%%%**%%**%%%%%%**%%%%%.%...%%%%%%%%#", ".%%%%*%%****%%*%%*%%****%%*%%*%%****%%*%%%%.%%.%.%%%%%%%%#", ".%%%%%%******%%%%%%******%%%%%%******%%%%%.%%%...%%%%%%%%#", ".%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#", ".%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#", " .%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# ", " ###################################################### "}; dockapps/src/dockapp.c000066400000000000000000000235361251075456100152550ustar00rootroot00000000000000/* * Copyright (c) 1999 Alfredo K. Kojima * Copyright (c) 2001, 2002 Seiichi SATO * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * This code is based on libdockapp-0.4.0 * modified by Seiichi SATO */ #include "dockapp.h" #define WINDOWED_SIZE_W 64 #define WINDOWED_SIZE_H 64 /* global */ Display *display = NULL; Bool dockapp_iswindowed = False; Bool dockapp_isbrokenwm = False; /* private */ static Window window = None; static Window icon_window = None; static GC gc; static int depth; static Atom delete_win; static int width, height; static int offset_w, offset_h; void dockapp_open_window(char *display_specified, char *appname, unsigned w, unsigned h, int argc, char **argv) { XClassHint *classhint; XWMHints *wmhints; XTextProperty title; XSizeHints sizehints; Window root; int ww, wh; /* Open Connection to X Server */ display = XOpenDisplay(display_specified); if (!display) { fprintf(stderr, "%s: could not open display %s!\n", argv[0], XDisplayName(display_specified)); exit(1); } root = DefaultRootWindow(display); width = w; height = h; if (dockapp_iswindowed) { offset_w = (WINDOWED_SIZE_W - w) / 2; offset_h = (WINDOWED_SIZE_H - h) / 2; ww = WINDOWED_SIZE_W; wh = WINDOWED_SIZE_H; } else { offset_w = offset_h = 0; ww = w; wh = h; } /* Create Windows */ icon_window = XCreateSimpleWindow(display, root, 0, 0, ww, wh, 0, 0, 0); if (dockapp_isbrokenwm) window = XCreateSimpleWindow(display, root, 0, 0, ww, wh, 0, 0, 0); else window = XCreateSimpleWindow(display, root, 0, 0, 1, 1, 0, 0, 0); /* Set ClassHint */ classhint = XAllocClassHint(); if (classhint == NULL) { fprintf(stderr, "%s: can't allocate memory for wm hints!\n", argv[0]); exit(1); } classhint->res_class = "DockApp"; classhint->res_name = appname; XSetClassHint(display, window, classhint); XFree(classhint); /* Set WMHints */ wmhints = XAllocWMHints(); if (wmhints == NULL) { fprintf(stderr, "%s: can't allocate memory for wm hints!\n", argv[0]); exit(1); } wmhints->flags = IconWindowHint | WindowGroupHint; if (!dockapp_iswindowed) { wmhints->flags |= StateHint; wmhints->initial_state = WithdrawnState; } wmhints->window_group = window; wmhints->icon_window = icon_window; XSetWMHints(display, window, wmhints); XFree(wmhints); /* Set WM Protocols */ delete_win = XInternAtom(display, "WM_DELETE_WINDOW", False); XSetWMProtocols(display, icon_window, &delete_win, 1); /* Set Size Hints */ sizehints.flags = USSize; if (!dockapp_iswindowed) { sizehints.flags |= USPosition; sizehints.x = sizehints.y = 0; } else { sizehints.flags |= PMinSize | PMaxSize; sizehints.min_width = sizehints.max_width = WINDOWED_SIZE_W; sizehints.min_height = sizehints.max_height = WINDOWED_SIZE_H; } sizehints.width = ww; sizehints.height = wh; XSetWMNormalHints(display, icon_window, &sizehints); /* Set WindowTitle for AfterStep Wharf */ XStringListToTextProperty(&appname, 1, &title); XSetWMName(display, window, &title); XSetWMName(display, icon_window, &title); /* Set Command to start the app so it can be docked properly */ XSetCommand(display, window, argv, argc); depth = DefaultDepth(display, DefaultScreen(display)); gc = DefaultGC(display, DefaultScreen(display)); XFlush(display); } void dockapp_set_eventmask(long mask) { XSelectInput(display, icon_window, mask); XSelectInput(display, window, mask); } static Pixmap create_bg_pixmap(void) { Pixmap bg; bg = XCreatePixmap(display, icon_window, WINDOWED_SIZE_W, WINDOWED_SIZE_H, depth); XSetForeground(display, gc, dockapp_getcolor("rgb:ae/aa/ae")); XFillRectangle(display, bg, gc, 0, 0, WINDOWED_SIZE_W, WINDOWED_SIZE_H); XSetForeground(display, gc, dockapp_getcolor("rgb:ff/ff/ff")); XDrawLine(display, bg, gc, 0, 0, 0, 63); XDrawLine(display, bg, gc, 1, 0, 1, 62); XDrawLine(display, bg, gc, 2, 0, 63, 0); XDrawLine(display, bg, gc, 2, 1, 62, 1); XSetForeground(display, gc, dockapp_getcolor("rgb:52/55/52")); XDrawLine(display, bg, gc, 1, 63, 63, 63); XDrawLine(display, bg, gc, 2, 62, 63, 62); XDrawLine(display, bg, gc, 63, 1, 63, 61); XDrawLine(display, bg, gc, 62, 2, 62, 61); return bg; } void dockapp_set_background(Pixmap pixmap) { if (dockapp_iswindowed) { Pixmap bg; bg = create_bg_pixmap(); XCopyArea(display, pixmap, bg, gc, 0, 0, width, height, offset_w, offset_w); XSetWindowBackgroundPixmap(display, icon_window, bg); XSetWindowBackgroundPixmap(display, window, bg); XFreePixmap(display, bg); } else { XSetWindowBackgroundPixmap(display, icon_window, pixmap); XSetWindowBackgroundPixmap(display, window, pixmap); } XClearWindow(display, icon_window); XFlush(display); } void dockapp_show(void) { if (!dockapp_iswindowed) XMapRaised(display, window); else XMapRaised(display, icon_window); XFlush(display); } Bool dockapp_xpm2pixmap(char **data, Pixmap *pixmap, Pixmap *mask, XpmColorSymbol *colorSymbol, unsigned int nsymbols) { XpmAttributes xpmAttr; xpmAttr.valuemask = XpmCloseness; xpmAttr.closeness = 40000; if (nsymbols) { xpmAttr.colorsymbols = colorSymbol; xpmAttr.numsymbols = nsymbols; xpmAttr.valuemask |= XpmColorSymbols; } if (XpmCreatePixmapFromData(display, icon_window, data, pixmap, mask, &xpmAttr) != 0) return False; return True; } Pixmap dockapp_XCreatePixmap(int w, int h) { return XCreatePixmap(display, icon_window, w, h, depth); } void dockapp_setshape(Pixmap mask, int x_ofs, int y_ofs) { XShapeCombineMask(display, icon_window, ShapeBounding, -x_ofs, -y_ofs, mask, ShapeSet); XShapeCombineMask(display, window, ShapeBounding, -x_ofs, -y_ofs, mask, ShapeSet); XFlush(display); } void dockapp_copyarea(Pixmap src, Pixmap dist, int x_src, int y_src, int w, int h, int x_dist, int y_dist) { XCopyArea(display, src, dist, gc, x_src, y_src, w, h, x_dist, y_dist); } void dockapp_copy2window(Pixmap src) { if (dockapp_isbrokenwm) { XCopyArea(display, src, window, gc, 0, 0, width, height, offset_w, offset_h); } else { XCopyArea(display, src, icon_window, gc, 0, 0, width, height, offset_w, offset_h); } } Bool dockapp_nextevent_or_timeout(XEvent *event, unsigned long miliseconds) { struct timeval timeout; fd_set rset; XSync(display, False); if (XPending(display)) { XNextEvent(display, event); return True; } timeout.tv_sec = miliseconds / 1000; timeout.tv_usec = (miliseconds % 1000) * 1000; FD_ZERO(&rset); FD_SET(ConnectionNumber(display), &rset); if (select(ConnectionNumber(display)+1, &rset, NULL, NULL, &timeout) > 0) { XNextEvent(display, event); if (event->type == ClientMessage) { if (event->xclient.data.l[0] == delete_win) { XDestroyWindow(display, event->xclient.window); XCloseDisplay(display); exit(0); } } if (dockapp_iswindowed) { event->xbutton.x -= offset_w; event->xbutton.y -= offset_h; } return True; } return False; } unsigned long dockapp_getcolor(char *color_name) { XColor color; if (!XParseColor(display, DefaultColormap(display, DefaultScreen(display)), color_name, &color)) fprintf(stderr, "can't parse color %s\n", color_name), exit(1); if (!XAllocColor(display, DefaultColormap(display, DefaultScreen(display)), &color)) { fprintf(stderr, "can't allocate color %s. Using black\n", color_name); return BlackPixel(display, DefaultScreen(display)); } return color.pixel; } unsigned long dockapp_blendedcolor(char *color_name, int r, int g, int b, float fac) { XColor color; if ((r < -255 || r > 255) || (g < -255 || g > 255) || (b < -255 || b > 255)) { fprintf(stderr, "r:%d,g:%d,b:%d (r,g,b must be 0 to 255)", r, g, b); exit(1); } r *= 255; g *= 255; b *= 255; if (!XParseColor(display, DefaultColormap(display, DefaultScreen(display)), color_name, &color)) fprintf(stderr, "can't parse color %s\n", color_name), exit(1); if (!XAllocColor(display, DefaultColormap(display, DefaultScreen(display)), &color)) { fprintf(stderr, "can't allocate color %s. Using black\n", color_name); return BlackPixel(display, DefaultScreen(display)); } if (DefaultDepth(display, DefaultScreen(display)) < 16) return color.pixel; /* red */ if (color.red + r > 0xffff) color.red = 0xffff; else if (color.red + r < 0) color.red = 0; else color.red = (unsigned short)(fac * color.red + r); /* green */ if (color.green + g > 0xffff) color.green = 0xffff; else if (color.green + g < 0) color.green = 0; else color.green = (unsigned short)(fac * color.green + g); /* blue */ if (color.blue + b > 0xffff) color.blue = 0xffff; else if (color.blue + b < 0) color.blue = 0; else color.blue = (unsigned short)(fac * color.blue + b); color.flags = DoRed | DoGreen | DoBlue; if (!XAllocColor(display, DefaultColormap(display, DefaultScreen(display)), &color)) { fprintf(stderr, "can't allocate color %s. Using black\n", color_name); return BlackPixel(display, DefaultScreen(display)); } return color.pixel; } dockapps/src/dockapp.h000066400000000000000000000054661251075456100152640ustar00rootroot00000000000000/* * Copyright (c) 1999 Alfredo K. Kojima * Copyright (c) 2001, 2002 Seiichi SATO * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * This code is based on libdockapp-0.4.0 * modified by Seiichi SATO */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_SELECT # include #endif #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #if HAVE_UNISTD_H # include #else /* We are in trouble. */ #endif extern Display *display; extern Bool dockapp_iswindowed; extern Bool dockapp_isbrokenwm; void dockapp_open_window(char *display_specified, char *appname, unsigned w, unsigned h, int argc, char **argv); void dockapp_set_eventmask(long mask); void dockapp_set_background(Pixmap pixmap); void dockapp_show(void); Bool dockapp_xpm2pixmap(char **data, Pixmap *pixmap, Pixmap *mask, XpmColorSymbol *colorSymbol, unsigned int nsymbols); Pixmap dockapp_XCreatePixmap(int w, int h); void dockapp_setshape(Pixmap mask, int x_ofs, int y_ofs); void dockapp_copyarea(Pixmap src, Pixmap dist, int x_src, int y_src, int w, int h, int x_dist, int y_dist); void dockapp_copy2window(Pixmap src); Bool dockapp_nextevent_or_timeout(XEvent *event, unsigned long miliseconds); unsigned long dockapp_getcolor(char *color); unsigned long dockapp_blendedcolor(char *color, int r, int g, int b, float fac); dockapps/src/main.c000066400000000000000000000245371251075456100145620ustar00rootroot00000000000000/* * WMMemLoad - A dockapp to monitor memory usage * Copyright (C) 2002 Mark Staggs * * Based on work by Seiichi SATO * Copyright (C) 2001,2002 Seiichi SATO * 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. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "dockapp.h" #include "mem.h" #include "backlight_on.xpm" #include "backlight_off.xpm" #include "parts.xpm" #define SIZE 58 #define WINDOWED_BG " \tc #AEAAAE" #define MAX_HISTORY 16 #define CPUNUM_NONE -1 typedef enum { LIGHTON, LIGHTOFF } light; Pixmap pixmap; Pixmap backdrop_on; Pixmap backdrop_off; Pixmap parts; Pixmap mask; static char *display_name = ""; static char *light_color; /* back-light color */ static unsigned update_interval = 1; static light backlight = LIGHTOFF; static struct mem_options mem_opts; static int mem_usage; static int swap_usage; static unsigned alarm_mem = 101; static unsigned alarm_swap = 101; /* prototypes */ static void update(void); static void switch_light(void); static void draw_memdigit(int per); static void draw_swapdigit(int per); static void parse_arguments(int argc, char **argv); static void print_help(char *prog); int main(int argc, char **argv) { XEvent event; XpmColorSymbol colors[2] = { {"Back0", NULL, 0}, {"Back1", NULL, 0} }; int ncolor = 0; /* Parse CommandLine */ mem_opts.ignore_buffers = mem_opts.ignore_cached = mem_opts.ignore_wired = False; parse_arguments(argc, argv); /* Initialize Application */ mem_init(); dockapp_open_window(display_name, PACKAGE, SIZE, SIZE, argc, argv); dockapp_set_eventmask(ButtonPressMask); if (light_color) { colors[0].pixel = dockapp_getcolor(light_color); colors[1].pixel = dockapp_blendedcolor(light_color, -24, -24, -24, 1.0); ncolor = 2; } /* change raw xpm data to pixmap */ if (dockapp_iswindowed) backlight_on_xpm[1] = backlight_off_xpm[1] = WINDOWED_BG; if (!dockapp_xpm2pixmap(backlight_on_xpm, &backdrop_on, &mask, colors, ncolor)) { fprintf(stderr, "Error initializing backlit background image.\n"); exit(1); } if (!dockapp_xpm2pixmap(backlight_off_xpm, &backdrop_off, NULL, NULL, 0)) { fprintf(stderr, "Error initializing background image.\n"); exit(1); } if (!dockapp_xpm2pixmap(parts_xpm, &parts, NULL, colors, ncolor)) { fprintf(stderr, "Error initializing parts image.\n"); exit(1); } /* shape window */ if (!dockapp_iswindowed) dockapp_setshape(mask, 0, 0); if (mask) XFreePixmap(display, mask); /* pixmap : draw area */ pixmap = dockapp_XCreatePixmap(SIZE, SIZE); /* Initialize pixmap */ if (backlight == LIGHTON) dockapp_copyarea(backdrop_on, pixmap, 0, 0, SIZE, SIZE, 0, 0); else dockapp_copyarea(backdrop_off, pixmap, 0, 0, SIZE, SIZE, 0, 0); dockapp_set_background(pixmap); dockapp_show(); /* Main loop */ while (1) { if (dockapp_nextevent_or_timeout(&event, update_interval * 1000)) { /* Next Event */ switch (event.type) { case ButtonPress: switch_light(); break; default: /* make gcc happy */ break; } } else { /* Time Out */ update(); } } return 0; } /* called by timer */ static void update(void) { static light pre_backlight; static Bool in_alarm_mode = False; /* get current cpu usage in percent */ mem_getusage(&mem_usage, &swap_usage, &mem_opts); /* alarm mode */ if (mem_usage >= alarm_mem || swap_usage >= alarm_swap) { if (!in_alarm_mode) { in_alarm_mode = True; pre_backlight = backlight; } if (backlight == LIGHTOFF) { switch_light(); return; } } else { if (in_alarm_mode) { in_alarm_mode = False; if (backlight != pre_backlight) { switch_light(); return; } } } /* all clear */ if (backlight == LIGHTON) dockapp_copyarea(backdrop_on, pixmap, 0, 0, 58, 58, 0, 0); else dockapp_copyarea(backdrop_off, pixmap, 0, 0, 58, 58, 0, 0); /* draw digit */ draw_memdigit(mem_usage); draw_swapdigit(swap_usage); /* show */ dockapp_copy2window(pixmap); } /* called when mouse button pressed */ static void switch_light(void) { switch (backlight) { case LIGHTOFF: backlight = LIGHTON; dockapp_copyarea(backdrop_on, pixmap, 0, 0, 58, 58, 0, 0); break; case LIGHTON: backlight = LIGHTOFF; dockapp_copyarea(backdrop_off, pixmap, 0, 0, 58, 58, 0, 0); break; } /* redraw digit */ mem_getusage(&mem_usage, &swap_usage, &mem_opts); draw_memdigit(mem_usage); draw_swapdigit(swap_usage); /* show */ dockapp_copy2window(pixmap); } static void draw_memdigit(int per) { int v100, v10, v1; int y = 0; if (per < 0) per = 0; if (per > 100) per = 100; v100 = per / 100; v10 = (per - v100 * 100) / 10; v1 = (per - v100 * 100 - v10 * 10); if (backlight == LIGHTON) y = 20; /* draw digit */ dockapp_copyarea(parts, pixmap, v1 * 10, y, 10, 20, 29, 7); if (v10 != 0) dockapp_copyarea(parts, pixmap, v10 * 10, y, 10, 20, 17, 7); if (v100 == 1) { dockapp_copyarea(parts, pixmap, 10, y, 10, 20, 5, 7); dockapp_copyarea(parts, pixmap, 0, y, 10, 20, 17, 7); } } static void draw_swapdigit(int per) { int v100, v10, v1; int y = 0; if (per < 0) per = 0; if (per > 100) per = 100; v100 = per / 100; v10 = (per - v100 * 100) / 10; v1 = (per - v100 * 100 - v10 * 10); if (backlight == LIGHTON) y = 20; /* draw digit */ dockapp_copyarea(parts, pixmap, v1 * 10, y, 10, 20, 29, 34); if (v10 != 0) dockapp_copyarea(parts, pixmap, v10 * 10, y, 10, 20, 17, 34); if (v100 == 1) { dockapp_copyarea(parts, pixmap, 10, y, 10, 20, 5, 34); dockapp_copyarea(parts, pixmap, 0, y, 10, 20, 17, 34); } } static void parse_arguments(int argc, char **argv) { int i; int integer; for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) print_help(argv[0]), exit(0); else if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "-v")) printf("%s version %s\n", PACKAGE, VERSION), exit(0); else if (!strcmp(argv[i], "--display") || !strcmp(argv[i], "-d")) { display_name = argv[i + 1]; i++; } else if (!strcmp(argv[i], "--alarm-mem") || !strcmp(argv[i], "-am")) { if (argc == i + 1) alarm_mem = 90; else if (sscanf(argv[i + 1], "%i", &integer) != 1) alarm_mem = 90; else if (integer < 0 || integer > 100) fprintf(stderr, "%s: argument %s must be from 0 to 100\n", argv[0], argv[i]), exit(1); else alarm_mem = integer, i++; } else if (!strcmp(argv[i], "--alarm-swap") || !strcmp(argv[i], "-as")) { if (argc == i + 1) alarm_swap = 50; else if (sscanf(argv[i + 1], "%i", &integer) != 1) alarm_swap = 50; else if (integer < 0 || integer > 100) fprintf(stderr, "%s: argument %s must be from 0 to 100\n", argv[0], argv[i]), exit(1); else alarm_swap = integer, i++; } else if (!strcmp(argv[i], "--backlight") || !strcmp(argv[i], "-bl")) backlight = LIGHTON; else if (!strcmp(argv[i], "--light-color") || !strcmp(argv[i], "-lc")) { light_color = argv[i + 1]; i++; } else if (!strcmp(argv[i], "--interval") || !strcmp(argv[i], "-i")) { if (argc == i + 1) fprintf(stderr, "%s: error parsing argument for option %s\n", argv[0], argv[i]), exit(1); if (sscanf(argv[i + 1], "%i", &integer) != 1) fprintf(stderr, "%s: error parsing argument for option %s\n", argv[0], argv[i]), exit(1); if (integer < 1) fprintf(stderr, "%s: argument %s must be >=1\n", argv[0], argv[i]), exit(1); update_interval = integer; i++; } else if (!strcmp(argv[i], "--windowed") || !strcmp(argv[i], "-w")) dockapp_iswindowed = True; else if (!strcmp(argv[i], "--broken-wm") || !strcmp(argv[i], "-bw")) dockapp_isbrokenwm = True; #ifdef IGNORE_BUFFERS else if (!strcmp(argv[i], "--ignore-buffers") || !strcmp(argv[i], "-b")) mem_opts.ignore_buffers = True; #endif #ifdef IGNORE_CACHED else if (!strcmp(argv[i], "--ignore-cached") || !strcmp(argv[i], "-c")) mem_opts.ignore_cached = True; #endif #ifdef IGNORE_WIRED else if (!strcmp(argv[i], "--ignore-wired") || !strcmp(argv[i], "-wr")) mem_opts.ignore_wired = True; #endif else { fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], argv[i]); print_help(argv[0]), exit(1); } } if (alarm_mem != 101 && alarm_swap != 101) { fprintf(stderr, "%s: select either '-am, --alarm-mem' or '-as, --alarm-swap'\n", argv[0]); exit(1); } } static void print_help(char *prog) { printf("Usage : %s [OPTIONS]\n", prog); printf("WMMemMon - Window Maker memory/swap monitor dockapp\n"); printf(" -d, --display display to use\n"); printf(" -bl, --backlight turn on back-light\n"); printf(" -lc, --light-color back-light color(rgb:6E/C6/3B is default)\n"); printf(" -i, --interval number of secs between updates (1 is default)\n"); #ifdef IGNORE_BUFFERS printf(" -b, --ignore-buffers ignore buffers\n"); #endif #ifdef IGNORE_CACHED printf(" -c, --ignore-cached ignore cached pages\n"); #endif #ifdef IGNORE_WIRED printf(" -wr, --ignore-wired ignore wired pages\n"); #endif printf(" -h, --help show this help text and exit\n"); printf(" -v, --version show program version and exit\n"); printf(" -w, --windowed run the application in windowed mode\n"); printf(" -bw, --broken-wm activate broken window manager fix\n"); printf(" -am, --alarm-mem activate alarm mode of memory. \n"); printf(" is threshold of percentage from 0 to 100.\n"); printf(" (90 is default)\n"); printf(" -as, --alarm-swap activate alarm mode of swap. is\n"); printf(" threshold of percentage from 0 to 100.\n"); printf(" (50 is default)\n"); } dockapps/src/mem.h000066400000000000000000000005211251075456100144040ustar00rootroot00000000000000/* * mem.h - module to get memory/swap usages in percent * * Copyright (c) 2001 Seiichi SATO * * licensed under the GPL */ struct mem_options { int ignore_buffers; int ignore_cached; int ignore_wired; }; void mem_init(void); void mem_getusage(int *per_mem, int *per_swap, const struct mem_options *opts); dockapps/src/mem_freebsd.c000066400000000000000000000064601251075456100161010ustar00rootroot00000000000000/* * mem_freebsd.c - module to get memory/swap usages in percent, for FreeBSD * * Copyright(c) 2001 Seiichi SATO * * licensed under the GPL */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "mem.h" #include #include #include #include /* initialize function */ void mem_init(void) { return; } #define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var)) static void getsysctl(const char *name, void *ptr, size_t len) { size_t nlen = len; if (sysctlbyname(name, ptr, &nlen, NULL, 0) == -1) { fprintf(stderr, "sysctl(%s...) failed: %s\n", name, strerror(errno)); exit(1); } if (nlen != len) { fprintf(stderr, "sysctl(%s...) expected %lu, got %lu\n", name, (unsigned long)len, (unsigned long)nlen); exit(1); } } /* return mem/swap usage in percent 0 to 100 */ void mem_getusage(int *per_mem, int *per_swap, const struct mem_options *opts) { u_int mtotal, mwired, mcached, mfree, mused; #ifdef DEBUG u_int pagesize; #endif u_int new_swappgsin, new_swappgsout; static int swap_firsttime = 1; static int swappgsin = -1; static int swappgsout = -1; static int swapmax, swapused; time_t cur_time; static time_t last_time_swap; /* get mem usage */ GETSYSCTL("vm.stats.vm.v_page_count", mtotal); GETSYSCTL("vm.stats.vm.v_wire_count", mwired); GETSYSCTL("vm.stats.vm.v_cache_count", mcached); GETSYSCTL("vm.stats.vm.v_free_count", mfree); #ifdef DEBUG GETSYSCTL("hw.pagesize", pagesize); #endif /* get swap usage */ /* only calculate when first time or when changes took place */ /* do not call it more than 1 time per 2 seconds */ /* otherwise it can eat up to 50% of CPU time on heavy swap activity */ cur_time = time(NULL); GETSYSCTL("vm.stats.vm.v_swappgsin", new_swappgsin); GETSYSCTL("vm.stats.vm.v_swappgsout", new_swappgsout); if (swap_firsttime || (((new_swappgsin > swappgsin) || (new_swappgsout > swappgsout)) && cur_time > last_time_swap + 1)) { int mib[2], n; size_t mibsize, size; struct xswdev xsw; mibsize = sizeof(mib) / sizeof(mib[0]); if (sysctlnametomib("vm.swap_info", mib, &mibsize) == -1) { fprintf(stderr, "sysctlnametomib() failed: %s\n", strerror(errno)); exit(1); } swapmax = 0; swapused = 0; for (n = 0; ; n++) { mib[mibsize] = n; size = sizeof(xsw); if (sysctl(mib, mibsize + 1, &xsw, &size, NULL, 0) == -1) { if (errno == ENOENT) break; fprintf(stderr, "sysctl() failed: %s\n", strerror(errno)); exit(1); } swapmax += xsw.xsw_nblks; swapused += xsw.xsw_used; } swap_firsttime = 0; last_time_swap = cur_time; } swappgsin = new_swappgsin; swappgsout = new_swappgsout; #ifdef DEBUG printf("-------------------\n"); printf("total:%10d\n", mtotal * pagesize); printf("free :%10d\n", mfree * pagesize); printf("wired:%10d\n", mwired * pagesize); printf("cache:%10d\n", mcached * pagesize); printf("-------------------\n"); #endif /* calc mem/swap usage in percent */ mused = mtotal - mfree; if (opts->ignore_wired) mused -= mwired; if (opts->ignore_cached) mused -= mcached; *per_mem = 100 * (double) mused / (double) mtotal; *per_swap = 100 * (double) swapused / (double) swapmax; if (*per_mem > 97) *per_mem = 100; } dockapps/src/mem_gnu.c000066400000000000000000000064461251075456100152640ustar00rootroot00000000000000/* * mem_gnu.c - module to get memory/swap usages, for GNU/Hurd * * Copyright(C) 2014 Svante Signell * Copyright(C) 2001,2002 Seiichi SATO * Copyright(C) 2001 John McCutchan * * licensed under the GPL */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #if defined(HAVE_STRING_H) #include #elif defined(HAVE_STRINGS_H) #include #endif #include #include #include #include #include #include "mem.h" #ifdef DEBUG # define INLINE_STATIC static #else # define INLINE_STATIC static inline #endif /* initialize function */ void mem_init(void) { struct utsname un; int version, patchlevel; /* get kernel version */ if (uname(&un) == -1) perror("uname()"); sscanf(un.release, "%d.%d", &version, &patchlevel); } INLINE_STATIC char *skip_line(const char *p) { while (*p != '\n') p++; return (char *) ++p; } INLINE_STATIC char *skip_token(const char *p) { while (isspace(*p)) p++; while (*p && !isspace(*p)) p++; return (char *)p; } INLINE_STATIC char *skip_multiple_token(const char *p, int count) { int i; for (i = 0; i < count; i++) p = skip_token(p); return (char *)p; } /* return mem/swap usage in percent 0 to 100 */ void mem_getusage(int *per_mem, int *per_swap, const struct mem_options *opts) { char buffer[BUFSIZ], *p; int fd, len, i; u_int64_t mtotal, mused, mfree, mbuffer, mcached; u_int64_t stotal, sused, sfree, scached = 0; /* read /proc/meminfo */ fd = open("/proc/meminfo", O_RDONLY); if (fd < 0) { perror("can't open /proc/meminfo"); exit(1); } len = read(fd, buffer, BUFSIZ - 1); if (len < 0) { perror("can't read /proc/meminfo"); exit(1); } close(fd); buffer[len] = '\0'; p = buffer; p = skip_token(p); /* examine each line of file */ mtotal = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); mfree = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); mbuffer = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); mcached = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); scached = strtoul(p, &p, 0); /* skip N lines and examine info about swap */ while (isprint(p[0])) { p = skip_line(p); if (strncmp(p, "SwapTotal", 9) == 0) break; } p = skip_token(p); stotal = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); sfree = strtoul(p, &p, 0); /* calculate memory usage in percent */ mused = mtotal - mfree; if (opts->ignore_buffers) mused -= mbuffer; if (opts->ignore_cached) mused -= mcached; *per_mem = 100 * (double) mused / (double) mtotal; /* calculate swap usage in percent */ sused = stotal - sfree; if (opts->ignore_cached) sused -= scached; if (!stotal) *per_swap = 0; else *per_swap = 100 * (double) sused / (double) stotal; #if DEBUG printf("-----------------------\n"); printf("MemTotal: %12ld\n", (unsigned long)mtotal); printf("MemFree: %12ld\n", (unsigned long)mfree); printf("Buffers: %12ld\n", (unsigned long)mbuffer); printf("Cached: %12ld\n", (unsigned long)mcached); printf("SwapTotal: %12ld\n", (unsigned long)stotal); printf("SwapFree: %12ld\n", (unsigned long)sfree); printf("SwapCached:%12ld\n", (unsigned long)scached); printf("-----------------------\n\n"); #endif } dockapps/src/mem_linux.c000066400000000000000000000112121251075456100156150ustar00rootroot00000000000000/* * mem_linux.c - module to get memory/swap usages, for GNU/Linxu * * Copyright(C) 2001,2002 Seiichi SATO * Copyright(C) 2001 John McCutchan * * licensed under the GPL */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #if defined(HAVE_STRING_H) #include #elif defined(HAVE_STRINGS_H) #include #endif #include #include #include #include #include #include "mem.h" static enum { BEFORE_2_5_1, BETWEEN_2_5_1_AND_3_14, AFTER_3_14 } format; #ifdef DEBUG # define INLINE_STATIC static #else # define INLINE_STATIC static inline #endif /* initialize function */ void mem_init(void) { struct utsname un; int version, patchlevel, sublevel; /* get kernel version */ if (uname(&un) == -1) perror("uname()"); sscanf(un.release, "%d.%d.%d", &version, &patchlevel, &sublevel); /* new format ? (kernel >= 3.14 or 2.5.1pre?) */ /* see linux/fs/proc/proc_misc.c */ /* or linux/fs/proc/meminfo.c */ if ((version == 3 && patchlevel >= 14) || version > 3) format = AFTER_3_14; else if ((version == 2 && patchlevel >= 5 && sublevel >= 1) || (version == 2 && patchlevel >= 6 && sublevel >= 0) || version > 2) format = BETWEEN_2_5_1_AND_3_14; else format = BEFORE_2_5_1; } INLINE_STATIC char *skip_line(const char *p) { while (*p != '\n') p++; return (char *) ++p; } INLINE_STATIC char *skip_token(const char *p) { while (isspace(*p)) p++; while (*p && !isspace(*p)) p++; return (char *)p; } INLINE_STATIC char *skip_multiple_token(const char *p, int count) { int i; for (i = 0; i < count; i++) p = skip_token(p); return (char *)p; } /* return mem/swap usage in percent 0 to 100 */ void mem_getusage(int *per_mem, int *per_swap, const struct mem_options *opts) { char buffer[BUFSIZ], *p; int fd, len, i; u_int64_t mtotal, mused, mfree, mbuffer, mcached; u_int64_t stotal, sused, sfree, scached = 0; /* read /proc/meminfo */ fd = open("/proc/meminfo", O_RDONLY); if (fd < 0) { perror("can't open /proc/meminfo"); exit(1); } len = read(fd, buffer, BUFSIZ - 1); if (len < 0) { perror("can't read /proc/meminfo"); exit(1); } close(fd); buffer[len] = '\0'; p = buffer; switch (format) { case (BEFORE_2_5_1): /* skip 3 lines */ for (i = 0; i < 3; i++) p = skip_line(p); p = skip_token(p); /* examine each line of file */ mtotal = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); mfree = strtoul(p, &p, 0); p = skip_multiple_token(p, 5); mbuffer = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); mcached = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); scached = strtoul(p, &p, 0); break; case (BETWEEN_2_5_1_AND_3_14): p = skip_token(p); /* examine each line of file */ mtotal = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); mfree = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); mbuffer = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); mcached = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); scached = strtoul(p, &p, 0); break; case (AFTER_3_14): p = skip_token(p); /* examine each line of file */ mtotal = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); mfree = strtoul(p, &p, 0); p = skip_multiple_token(p, 5); /* skip MemAvailable line */ mbuffer = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); mcached = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); scached = strtoul(p, &p, 0); break; } /* skip N lines and examine info about swap */ /* kernel-2.4.2:N=8 2.4.16:N=7 */ while (isprint(p[0])) { p = skip_line(p); if (strncmp(p, "SwapTotal", 9) == 0) break; } p = skip_token(p); stotal = strtoul(p, &p, 0); p = skip_multiple_token(p, 2); sfree = strtoul(p, &p, 0); /* calculate memory usage in percent */ mused = mtotal - mfree; if (opts->ignore_buffers) mused -= mbuffer; if (opts->ignore_cached) mused -= mcached; *per_mem = 100 * (double) mused / (double) mtotal; /* calculate swap usage in percent */ sused = stotal - sfree; if (opts->ignore_cached) sused -= scached; if (!stotal) *per_swap = 0; else *per_swap = 100 * (double) sused / (double) stotal; #if DEBUG printf("-----------------------\n"); printf("MemTotal: %12ld\n", (unsigned long)mtotal); printf("MemFree: %12ld\n", (unsigned long)mfree); printf("Buffers: %12ld\n", (unsigned long)mbuffer); printf("Cached: %12ld\n", (unsigned long)mcached); printf("SwapTotal: %12ld\n", (unsigned long)stotal); printf("SwapFree: %12ld\n", (unsigned long)sfree); printf("SwapCached:%12ld\n", (unsigned long)scached); printf("-----------------------\n\n"); #endif } dockapps/src/mem_openbsd.c000066400000000000000000000036521251075456100161210ustar00rootroot00000000000000/* * mem_openbsd.c - module to get memory/swap usages in percent, for OpenBSD * * Copyright (c) 2001 Seiichi SATO * * licensed under the GPL */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "mem.h" #include #include #include /* initialize function */ void mem_init(void) { return; } /* get swap usage */ static int get_swap_usage(void) { struct swapent *swap_dev; int num_swap; int stotal, sused, i; stotal = sused = 0; num_swap = swapctl(SWAP_NSWAP, 0, 0); if (num_swap == 0) return 0; swap_dev = malloc(num_swap * sizeof(*swap_dev)); if (swap_dev == NULL) return 0; if (swapctl(SWAP_STATS, swap_dev, num_swap) == -1) return 0; for (i = 0; i < num_swap; i++) { if (swap_dev[i].se_flags & SWF_ENABLE) { stotal += swap_dev[i].se_nblks; sused += swap_dev[i].se_inuse; } } free(swap_dev); if (sused == 0) return 0; return (100 * (double) sused / (double) stotal); } /* return mem/swap usage in percent 0 to 100 */ void mem_getusage(int *per_mem, int *per_swap, const struct mem_options *opts) { struct vmtotal vm; size_t size = sizeof(vm); static int mib[] = { CTL_VM, VM_METER }; /* get mem usage */ if (sysctl(mib, 2, &vm, &size, NULL, 0) < 0) bzero(&vm, sizeof(vm)); /* calc mem usage in percent */ if (vm.t_rm > 0) *per_mem = 100 * (double) vm.t_rm / (double) (vm.t_rm + vm.t_free); if (*per_mem > 97) *per_mem = 100; /* swap */ *per_swap = get_swap_usage(); #ifdef DEBUG printf("t_rm total real memory in use %6d\n", vm.t_rm); printf("t_arm active real memory %6d\n", vm.t_arm); printf("t_rmshr shared real memory %6d\n", vm.t_rmshr); printf("t_armshr active shared real memory %6d\n", vm.t_armshr); printf("t_free free memory pages %6d\n", vm.t_free); #endif return; } dockapps/src/mem_solaris.c000066400000000000000000000022161251075456100161360ustar00rootroot00000000000000/* * mem_solaric.c - module to get memory/swap usages in percent, for Solaris * * Copyright (c) 2001 Jonathan Lang * Copyright (c) 2002 Seiichi SATO * * licensed under the GPL */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "mem.h" #include #include /* initialize function */ void mem_init(void) { /* solaris doesn't need initialization */ return; } /* return memory/swap usage in percent 0 to 100 */ void mem_getusage(int *per_mem, int *per_swap, const struct mem_options *opts) { static int mem_total; static int mem_free; static int swap_total; static int swap_free; struct anoninfo anon; /* get mem usage */ mem_total = sysconf(_SC_PHYS_PAGES); mem_free = sysconf(_SC_AVPHYS_PAGES); /* get swap usage */ if (swapctl(SC_AINFO, &anon) == -1) exit(1); swap_total = anon.ani_max; swap_free = anon.ani_max - anon.ani_resv; /* calc mem/swap usage in percent */ *per_mem = 100 * (1 - ((double) mem_free / (double) mem_total)); *per_swap = 100 * (1 - ((double) swap_free / (double) swap_total)); } dockapps/src/parts.xpm000066400000000000000000000125501251075456100153410ustar00rootroot00000000000000/* XPM */ static char * parts_xpm[] = { "104 49 8 1", " c None", ". c #8E968A", "+ c #020202", "@ c #767C6F", "# c #6EC63B s Back0", "$ c #6CB237 s Back1", "% c #FFFFFF", "& c #3E463E", "..++++++....@@@@@@....++++++....++++++....@@@@@@....++++++....++++++....++++++....++++++....++++++..++++", "+..++++..+@..@@@@..+@..++++..+@..++++..++..@@@@..++..++++..@+..++++..@@..++++..++..++++..++..++++..+..##", "++......++@@......++@@......++@@......++++......++++......@@++......@@@@......++++......++++......++++++", "++......++@@......++@@......++@@......++++......++++......@@++......@@@@......++++......++++......++..##", "++......++@@......++@@......++@@......++++......++++......@@++......@@@@......++++......++++......++++++", "++......++@@......++@@......++@@......++++......++++......@@++......@@@@......++++......++++......++..##", "++......++@@......++@@......++@@......++++......++++......@@++......@@@@......++++......++++......++++++", "++......++@@......++@@......++@@......++++......++++......@@++......@@@@......++++......++++......++..##", "++......++@@......++@@......++@@......++++......++++......@@++......@@@@......++++......++++......++++++", "+..@@@@..+@..@@@@..+@..++++..+@..++++..++..++++..++..++++..@+..++++..@@..@@@@..++..++++..++..++++..+..##", "..@@@@@@....@@@@@@....++++++....++++++....++++++....++++++....++++++....@@@@@@....++++++....++++++..++++", "+........+@........++........@@........+@........+@........++........+@........++........+@........+..##", "++......++@@......++++......@@@@......++@@......++@@......++++......++@@......++++......++@@......++++++", "++......++@@......++++......@@@@......++@@......++@@......++++......++@@......++++......++@@......++..##", "++......++@@......++++......@@@@......++@@......++@@......++++......++@@......++++......++@@......++++++", "++......++@@......++++......@@@@......++@@......++@@......++++......++@@......++++......++@@......++..##", "++......++@@......++++......@@@@......++@@......++@@......++++......++@@......++++......++@@......++++++", "++......++@@......++++......@@@@......++@@......++@@......++++......++@@......++++......++@@......++..##", "+..++++..+@..@@@@..++..++++..@@..++++..+@..@@@@..+@..++++..++..++++..+@..@@@@..++..++++..+@..++++..+++++", "..++++++....@@@@@@....++++++....++++++....@@@@@@....++++++....++++++....@@@@@@....++++++....++++++....##", "##++++++####$$$$$$####++++++####++++++####$$$$$$####++++++####++++++####++++++####++++++####++++++##++++", "+##++++##+$##$$$$##+$##++++##+$##++++##++##$$$$##++##++++##$+##++++##$$##++++##++##++++##++##++++##+%%%%", "++######++$$######++$$######++$$######++++######++++######$$++######$$$$######++++######++++######++%%%%", "++######++$$######++$$######++$$######++++######++++######$$++######$$$$######++++######++++######++%%%%", "++######++$$######++$$######++$$######++++######++++######$$++######$$$$######++++######++++######++%%%%", "++######++$$######++$$######++$$######++++######++++######$$++######$$$$######++++######++++######++%%%%", "++######++$$######++$$######++$$######++++######++++######$$++######$$$$######++++######++++######++%%%%", "++######++$$######++$$######++$$######++++######++++######$$++######$$$$######++++######++++######++%%%%", "++######++$$######++$$######++$$######++++######++++######$$++######$$$$######++++######++++######++%%%%", "+##$$$$##+$##$$$$##+$##++++##+$##++++##++##++++##++##++++##$+##++++##$$##$$$$##++##++++##++##++++##+%%%%", "##$$$$$$####$$$$$$####++++++####++++++####++++++####++++++####++++++####$$$$$$####++++++####++++++##%%%%", "+########+$########++########$$########+$########+$########++########+$########++########+$########+%%%%", "++######++$$######++++######$$$$######++$$######++$$######++++######++$$######++++######++$$######++%%%%", "++######++$$######++++######$$$$######++$$######++$$######++++######++$$######++++######++$$######++%%%%", "++######++$$######++++######$$$$######++$$######++$$######++++######++$$######++++######++$$######++%%%%", "++######++$$######++++######$$$$######++$$######++$$######++++######++$$######++++######++$$######++%%%%", "++######++$$######++++######$$$$######++$$######++$$######++++######++$$######++++######++$$######++%%%%", "++######++$$######++++######$$$$######++$$######++$$######++++######++$$######++++######++$$######++%%%%", "+##++++##+$##$$$$##++##++++##$$##++++##+$##$$$$##+$##++++##++##++++##+$##$$$$##++##++++##+$##++++##+%%%%", "##++++++####$$$$$$####++++++####++++++####$$$$$$####++++++####++++++####$$$$$$####++++++####++++++##%%%%", ".+++..@@@&.+++..+++.&@@@&&+++..+++..+++&.+++..+++.#+++##$$$&#+++##+++#&$$$&&+++##+++##+++&#+++##+++#%%%%", "+...+@...+@...+@...++...++...@+...@@...++...++...++###+$###+$###+$###++###++###$+###$$###++###++###+%%%%", "+...+@...+@...+@...++...++...@+...@@...++...++...++###+$###+$###+$###++###++###$+###$$###++###++###+%%%%", "+...+@...+@...+@...++...++...@+...@@...++...++...++###+$###+$###+$###++###++###$+###$$###++###++###+%%%%", "&@@@&.@@@&.+++..+++&&+++&&+++..+++..@@@&.+++..+++&&$$$&#$$$&#+++##+++&&+++&&+++##+++##$$$&#+++##+++&%%%%", "+...+@...++...@@...+@...+@...++...+@...++...+@...++###+$###++###$$###+$###+$###++###+$###++###+$###+%%%%", "+...+@...++...@@...+@...+@...++...+@...++...+@...++###+$###++###$$###+$###+$###++###+$###++###+$###+%%%%", "+...+@...++...@@...+@...+@...++...+@...++...+@...++###+$###++###$$###+$###+$###++###+$###++###+$###+%%%%", ".+++..@@@&.+++&.+++..@@@&&+++..+++..@@@&.+++..+++.#+++##$$$&#+++&#+++##$$$&&+++##+++##$$$&#+++##+++#%%%%"};