diff options
| author | bakkeby <[email protected]> | 2020-09-07 09:50:42 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2020-09-07 09:50:42 +0200 |
| commit | f4f5ecab75916eb6d11333dcaaaa50de22f8db19 (patch) | |
| tree | 8bd83ec94987f2a28030f84913a7b34e046121c3 /patch | |
| parent | fce55dadcb6bf81550f16ebad7270b99d5d08c47 (diff) | |
| download | dwm-flexipatch-f4f5ecab75916eb6d11333dcaaaa50de22f8db19.tar.gz dwm-flexipatch-f4f5ecab75916eb6d11333dcaaaa50de22f8db19.zip | |
Scratchpads improvement (multi-monitor support)
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/scratchpad.c | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/patch/scratchpad.c b/patch/scratchpad.c index 4edff52..c0c1873 100644 --- a/patch/scratchpad.c +++ b/patch/scratchpad.c @@ -1,25 +1,34 @@ void togglescratch(const Arg *arg) { - Client *c; - unsigned int found = 0; - unsigned int scratchtag = SPTAG(arg->ui); - Arg sparg = {.v = scratchpads[arg->ui].cmd}; + Client *c = NULL; + Monitor *mon; + unsigned int found = 0; + unsigned int scratchtag = SPTAG(arg->ui); + Arg sparg = {.v = scratchpads[arg->ui].cmd}; - for (c = selmon->clients; c && !(found = c->tags & scratchtag); c = c->next); - if (found) { - unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag; - if (newtagset) { - selmon->tagset[selmon->seltags] = newtagset; - focus(NULL); - arrange(selmon); - } - if (ISVISIBLE(c)) { - focus(c); - restack(selmon); - } - } else { - selmon->tagset[selmon->seltags] |= scratchtag; - spawn(&sparg); - } + for (mon = mons; mon && !found; mon = mon->next) + for (c = mon->clients; c && !(found = c->tags & scratchtag); c = c->next); + + if (found) { + if (c->mon != selmon) { + if (c->mon->tagset[c->mon->seltags] & SPTAGMASK) + c->mon->tagset[c->mon->seltags] ^= scratchtag; + sendmon(c, selmon); + } + + unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag; + if (newtagset) { + selmon->tagset[selmon->seltags] = newtagset; + focus(NULL); + arrange(selmon); + } + if (ISVISIBLE(c)) { + focus(c); + restack(selmon); + } + } else { + selmon->tagset[selmon->seltags] |= scratchtag; + spawn(&sparg); + } }
\ No newline at end of file |
