summaryrefslogtreecommitdiff
path: root/dwl/dwl-patches/stale-patches/remembertags
diff options
context:
space:
mode:
authorcoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
committercoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
commit8cbadb61604667b407b53ee1258433994fa4765a (patch)
tree97765fb29418fd6278fcb4cbb9760893afaf7a58 /dwl/dwl-patches/stale-patches/remembertags
Diffstat (limited to 'dwl/dwl-patches/stale-patches/remembertags')
-rwxr-xr-xdwl/dwl-patches/stale-patches/remembertags/README.md16
-rwxr-xr-xdwl/dwl-patches/stale-patches/remembertags/remembertags.patch105
2 files changed, 121 insertions, 0 deletions
diff --git a/dwl/dwl-patches/stale-patches/remembertags/README.md b/dwl/dwl-patches/stale-patches/remembertags/README.md
new file mode 100755
index 0000000..b45e87c
--- /dev/null
+++ b/dwl/dwl-patches/stale-patches/remembertags/README.md
@@ -0,0 +1,16 @@
+### Description
+This patch modifies the behavior when selecting tags so that selecting a tag will also enable any other tags that were previously visible.
+
+For example:
+1. Select tag 5, with mod+5
+2. Toggle tag 8, with ctrl+mod+8
+3. Select tag 1, with mod+1. Tags 5 and 8 should no longer be visible.
+4. Select tag 5 again, with mod+5. Tag 8 should be visible since it was remembered.
+5. Select tag 5 again, with mod_5. Selecting the already selected tag resets any remembered tags, so now tag 5 should be the only one visible.
+
+### Download
+- [git branch](https://codeberg.org/minego/dwl/src/branch/remembertags)
+- [2024-03-27](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/remembertags/remembertags.patch)
+
+### Authors
+- [minego](https://codeberg.org/minego) \ No newline at end of file
diff --git a/dwl/dwl-patches/stale-patches/remembertags/remembertags.patch b/dwl/dwl-patches/stale-patches/remembertags/remembertags.patch
new file mode 100755
index 0000000..fd6135e
--- /dev/null
+++ b/dwl/dwl-patches/stale-patches/remembertags/remembertags.patch
@@ -0,0 +1,105 @@
+From fea6eb3cfc84ede8403c89a3230f5c658a6c7bd1 Mon Sep 17 00:00:00 2001
+From: Micah N Gorrell <m@minego.net>
+Date: Wed, 27 Mar 2024 13:05:09 -0600
+Subject: [PATCH] remembertags
+
+---
+ config.def.h | 8 ++++----
+ dwl.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 52 insertions(+), 4 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 9009517..2312802 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -105,10 +105,10 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
+ #define MODKEY WLR_MODIFIER_ALT
+
+ #define TAGKEYS(KEY,SKEY,TAG) \
+- { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
+- { MODKEY|WLR_MODIFIER_CTRL, KEY, toggleview, {.ui = 1 << TAG} }, \
+- { MODKEY|WLR_MODIFIER_SHIFT, SKEY, tag, {.ui = 1 << TAG} }, \
+- { MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,SKEY,toggletag, {.ui = 1 << TAG} }
++ { MODKEY, KEY, remembertagsview, {.i = TAG} }, \
++ { MODKEY|WLR_MODIFIER_CTRL, KEY, toggleview, {.ui = 1 << TAG} }, \
++ { MODKEY|WLR_MODIFIER_SHIFT, SKEY, tag, {.ui = 1 << TAG} }, \
++ { MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT, SKEY, toggletag, {.ui = 1 << TAG} }
+
+ /* helper for spawning shell commands in the pre dwm-5.0 fashion */
+ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
+diff --git a/dwl.c b/dwl.c
+index 5867b0c..31a81aa 100644
+--- a/dwl.c
++++ b/dwl.c
+@@ -205,6 +205,11 @@ struct Monitor {
+ int gamma_lut_changed;
+ int nmaster;
+ char ltsymbol[16];
++ unsigned int createtag[2]; /* Create windows on the last tag directly selected, not all selected */
++ struct {
++ unsigned int tagset;
++ Client *zoomed;
++ } remembered[31];
+ };
+
+ typedef struct {
+@@ -308,6 +313,7 @@ static void pointerfocus(Client *c, struct wlr_surface *surface,
+ double sx, double sy, uint32_t time);
+ static void printstatus(void);
+ static void quit(const Arg *arg);
++static void remembertagsview(const Arg *arg);
+ static void rendermon(struct wl_listener *listener, void *data);
+ static void requestdecorationmode(struct wl_listener *listener, void *data);
+ static void requeststartdrag(struct wl_listener *listener, void *data);
+@@ -1951,6 +1957,48 @@ quit(const Arg *arg)
+ wl_display_terminate(dpy);
+ }
+
++void
++remembertagsview(const Arg *arg) {
++ unsigned newtags = (1 << arg->i) & TAGMASK;
++ int oldtag;
++ int active;
++ unsigned int newcreate;
++
++ if (selmon == NULL) {
++ return;
++ }
++
++ oldtag = selmon->createtag[selmon->seltags];
++ active = (oldtag == arg->i);
++
++ if (oldtag < TAGCOUNT) {
++ selmon->remembered[oldtag].tagset = selmon->tagset[selmon->seltags];
++ }
++
++ selmon->seltags ^= 1; /*toggle tagset*/
++
++ if (-1 == arg->i) {
++ /* A specific tag was not specified */
++ active = 0;
++ newcreate = selmon->createtag[selmon->seltags];
++ } else {
++ newcreate = arg->i;
++ }
++
++ if (active) {
++ /* Select twice to isolate the tag */
++ selmon->tagset[selmon->seltags] = newtags;
++ } else if (arg->i < TAGCOUNT) {
++ /* Restore whatever was previously on this tag */
++ selmon->tagset[selmon->seltags] = newtags | selmon->remembered[newcreate].tagset;
++ }
++
++ selmon->createtag[selmon->seltags] = newcreate;
++ focusclient(focustop(selmon), 1);
++ arrange(selmon);
++ printstatus();
++}
++
+ void
+ rendermon(struct wl_listener *listener, void *data)
+ {
+--
+2.44.0
+