|
|
|
@ -70,6 +70,7 @@ init(void) |
|
|
|
init_pair(0, ttyclock.bg, ttyclock.bg); |
|
|
|
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(2, ttyclock.option.color, ttyclock.bg); |
|
|
|
|
|
|
|
init_pair(3, ttyclock.bg, ttyclock.option.alt_color); |
|
|
|
// init_pair(0, ttyclock.bg, ttyclock.bg);
|
|
|
|
// 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(2, ttyclock.option.color, ttyclock.bg);
|
|
|
|
@ -255,7 +256,7 @@ draw_clock(void) |
|
|
|
/* Draw hour numbers */ |
|
|
|
/* Draw hour numbers */ |
|
|
|
draw_number(ttyclock.date.hour[0], 1, 1); |
|
|
|
draw_number(ttyclock.date.hour[0], 1, 1); |
|
|
|
draw_number(ttyclock.date.hour[1], 1, 8); |
|
|
|
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) |
|
|
|
if (ttyclock.option.blink && time(NULL) % 2 == 0) |
|
|
|
dotcolor = COLOR_PAIR(2); |
|
|
|
dotcolor = COLOR_PAIR(2); |
|
|
|
|
|
|
|
|
|
|
|
@ -562,6 +563,7 @@ main(int argc, char **argv) |
|
|
|
strncpy(ttyclock.option.format, "%F", sizeof (ttyclock.option.format)); |
|
|
|
strncpy(ttyclock.option.format, "%F", sizeof (ttyclock.option.format)); |
|
|
|
/* Default color */ |
|
|
|
/* Default color */ |
|
|
|
ttyclock.option.color = COLOR_GREEN; /* COLOR_GREEN = 2 */ |
|
|
|
ttyclock.option.color = COLOR_GREEN; /* COLOR_GREEN = 2 */ |
|
|
|
|
|
|
|
ttyclock.option.alt_color = 100; /* COLOR_GREEN = 2 */ |
|
|
|
/* Default delay */ |
|
|
|
/* Default delay */ |
|
|
|
ttyclock.option.delay = 1; /* 1FPS */ |
|
|
|
ttyclock.option.delay = 1; /* 1FPS */ |
|
|
|
ttyclock.option.nsdelay = 0; /* -0FPS */ |
|
|
|
ttyclock.option.nsdelay = 0; /* -0FPS */ |
|
|
|
@ -569,7 +571,7 @@ main(int argc, char **argv) |
|
|
|
|
|
|
|
|
|
|
|
atexit(cleanup); |
|
|
|
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) |
|
|
|
switch(c) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -581,6 +583,7 @@ main(int argc, char **argv) |
|
|
|
" -x Show box \n" |
|
|
|
" -x Show box \n" |
|
|
|
" -c Set the clock at the center of the terminal \n" |
|
|
|
" -c Set the clock at the center of the terminal \n" |
|
|
|
" -C [0-7] Set the clock color \n" |
|
|
|
" -C [0-7] Set the clock color \n" |
|
|
|
|
|
|
|
" -X [0-7] Set the alternate clock color \n" |
|
|
|
" -b Use bold colors \n" |
|
|
|
" -b Use bold colors \n" |
|
|
|
" -t Set the hour in 12h format \n" |
|
|
|
" -t Set the hour in 12h format \n" |
|
|
|
" -u Use UTC time \n" |
|
|
|
" -u Use UTC time \n" |
|
|
|
@ -624,6 +627,10 @@ main(int argc, char **argv) |
|
|
|
if(atoi(optarg) >= 0 && atoi(optarg) < 8) |
|
|
|
if(atoi(optarg) >= 0 && atoi(optarg) < 8) |
|
|
|
ttyclock.option.color = atoi(optarg); |
|
|
|
ttyclock.option.color = atoi(optarg); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case 'X': |
|
|
|
|
|
|
|
if(atoi(optarg) >= 0 && atoi(optarg) < 8) |
|
|
|
|
|
|
|
ttyclock.option.alt_color = atoi(optarg); |
|
|
|
|
|
|
|
break; |
|
|
|
case 't': |
|
|
|
case 't': |
|
|
|
ttyclock.option.twelve = true; |
|
|
|
ttyclock.option.twelve = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
@ -671,6 +678,9 @@ main(int argc, char **argv) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( ttyclock.option.alt_color == 100) { |
|
|
|
|
|
|
|
ttyclock.option.alt_color = ttyclock.option.color; |
|
|
|
|
|
|
|
} |
|
|
|
init(); |
|
|
|
init(); |
|
|
|
attron(A_BLINK); |
|
|
|
attron(A_BLINK); |
|
|
|
while(ttyclock.running) |
|
|
|
while(ttyclock.running) |
|
|
|
|