aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-05-23 17:02:54 -0700
committerFuwn <[email protected]>2024-05-23 17:02:58 -0700
commit3da30f076a5551028d4a300d18c60d8ecece8a3f (patch)
treed41b851cb366b78c93597988225149dfa04f0cc7
parentfeat(config.h): reactive togglebar (diff)
downloadseiwm-3da30f076a5551028d4a300d18c60d8ecece8a3f.tar.xz
seiwm-3da30f076a5551028d4a300d18c60d8ecece8a3f.zip
feat(config.h): followclient
-rw-r--r--config.h5
-rw-r--r--dwm.c12
2 files changed, 17 insertions, 0 deletions
diff --git a/config.h b/config.h
index d5f9be4..3140b32 100644
--- a/config.h
+++ b/config.h
@@ -9,6 +9,11 @@
#define WMNAME "sei"
/* appearance */
+/* followclient:
+ * 1: if sending a client to a new tag with no other clients, the view will
+ * follow the client
+ * 0: default behaviour */
+static const int followclient = 1;
static unsigned int borderpx = 2; /* border pixel of windows */
static unsigned int snap = 32; /* snap pixel */
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
diff --git a/dwm.c b/dwm.c
index a7018f4..d083c66 100644
--- a/dwm.c
+++ b/dwm.c
@@ -440,6 +440,8 @@ keyrelease(XEvent *e) {
void
combotag(const Arg *arg) {
+ Client *target = selmon->sel;
+
if(selmon->sel && arg->ui & TAGMASK) {
if (combo) {
selmon->sel->tags |= arg->ui & TAGMASK;
@@ -449,6 +451,16 @@ combotag(const Arg *arg) {
}
focus(NULL);
arrange(selmon);
+
+ if (followclient) {
+ Client *c;
+ int i = 0;
+
+ for (c = target->mon->clients; c && !ISVISIBLE(c); c = c->next)
+ if (c->tags == target->tags) i += 1;
+
+ if (i <= 1) view(arg);
+ }
}
}