dwm-ignore_transient_windows-20211114-a786211.diff (2945B)
1 From ab0b7c8798f19fd45969590fbca421e0a526a72c Mon Sep 17 00:00:00 2001 2 From: BrunoCooper17 <BrunoCooper17@outlook.com> 3 Date: Sun, 14 Nov 2021 21:17:39 -0600 4 Subject: [PATCH] Add support to ignore transient window to avoid becoming floating 5 6 This fix issues working with Jetbrains applications and the UE4 Editor. 7 8 Also, not sure if needed but add the following for some java applications before launching dwm: 9 export _JAVA_AWT_WM_NONREPARENTING=1 10 export AWT_TOOLKIT=MToolkit 11 wmname LG3D 12 13 The real authors of this patch are Ar4m1d and bakkeby from reddit, I just put it 14 on a patch to share it to anyone who find it useful: 15 https://www.reddit.com/r/suckless/comments/k67tso/dwm_webstormjetbrains_webstorm_window_becomes/ 16 17 --- 18 config.def.h | 6 +++--- 19 dwm.c | 11 +++++++---- 20 2 files changed, 10 insertions(+), 7 deletions(-) 21 22 diff --git a/config.def.h b/config.def.h 23 index a2ac963..39e50a1 100644 24 --- a/config.def.h 25 +++ b/config.def.h 26 @@ -26,9 +26,9 @@ static const Rule rules[] = { 27 * WM_CLASS(STRING) = instance, class 28 * WM_NAME(STRING) = title 29 */ 30 - /* class instance title tags mask isfloating monitor */ 31 - { "Gimp", NULL, NULL, 0, 1, -1 }, 32 - { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, 33 + /* class instance title tags mask isfloating monitor ignoretransient */ 34 + { "Gimp", NULL, NULL, 0, 1, -1, 0 }, 35 + { "Firefox", NULL, NULL, 1 << 8, 0, -1, 0 }, 36 }; 37 38 /* layout(s) */ 39 diff --git a/dwm.c b/dwm.c 40 index 5e4d494..8313f96 100644 41 --- a/dwm.c 42 +++ b/dwm.c 43 @@ -92,7 +92,7 @@ struct Client { 44 int basew, baseh, incw, inch, maxw, maxh, minw, minh; 45 int bw, oldbw; 46 unsigned int tags; 47 - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; 48 + int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, ignoretransient; 49 Client *next; 50 Client *snext; 51 Monitor *mon; 52 @@ -139,6 +139,7 @@ typedef struct { 53 unsigned int tags; 54 int isfloating; 55 int monitor; 56 + int ignoretransient; 57 } Rule; 58 59 /* function declarations */ 60 @@ -299,6 +300,7 @@ applyrules(Client *c) 61 && (!r->instance || strstr(instance, r->instance))) 62 { 63 c->isfloating = r->isfloating; 64 + c->ignoretransient = r->ignoretransient; 65 c->tags |= r->tags; 66 for (m = mons; m && m->num != r->monitor; m = m->next); 67 if (m) 68 @@ -1224,9 +1226,10 @@ propertynotify(XEvent *e) 69 switch(ev->atom) { 70 default: break; 71 case XA_WM_TRANSIENT_FOR: 72 - if (!c->isfloating && (XGetTransientForHint(dpy, c->win, &trans)) && 73 - (c->isfloating = (wintoclient(trans)) != NULL)) 74 - arrange(c->mon); 75 + if (!c->ignoretransient && !c->isfloating && 76 + (XGetTransientForHint(dpy, c->win, &trans)) && 77 + (c->isfloating = (wintoclient(trans)) != NULL)) 78 + arrange(c->mon); 79 break; 80 case XA_WM_NORMAL_HINTS: 81 updatesizehints(c); 82 -- 83 2.33.1 84