summaryrefslogtreecommitdiff
path: root/dwm/patches
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-06-06 19:36:08 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-06-06 19:36:08 +0900
commit9605957bcdab78a9af8bb1e1a576c3ab50b81d12 (patch)
treebeef62ed1d41f22aedb0cd4e427885432d7bb6c5 /dwm/patches
parentca795e9ec7f360836b369fc2ba277ff89c90488e (diff)
modified dwm/config.def.h, modified dwm/dwm.c, created patches/dwm-alternativetags-6.3.diff, created patches/dwm-rainbowtags-6.2-alpha.diff
Diffstat (limited to 'dwm/patches')
-rw-r--r--dwm/patches/dwm-alternativetags-6.3.diff130
-rw-r--r--dwm/patches/dwm-rainbowtags-6.2-alpha.diff61
2 files changed, 191 insertions, 0 deletions
diff --git a/dwm/patches/dwm-alternativetags-6.3.diff b/dwm/patches/dwm-alternativetags-6.3.diff
new file mode 100644
index 0000000..c881b00
--- /dev/null
+++ b/dwm/patches/dwm-alternativetags-6.3.diff
@@ -0,0 +1,130 @@
+From 937130c8ea4884f54eb71357bfa99233e6c3e556 Mon Sep 17 00:00:00 2001
+From: Tom Schwindl <schwindl@posteo.de>
+Date: Sun, 18 Sep 2022 18:44:29 +0200
+Subject: [PATCH] 6.3 alternativetags patch
+
+---
+ config.def.h | 3 +++
+ dwm.c | 35 +++++++++++++++++++++++++++++++++--
+ 2 files changed, 36 insertions(+), 2 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 061ad662f82a..e912edd557cf 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -20,6 +20,8 @@ static const char *colors[][3] = {
+
+ /* tagging */
+ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
++static const char *tagsalt[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
++static const int momentaryalttags = 0; /* 1 means alttags will show only when key is held down*/
+
+ static const Rule rules[] = {
+ /* xprop(1):
+@@ -84,6 +86,7 @@ static const Key keys[] = {
+ { MODKEY, XK_period, focusmon, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
+ { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
++ { MODKEY, XK_n, togglealttag, {0} },
+ TAGKEYS( XK_1, 0)
+ TAGKEYS( XK_2, 1)
+ TAGKEYS( XK_3, 2)
+diff --git a/dwm.c b/dwm.c
+index e5efb6a22806..12ff3f0768bc 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -130,6 +130,7 @@ struct Monitor {
+ Monitor *next;
+ Window barwin;
+ const Layout *lt[2];
++ unsigned int alttag;
+ };
+
+ typedef struct {
+@@ -177,6 +178,7 @@ static void grabbuttons(Client *c, int focused);
+ static void grabkeys(void);
+ static void incnmaster(const Arg *arg);
+ static void keypress(XEvent *e);
++static void keyrelease(XEvent *e);
+ static void killclient(const Arg *arg);
+ static void manage(Window w, XWindowAttributes *wa);
+ static void mappingnotify(XEvent *e);
+@@ -210,6 +212,7 @@ static void spawn(const Arg *arg);
+ static void tag(const Arg *arg);
+ static void tagmon(const Arg *arg);
+ static void tile(Monitor *);
++static void togglealttag(const Arg *arg);
+ static void togglebar(const Arg *arg);
+ static void togglefloating(const Arg *arg);
+ static void toggletag(const Arg *arg);
+@@ -254,6 +257,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
+ [Expose] = expose,
+ [FocusIn] = focusin,
+ [KeyPress] = keypress,
++ [KeyRelease] = keyrelease,
+ [MappingNotify] = mappingnotify,
+ [MapRequest] = maprequest,
+ [MotionNotify] = motionnotify,
+@@ -699,7 +703,7 @@ dirtomon(int dir)
+ void
+ drawbar(Monitor *m)
+ {
+- int x, w, tw = 0;
++ int x, w, wdelta, tw = 0;
+ int boxs = drw->fonts->h / 9;
+ int boxw = drw->fonts->h / 6 + 2;
+ unsigned int i, occ = 0, urg = 0;
+@@ -723,8 +727,9 @@ drawbar(Monitor *m)
+ x = 0;
+ for (i = 0; i < LENGTH(tags); i++) {
+ w = TEXTW(tags[i]);
++ wdelta = selmon->alttag ? abs(TEXTW(tags[i]) - TEXTW(tagsalt[i])) / 2 : 0;
+ 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);
++ drw_text(drw, x, 0, w, bh, wdelta + lrpad / 2, (selmon->alttag ? tagsalt[i] : 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,
+@@ -1003,6 +1008,25 @@ keypress(XEvent *e)
+ keys[i].func(&(keys[i].arg));
+ }
+
++void
++keyrelease(XEvent *e)
++{
++ unsigned int i;
++ KeySym keysym;
++ XKeyEvent *ev;
++
++ ev = &e->xkey;
++ keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
++
++ for (i = 0; i < LENGTH(keys); i++)
++ if (momentaryalttags
++ && keys[i].func && keys[i].func == togglealttag
++ && selmon->alttag
++ && (keysym == keys[i].keysym
++ || CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)))
++ keys[i].func(&(keys[i].arg));
++}
++
+ void
+ killclient(const Arg *arg)
+ {
+@@ -1694,6 +1718,13 @@ tile(Monitor *m)
+ }
+ }
+
++void
++togglealttag(const Arg *arg)
++{
++ selmon->alttag = !selmon->alttag;
++ drawbar(selmon);
++}
++
+ void
+ togglebar(const Arg *arg)
+ {
+--
+2.37.3
+
diff --git a/dwm/patches/dwm-rainbowtags-6.2-alpha.diff b/dwm/patches/dwm-rainbowtags-6.2-alpha.diff
new file mode 100644
index 0000000..8701b19
--- /dev/null
+++ b/dwm/patches/dwm-rainbowtags-6.2-alpha.diff
@@ -0,0 +1,61 @@
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..80d0e6e 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -21,6 +21,20 @@ static const char *colors[][3] = {
+ /* tagging */
+ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+
++static const char *tagsel[][2] = {
++ { "#ffffff", "#ff0000" },
++ { "#ffffff", "#ff7f00" },
++ { "#000000", "#ffff00" },
++ { "#000000", "#00ff00" },
++ { "#ffffff", "#0000ff" },
++ { "#ffffff", "#4b0082" },
++ { "#ffffff", "#9400d3" },
++ { "#000000", "#ffffff" },
++ { "#ffffff", "#000000" },
++};
++
++static const unsigned int tagalpha[] = { OPAQUE, baralpha };
++
+ static const Rule rules[] = {
+ /* xprop(1):
+ * WM_CLASS(STRING) = instance, class
+diff --git a/dwm.c b/dwm.c
+index b0b3466..23d1c46 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -264,6 +264,7 @@ static Atom wmatom[WMLast], netatom[NetLast];
+ static int running = 1;
+ static Cur *cursor[CurLast];
+ static Clr **scheme;
++static Clr **tagscheme;
+ static Display *dpy;
+ static Drw *drw;
+ static Monitor *mons, *selmon;
+@@ -717,7 +718,7 @@ drawbar(Monitor *m)
+ 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_setscheme(drw, (m->tagset[m->seltags] & 1 << i ? tagscheme[i] : scheme[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,
+@@ -1568,9 +1569,14 @@ setup(void)
+ cursor[CurResize] = drw_cur_create(drw, XC_sizing);
+ cursor[CurMove] = drw_cur_create(drw, XC_fleur);
+ /* init appearance */
++ if (LENGTH(tags) > LENGTH(tagsel))
++ die("too few color schemes for the tags");
+ scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
+ for (i = 0; i < LENGTH(colors); i++)
+ scheme[i] = drw_scm_create(drw, colors[i], 3);
++ tagscheme = ecalloc(LENGTH(tagsel), sizeof(Clr *));
++ for (i = 0; i < LENGTH(tagsel); i++)
++ tagscheme[i] = drw_scm_create(drw, tagsel[i], tagalpha, 2);
+ /* init bars */
+ updatebars();
+ updatestatus();