add [E]ssential_clock to lcdproc client
This commit is contained in:
@@ -470,3 +470,34 @@ big_clock_screen (int rep, int display)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} // End big_clock_screen()
|
} // 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()
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ static mode default_sequence[] =
|
|||||||
{'G', 1, 2, 0, 0xffff, 0,}, // Cpu histogram [G]raph
|
{'G', 1, 2, 0, 0xffff, 0,}, // Cpu histogram [G]raph
|
||||||
{'S', 16, 256, 1, 0xffff, 0,}, // [S]ize of biggest programs
|
{'S', 16, 256, 1, 0xffff, 0,}, // [S]ize of biggest programs
|
||||||
{'D', 256, 256, 1, 0xffff, 0,}, // [D]isk stats
|
{'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.
|
{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("Usage: lcdproc [-s server] [-p port] [-e islow] [-d] [modelist]\n");
|
||||||
printf("\tOptions in []'s are optional.\n");
|
printf("\tOptions in []'s are optional.\n");
|
||||||
printf("\tmodelist is \"mode [mode mode ...]\"\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("\n");
|
||||||
printf("\tislow is to slow down initial announcement of modes (in 1/100 sec)\n");
|
printf("\tislow is to slow down initial announcement of modes (in 1/100 sec)\n");
|
||||||
printf("\tUse \"man lcdproc\" for more info.\n");
|
printf("\tUse \"man lcdproc\" for more info.\n");
|
||||||
|
|||||||
@@ -133,6 +133,10 @@ update_screen(mode *m, int display)
|
|||||||
case 'P':
|
case 'P':
|
||||||
status = cpu_smp_screen(m->timer, display);
|
status = cpu_smp_screen(m->timer, display);
|
||||||
break;
|
break;
|
||||||
|
case 'e':
|
||||||
|
case 'E':
|
||||||
|
status = essential_clock_screen(m->timer, display);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ Daemonize right after startup
|
|||||||
.B \fImode\fP
|
.B \fImode\fP
|
||||||
Where mode is one of the following letters:
|
Where mode is one of the following letters:
|
||||||
.RS
|
.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
|
.RE
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user