dockapps-dc20366/000077500000000000000000000000001256672467000136665ustar00rootroot00000000000000dockapps-dc20366/COPYING000066400000000000000000000432541256672467000147310ustar00rootroot00000000000000 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-dc20366/ChangeLog000066400000000000000000000116341256672467000154450ustar00rootroot00000000000000VERSION: 0.9.7 RELEASE DATE: 23 August 2015 -Bump _POSIX_C_SOURCE to 200112L. Otherwise, we get the following warning during build. wmload.c: In function ‘GetLoad’: wmload.c:523:10: warning: incompatible implicit declaration of built-in function ‘rint’ *usr = rint(Maximum * (float)(*usr) /total); ^ Obtained from the Debian package [1]. -Fix -Wunused-result compiler warning. Obtained from the Debian package [2]. [1] https://sources.debian.net/src/wmload/0.9.6-1/debian/patches/ bump_POSIX_C_SOURCE.patch/ [2] https://sources.debian.net/src/wmload/0.9.6-1/debian/patches/ fix_unused_result.patch/ VERSION: 0.9.6 RELEASE DATE: 15 April 2015 -Clarify copyright information. Add copyright header to wmload.c and COPYING file, obtained from https://www.gnu.org/licenses/gpl-2.0.txt. VERSION: 0.9.5 RELEASE DATE: 7 April 2015 -Now maintained by the Window Maker Developers Team -Replace deprecated Imakefile with Makefile. Update INSTALL to reflect changes. -Add missing headers. Fixes "incompatible implicit declaration of built-in function" warnings. -Add missing format arguments to fprintf(). Fixes "format not a string literal and no format arguments [-Wformat-security]" warnings. -Add more missing headers. Fixes -Wimplicit-function-declaration warnings. -Pass XCreateBitmapFromData a pointer to char as expected. Previously, a pointer to an unsigned char was passed, causing a "pointer targets differ in signedness [-Wpointer-sign]" warning. -Add manpage from Debian. Slightly modified from [1]. Also modify Makefile to install manpage. -Split ChangeLog off from README. Also remove redundant INSTALL section. -Incorporate changes from asload-0.9.3. Obtained from [2]. -Incorporate changes from asload-0.9.4. Obtained from [3]. -Remove trailing whitespace. -Include sys/wait.h. Needed to fix "implicit declaration of function ‘waitpid’" warning introduced after merging asload-0.9.4. -Remove ">/dev/console" from default command to execute on click. Otherwise, user may receive "permission denied" errors. -Check if Execute string is empty by testing first character. Fixes "the address of ‘Execute’ will always evaluate as ‘true’ [-Waddress]" warning. -Cast data from client message event to Atom for comparison. Fixes -Wsign-compare compiler warning. -Replace deprecated usleep with nanosleep. [1] http://manned.org/wmload/a214d0b5/src [2] http://tigr.net/afterstep/download/asload/asload-0.9.3.tar.gz [3] http://tigr.net/afterstep/download/asload/asload-0.9.4.tar.gz VERSION: 0.9.4 RELEASE DATE: 09 March 2000 by albert@tigr.net Fixed the security bug. The program now forks and the child drops privileges before executing an external command. VERSION: 0.9.3 RELEASE DATE: 03 March 2000 (sashav@sprintmail.com) -added range check for values. It seems that on 2.3 kernels time can go backwards :) -Destroying Icon window prior to main window to avoid shutdown time errors VERSION: 0.9.2 RELEASE DATE: 17 July 1997 -Minor cosmetic changes. The graph zone is now perfectly square, 54x54. -All values dealing with pixmap size have been adjusted to accomodate the new `look'. VERSION: 0.9.1 RELEASE DATE: 8 July 1997 -Uses correct ordering of PROC data. -Increases the differentiation between tones, just a smidgion. -Catches a "Once In A Blue Moon" condition. Under various circumstances rounding error results in a pixel count of 55 or 53. To prevent the 55 count from writing one pixel into the edge of the frame, wmload now catches these occurrences and corrects for them. VERSION: 0.9.0 RELEASE DATE: 6 July 1997 -Fixed the grayscale problem that occurred whenever the "-shape" argument was used. -Implemented the "-led" argument... ...the last release had the argument, however it wasn't implemented... ...ie: it did nothing. Called without the "-led" argument, wmload uses it's default color "LightSeaGreen" [which is the same as the asclock readout]. Called with the argument, it uses the named color. If the default color is unavailable, or the named color is invalid, wmload simply uses the 3 green tones found in the "back.xpm" pixmap. -Added a "-ver" argument... When used, it prints the current version on stdout. If it is called alone with no other arguments, wmload exits after printing its' version. Called with other arguments... wmload prints its' version and continues as normal. -Trapped bad arguments that don't start with "-". -Cleaned up the code a bit. -Removed unnecessary files from the distribution. VERSION: ? RELEASE DATE: ? -adapted from asload by Nic Bernstein added withdrawn option, added WM hints. changed trace color VERSION: asload 0.1 RELEASE DATE: 30th November 1996 - by Beat Christen, bchriste@iiic.ethz.ch - First Version for Linux /proc dockapps-dc20366/INSTALL000066400000000000000000000003521256672467000147170ustar00rootroot000000000000001. Check the Makefile to see if all the LIBS are ok for your system. ALSO, check DESTDIR and BINDIR; as they are now, a `make install' will put the wmload binary in /usr/local/bin. 2. `make' 3. `make install' 4. Enjoy!!!! (;-) dockapps-dc20366/Makefile000066400000000000000000000007121256672467000153260ustar00rootroot00000000000000OBJS = wmload.o LIBS = -lX11 -lXpm -lXext -lm PREFIX = /usr/local BINDIR = $(PREFIX)/bin MANDIR = $(PREFIX)/share/man/man1 INSTALL = install %.o: %.c $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< wmload: $(OBJS) $(CC) $(LDFLAGS) -o wmload $(OBJS) $(LIBS) clean: rm -f $(OBJS) wmload install: wmload $(INSTALL) -d $(DESTDIR)$(BINDIR) $(INSTALL) wmload $(DESTDIR)$(BINDIR) $(INSTALL) -d $(DESTDIR)$(MANDIR) $(INSTALL) -m 644 wmload.1 $(DESTDIR)$(MANDIR) dockapps-dc20366/README000066400000000000000000000037721256672467000145570ustar00rootroot00000000000000>================================================< wmload - WindowMaker load gauge Updated, cleaned up and "fixed" ================================================== NOTE: This is a load monitor which is designed to work with the PROC filesystem. Generally all Linux systems come with the PROC fs. If you're using a different Unix and it doesn't have the PROC fs, first see if there is one available... otherwise this monitor won't work! Work is currently underway to produce a more `portable' wmload that Solaris/Sun/HP etc. users can also enjoy. SUGGESTED INVOCATION (for WindowMaker!): `wmload -shape -withdrawn &' OR for a different graph color: `wmload -led ??? -shape -withdrawn &' ...replace "???" with a color name eg. green, red, orange, yellow, orchid, purple.... any of your systems standard X color symbols. SUGGESTED INVOCATION (for AfterStep): To load wmload in Wharf, add a line in .steprc: *Wharf wmload nil MaxSwallow "wmload" wmload -led green -shape & ...or to run it as a normal app: wmload -led "???" & NOTE: AfterStep doesn't require the "-withdrawn" option. AVAILABILITY: The latest release should be available from: http://windowmaker.org/dockapps?name=wmload TODO LIST: -Implement alternative `load' algorithms? LIABILITY & USABILITY: As usual, this software is bound by the GNU public license. You can use it however you see fit, as long as all the README's accompany any copy/version of it. THE KIND SOLES WHO HAVE WRITTEN/CONTRIBUTED TO THIS SOFTWARE, IN NO WAY ACCEPT LIABILITY OR ANY RESPONSIBILITY FOR THE USE OF, OR FOR ANY CONSEQUENCES RESULTING FROM THE USE OF THIS SOFTWARE. ...that having been said, I think you'll like this new version and shouldn't have problems with it. Happy load monitoring! FEEDBACK etc: Maintainer of the current version... Window Maker Developers Team, wmaker-dev@lists.windowmaker.org Previously maintained by... Ryan Land, rland@bc1.com Nic Bernstein Beat Christen, bchriste@iiic.ethz.ch (asload) ------ dockapps-dc20366/back.xpm000066400000000000000000000121271256672467000153170ustar00rootroot00000000000000/* XPM */ static char *back_xpm[] = { /* width height num_colors chars_per_pixel */ " 64 64 47 1", /* colors */ ". c #010103", "# c #818183", "a c #414143", "b c #c1c1c3", "c c #a1a1a3", "d c #616163", "e c #919193", "f c #515153", "g c #b1b1b3", "h c #717173", "i c #29292b", "j c #fdfdfb", "k c #cdcdcb", "l c #353533", "m c #89898b", "n c #49494b", "o c #a9a9ab", "p c #69696b", "q c #99999b", "r c #59595b", "s c #b9b9bb", "t c #79797b", "u c #bdbdbb", "v c #c9c9cb", "w c #3d3d3b", "x c #313133", "y c #7d7d7b", "z c #d1d1d3", "A c #39393b", "B c #858583", "C c #454543", "D c #c5c5c3", "E c #a5a5a3", "F c #656563", "G c #959593", "H c #555553", "I c #b5b5b3", "J c #757573", "K c #8d8d8b", "L c #4d4d4b", "M c #adadab", "N c #6d6d6b", "O c #9d9d9b", "P c #5d5d5b", "Q c #009f00", "R c #00a600", "S c #00b600", /* pixels */ "qqqqqqqqqqqqqqqOOOOOOccccccEEEEEEEooooooMMMMMMggggggIIIIIIIIsssN", "OOOOOOOOOOOOOOOqOOOccOOcccEcEEEEEoEEoooMoMMgggMgggIIgIIIssubbDGC", "qqxxxxxxxxxxxlAAAwwwaaaCnnLLLffffHrHrPPddddFpppNNNNhhJJJttyyy#AC", "qqxxxlllllllAAAAwwaaaCCnnnLLfffHHrHPPPdddFpppNNNhhJJhJtttyy#BBwC", "OqllxlllllAAwwwaaaCCCnnnLLfffHrrrPrPdddFpFpppNNhhhhtJttyy##BBBaC", "OOxll.....................................................iBBman", "OOxll.QRSiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijmmman", "Oqxll.QRSiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijmmKCC", "OOxxl.QRSiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijKmKCn", "OOxll.QRSiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijKKKnn", "OOxxl.QRSiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijKeenn", "OclAA.QRSiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijeeeCL", "OOxAA.QRSiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijeeGnL", "OOAAw.QRSiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijeGGnn", "ccAAw.QRSiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijeGGnL", "ccAww.QRSiiiiiiiiiiiiiiiiiiiiiiiiii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CCCCnCnnLnLLLLffffHHHrrrPrPPPddPPPPddddddF" }; dockapps-dc20366/mask.xpm000066400000000000000000000064541256672467000153600ustar00rootroot00000000000000/* XPM */ static char *mask_xpm[] = { /* width height num_colors chars_per_pixel */ " 54 54 6 1", /* colors */ ". c #000000", "# c #282828", "a c #ffffff", "b c #5a5a5a", "c c #979797", "d c #e6e6e6", /* pixels */ ".....................................................#", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", ".bcd#################################################a", "#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }; dockapps-dc20366/mask2.xbm000066400000000000000000000046221256672467000154170ustar00rootroot00000000000000#define mask2_width 54 #define mask2_height 54 static unsigned char mask2_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; dockapps-dc20366/wmload.1000066400000000000000000000021541256672467000152350ustar00rootroot00000000000000.TH WMLOAD 1 "September 1999" .SH NAME wmload \- graphically display the kernel/system statistics .SH SYNOPSIS .B wmload [ \-u ] [ \-e ] [ \-l ] [ \-p [+|\-]x [+|\-]y ] [ \-s ] [ \-i ] [ \-w ] [ \-v ] .SH DESCRIPTION \fBwmload\fP displays a graphical representation of the kernel/system statistics on a 64x64 miniwindow. There are three shades in the window: the light one, which corresponds to \fIuser\fP statistics, second is the \fInice time\fP statistics, and the darkest one is \fIsystem\fP statistics. .SH OPTIONS .TP .I \-u updatespeed .TP .I \-e program to start on click .TP .I \-p [+|\-]x[+|\-]y position of wmload .TP .I \-s without groundplate .TP .I \-i start up as icon .TP .I \-w start up withdrawn .TP .I \-v output version .SH FILES .TP .I /proc/stat kernel/system statistics and other information .SH AUTHORS .B wmload was written by Ryan Land , based on asload by Beat Christen . .sp This manpage was written by Marcelo Magallon . .SH "SEE ALSO" .BR ps (1), .BR tload (1), .BR top (1), .BR uptime (5), .BR w (1). dockapps-dc20366/wmload.c000066400000000000000000000376331256672467000153310ustar00rootroot00000000000000/* wmload - system load monitor designed for Window Maker * Copyright (C) 1996 Beat Christen * Copyright (C) 1997 Ryan Land * Copyright (C) 2015 Window Maker Developers Team * * * 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. */ #define _POSIX_C_SOURCE 200112L #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "back.xpm" #include "mask2.xbm" #include "mask.xpm" #define major_VER 0 #define minor_VER 9 #define patch_VER 7 #define MW_EVENTS (ExposureMask | ButtonPressMask | StructureNotifyMask) #define FALSE 0 #define Shape(num) (ONLYSHAPE ? num-5 : num) #define NCPUSTATES 4 /* Global Data storage/structures ********************************************/ static long cp_time[NCPUSTATES]; static long last[NCPUSTATES]; int ONLYSHAPE=0; /* default value is noshape */ int updatespeed = 4; static char *help_message[] = { "where options include:", " -u updatespeed", " -exe program to start on click", " -led color of the led", " -position [+|-]x[+|-]y position of wmload", " -shape without groundplate", " -iconic start up as icon", " -withdrawn start up withdrawn", " -ver output version", NULL }; /* X11 Variables *************************************************************/ Display *dpy; /* welches DISPLAY */ Window Root; /* Hintergrund-Drawable */ int screen; int x_fd; int d_depth; XSizeHints mysizehints; XWMHints mywmhints; Pixel back_pix, fore_pix; GC NormalGC; Window iconwin, win; /* My home is my window */ char *ProgName; char *Geometry; char *LedColor = "LightSeaGreen"; char Execute[] = "echo no program has been specified"; char *ERR_colorcells = "not enough free color cells\n"; char *ampers = " &"; /* XPM Structures & Variables ************************************************/ typedef struct _XpmIcon { Pixmap pixmap; Pixmap mask; XpmAttributes attributes; } XpmIcon; XpmIcon wmload; XpmIcon visible; time_t actualtime; long actualmin; /* Function definitions ******************************************************/ void GetXPM(void); Pixel GetColor(char *name); void RedrawWindow( XpmIcon *v); void InitLoad(); void InsertLoad(); /*****************************************************************************/ /* Source Code <--> Function Implementations */ /*****************************************************************************/ void usage() { char **cpp; fprintf(stderr,"\nusage: %s [-options ...] \n", ProgName); for (cpp = help_message; *cpp; cpp++) { fprintf(stderr, "%s\n", *cpp); } fprintf(stderr,"\n"); exit(1); } /* * Copied from ascpu - albert@tigr.net - 09 Mar 2000 * * This function executes an external command while * checking whether we should drop the privileges. * * Since we might need privileges later we fork and * then drop privileges in one of the instances which * will then execute the command and die. * * This fixes the security hole for FreeBSD and AIX * where this program needs privileges to access * the system information. */ void ExecuteExternal() { uid_t ruid, euid; int pid; #ifdef DEBUG printf("asload: system(%s)\n",Execute); #endif if( Execute[0] == '\0' ) { return; } ruid = getuid(); euid = geteuid(); if ( ruid == euid ) { if (system( Execute ) == -1) fprintf(stderr, "system(%s) returned an error", Execute); return; } pid = fork(); if ( pid == -1 ) { printf("asload : fork() failed (%s), command not executed", strerror(errno)); return; } if ( pid != 0 ) { /* parent process simply waits for the child and continues */ if ( waitpid(pid, 0, 0) == -1 ) { printf("asload : waitpid() for child failed (%s)", strerror(errno)); } return; } /* * child process drops the privileges * executes the command and dies */ if ( setuid(ruid) ) { printf("asload : setuid failed (%s), command not executed", strerror(errno)); exit(127); } if (system( Execute ) == -1) fprintf(stderr, "system(%s) returned an error", Execute); exit(0); } int main(int argc,char *argv[]) { int i; unsigned int borderwidth ; char *display_name = NULL; char *wname = "wmload"; XGCValues gcv; unsigned long gcm; XEvent Event; XTextProperty name; XClassHint classHint; Pixmap pixmask; Atom _XA_WM_DELETE_WINDOW = None; Geometry = ""; mywmhints.initial_state = NormalState; /* Parse command line options */ ProgName = argv[0]; for(i=1;i=argc) usage(); sscanf(argv[i], "%d", &updatespeed); continue; case 'e': if(++i >=argc) usage(); strcpy(&Execute[0], argv[i]); strcat(&Execute[0], " &"); continue; case 's': ONLYSHAPE=1; continue; case 'p': if(++i >=argc) usage(); Geometry = argv[i]; continue; case 'i': mywmhints.initial_state = IconicState; continue; case 'w': mywmhints.initial_state = WithdrawnState; continue; case 'l': if(++i >=argc) usage(); LedColor = argv[i]; continue; case 'v': fprintf(stdout, "\nwmload version: %i.%i.%i\n", major_VER, minor_VER, patch_VER); if(argc == 2) exit(0); continue; default: usage(); } } else { fprintf(stderr, "\nInvalid argument: %s\n", arg); usage(); } } /* Open the display */ if (!(dpy = XOpenDisplay(display_name))) { fprintf(stderr,"wmload: can't open display %s\n", XDisplayName(display_name)); exit (1); } screen= DefaultScreen(dpy); Root = RootWindow(dpy, screen); d_depth = DefaultDepth(dpy, screen); x_fd = XConnectionNumber(dpy); _XA_WM_DELETE_WINDOW = XInternAtom (dpy, "WM_DELETE_WINDOW", False); /* Convert XPM Data to XImage */ GetXPM(); /* Create a window to hold the banner */ mysizehints.flags= USSize|USPosition; mysizehints.x = 0; mysizehints.y = 0; back_pix = GetColor("white"); fore_pix = GetColor("black"); XWMGeometry(dpy, screen, Geometry, NULL, (borderwidth =1), &mysizehints, &mysizehints.x,&mysizehints.y,&mysizehints.width,&mysizehints.height, &i); mysizehints.width = wmload.attributes.width; mysizehints.height= wmload.attributes.height; win = XCreateSimpleWindow(dpy,Root,mysizehints.x,mysizehints.y, mysizehints.width,mysizehints.height, borderwidth,fore_pix,back_pix); iconwin = XCreateSimpleWindow(dpy,win,mysizehints.x,mysizehints.y, mysizehints.width,mysizehints.height, borderwidth,fore_pix,back_pix); /* activate hints */ XSetWMNormalHints(dpy, win, &mysizehints); classHint.res_name = "wmload"; classHint.res_class = "WMLoad"; XSetClassHint(dpy, win, &classHint); XSelectInput(dpy,win,MW_EVENTS); XSelectInput(dpy,iconwin,MW_EVENTS); XSetCommand(dpy,win,argv,argc); if (XStringListToTextProperty(&wname, 1, &name) ==0) { fprintf(stderr, "wmload: can't allocate window name\n"); exit(-1); } XSetWMName(dpy, win, &name); /* Create a GC for drawing */ gcm = GCForeground|GCBackground|GCGraphicsExposures; gcv.foreground = fore_pix; gcv.background = back_pix; gcv.graphics_exposures = FALSE; NormalGC = XCreateGC(dpy, Root, gcm, &gcv); if (ONLYSHAPE) { /* try to make shaped window here */ pixmask = XCreateBitmapFromData(dpy, win, (char *)mask2_bits, mask2_width, mask2_height); XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, pixmask, ShapeSet); XShapeCombineMask(dpy, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet); } mywmhints.icon_window = iconwin; mywmhints.icon_x = mysizehints.x; mywmhints.icon_y = mysizehints.y; mywmhints.window_group = win; mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint; XSetWMHints(dpy, win, &mywmhints); XSetWMProtocols (dpy, win, &_XA_WM_DELETE_WINDOW, 1); XMapWindow(dpy,win); InitLoad(); InsertLoad(); RedrawWindow(&visible); while(1) { if (actualtime != time(0)) { actualtime = time(0); if(actualtime % updatespeed == 0) InsertLoad(); RedrawWindow(&visible); } /* read a packet */ while (XPending(dpy)) { XNextEvent(dpy,&Event); switch(Event.type) { case Expose: if(Event.xexpose.count == 0 ) RedrawWindow(&visible); break; case ButtonPress: ExecuteExternal(); break; case ClientMessage: if ((Event.xclient.format != 32) || ((Atom)Event.xclient.data.l[0] != _XA_WM_DELETE_WINDOW)) break; case DestroyNotify: XFreeGC(dpy, NormalGC); XDestroyWindow(dpy, iconwin); XDestroyWindow(dpy, win); XCloseDisplay(dpy); exit(0); break ; default: break; } } XFlush(dpy); #ifdef SYSV poll((struct poll *) 0, (size_t) 0, 50); #else { struct timespec ts; ts.tv_sec = 0; ts.tv_nsec = 50000000L; /* 5/100 sec */ nanosleep(&ts, NULL); } #endif } return 0; } /*****************************************************************************/ void nocolor(char *a, char *b) { fprintf(stderr,"wmload: can't %s %s\n", a,b); } /*****************************************************************************/ /* convert the XPMIcons to XImage */ void GetXPM(void) { static char **alt_xpm; XColor col; XWindowAttributes attributes; int ret; char tempc1[12],tempc2[12],tempc3[12]; float colr,colg,colb; alt_xpm =ONLYSHAPE ? mask_xpm : back_xpm; /* for the colormap */ XGetWindowAttributes(dpy,Root,&attributes); /* get user-defined color or validate the default */ if (!XParseColor (dpy, attributes.colormap, LedColor, &col)) { nocolor("parse",LedColor); } else { /* scale down the Xcolor values */ colr = col.red / 257; colg = col.green / 257; colb = col.blue / 257; /* the brightest color */ sprintf(tempc1, "S c #%.2x%.2x%.2x", (int)colr, (int)colg, (int)colb); back_xpm[47] = tempc1; /* make medium color */ colr = (colr /100) *89; colg = (colg /100) *89; colb = (colb /100) *89; sprintf(tempc2, "R c #%.2x%.2x%.2x", (int)colr, (int)colg, (int)colb); back_xpm[46] = tempc2; /* make darkest color */ colr = (colr /100) *89; colg = (colg /100) *89; colb = (colb /100) *89; sprintf(tempc3, "Q c #%.2x%.2x%.2x", (int)colr, (int)colg, (int)colb); back_xpm[45] = tempc3; } wmload.attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions); ret = XpmCreatePixmapFromData(dpy, Root, alt_xpm, &wmload.pixmap, &wmload.mask, &wmload.attributes); if(ret != XpmSuccess) {fprintf(stderr, "%s\n", ERR_colorcells);exit(1);} visible.attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions); ret = XpmCreatePixmapFromData(dpy, Root, back_xpm, &visible.pixmap, &visible.mask, &visible.attributes); if(ret != XpmSuccess) {fprintf(stderr, "%s\n", ERR_colorcells);exit(1);} } /*****************************************************************************/ /* Removes expose events for a specific window from the queue */ int flush_expose (Window w) { XEvent dummy; int i=0; while (XCheckTypedWindowEvent (dpy, w, Expose, &dummy))i++; return i; } /*****************************************************************************/ /* Draws the icon window */ void RedrawWindow( XpmIcon *v) { flush_expose (iconwin); XCopyArea(dpy,v->pixmap,iconwin,NormalGC, 0,0,v->attributes.width, v->attributes.height,0,0); flush_expose (win); XCopyArea(dpy,v->pixmap,win,NormalGC, 0,0,v->attributes.width, v->attributes.height,0,0); } /*****************************************************************************/ Pixel GetColor(char *name) { XColor color; XWindowAttributes attributes; XGetWindowAttributes(dpy,Root,&attributes); color.pixel = 0; if (!XParseColor (dpy, attributes.colormap, name, &color)) { nocolor("parse",name); } else if(!XAllocColor (dpy, attributes.colormap, &color)) { nocolor("alloc",name); } return color.pixel; } /*****************************************************************************/ void InitLoad() { /* Save the 4 base colors in wmload */ XCopyArea(dpy, visible.pixmap, wmload.pixmap, NormalGC, 6,6,3,52, Shape(6), Shape(6)); /* Copy the base panel to visible */ XCopyArea(dpy, wmload.pixmap, visible.pixmap, NormalGC, 0,0,mysizehints.width, mysizehints.height, 0 ,0); /* Remove the 4 base colors from visible */ XCopyArea(dpy, visible.pixmap, visible.pixmap, NormalGC, Shape(9),Shape(6),3,52, Shape(6), Shape(6)); } static char * skip_token(const char *p) { while (isspace(*p)) p++; while (*p && !isspace(*p)) p++; return (char *)p; } void GetLoad(int Maximum, int *usr, int *nice, int *sys, int *free) { char buffer[100];/*[4096+1];*/ int fd, len; int total; char *p; fd = open("/proc/stat", O_RDONLY); len = read(fd, buffer, sizeof(buffer)-1); close(fd); buffer[len] = '\0'; p = skip_token(buffer); /* "cpu" */ cp_time[0] = strtoul(p, &p, 0); /* user */ cp_time[1] = strtoul(p, &p, 0); /* nice */ cp_time[2] = strtoul(p, &p, 0); /* system */ cp_time[3] = strtoul(p, &p, 0); /* idle */ if( (*usr = cp_time[0] - last[0]) < 0 ) *usr = 0 ; if( (*nice = cp_time[1] - last[1]) < 0 ) *nice = 0 ; if( (*sys = cp_time[2] - last[2]) < 0 ) *sys = 0 ; if( (*free = cp_time[3] - last[3]) < 0 ) *free = 0 ; total = *usr + *nice + *sys + *free; last[0] = cp_time[0]; last[1] = cp_time[1]; last[2] = cp_time[2]; last[3] = cp_time[3]; *usr = rint(Maximum * (float)(*usr) /total); *nice =rint(Maximum * (float)(*nice) /total); *sys = rint(Maximum * (float)(*sys) /total); *free = rint(Maximum * (float)(*free) /total); } void InsertLoad() { int UserTime, NiceTime, SystemTime, FreeTime, act, constrain; GetLoad( 52, &UserTime, &NiceTime, &SystemTime, &FreeTime); constrain = (UserTime + NiceTime + SystemTime + FreeTime); if(constrain == 53) { if(FreeTime > 0) FreeTime--; else if(SystemTime > 0) SystemTime--; else if(NiceTime > 0) NiceTime--; else if(UserTime > 0) UserTime--; } else if(constrain == 51) FreeTime++; /* Move the area */ XCopyArea(dpy, visible.pixmap, visible.pixmap, NormalGC, Shape(7), Shape(6), 51, 52, Shape(6), Shape(6)); /* User Time */ act = 58 - UserTime; if(UserTime > 0) XCopyArea(dpy, wmload.pixmap, visible.pixmap, NormalGC, Shape(6), Shape(6), 1, UserTime, Shape(57), Shape(act)); /* Nice Time */ act = act - NiceTime; if(NiceTime > 0) XCopyArea(dpy, wmload.pixmap, visible.pixmap, NormalGC, Shape(7), Shape(6), 1, NiceTime, Shape(57), Shape(act)); /* System Time */ act = act - SystemTime; if(SystemTime > 0) XCopyArea(dpy, wmload.pixmap, visible.pixmap, NormalGC, Shape(8), Shape(6), 1, SystemTime, Shape(57), Shape(act)); /* Free Time */ if(FreeTime > 0) XCopyArea(dpy, wmload.pixmap, visible.pixmap, NormalGC, Shape(9), Shape(6), 1, FreeTime, Shape(57), Shape(6)); }