dwm-notallowed-6.2.diff - sites - public wiki contents of suckless.org
(HTM) git clone git://git.suckless.org/sites
(DIR) Log
(DIR) Files
(DIR) Refs
---
dwm-notallowed-6.2.diff (2569B)
---
1 diff -up dwm-6.2.orig/config.def.h dwm-6.2/config.def.h
2 --- dwm-6.2.orig/config.def.h 2021-04-17 17:58:27.803010601 +0200
3 +++ dwm-6.2/config.def.h 2021-04-19 09:04:26.224804870 +0200
4 @@ -26,9 +26,9 @@ static const Rule rules[] = {
5 * WM_CLASS(STRING) = instance, class
6 * WM_NAME(STRING) = title
7 */
8 - /* class instance title tags mask isfloating monitor */
9 - { "Gimp", NULL, NULL, 0, 1, -1 },
10 - { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
11 + /* class instance title tags mask isfloating monitor notallowed */
12 + { "Gimp", NULL, NULL, 0, 1, -1, 0 },
13 + { "Firefox", NULL, NULL, 1 << 8, 0, -1, 0 },
14 };
15
16 /* layout(s) */
17 diff -up dwm-6.2.orig/dwm.c dwm-6.2/dwm.c
18 --- dwm-6.2.orig/dwm.c 2021-04-17 17:58:27.803010601 +0200
19 +++ dwm-6.2/dwm.c 2021-04-19 09:03:42.571206643 +0200
20 @@ -92,7 +92,7 @@ struct Client {
21 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
22 int bw, oldbw;
23 unsigned int tags;
24 - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
25 + int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, notallowed;
26 Client *next;
27 Client *snext;
28 Monitor *mon;
29 @@ -139,6 +139,7 @@ typedef struct {
30 unsigned int tags;
31 int isfloating;
32 int monitor;
33 + int notallowed;
34 } Rule;
35
36 /* function declarations */
37 @@ -297,6 +298,10 @@ applyrules(Client *c)
38 && (!r->class || strstr(class, r->class))
39 && (!r->instance || strstr(instance, r->instance)))
40 {
41 + if (r->notallowed) {
42 + c->notallowed = r->notallowed;
43 + break;
44 + }
45 c->isfloating = r->isfloating;
46 c->tags |= r->tags;
47 for (m = mons; m && m->num != r->monitor; m = m->next);
48 @@ -1029,6 +1034,7 @@ manage(Window w, XWindowAttributes *wa)
49 c->w = c->oldw = wa->width;
50 c->h = c->oldh = wa->height;
51 c->oldbw = wa->border_width;
52 + c->notallowed = 0;
53
54 updatetitle(c);
55 if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
56 @@ -1037,6 +1043,21 @@ manage(Window w, XWindowAttributes *wa)
57 } else {
58 c->mon = selmon;
59 applyrules(c);
60 + if (c->notallowed) {
61 +
62 + XMapWindow(dpy, c->win);
63 + if (!sendevent(c, wmatom[WMDelete])) {
64 + XGrabServer(dpy);
65 + XSetErrorHandler(xerrordummy);
66 + XSetCloseDownMode(dpy, DestroyAll);
67 + XKillClient(dpy, c->win);
68 + XSync(dpy, False);
69 + XSetErrorHandler(xerror);
70 + XUngrabServer(dpy);
71 + }
72 +
73 + return;
74 + }
75 }
76
77 if (c->x + WIDTH(c) > c->mon->mx + c->mon->mw)