mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Scratchpads improvement (multi-monitor support)
This commit is contained in:
parent
fce55dadcb
commit
f4f5ecab75
@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
|
||||
### Changelog:
|
||||
|
||||
2020-09-07 - Scratchpads improvement (multi-monitor support)
|
||||
|
||||
2020-09-05 - Assortment of fullscreen improvements
|
||||
|
||||
2020-08-27 - Added aspectresize patch
|
||||
|
25
dwm.c
25
dwm.c
@ -742,12 +742,12 @@ applyrules(Client *c)
|
||||
#endif // SWALLOW_PATCH
|
||||
c->isfloating = r->isfloating;
|
||||
c->tags |= r->tags;
|
||||
#if SCRATCHPADS_PATCH && !SCRATCHPAD_KEEP_POSITION_AND_SIZE_PATCH
|
||||
#if SCRATCHPADS_PATCH
|
||||
if ((r->tags & SPTAGMASK) && r->isfloating) {
|
||||
c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2);
|
||||
c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2);
|
||||
}
|
||||
#endif // SCRATCHPADS_PATCH | SCRATCHPAD_KEEP_POSITION_AND_SIZE_PATCH
|
||||
#endif // SCRATCHPADS_PATCH
|
||||
for (m = mons; m && m->num != r->monitor; m = m->next);
|
||||
if (m)
|
||||
c->mon = m;
|
||||
@ -2693,6 +2693,9 @@ sendmon(Client *c, Monitor *m)
|
||||
arrange(c->mon);
|
||||
#endif // SENDMON_KEEPFOCUS_PATCH
|
||||
c->mon = m;
|
||||
#if SCRATCHPADS_PATCH
|
||||
if (!(c->tags & SPTAGMASK))
|
||||
#endif // SCRATCHPADS_PATCH
|
||||
#if EMPTYVIEW_PATCH
|
||||
c->tags = (m->tagset[m->seltags] ? m->tagset[m->seltags] : 1);
|
||||
#else
|
||||
@ -3115,12 +3118,26 @@ showhide(Client *c)
|
||||
if (!c)
|
||||
return;
|
||||
if (ISVISIBLE(c)) {
|
||||
#if SCRATCHPADS_PATCH && !SCRATCHPAD_KEEP_POSITION_AND_SIZE_PATCH
|
||||
#if SCRATCHPADS_KEEP_POSITION_AND_SIZE_PATCH
|
||||
if (
|
||||
(c->tags & SPTAGMASK) &&
|
||||
c->isfloating &&
|
||||
(
|
||||
c->x < c->mon->mx ||
|
||||
c->x > c->mon->mx + c->mon->mw ||
|
||||
c->y < c->mon->my ||
|
||||
c->y > c->mon->my + c->mon->mh
|
||||
)
|
||||
) {
|
||||
c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2);
|
||||
c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2);
|
||||
}
|
||||
#elif SCRATCHPADS_PATCH
|
||||
if ((c->tags & SPTAGMASK) && c->isfloating) {
|
||||
c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2);
|
||||
c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2);
|
||||
}
|
||||
#endif // SCRATCHPADS_PATCH | SCRATCHPAD_KEEP_POSITION_AND_SIZE_PATCH
|
||||
#endif // SCRATCHPADS_KEEP_POSITION_AND_SIZE_PATCH | SCRATCHPADS_PATCH
|
||||
/* show clients top down */
|
||||
#if SAVEFLOATS_PATCH || EXRESIZE_PATCH
|
||||
if (!c->mon->lt[c->mon->sellt]->arrange && c->sfx != -9999 && !c->isfullscreen) {
|
||||
|
@ -1,13 +1,22 @@
|
||||
void
|
||||
togglescratch(const Arg *arg)
|
||||
{
|
||||
Client *c;
|
||||
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);
|
||||
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;
|
||||
|
@ -714,6 +714,9 @@
|
||||
*/
|
||||
#define SCRATCHPADS_PATCH 0
|
||||
|
||||
/* Minor alteration of the above allowing clients to keep their size and position when shown */
|
||||
#define SCRATCHPADS_KEEP_POSITION_AND_SIZE_PATCH 0
|
||||
|
||||
/* This alternative patch enables a scratchpad feature in dwm similar to the scratchpad
|
||||
* feature in i3wm.
|
||||
* https://github.com/GasparVardanyan/dwm-scratchpad
|
||||
|
Loading…
Reference in New Issue
Block a user