/* * wmupmon - A dockapp to monitor system uptime * Copyright (C) 2003/4 Justin Spadea * * Based on work by Seiichi SATO * Copyright (C) 2001,2002 Seiichi SATO * AND by Mark Staggs * Copyright (C) 2002 Mark Staggs * 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 "backlight_on.xpm" #include "backlight_off.xpm" #include "backlight2_on.xpm" #include "backlight2_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 = NULL; /* back-light color */ static unsigned update_interval = 1; static light backlight = LIGHTOFF; static int style = 1; /* 1 = default, 2 = new style */ /* prototypes */ static void update(void); static void switch_light(void); static void draw_daydigit(int per); static void draw_hourdigit(int per); static void draw_minutedigit(int per); static void draw_seconddigit(int per); static void parse_arguments(int argc, char **argv); static void print_help(char *prog); int main(int argc, char **argv) { int i, a, aa, b, bb; char* real_off_xpm[(style == 2 ? sizeof(backlight2_off_xpm) : sizeof(backlight_off_xpm))]; char* real_on_xpm[(style == 2 ? sizeof(backlight2_on_xpm) : sizeof(backlight_on_xpm))]; XEvent event; XpmColorSymbol colors[2] = { {"Back0", NULL, 0}, {"Back1", NULL, 0} }; int ncolor = 0; /* Parse CommandLine */ parse_arguments(argc, argv); /* setup pixmap to use - this is ugly but it works */ a = sizeof(backlight2_off_xpm); aa = sizeof(backlight2_on_xpm); b = sizeof(backlight_off_xpm); bb = sizeof(backlight_on_xpm); if(style == 2){ for(i=0; i=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; else { fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], argv[i]); print_help(argv[0]), exit(1); } } } static void print_help(char *prog) { printf("Usage : %s [OPTIONS]\n", prog); printf("wmupmon - uptime 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(" -s, --style <1 or 2> display style (1 is default)\n"); printf(" -i, --interval number of secs between updates (1 is default)\n"); 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"); }