mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 12:05:45 +00:00
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
This commit is contained in:
parent
01464c584e
commit
b3cb874ff5
@ -5,19 +5,34 @@ togglescratch(const Arg *arg)
|
|||||||
Monitor *mon;
|
Monitor *mon;
|
||||||
unsigned int found = 0;
|
unsigned int found = 0;
|
||||||
unsigned int scratchtag = SPTAG(arg->ui);
|
unsigned int scratchtag = SPTAG(arg->ui);
|
||||||
|
unsigned int newtagset;
|
||||||
|
int nh = 0, nw = 0;
|
||||||
Arg sparg = {.v = scratchpads[arg->ui].cmd};
|
Arg sparg = {.v = scratchpads[arg->ui].cmd};
|
||||||
|
|
||||||
for (mon = mons; mon && !found; mon = mon->next)
|
for (mon = mons; mon && !found; mon = mon->next)
|
||||||
for (c = mon->clients; c && !(found = c->tags & scratchtag); c = c->next);
|
for (c = mon->clients; c && !(found = c->tags & scratchtag); c = c->next);
|
||||||
|
|
||||||
if (found) {
|
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 != selmon) {
|
||||||
if (c->mon->tagset[c->mon->seltags] & SPTAGMASK)
|
if (c->mon->tagset[c->mon->seltags] & SPTAGMASK)
|
||||||
c->mon->tagset[c->mon->seltags] ^= scratchtag;
|
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);
|
sendmon(c, selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag;
|
|
||||||
if (newtagset) {
|
if (newtagset) {
|
||||||
selmon->tagset[selmon->seltags] = newtagset;
|
selmon->tagset[selmon->seltags] = newtagset;
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user