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
-26
View File
@@ -1,26 +0,0 @@
#include "bar.h"
#include <stdio.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());
}
+5 -12
View File
@@ -1,13 +1,9 @@
static const unsigned int borderpx = 2;
static const unsigned int gappx = 3;
static const unsigned int borderpx = 0;
static const unsigned int gappx = 10;
static const int showbar = 0;
static const int topbar = 0;
static const char *fonts[] = { "Cascadia Mono:style=Bold:size=10:antialias=true:autohint=true" };
static const char *colors[][3] = {
[SchemeNorm] = { "#D3C6AA", "#272E33", "#83C092" },
[SchemeSel] = { "#374145", "#DBBC7F", "#A7C080" },
};
static const char *tags[] = { "1", "2", "3" };
static const Rule rules[] = {
@@ -35,15 +31,12 @@ static const Layout layouts[] = {
#include "X11/XF86keysym.h"
static const Key keys[] = {
{ MODKEY, XK_h, focusstack, {.i = +1 } },
{ MODKEY, XK_l, focusstack, {.i = -1 } },
{ MODKEY, XK_q, killclient, {0} },
{ MODKEY, XK_Return, spawn, SHCMD("ghostty -e tmux a") },
{ MODKEY, XK_f, spawn, SHCMD("librewolf") },
{ MODKEY|ShiftMask, XK_s, spawn, SHCMD("steam") },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_q, killclient, {0} },
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ +5%") },
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ -5%") },
+6 -23
View File
@@ -160,7 +160,6 @@ static int sendevent(Client *c, Atom proto);
static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen);
static void setmfact(const Arg *arg);
static void setup(void);
static void seturgent(Client *c, int urg);
static void showhide(Client *c);
@@ -384,8 +383,8 @@ cleanup(void)
cleanupmon(mons);
for (i = 0; i < CurLast; i++)
drw_cur_free(drw, cursor[i]);
for (i = 0; i < LENGTH(colors); i++)
free(scheme[i]);
// for (i = 0; i < LENGTH(colors); i++)
// free(scheme[i]);
free(scheme);
XDestroyWindow(dpy, wmcheckwin);
drw_free(drw);
@@ -594,7 +593,6 @@ drawbar(Monitor *m)
return;
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
execute_bar(stext, sizeof(stext));
drw_setscheme(drw, scheme[SchemeNorm]);
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
@@ -1175,25 +1173,10 @@ setfullscreen(Client *c, int fullscreen)
}
}
/* arg > 1.0 will set mfact absolutely */
void
setmfact(const Arg *arg)
{
float f;
if (!arg || !selmon->lt[selmon->sellt]->arrange)
return;
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
if (f < 0.05 || f > 0.95)
return;
selmon->mfact = f;
arrange(selmon);
}
void
setup(void)
{
int i;
// int i;
XSetWindowAttributes wa;
Atom utf8string;
struct sigaction sa;
@@ -1238,9 +1221,9 @@ setup(void)
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
/* init appearance */
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
scheme[i] = drw_scm_create(drw, colors[i], 3);
// scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
// for (i = 0; i < LENGTH(colors); i++)
// scheme[i] = drw_scm_create(drw, colors[i], 3);
/* init bars */
updatebars();
updatestatus();
-24
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;
-1
View File
@@ -5,4 +5,3 @@
void die(const char *fmt, ...);
void *ecalloc(size_t nmemb, size_t size);
void execute_bar(char *out, size_t len);