From 3da30f076a5551028d4a300d18c60d8ecece8a3f Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 23 May 2024 17:02:54 -0700 Subject: feat(config.h): followclient --- config.h | 5 +++++ dwm.c | 12 ++++++++++++ 2 files changed, 17 insertions(+) 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); + } } } -- cgit v1.2.3