dwm-selectivefakefullscreen-20200513-f09418b.diff (5039B)
1 From 524ac2f4bc0a741cc6b1c43aa2e1b6bff2a57088 Mon Sep 17 00:00:00 2001 2 From: Francisco Tapia <link_1232@yahoo.com.mx> 3 Date: Wed, 13 May 2020 15:47:16 -0500 4 Subject: [PATCH] Selective fake full screen 5 6 --- 7 config.def.h | 6 +++--- 8 dwm.c | 26 +++++++++++++++++++------- 9 2 files changed, 22 insertions(+), 10 deletions(-) 10 11 diff --git a/config.def.h b/config.def.h 12 index 1c0b587..b7a445b 100644 13 --- a/config.def.h 14 +++ b/config.def.h 15 @@ -26,9 +26,9 @@ static const Rule rules[] = { 16 * WM_CLASS(STRING) = instance, class 17 * WM_NAME(STRING) = title 18 */ 19 - /* class instance title tags mask isfloating monitor */ 20 - { "Gimp", NULL, NULL, 0, 1, -1 }, 21 - { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, 22 + /* class instance title tags mask isfloating isfakefullscreen monitor */ 23 + { "Gimp", NULL, NULL, 0, 1, 0, -1 }, 24 + { "Firefox", NULL, NULL, 1 << 8, 0, 1, -1 }, 25 }; 26 27 /* layout(s) */ 28 diff --git a/dwm.c b/dwm.c 29 index 9fd0286..acc11db 100644 30 --- a/dwm.c 31 +++ b/dwm.c 32 @@ -92,7 +92,7 @@ struct Client { 33 int basew, baseh, incw, inch, maxw, maxh, minw, minh; 34 int bw, oldbw; 35 unsigned int tags; 36 - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; 37 + int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isfakefullscreen; 38 Client *next; 39 Client *snext; 40 Monitor *mon; 41 @@ -138,6 +138,7 @@ typedef struct { 42 const char *title; 43 unsigned int tags; 44 int isfloating; 45 + int isfakefullscreen; 46 int monitor; 47 } Rule; 48 49 @@ -299,6 +300,7 @@ applyrules(Client *c) 50 && (!r->instance || strstr(instance, r->instance))) 51 { 52 c->isfloating = r->isfloating; 53 + c->isfakefullscreen = r->isfakefullscreen; 54 c->tags |= r->tags; 55 for (m = mons; m && m->num != r->monitor; m = m->next); 56 if (m) 57 @@ -522,7 +524,8 @@ clientmessage(XEvent *e) 58 if (cme->data.l[1] == netatom[NetWMFullscreen] 59 || cme->data.l[2] == netatom[NetWMFullscreen]) 60 setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ 61 - || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); 62 + || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ 63 + && (!c->isfullscreen || c->isfakefullscreen)))); 64 } else if (cme->message_type == netatom[NetActiveWindow]) { 65 if (c != selmon->sel && !c->isurgent) 66 seturgent(c, 1); 67 @@ -566,7 +569,8 @@ configurenotify(XEvent *e) 68 updatebars(); 69 for (m = mons; m; m = m->next) { 70 for (c = m->clients; c; c = c->next) 71 - if (c->isfullscreen) 72 + if (c->isfullscreen 73 + && !c->isfakefullscreen) 74 resizeclient(c, m->mx, m->my, m->mw, m->mh); 75 XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh); 76 } 77 @@ -1144,7 +1148,8 @@ movemouse(const Arg *arg) 78 79 if (!(c = selmon->sel)) 80 return; 81 - if (c->isfullscreen) /* no support moving fullscreen windows by mouse */ 82 + if (c->isfullscreen 83 + && !c->isfakefullscreen) /* no support moving fullscreen windows by mouse */ 84 return; 85 restack(selmon); 86 ocx = c->x; 87 @@ -1299,7 +1304,8 @@ resizemouse(const Arg *arg) 88 89 if (!(c = selmon->sel)) 90 return; 91 - if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */ 92 + if (c->isfullscreen 93 + && !c->isfakefullscreen) /* no support resizing fullscreen windows by mouse */ 94 return; 95 restack(selmon); 96 ocx = c->x; 97 @@ -1477,6 +1483,8 @@ setfullscreen(Client *c, int fullscreen) 98 XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, 99 PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); 100 c->isfullscreen = 1; 101 + if (c->isfakefullscreen) 102 + return; 103 c->oldstate = c->isfloating; 104 c->oldbw = c->bw; 105 c->bw = 0; 106 @@ -1487,6 +1495,8 @@ setfullscreen(Client *c, int fullscreen) 107 XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, 108 PropModeReplace, (unsigned char*)0, 0); 109 c->isfullscreen = 0; 110 + if (c->isfakefullscreen) 111 + return; 112 c->isfloating = c->oldstate; 113 c->bw = c->oldbw; 114 c->x = c->oldx; 115 @@ -1619,7 +1629,8 @@ showhide(Client *c) 116 if (ISVISIBLE(c)) { 117 /* show clients top down */ 118 XMoveWindow(dpy, c->win, c->x, c->y); 119 - if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen) 120 + if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) 121 + && (!c->isfullscreen || c->isfakefullscreen)) 122 resize(c, c->x, c->y, c->w, c->h, 0); 123 showhide(c->snext); 124 } else { 125 @@ -1713,7 +1724,8 @@ togglefloating(const Arg *arg) 126 { 127 if (!selmon->sel) 128 return; 129 - if (selmon->sel->isfullscreen) /* no support for fullscreen windows */ 130 + if (selmon->sel->isfullscreen 131 + && !selmon->sel->isfakefullscreen) /* no support for fullscreen windows */ 132 return; 133 selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed; 134 if (selmon->sel->isfloating) 135 -- 136 2.20.1 137