a small clock for X11 that displays time as pixels
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

move default width to a define

jcs 4fff8c3a 20ac7567

+13 -12
+13 -12
pixelclock.c
··· 1 1 /* vim:ts=8 2 - * $Id: pixelclock.c,v 1.1 2005/06/28 21:05:19 jcs Exp $ 2 + * $Id: pixelclock.c,v 1.2 2005/06/28 21:07:37 jcs Exp $ 3 3 * 4 4 * pixelclock 5 5 * a different way of looking at time ··· 43 43 #include <X11/Xlib.h> 44 44 #include <X11/Xutil.h> 45 45 46 + /* default clock width */ 47 + #define DEFWIDTH 3 48 + 49 + /* so our window manager knows us */ 50 + char* win_name = "pixelclock"; 51 + 52 + /* hours to highlight (start work, lunch, etc.) */ 53 + int hihours[] = { 9, 12, 17 }; 54 + 46 55 struct xinfo { 47 56 Display* dpy; 48 57 int dpy_width, dpy_height; ··· 58 67 Colormap win_colormap; 59 68 } x; 60 69 61 - extern char *__progname; 62 - 63 - /* so our window manager knows us */ 64 - char* win_name = "pixelclock"; 65 - 66 - /* hours to highlight (start work, lunch, etc.) */ 67 - int hihours[] = { 9, 12, 17 }; 68 - 69 70 const struct option longopts[] = { 70 71 { "display", required_argument, NULL, 'd' }, 71 72 { "width", required_argument, NULL, 'w' }, ··· 73 74 { NULL, 0, NULL, 0 } 74 75 }; 75 76 77 + extern char *__progname; 78 + 76 79 long getcolor(const char *); 77 80 void handler(int sig); 78 81 void init_x(const char *); ··· 84 87 char *display = NULL, *p; 85 88 int c, hi, y, z; 86 89 int hourtick, lastpos = -1, newpos = 0; 87 - 88 90 struct timeval tv[2]; 89 91 time_t now; 90 92 struct tm *t; 91 93 92 94 bzero(&x, sizeof(struct xinfo)); 93 95 94 - /* default clock width */ 95 - x.width = 3; 96 + x.width = DEFWIDTH; 96 97 97 98 while ((c = getopt_long_only(argc, argv, "", longopts, NULL)) != -1) { 98 99 switch (c) {