From 30b203af5d6f35c5f94fb3a65845432cde014347 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sat, 10 May 2025 20:30:09 +0530 Subject: patched dwm-focusadjacenttag-6.3.diff --- dwm.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'dwm.c') diff --git a/dwm.c b/dwm.c index 78f6996..a3d9254 100644 --- a/dwm.c +++ b/dwm.c @@ -213,6 +213,8 @@ static void showhide(Client *c); static void spawn(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); +static void tagtoleft(const Arg *arg); +static void tagtoright(const Arg *arg); static void tile(Monitor *m); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); @@ -232,6 +234,8 @@ static void updatetitle(Client *c); static void updatewindowtype(Client *c); static void updatewmhints(Client *c); static void view(const Arg *arg); +static void viewtoleft(const Arg *arg); +static void viewtoright(const Arg *arg); static Client *wintoclient(Window w); static Monitor *wintomon(Window w); static int xerror(Display *dpy, XErrorEvent *ee); @@ -1875,6 +1879,28 @@ tagmon(const Arg *arg) sendmon(selmon->sel, dirtomon(arg->i)); } +void +tagtoleft(const Arg *arg) { + if(selmon->sel != NULL + && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 + && selmon->tagset[selmon->seltags] > 1) { + selmon->sel->tags >>= 1; + focus(NULL); + arrange(selmon); + } +} + +void +tagtoright(const Arg *arg) { + if(selmon->sel != NULL + && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 + && selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) { + selmon->sel->tags <<= 1; + focus(NULL); + arrange(selmon); + } +} + void tile(Monitor *m) { @@ -2260,6 +2286,28 @@ view(const Arg *arg) arrange(selmon); } +void +viewtoleft(const Arg *arg) { + if(__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 + && selmon->tagset[selmon->seltags] > 1) { + selmon->seltags ^= 1; /* toggle sel tagset */ + selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1; + focus(NULL); + arrange(selmon); + } +} + +void +viewtoright(const Arg *arg) { + if(__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 + && selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) { + selmon->seltags ^= 1; /* toggle sel tagset */ + selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1; + focus(NULL); + arrange(selmon); + } +} + Client * wintoclient(Window w) { -- cgit v1.2.3