diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-05-10 20:30:09 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-05-10 20:30:09 +0530 |
commit | 30b203af5d6f35c5f94fb3a65845432cde014347 (patch) | |
tree | 55663a7a3c0737d34403fcca3a64c46dacf8c08a /dwm.c | |
parent | bd7e23dff2c22e1133ec7908f689b9e7b8d5704a (diff) |
patched dwm-focusadjacenttag-6.3.diff
Diffstat (limited to 'dwm.c')
-rw-r--r-- | dwm.c | 48 |
1 files changed, 48 insertions, 0 deletions
@@ -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); @@ -1876,6 +1880,28 @@ tagmon(const Arg *arg) } 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) { unsigned int i, n, h, mw, my, ty; @@ -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) { |