|
|
|
|
@ -66,8 +66,9 @@ init(void) |
|
|
|
|
|
|
|
|
|
/* Init color pair */ |
|
|
|
|
init_pair(0, ttyclock.bg, ttyclock.bg); |
|
|
|
|
init_pair(1, ttyclock.bg, ttyclock.option.color); |
|
|
|
|
init_pair(1, ttyclock.bg, ttyclock.option.color ); |
|
|
|
|
init_pair(2, ttyclock.option.color, ttyclock.bg); |
|
|
|
|
init_pair(3, ttyclock.bg, ttyclock.option.alt_color); |
|
|
|
|
// init_pair(0, ttyclock.bg, ttyclock.bg);
|
|
|
|
|
// init_pair(1, ttyclock.bg, ttyclock.option.color);
|
|
|
|
|
// init_pair(2, ttyclock.option.color, ttyclock.bg);
|
|
|
|
|
@ -236,8 +237,13 @@ draw_number(int n, int x, int y) |
|
|
|
|
wattroff(ttyclock.framewin, A_BLINK); |
|
|
|
|
|
|
|
|
|
wbkgdset(ttyclock.framewin, COLOR_PAIR(number[n][i/2])); |
|
|
|
|
if (number[n][i/2] == 1) |
|
|
|
|
wattron(ttyclock.framewin, A_REVERSE); |
|
|
|
|
else |
|
|
|
|
wattroff(ttyclock.framewin, A_REVERSE); |
|
|
|
|
mvwaddch(ttyclock.framewin, x, sy, ' '); |
|
|
|
|
} |
|
|
|
|
wattroff(ttyclock.framewin, A_REVERSE); |
|
|
|
|
wrefresh(ttyclock.framewin); |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
@ -249,14 +255,13 @@ draw_clock(void) |
|
|
|
|
/* Draw hour numbers */ |
|
|
|
|
draw_number(ttyclock.date.hour[0], 1, 1); |
|
|
|
|
draw_number(ttyclock.date.hour[1], 1, 8); |
|
|
|
|
chtype dotcolor = COLOR_PAIR(1); |
|
|
|
|
chtype dotcolor = COLOR_PAIR(3); |
|
|
|
|
if (ttyclock.option.blink && time(NULL) % 2 == 0) |
|
|
|
|
dotcolor = COLOR_PAIR(2); |
|
|
|
|
|
|
|
|
|
/* 2 dot for number separation */ |
|
|
|
|
/* 1 dot for number separation */ |
|
|
|
|
wbkgdset(ttyclock.framewin, dotcolor); |
|
|
|
|
mvwaddstr(ttyclock.framewin, 2, 16, " "); |
|
|
|
|
mvwaddstr(ttyclock.framewin, 4, 16, " "); |
|
|
|
|
mvwaddstr(ttyclock.framewin, 3, 16, " "); |
|
|
|
|
|
|
|
|
|
/* Draw minute numbers */ |
|
|
|
|
draw_number(ttyclock.date.minute[0], 1, 20); |
|
|
|
|
@ -547,6 +552,7 @@ main(int argc, char **argv) |
|
|
|
|
strncpy(ttyclock.option.format, "%F", sizeof (ttyclock.option.format)); |
|
|
|
|
/* Default color */ |
|
|
|
|
ttyclock.option.color = COLOR_GREEN; /* COLOR_GREEN = 2 */ |
|
|
|
|
ttyclock.option.alt_color = 100; /* COLOR_GREEN = 2 */ |
|
|
|
|
/* Default delay */ |
|
|
|
|
ttyclock.option.delay = 1; /* 1FPS */ |
|
|
|
|
ttyclock.option.nsdelay = 0; /* -0FPS */ |
|
|
|
|
@ -554,7 +560,7 @@ main(int argc, char **argv) |
|
|
|
|
|
|
|
|
|
atexit(cleanup); |
|
|
|
|
|
|
|
|
|
while ((c = getopt(argc, argv, "iuvsScbtrhBxnDC:f:d:T:a:")) != -1) |
|
|
|
|
while ((c = getopt(argc, argv, "iuvsScbtrhBxnDX:C:f:d:T:a:")) != -1) |
|
|
|
|
{ |
|
|
|
|
switch(c) |
|
|
|
|
{ |
|
|
|
|
@ -566,6 +572,7 @@ main(int argc, char **argv) |
|
|
|
|
" -x Show box \n" |
|
|
|
|
" -c Set the clock at the center of the terminal \n" |
|
|
|
|
" -C [0-7] Set the clock color \n" |
|
|
|
|
" -X [0-7] Set the alternate clock color \n" |
|
|
|
|
" -b Use bold colors \n" |
|
|
|
|
" -t Set the hour in 12h format \n" |
|
|
|
|
" -u Use UTC time \n" |
|
|
|
|
@ -609,6 +616,10 @@ main(int argc, char **argv) |
|
|
|
|
if(atoi(optarg) >= 0 && atoi(optarg) < 8) |
|
|
|
|
ttyclock.option.color = atoi(optarg); |
|
|
|
|
break; |
|
|
|
|
case 'X': |
|
|
|
|
if(atoi(optarg) >= 0 && atoi(optarg) < 8) |
|
|
|
|
ttyclock.option.alt_color = atoi(optarg); |
|
|
|
|
break; |
|
|
|
|
case 't': |
|
|
|
|
ttyclock.option.twelve = True; |
|
|
|
|
break; |
|
|
|
|
@ -656,6 +667,9 @@ main(int argc, char **argv) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( ttyclock.option.alt_color == 100) { |
|
|
|
|
ttyclock.option.alt_color = ttyclock.option.color; |
|
|
|
|
} |
|
|
|
|
init(); |
|
|
|
|
attron(A_BLINK); |
|
|
|
|
while(ttyclock.running) |
|
|
|
|
|