config.def.h
author Stiletto <blasux@blasux.ru>
Thu, 23 Oct 2014 19:32:52 +0400
changeset 7 c0ca2b08f061
parent 6 de6b88d1fa3c
permissions -rw-r--r--
v0.03 yay!

static DPokeSource sources[] = {
//    { DPOKE_PROGRAM, "./status-wifi/status-wifi wlan0 pango" },
//    { DPOKE_PROGRAM, "./status-bat/status-bat BAT1 pango" },
    { DPOKE_PROGRAM, "./status-mem/status-mem" },
    { DPOKE_PROGRAM, "./status-loadavg/status-loadavg" },
    { DPOKE_PROGRAM, "./status-time/status-time" },
};

#define FAILURE_MSG "FAILURE"
//#define MINTIME 0.4
#define MINTIME 1.0
//#define DEBUG

#include <X11/Xlib.h>

Display *dpy;
Window rootwin;
int scr;

void display(char* v[], size_t vc) {
    char *new_title = smprintf("%s | %s | %s",v[0],v[1],v[2]);
    XStoreName(dpy, rootwin, new_title);
    //printf("set: %s\n", new_title);
    XSync(dpy, False);
    free(new_title);
}

void setup() {
    if(!(dpy=XOpenDisplay(NULL))) {
        fprintf(stderr, "ERROR: could not open display\n");
        exit(21);
    }
    scr = DefaultScreen(dpy);
    rootwin = RootWindow(dpy, scr);
}

void cleanup(int exitcode) {
    XCloseDisplay(dpy);
}

#if 0
// no-X11 variant:
void display() {
    printf("%s | <%s> | %s | %s\n",v[0],v[1],v[2],v[3]);
}
void setup() {
}
void cleanup(int exitcode) {
}
#endif