add kwm window manager (river+kwm), remove old river config
This commit is contained in:
32
lupan-clock/stdout-clock.c
Normal file
32
lupan-clock/stdout-clock.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
void show(struct tm *tm)
|
||||
{
|
||||
char s[6];
|
||||
strftime(s, sizeof(s), "%H:%M", tm);
|
||||
printf("%s\n", s);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
int main() {
|
||||
int h, m, init = 60;
|
||||
time_t t;
|
||||
struct tm *tm;
|
||||
|
||||
while (1) {
|
||||
t = time(NULL);
|
||||
tm = localtime(&t);
|
||||
if (tm->tm_hour != h || tm->tm_min != m || init > 0) {
|
||||
show(tm);
|
||||
h = tm->tm_hour;
|
||||
m = tm->tm_min;
|
||||
init = (init > 0) ? init - 1 : 0;
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user