/* See LICENSE file for copyright and license details. */
/* alsa sound */
-#define ALSA_CHANNEL "Master"
+#define ALSA_CHANNEL "Master"
/* battery */
-#define BATTERY_PATH "/sys/class/power_supply/"
-#define BATTERY_NOW "energy_now"
-#define BATTERY_FULL "energy_full_design"
+#define BATTERY_PATH "/sys/class/power_supply/"
+#define BATTERY_NOW "energy_now"
+#define BATTERY_FULL "energy_full_design"
/* text to show if no value can be retrieved */
-#define UNKNOWN_STR "n/a"
+#define UNKNOWN_STR "n/a"
/* statusbar
- battery_perc (battery percentage) [argument: battery name]
- wifi_essid (wifi essid) [argument: wifi card interface name] */
static const struct arg args[] = {
/* function format argument */
- { cpu_perc, "[ CPU %4s ]", NULL },
- { ram_perc, "[ Mem %3s ]", NULL },
- { disk_perc, "[ HDD %3s ]", "/" },
- { datetime, "[ %s ]", "%F %T" },
+ { cpu_perc, "[ CPU %4s ]", NULL },
+ { ram_perc, "[ Mem %3s ]", NULL },
+ { datetime, "[ %s ]", "%F %T" },
};
fscanf(fp, "%*s %Lf %Lf %Lf %Lf", &b[0], &b[1], &b[2], &b[3]);
fclose(fp);
perc = 100 * ((b[0]+b[1]+b[2]) - (a[0]+a[1]+a[2])) / ((b[0]+b[1]+b[2]+b[3]) - (a[0]+a[1]+a[2]+a[3]));
+
return smprintf("%d%%", perc);
}
warn("Could not get filesystem info");
return smprintf(UNKNOWN_STR);
}
+
return smprintf("%f", (float)fs.f_bsize * (float)fs.f_bfree / 1024 / 1024 / 1024);
}
}
perc = 100 * (1.0f - ((float)fs.f_bfree / (float)fs.f_blocks));
+
return smprintf("%d%%", perc);
}
fscanf(fp, "%d", &entropy);
fclose(fp);
+
return smprintf("%d", entropy);
}
memset(&hostname[strlen(hostname)-1], '\0',
sizeof(hostname) - strlen(hostname));
fclose(fp);
+
return smprintf("%s", hostname);
}
fscanf(fp, "MemFree: %ld kB\n", &free);
fclose(fp);
+
return smprintf("%f", (float)free / 1024 / 1024);
}
fclose(fp);
perc = 100 * ((total - free) - (buffers + cached)) / total;
+
return smprintf("%d%%", perc);
}
fscanf(fp, "MemTotal: %ld kB\n", &total);
fclose(fp);
+
return smprintf("%f", (float)total / 1024 / 1024);
}
fclose(fp);
used = total - free - buffers - cached;
+
return smprintf("%f", (float)used / 1024 / 1024);
}
}
if (good)
buffer[strlen(buffer)-1] = '\0';
+
return smprintf("%s", buffer);
}
fscanf(fp, "%d", &temperature);
fclose(fp);
+
return smprintf("%d°C", temperature / 1000);
}
}
fclose(fp);
+
return smprintf("%d%%", strength);
}