summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-09-14 13:23:59 +0200
committerbakkeby <[email protected]>2020-09-14 13:23:59 +0200
commitb3cb874ff558246deff2979f94805192ef3992e9 (patch)
treea3c4df70fa2a376ed93df0b961cdda2f570a6378 /patch
parent01464c584ea3403ef315cad2998932b6e405b825 (diff)
downloaddwm-flexipatch-b3cb874ff558246deff2979f94805192ef3992e9.tar.gz
dwm-flexipatch-b3cb874ff558246deff2979f94805192ef3992e9.zip
scratchpads: allow a hidden scratchpad to be revealed when toggling scratch and reduce size of window if too large to be displayed when switching monitors
Diffstat (limited to 'patch')
-rw-r--r--patch/scratchpad.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/patch/scratchpad.c b/patch/scratchpad.c
index c0c1873..5813b6f 100644
--- a/patch/scratchpad.c
+++ b/patch/scratchpad.c
@@ -5,19 +5,34 @@ togglescratch(const Arg *arg)
Monitor *mon;
unsigned int found = 0;
unsigned int scratchtag = SPTAG(arg->ui);
+ unsigned int newtagset;
+ int nh = 0, nw = 0;
Arg sparg = {.v = scratchpads[arg->ui].cmd};
for (mon = mons; mon && !found; mon = mon->next)
for (c = mon->clients; c && !(found = c->tags & scratchtag); c = c->next);
if (found) {
+
+ if (HIDDEN(c)) {
+ XMapWindow(dpy, c->win);
+ setclientstate(c, NormalState);
+ newtagset = 0;
+ } else
+ newtagset = selmon->tagset[selmon->seltags] ^ scratchtag;
+
if (c->mon != selmon) {
if (c->mon->tagset[c->mon->seltags] & SPTAGMASK)
c->mon->tagset[c->mon->seltags] ^= scratchtag;
+ if (c->w > selmon->ww)
+ nw = selmon->ww - c->bw * 2;
+ if (c->h > selmon->wh)
+ nh = selmon->wh - c->bw * 2;
+ if (nw > 0 || nh > 0)
+ resizeclient(c, c->x, c->y, nw ? nw : c->w, nh ? nh : c->h);
sendmon(c, selmon);
}
- unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag;
if (newtagset) {
selmon->tagset[selmon->seltags] = newtagset;
focus(NULL);