summaryrefslogtreecommitdiff
path: root/dwm/dwm.c
diff options
context:
space:
mode:
authorauric <104602845+ihateamongus@users.noreply.github.com>2025-09-07 17:49:24 -0500
committerGitHub <noreply@github.com>2025-09-07 17:49:24 -0500
commit055af7faa25e70b7f19bfdad8514ff684de6672d (patch)
tree56962ec5459776bd69ffdb5019e9133d71b8baee /dwm/dwm.c
parent417c5740bc4cd96e053b5725589fe3c4a835a231 (diff)
parent2028ef39f0a65e44213acee2c2bda28006f462a1 (diff)
Merge pull request #5 from ihateamongus/codex/analyze-oldresources-folder-for-performance-ljz6ny
Add glass-style transparency and dynamic tags
Diffstat (limited to 'dwm/dwm.c')
-rw-r--r--dwm/dwm.c41
1 files changed, 27 insertions, 14 deletions
diff --git a/dwm/dwm.c b/dwm/dwm.c
index 633e9d6..21f352e 100644
--- a/dwm/dwm.c
+++ b/dwm/dwm.c
@@ -208,6 +208,7 @@ static void setfullscreen(Client *c, int fullscreen);
static void setgaps(const Arg *arg);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
+static void setopacity(Window w, double opacity);
static void setup(void);
static void initaccent(void);
static void updateaccent(void);
@@ -754,7 +755,7 @@ dirtomon(int dir)
void
drawbar(Monitor *m)
{
- int x, w, tw = 0;
+ int x, w, tw = 0;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
@@ -776,16 +777,18 @@ drawbar(Monitor *m)
urg |= c->tags;
}
x = 0;
- for (i = 0; i < LENGTH(tags); i++) {
- w = TEXTW(tags[i]);
- drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
- drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
- if (occ & 1 << i)
- drw_rect(drw, x + boxs, boxs, boxw, boxw,
- m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
- urg & 1 << i);
- x += w;
- }
+ for (i = 0; i < LENGTH(tags); i++) {
+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
+ continue;
+ w = TEXTW(tags[i]);
+ drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
+ drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
+ if (occ & 1 << i)
+ drw_rect(drw, x + boxs, boxs, boxw, boxw,
+ m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
+ urg & 1 << i);
+ x += w;
+ }
w = TEXTW(m->ltsymbol);
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
@@ -1626,6 +1629,15 @@ setmfact(const Arg *arg)
arrange(selmon);
}
+static void
+setopacity(Window w, double opacity)
+{
+ unsigned long val = opacity * 0xffffffff;
+ XChangeProperty(dpy, w, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False),
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *)&val, 1);
+}
+
void
setup(void)
{
@@ -1946,9 +1958,10 @@ updatebars(void)
CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
- XMapRaised(dpy, m->barwin);
- XSetClassHint(dpy, m->barwin, &ch);
- }
+ XMapRaised(dpy, m->barwin);
+ setopacity(m->barwin, baropacity);
+ XSetClassHint(dpy, m->barwin, &ch);
+ }
}
void