diff --git a/clients/lcdproc/chrono.c b/clients/lcdproc/chrono.c index 8de7712..befd519 100644 --- a/clients/lcdproc/chrono.c +++ b/clients/lcdproc/chrono.c @@ -470,3 +470,34 @@ big_clock_screen (int rep, int display) return 0; } // End big_clock_screen() + +int +essential_clock_screen (int rep, int display) +{ + static int first = 1; + struct tm *rtime; + struct timeval ttime; + char cmdbuf[64]; + char heartbeat[] = {':', ' '}; + char fulltxt[6]; + + if (first) { + first = 0; + + sock_send_string (sock, "screen_add E\n"); + sock_send_string (sock, "screen_set E -name {Essential Clock Screen} -heartbeat off\n"); + sock_send_string (sock, "widget_add E s0 string\n"); + } + + gettimeofday(&ttime, NULL); + + rtime = localtime (&ttime.tv_sec); + + sprintf (fulltxt, "%02d%c%02d", rtime->tm_hour, heartbeat[ttime.tv_usec / 500000], rtime->tm_min); + + sprintf (cmdbuf, "widget_set E s0 %d %d \"%s\"\n", ( lcd_wid - 5 ) / 2, lcd_hgt / 2, fulltxt); + + sock_send_string (sock, cmdbuf); + + return 0; +} // End essential_clock_screen() diff --git a/clients/lcdproc/main.c b/clients/lcdproc/main.c index 9a8c642..1c1bf82 100644 --- a/clients/lcdproc/main.c +++ b/clients/lcdproc/main.c @@ -70,6 +70,7 @@ static mode default_sequence[] = {'G', 1, 2, 0, 0xffff, 0,}, // Cpu histogram [G]raph {'S', 16, 256, 1, 0xffff, 0,}, // [S]ize of biggest programs {'D', 256, 256, 1, 0xffff, 0,}, // [D]isk stats + {'E', 4, 64, 0, 0xffff, 0,}, // [E]ssential clock {0, 0, 0, 0, 0,}, // No more.. all done. }; @@ -248,7 +249,9 @@ HelpScreen () printf("Usage: lcdproc [-s server] [-p port] [-e islow] [-d] [modelist]\n"); printf("\tOptions in []'s are optional.\n"); printf("\tmodelist is \"mode [mode mode ...]\"\n"); - printf("\tMode letters: \t[C]pu [G]raph [T]ime [M]emory [X]load [D]isk [B]attery\n\t\t\tproc_[S]izes [O]ld_time big_cloc[K] [U]ptime CPU_SM[P]\n\t\t\t[A]bout\n"); + printf("\tMode letters: \t[C]pu [G]raph [T]ime [M]emory [X]load [D]isk [B]attery\n" + "\t\t\tproc_[S]izes [O]ld_time big_cloc[K] [E]ssential_clock\n" + "\t\t\t[U]ptime CPU_SM[P] [A]bout\n"); printf("\n"); printf("\tislow is to slow down initial announcement of modes (in 1/100 sec)\n"); printf("\tUse \"man lcdproc\" for more info.\n"); diff --git a/clients/lcdproc/mode.c b/clients/lcdproc/mode.c index db9dbee..eca0f2c 100644 --- a/clients/lcdproc/mode.c +++ b/clients/lcdproc/mode.c @@ -133,6 +133,10 @@ update_screen(mode *m, int display) case 'P': status = cpu_smp_screen(m->timer, display); break; + case 'e': + case 'E': + status = essential_clock_screen(m->timer, display); + break; default: break; } diff --git a/docs/lcdproc.1 b/docs/lcdproc.1 index 59064d1..5388fe0 100644 --- a/docs/lcdproc.1 +++ b/docs/lcdproc.1 @@ -24,7 +24,7 @@ Daemonize right after startup .B \fImode\fP Where mode is one of the following letters: .RS -[C]pu [G]raph [T]ime [M]emory [X]load [D]isk [B]attery proc_[S]izes [O]ld_time big_cloc[K] [U]ptime CPU_SM[P] [A]bout +[C]pu [G]raph [T]ime [M]emory [X]load [D]isk [B]attery proc_[S]izes [O]ld_time big_cloc[K] [E]ssential_clock [U]ptime CPU_SM[P] [A]bout .RE .PP