diff --git a/README.md b/README.md index a1c0367..7db3452 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: -2020-06-24 - Added resizepoint and statusbutton patches +2020-06-24 - Added resizepoint, statusbutton and sendmon_keepfocus patches 2020-06-21 - Added floatpos and bar_height patches @@ -369,6 +369,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t - [selfrestart](https://dwm.suckless.org/patches/selfrestart/) - restart dwm without the unnecessary dependency of an external script + - sendmon_keepfocus + - minor patch that allow clients to keep focus when being sent to another monitor + - [setborderpx](https://dwm.suckless.org/patches/statuspadding/) - this patch allows border pixels to be changed during runtime diff --git a/dwm.c b/dwm.c index c41ba93..a60de73 100644 --- a/dwm.c +++ b/dwm.c @@ -2897,6 +2897,9 @@ sendmon(Client *c, Monitor *m) unfocus(c, 1); detach(c); detachstack(c); + #if SENDMON_KEEPFOCUS_PATCH && !EXRESIZE_PATCH + arrange(c->mon); + #endif // SENDMON_KEEPFOCUS_PATCH c->mon = m; #if EMPTYVIEW_PATCH c->tags = (m->tagset[m->seltags] ? m->tagset[m->seltags] : 1); @@ -2915,10 +2918,14 @@ sendmon(Client *c, Monitor *m) arrange(m); focus(c); restack(m); + #elif SENDMON_KEEPFOCUS_PATCH + arrange(m); + focus(c); + restack(m); #else focus(NULL); arrange(NULL); - #endif // EXRESIZE_PATCH + #endif // EXRESIZE_PATCH / SENDMON_KEEPFOCUS_PATCH #if SWITCHTAG_PATCH if (c->switchtag) c->switchtag = 0; diff --git a/patches.def.h b/patches.def.h index 2a54939..97eb0c7 100644 --- a/patches.def.h +++ b/patches.def.h @@ -507,6 +507,9 @@ */ #define SELFRESTART_PATCH 0 +/* This patch allow clients to keep focus when being sent to another monitor. */ +#define SENDMON_KEEPFOCUS_PATCH 0 + /* This patch allows border pixels to be changed during runtime. * https://dwm.suckless.org/patches/setborderpx/ */