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.

-l option to display on the left of the screen

jcs c3756ec9 0cc7c8dc

+12 -4
+12 -4
pixelclock.c
··· 1 1 /* vim:ts=8 2 - * $Id: pixelclock.c,v 1.6 2008/08/21 21:34:54 jcs Exp $ 2 + * $Id: pixelclock.c,v 1.7 2008/11/26 16:51:48 jcs Exp $ 3 3 * 4 4 * pixelclock 5 5 * a different way of looking at time 6 6 * 7 - * Copyright (c) 2005 joshua stein <jcs@jcs.org> 7 + * Copyright (c) 2005,2008 joshua stein <jcs@jcs.org> 8 8 * Copyright (c) 2005 Federico G. Schwindt 9 9 * 10 10 * Redistribution and use in source and binary forms, with or without ··· 59 59 int screen; 60 60 Window win; 61 61 int width; 62 + int onleft; 62 63 GC gc; 63 64 Colormap win_colormap; 64 65 } x; ··· 66 67 const struct option longopts[] = { 67 68 { "display", required_argument, NULL, 'd' }, 68 69 { "width", required_argument, NULL, 'w' }, 70 + { "left", no_argument, NULL, 'l' }, 69 71 70 72 { NULL, 0, NULL, 0 } 71 73 }; ··· 94 96 95 97 bzero(&x, sizeof(struct xinfo)); 96 98 x.width = DEFWIDTH; 99 + x.onleft = 0; 97 100 98 101 while ((c = getopt_long_only(argc, argv, "", longopts, NULL)) != -1) { 99 102 switch (c) { ··· 101 104 display = optarg; 102 105 break; 103 106 107 + case 'l': 108 + x.onleft = 1; 109 + break; 110 + 104 111 case 'w': 105 112 x.width = strtol(optarg, &p, 10); 106 113 if (*p || x.width < 1) ··· 231 238 x.win_colormap = DefaultColormap(x.dpy, DefaultScreen(x.dpy)); 232 239 233 240 x.win = XCreateSimpleWindow(x.dpy, RootWindow(x.dpy, x.screen), 234 - x.dpy_width - x.width, 0, 241 + (x.onleft ? 0 : x.dpy_width - x.width), 0, 235 242 x.width, x.dpy_height, 236 243 0, 237 244 BlackPixel(x.dpy, x.screen), ··· 288 295 usage(void) 289 296 { 290 297 fprintf(stderr, "usage: %s %s\n", __progname, 291 - "[-display host:dpy] [-width <pixels>] [time time2 ...]"); 298 + "[-display host:dpy] [-left] [-width <pixels>] " 299 + "[time time2 ...]"); 292 300 exit(1); 293 301 }