Introduction
Introduction Statistics Contact Development Disclaimer Help
dwm-appicons fix - sites - public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log
Files
Refs
---
commit 31e7d6198aa0e294e5109cfc0b3c03ad6106c35f
parent 559ddebf9769f453d3eb1e45149f5f08b1d46798
Author: Rumen <[email protected]>
Date: Mon, 6 Jan 2025 14:29:25 +0100
dwm-appicons fix
appicons patch should now correctly handle mouse clicks
Diffstat:
M dwm.suckless.org/patches/appicons/… | 87 ++++++++++++++++++++++-----…
1 file changed, 63 insertions(+), 24 deletions(-)
---
diff --git a/dwm.suckless.org/patches/appicons/dwm-appicons-6.5.diff b/dwm.suck…
@@ -1,14 +1,13 @@
-From 5bd12261788064919c47ea35085bba6c9a1110ed Mon Sep 17 00:00:00 2001
+From f967b9b49ab3522d84fba8d95bbd90b6b5db0052 Mon Sep 17 00:00:00 2001
From: Rumen <[email protected]>
-Date: Sat, 4 Jan 2025 22:28:14 +0100
-Subject: [PATCH] appicons patch:
+Date: Mon, 6 Jan 2025 14:22:39 +0100
+Subject: [PATCH] appicons patch
-clients can now be assigned icons based on rules set by the user.
-these icons will be displayed insteas of the tag indicator and tag name.
+Adds support for app icons that can replace the tag indicator and tag name.
---
config.def.h | 14 ++++--
- dwm.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++++--
- 2 files changed, 136 insertions(+), 6 deletions(-)
+ dwm.c | 140 +++++++++++++++++++++++++++++++++++++++++++++++++--
+ 2 files changed, 147 insertions(+), 7 deletions(-)
diff --git a/config.def.h b/config.def.h
index 9efa774..3045af6 100644
@@ -41,7 +40,7 @@ index 9efa774..3045af6 100644
/* layout(s) */
diff --git a/dwm.c b/dwm.c
-index 1443802..069ece9 100644
+index 1443802..35327af 100644
--- a/dwm.c
+++ b/dwm.c
@@ -85,6 +85,7 @@ typedef struct Monitor Monitor;
@@ -52,7 +51,15 @@ index 1443802..069ece9 100644
float mina, maxa;
int x, y, w, h;
int oldx, oldy, oldw, oldh;
-@@ -138,6 +139,7 @@ typedef struct {
+@@ -121,6 +122,7 @@ struct Monitor {
+ unsigned int seltags;
+ unsigned int sellt;
+ unsigned int tagset[2];
++ char **tag_icons;
+ int showbar;
+ int topbar;
+ Client *clients;
+@@ -138,6 +140,7 @@ typedef struct {
unsigned int tags;
int isfloating;
int monitor;
@@ -60,7 +67,7 @@ index 1443802..069ece9 100644
} Rule;
/* function declarations */
-@@ -160,6 +162,9 @@ static void destroynotify(XEvent *e);
+@@ -160,6 +163,9 @@ static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
static Monitor *dirtomon(int dir);
@@ -70,7 +77,7 @@ index 1443802..069ece9 100644
static void drawbar(Monitor *m);
static void drawbars(void);
static void enternotify(XEvent *e);
-@@ -283,7 +288,13 @@ applyrules(Client *c)
+@@ -283,7 +289,13 @@ applyrules(Client *c)
Monitor *m;
XClassHint ch = { NULL, NULL };
@@ -84,7 +91,7 @@ index 1443802..069ece9 100644
c->isfloating = 0;
c->tags = 0;
XGetClassHint(dpy, c->win, &ch);
-@@ -296,6 +307,8 @@ applyrules(Client *c)
+@@ -296,6 +308,8 @@ applyrules(Client *c)
&& (!r->class || strstr(class, r->class))
&& (!r->instance || strstr(instance, r->instance)))
{
@@ -93,7 +100,43 @@ index 1443802..069ece9 100644
c->isfloating = r->isfloating;
c->tags |= r->tags;
for (m = mons; m && m->num != r->monitor; m = m->next…
-@@ -694,6 +707,96 @@ dirtomon(int dir)
+@@ -433,7 +447,7 @@ buttonpress(XEvent *e)
+ if (ev->window == selmon->barwin) {
+ i = x = 0;
+ do
+- x += TEXTW(tags[i]);
++ x += TEXTW(m->tag_icons[i]);
+ while (ev->x >= x && ++i < LENGTH(tags));
+ if (i < LENGTH(tags)) {
+ click = ClkTagBar;
+@@ -508,6 +522,12 @@ cleanupmon(Monitor *mon)
+ }
+ XUnmapWindow(dpy, mon->barwin);
+ XDestroyWindow(dpy, mon->barwin);
++
++ for (int i = 0; i < LENGTH(tags); i++) {
++ free(mon->tag_icons[i]);
++ mon->tag_icons[i] = NULL;
++ }
++
+ free(mon);
+ }
+
+@@ -643,6 +663,13 @@ createmon(void)
+ m->lt[0] = &layouts[0];
+ m->lt[1] = &layouts[1 % LENGTH(layouts)];
+ strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
++
++ m->tag_icons = (char**) malloc(LENGTH(tags));
++ if (m->tag_icons == NULL) perror("dwm: malloc()");
++ for (int i = 0; i < LENGTH(tags); i++) {
++ m->tag_icons[i] = NULL;
++ }
++
+ return m;
+ }
+
+@@ -694,6 +721,96 @@ dirtomon(int dir)
return m;
}
@@ -190,22 +233,23 @@ index 1443802..069ece9 100644
void
drawbar(Monitor *m)
{
-@@ -713,22 +816,41 @@ drawbar(Monitor *m)
+@@ -713,22 +830,37 @@ drawbar(Monitor *m)
drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
}
-+ char *tag_icons[LENGTH(tags)];
+ int icons_per_tag[LENGTH(tags)];
+ memset(icons_per_tag, 0, LENGTH(tags) * sizeof(int));
+
+ for (int i = 0; i < LENGTH(tags); i++) {
++ if (m->tag_icons[i]) free(m->tag_icons[i]);
++
+ /* set each tag to default value */
-+ tag_icons[i] = strndup(tags[i], strlen(tags[i]));
++ m->tag_icons[i] = strndup(tags[i], strlen(tags[i]));
+ }
+
for (c = m->clients; c; c = c->next) {
+ if (c->appicon && strlen(c->appicon) > 0) {
-+ applyappicon(tag_icons, icons_per_tag, c);
++ applyappicon(m->tag_icons, icons_per_tag, c);
+ }
+
occ |= c->tags;
@@ -215,11 +259,11 @@ index 1443802..069ece9 100644
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
- w = TEXTW(tags[i]);
-+ w = TEXTW(tag_icons[i]);
++ w = TEXTW(m->tag_icons[i]);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? Sc…
- drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
- if (occ & 1 << i)
-+ drw_text(drw, x, 0, w, bh, lrpad / 2, tag_icons[i], urg & 1 <…
++ drw_text(drw, x, 0, w, bh, lrpad / 2, m->tag_icons[i], urg & …
+ if (occ & 1 << i && icons_per_tag[i] == 0)
drw_rect(drw, x + boxs, boxs, boxw, boxw,
m == selmon && selmon->sel && selmon->sel->ta…
@@ -227,11 +271,6 @@ index 1443802..069ece9 100644
x += w;
}
+
-+ for (int i = 0; i < LENGTH(tags); i++) {
-+ free(tag_icons[i]);
-+ tag_icons[i] = NULL;
-+ }
-+
w = TEXTW(m->ltsymbol);
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.