diff options
| author | Douglas Rumbaugh <doug@douglasrumbaugh.com> | 2022-12-02 22:39:46 -0500 |
|---|---|---|
| committer | Douglas Rumbaugh <doug@douglasrumbaugh.com> | 2022-12-02 22:39:46 -0500 |
| commit | 13fda47c2b39e0db2e4bfcca8deb511dddb71387 (patch) | |
| tree | b46253852848a8b296e580173ca37807acb6a3e7 /dwm.c | |
| parent | 91489267b8eed6be9fbebdaad9371799982c93fa (diff) | |
| download | dwm-13fda47c2b39e0db2e4bfcca8deb511dddb71387.tar.gz | |
Improved tag-0 behavior
Displaying tag 0 now triggers on all attached monitors, and leaving it
on any monitor reverts all other back to their original configuration
Diffstat (limited to 'dwm.c')
| -rw-r--r-- | dwm.c | 48 |
1 files changed, 39 insertions, 9 deletions
@@ -266,6 +266,7 @@ static void updatetitle(Client *c); static void updatewindowtype(Client *c); static void updatewmhints(Client *c); static void view(const Arg *arg); +static void view_t0(const Arg *arg); static Client *wintoclient(Window w); static Monitor *wintomon(Window w); static int xerror(Display *dpy, XErrorEvent *ee); @@ -2452,21 +2453,30 @@ view(const Arg *arg) if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) return; + + + if (selmon->pertag->curtag == 0 && arg->ui != 0) { + Monitor *oldmon = selmon; + for (Monitor *m = mons; m; m = m->next) { + if (m != oldmon) { + selmon = m; + Arg tmp = {0}; + view(&tmp); + } + } + + selmon = oldmon; + } + selmon->seltags ^= 1; /* toggle sel tagset */ if (arg->ui & TAGMASK) { - selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; - selmon->pertag->prevtag = selmon->pertag->curtag; if (arg->ui == ~0) { - selmon->pertag->curtag = 0; - selmon->tagset[selmon->seltags] ^= SPTAGMASK; - // Force set the layout to grid when viewing - // all tags - Arg tmp; - tmp.v = &layouts[7]; - setlayout(&tmp); + view_t0(arg); } else { + selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; + selmon->pertag->prevtag = selmon->pertag->curtag; for (i = 0; !(arg->ui & 1 << i); i++) ; selmon->pertag->curtag = i + 1; } @@ -2489,6 +2499,26 @@ view(const Arg *arg) arrange(selmon); } +void +view_t0(const Arg *arg) +{ + Monitor *oldmon = selmon; + for (Monitor *m = mons; m; m = m->next) { + selmon = m; + selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; + selmon->pertag->prevtag = selmon->pertag->curtag; + selmon->pertag->curtag = 0; + selmon->tagset[selmon->seltags] ^= SPTAGMASK; + // Force set the layout to grid when viewing + // all tags + Arg tmp; + tmp.v = &layouts[7]; + setlayout(&tmp); + } + + selmon = oldmon; +} + pid_t winpid(Window w) { |