author | Stiletto <blasux@blasux.ru> |
Sat, 17 Aug 2019 15:27:14 +0400 | |
changeset 19 | bf780d158f3e |
parent 6 | de6b88d1fa3c |
permissions | -rw-r--r-- |
0 | 1 |
static DPokeSource sources[] = { |
6
de6b88d1fa3c
status-bat (with optional udev support!)
Stiletto <blasux@blasux.ru>
parents:
1
diff
changeset
|
2 |
// { DPOKE_PROGRAM, "./status-wifi/status-wifi wlan0 pango" }, |
de6b88d1fa3c
status-bat (with optional udev support!)
Stiletto <blasux@blasux.ru>
parents:
1
diff
changeset
|
3 |
// { DPOKE_PROGRAM, "./status-bat/status-bat BAT1 pango" }, |
1 | 4 |
{ DPOKE_PROGRAM, "./status-mem/status-mem" }, |
5 |
{ DPOKE_PROGRAM, "./status-loadavg/status-loadavg" }, |
|
6 |
{ DPOKE_PROGRAM, "./status-time/status-time" }, |
|
0 | 7 |
}; |
8 |
||
9 |
#define FAILURE_MSG "FAILURE" |
|
10 |
//#define MINTIME 0.4 |
|
11 |
#define MINTIME 1.0 |
|
12 |
//#define DEBUG |
|
13 |
||
1 | 14 |
#include <X11/Xlib.h> |
15 |
||
16 |
Display *dpy; |
|
17 |
Window rootwin; |
|
18 |
int scr; |
|
19 |
||
20 |
void display(char* v[], size_t vc) { |
|
21 |
char *new_title = smprintf("%s | %s | %s",v[0],v[1],v[2]); |
|
22 |
XStoreName(dpy, rootwin, new_title); |
|
23 |
//printf("set: %s\n", new_title); |
|
24 |
XSync(dpy, False); |
|
25 |
free(new_title); |
|
26 |
} |
|
27 |
||
28 |
void setup() { |
|
29 |
if(!(dpy=XOpenDisplay(NULL))) { |
|
30 |
fprintf(stderr, "ERROR: could not open display\n"); |
|
31 |
exit(21); |
|
32 |
} |
|
33 |
scr = DefaultScreen(dpy); |
|
34 |
rootwin = RootWindow(dpy, scr); |
|
35 |
} |
|
36 |
||
37 |
void cleanup(int exitcode) { |
|
38 |
XCloseDisplay(dpy); |
|
39 |
} |
|
40 |
||
41 |
#if 0 |
|
42 |
// no-X11 variant: |
|
0 | 43 |
void display() { |
44 |
printf("%s | <%s> | %s | %s\n",v[0],v[1],v[2],v[3]); |
|
45 |
} |
|
1 | 46 |
void setup() { |
47 |
} |
|
48 |
void cleanup(int exitcode) { |
|
49 |
} |
|
50 |
#endif |