diff options
author | Philip Wittamore <philip@wittamore.com> | 2025-05-21 20:49:54 +0200 |
---|---|---|
committer | Philip Wittamore <philip@wittamore.com> | 2025-05-21 20:49:54 +0200 |
commit | 5ac7d0f954402a6942943d08821d5391d098677c (patch) | |
tree | c3d11df97f393908bc2f6dda96356f07ee90a31e /dwm.c | |
parent | ed58bff91b2d872a3c5db3db2e86015640d7c3db (diff) | |
download | dwm-5ac7d0f954402a6942943d08821d5391d098677c.tar.gz dwm-5ac7d0f954402a6942943d08821d5391d098677c.tar.bz2 dwm-5ac7d0f954402a6942943d08821d5391d098677c.zip |
update
Diffstat (limited to 'dwm.c')
-rw-r--r-- | dwm.c | 58 |
1 files changed, 58 insertions, 0 deletions
@@ -256,6 +256,8 @@ static void updatetitle(Client *c); static void updatewindowtype(Client *c); static void updatewmhints(Client *c); static void view(const Arg *arg); +static void viewnext(const Arg *arg); +static void viewprev(const Arg *arg); static Client *wintoclient(Window w); static Monitor *wintomon(Window w); static int xerror(Display *dpy, XErrorEvent *ee); @@ -263,6 +265,10 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee); static int xerrorstart(Display *dpy, XErrorEvent *ee); static void xrdb(const Arg *arg); static void zoom(const Arg *arg); +static unsigned int nexttag(void); +static unsigned int prevtag(void); +static void tagtonext(const Arg *arg); +static void tagtoprev(const Arg *arg); static pid_t getparentprocess(pid_t p); static int isdescprocess(pid_t p, pid_t c); @@ -1349,6 +1355,13 @@ movemouse(const Arg *arg) } } +unsigned int +nexttag(void) +{ + unsigned int seltag = selmon->tagset[selmon->seltags]; + return seltag == (1 << (LENGTH(tags) - 1)) ? 1 : seltag << 1; +} + Client * nexttiled(Client *c) { @@ -1365,6 +1378,13 @@ pop(Client *c) arrange(c->mon); } +unsigned int +prevtag(void) +{ + unsigned int seltag = selmon->tagset[selmon->seltags]; + return seltag == 1 ? (1 << (LENGTH(tags) - 1)) : seltag >> 1; +} + void propertynotify(XEvent *e) { @@ -1864,6 +1884,32 @@ tagmon(const Arg *arg) } void +tagtonext(const Arg *arg) +{ + unsigned int tmp; + + if (selmon->sel == NULL) + return; + + tmp = nexttag(); + tag(&(const Arg){.ui = tmp }); + view(&(const Arg){.ui = tmp }); +} + +void +tagtoprev(const Arg *arg) +{ + unsigned int tmp; + + if (selmon->sel == NULL) + return; + + tmp = prevtag(); + tag(&(const Arg){.ui = tmp }); + view(&(const Arg){.ui = tmp }); +} + +void tile(Monitor *m) { unsigned int i, n, h, mw, my, ty; @@ -2388,6 +2434,18 @@ swallowingclient(Window w) return NULL; } +void +viewnext(const Arg *arg) +{ + view(&(const Arg){.ui = nexttag()}); +} + +void +viewprev(const Arg *arg) +{ + view(&(const Arg){.ui = prevtag()}); +} + Client * wintoclient(Window w) { |