dwm has no color

This commit is contained in:
DarthMooMancer
2025-10-09 23:59:04 -04:00
parent b1b05105fb
commit e6c6a8d03d
5 changed files with 13 additions and 88 deletions
+1 -25
View File
@@ -4,30 +4,6 @@
#include <string.h>
#include "util.h"
const char* vol() {
static char buf[5];
float v;
FILE *fp = popen("wpctl get-volume @DEFAULT_AUDIO_SINK@", "r");
if (!fp || fscanf(fp, "Volume: %f", &v) != 1) return NULL;
pclose(fp);
snprintf(buf, sizeof(buf), "%d%%", (int)(v * 100));
return buf;
}
const char* age() {
static char buf[5];
int days;
FILE *fp = popen("sh -c 'echo $(( ( $(date +%s) - $(stat -c %W /) ) / 86400 ))'", "r");
if (!fp || fscanf(fp, "%d", &days) != 1) return NULL;
pclose(fp);
snprintf(buf, sizeof(buf), "%dd", days);
return buf;
}
void execute_bar(char *out, size_t len) {
snprintf(out, len, " V: %s A: %s ", vol(), age());
}
void die(const char *fmt, ...) {
va_list ap;
@@ -43,7 +19,7 @@ void die(const char *fmt, ...) {
exit(1);
}
void * ecalloc(size_t nmemb, size_t size) {
void *ecalloc(size_t nmemb, size_t size) {
void *p;
if (!(p = calloc(nmemb, size))) die("calloc:");
return p;