int main(int argc, const char *argv[]) { (void)argc; (void)argv; Display *dpy; char msg[100]; dpy = XOpenDisplay(NULL); struct net_bandwidth speed; struct tm tm; time_t t; do { speed = get_network_speed(); t = time(NULL); tm = *localtime(&t); sprintf(msg, "freq: %" PRIi32 "MHz " "temp: %" PRIi32 "C " "cpu: %" PRIi32 "%% " "ram: %" PRIi64 "MB " "U: %" PRIu32 "kB D: %" PRIu32 "kB " "V: %" PRIi64 "%% " "%02d.%02d. %02d:%02d\n", get_cpu_freq(), get_cpu_temp(), get_cpu_usage(), get_ram_usage(), speed.up, speed.down, get_alsa_volume(), tm.tm_mday, tm.tm_mon + 1, tm.tm_hour, tm.tm_min); XStoreName(dpy, DefaultRootWindow(dpy), msg); XSync(dpy, False); } while(!sleep(DELAY)); XCloseDisplay(dpy); printf("Something happened!"); return 0; }
static void set_system_information(Enna_Buffer *b) { if (!b) return; enna_buffer_append(b, "<c>"); enna_buffer_append(b, _("System information")); enna_buffer_append(b, "</c><br><br>"); get_distribution(b); get_uname(b); get_cpuinfos(b); get_loadavg(b); get_ram_usage(b); #ifdef BUILD_LIBSVDRP get_vdr(b); #endif /* BUILD_LIBSVDRP */ #ifdef BUILD_LIBXRANDR get_resolution(b); #endif /* BUILD_LIBXRANDR */ get_network(b); get_default_gw(b); }