Compare commits

..

No commits in common. "998808b30367ddf630f44c5e838463f13406b28f" and "039be1a6cf0c17832f2413f2eea856d28485163b" have entirely different histories.

4 changed files with 97 additions and 130 deletions

View File

@ -1,13 +1,13 @@
From 8dff34be15664705654e5e4d41f990f8eba8b79d Mon Sep 17 00:00:00 2001
From 6d3a0506f45243cf11f0f7ba06048f453576567c Mon Sep 17 00:00:00 2001
From: nate zhou <gnuunixchad@outlook.com>
Date: Mon, 23 Mar 2026 01:16:06 +0800
Subject: [PATCH] shifttag with filtering occupied/unoccupied tags support for
bar patch
---
config.def.h | 8 ++++
shifttag.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 123 insertions(+)
config.def.h | 8 +++++
shifttag.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 107 insertions(+)
create mode 100644 shifttag.c
diff --git a/config.def.h b/config.def.h
@ -38,10 +38,10 @@ index 7da50d2..9fbcf2a 100644
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
diff --git a/shifttag.c b/shifttag.c
new file mode 100644
index 0000000..5f1d5c2
index 0000000..2615f4c
--- /dev/null
+++ b/shifttag.c
@@ -0,0 +1,115 @@
@@ -0,0 +1,99 @@
+// "arg->i" stores the number of tags to shift right (positive value)
+// or left (negative value)
+
@ -61,61 +61,45 @@ index 0000000..5f1d5c2
+find_next_tag(uint32_t current_tag, int direction, bool skip_unoccupied, bool skip_occupied)
+{
+ uint32_t occupied = get_occupied_tags(selmon);
+ uint32_t result = 0;
+ uint32_t start = current_tag;
+ uint32_t test_tag = current_tag;
+ uint32_t new_tag = current_tag;
+ int count = 0;
+
+ for (int i = 0; i < LENGTH(tags); i++) {
+ uint32_t bit = 1 << i;
+
+ if (current_tag & bit) {
+ uint32_t new_bit = bit;
+
+ if (!skip_unoccupied && !skip_occupied) {
+ if (direction > 0) {
+ if (bit << 1 && (bit << 1) <= TAGMASK)
+ new_bit = bit << 1;
+ else
+ new_bit = 1;
+ } else {
+ if (bit >> 1)
+ new_bit = bit >> 1;
+ else
+ new_bit = 1 << (LENGTH(tags) - 1);
+ }
+ } else {
+ uint32_t test_bit = bit;
+ uint32_t start_bit = bit;
+ int count = 0;
+
+ do {
+ if (direction > 0) {
+ if (test_bit << 1 && (test_bit << 1) <= TAGMASK)
+ test_bit = test_bit << 1;
+ else
+ test_bit = 1;
+ } else {
+ if (test_bit >> 1)
+ test_bit = test_bit >> 1;
+ else
+ test_bit = 1 << (LENGTH(tags) - 1);
+ }
+
+ int is_occupied = (occupied & test_bit) != 0;
+ int should_select = (skip_unoccupied && is_occupied) ||
+ (skip_occupied && !is_occupied);
+
+ if (should_select) {
+ new_bit = test_bit;
+ break;
+ }
+ count++;
+ } while (test_bit != start_bit && count < LENGTH(tags));
+ }
+
+ result |= new_bit;
+ if (!skip_unoccupied && !skip_occupied) {
+ if (direction > 0) {
+ new_tag = (current_tag << 1) | (current_tag >> (LENGTH(tags) - 1));
+ } else {
+ new_tag = (current_tag >> 1) | (current_tag << (LENGTH(tags) - 1));
+ }
+ return new_tag & TAGMASK;
+ }
+
+ return result;
+ do {
+ if (direction > 0) {
+ if (test_tag << 1 && (test_tag << 1) <= TAGMASK)
+ test_tag = test_tag << 1;
+ else
+ test_tag = 1;
+ } else {
+ if (test_tag >> 1)
+ test_tag = test_tag >> 1;
+ else
+ test_tag = 1 << (LENGTH(tags) - 1);
+ }
+
+ int is_occupied = (occupied & test_tag) != 0;
+ int should_select = (skip_unoccupied && is_occupied) ||
+ (skip_occupied && !is_occupied);
+
+ if (should_select) {
+ new_tag = test_tag;
+ break;
+ }
+ count++;
+ } while (test_tag != start && count < LENGTH(tags));
+
+ return new_tag;
+}
+
+static void

View File

@ -1,12 +1,12 @@
From 2a4417a6344c9d4b83989d63df17d9cdb0f81aea Mon Sep 17 00:00:00 2001
From 49b0da41f1f28a60cf216f5bffecc0ce1ea1ec9c Mon Sep 17 00:00:00 2001
From: nate zhou <gnuunixchad@outlook.com>
Date: Mon, 23 Mar 2026 00:50:54 +0800
Subject: [PATCH] shifttag with filtering occupied/unoccupied tags support
---
config.def.h | 8 ++++
shifttag.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 123 insertions(+)
config.def.h | 8 +++++
shifttag.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 107 insertions(+)
create mode 100644 shifttag.c
diff --git a/config.def.h b/config.def.h
@ -37,10 +37,10 @@ index 8a6eda0..2377fa5 100644
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
diff --git a/shifttag.c b/shifttag.c
new file mode 100644
index 0000000..971216b
index 0000000..5aeee00
--- /dev/null
+++ b/shifttag.c
@@ -0,0 +1,115 @@
@@ -0,0 +1,99 @@
+// "arg->i" stores the number of tags to shift right (positive value)
+// or left (negative value)
+
@ -60,61 +60,45 @@ index 0000000..971216b
+find_next_tag(uint32_t current_tag, int direction, bool skip_unoccupied, bool skip_occupied)
+{
+ uint32_t occupied = get_occupied_tags(selmon);
+ uint32_t result = 0;
+ uint32_t start = current_tag;
+ uint32_t test_tag = current_tag;
+ uint32_t new_tag = current_tag;
+ int count = 0;
+
+ for (int i = 0; i < TAGCOUNT; i++) {
+ uint32_t bit = 1 << i;
+
+ if (current_tag & bit) {
+ uint32_t new_bit = bit;
+
+ if (!skip_unoccupied && !skip_occupied) {
+ if (direction > 0) {
+ if (bit << 1 && (bit << 1) <= TAGMASK)
+ new_bit = bit << 1;
+ else
+ new_bit = 1;
+ } else {
+ if (bit >> 1)
+ new_bit = bit >> 1;
+ else
+ new_bit = 1 << (TAGCOUNT - 1);
+ }
+ } else {
+ uint32_t test_bit = bit;
+ uint32_t start_bit = bit;
+ int count = 0;
+
+ do {
+ if (direction > 0) {
+ if (test_bit << 1 && (test_bit << 1) <= TAGMASK)
+ test_bit = test_bit << 1;
+ else
+ test_bit = 1;
+ } else {
+ if (test_bit >> 1)
+ test_bit = test_bit >> 1;
+ else
+ test_bit = 1 << (TAGCOUNT - 1);
+ }
+
+ int is_occupied = (occupied & test_bit) != 0;
+ int should_select = (skip_unoccupied && is_occupied) ||
+ (skip_occupied && !is_occupied);
+
+ if (should_select) {
+ new_bit = test_bit;
+ break;
+ }
+ count++;
+ } while (test_bit != start_bit && count < TAGCOUNT);
+ }
+
+ result |= new_bit;
+ if (!skip_unoccupied && !skip_occupied) {
+ if (direction > 0) {
+ new_tag = (current_tag << 1) | (current_tag >> (TAGCOUNT - 1));
+ } else {
+ new_tag = (current_tag >> 1) | (current_tag << (TAGCOUNT - 1));
+ }
+ return new_tag & TAGMASK;
+ }
+
+ return result;
+ do {
+ if (direction > 0) {
+ if (test_tag << 1 && (test_tag << 1) <= TAGMASK)
+ test_tag = test_tag << 1;
+ else
+ test_tag = 1;
+ } else {
+ if (test_tag >> 1)
+ test_tag = test_tag >> 1;
+ else
+ test_tag = 1 << (TAGCOUNT - 1);
+ }
+
+ int is_occupied = (occupied & test_tag) != 0;
+ int should_select = (skip_unoccupied && is_occupied) ||
+ (skip_occupied && !is_occupied);
+
+ if (should_select) {
+ new_tag = test_tag;
+ break;
+ }
+ count++;
+ } while (test_tag != start && count < TAGCOUNT);
+
+ return new_tag;
+}
+
+static void

View File

@ -4,8 +4,7 @@ Adds a toggleable function that makes a sticky client that is visible on all tag
Originally based on [dwm sticky patch](https://dwm.suckless.org/patches/sticky).
### Download
- [v0.8](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/sticky/sticky.patch)
- [v0.7](https://codeberg.org/dwl/dwl-patches/raw/commit/898bc7a946c7be14034a665bd7a7b042632465ea/patches/sticky/sticky.patch)
- [2024-07-26](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/sticky/sticky.patch)
- [v0.4](https://github.com/djpohly/dwl/compare/main...dm1tz:04-sticky.patch)
- [git branch](https://codeberg.org/Rutherther/dwl/src/branch/v0.7/sticky)

View File

@ -1,17 +1,17 @@
From d36eee35fdc4b0e666fb04a580200e8c5d2b1f9e Mon Sep 17 00:00:00 2001
From: nate zhou <gnuunixchad@outlook.com>
Date: Sat, 28 Feb 2026 22:55:33 +0800
Subject: [PATCH] Update sticky patch to v0.8
From f113cdc0b4cecceaaf28679489852ae61a1aa3f5 Mon Sep 17 00:00:00 2001
From: Rutherther <rutherther@proton.me>
Date: Fri, 19 Jul 2024 16:29:43 +0200
Subject: [PATCH] sticky
---
dwl.c | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/dwl.c b/dwl.c
index 44f3ad9..05070ef 100644
index 5bf995e..820f4af 100644
--- a/dwl.c
+++ b/dwl.c
@@ -74,7 +74,7 @@
@@ -73,7 +73,7 @@
#define MAX(A, B) ((A) > (B) ? (A) : (B))
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS)
@ -20,7 +20,7 @@ index 44f3ad9..05070ef 100644
#define LENGTH(X) (sizeof X / sizeof X[0])
#define END(A) ((A) + LENGTH(A))
#define TAGMASK ((1u << TAGCOUNT) - 1)
@@ -137,7 +137,7 @@ typedef struct {
@@ -139,7 +139,7 @@ typedef struct {
#endif
unsigned int bw;
uint32_t tags;
@ -29,15 +29,15 @@ index 44f3ad9..05070ef 100644
uint32_t resize; /* configure serial of a pending resize */
} Client;
@@ -323,6 +323,7 @@ static void setcursor(struct wl_listener *listener, void *data);
@@ -326,6 +326,7 @@ static void setcursor(struct wl_listener *listener, void *data);
static void setcursorshape(struct wl_listener *listener, void *data);
static void setfloating(Client *c, int floating);
static void setfullscreen(Client *c, int fullscreen);
+static void setsticky(Client *c, int sticky);
static void setgamma(struct wl_listener *listener, void *data);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setmon(Client *c, Monitor *m, uint32_t newtags);
@@ -335,6 +336,7 @@ static void tag(const Arg *arg);
@@ -339,6 +340,7 @@ static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *m);
static void togglefloating(const Arg *arg);
@ -45,8 +45,8 @@ index 44f3ad9..05070ef 100644
static void togglefullscreen(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
@@ -2368,6 +2370,17 @@ setfullscreen(Client *c, int fullscreen)
printstatus();
@@ -2351,6 +2353,17 @@ setgamma(struct wl_listener *listener, void *data)
wlr_output_schedule_frame(m->wlr_output);
}
+void
@ -63,7 +63,7 @@ index 44f3ad9..05070ef 100644
void
setlayout(const Arg *arg)
{
@@ -2760,6 +2773,16 @@ togglefullscreen(const Arg *arg)
@@ -2738,6 +2751,16 @@ togglefullscreen(const Arg *arg)
setfullscreen(sel, !sel->isfullscreen);
}
@ -81,5 +81,5 @@ index 44f3ad9..05070ef 100644
toggletag(const Arg *arg)
{
--
2.53.0
2.45.2