Compare commits
2 Commits
master
...
patch/allo
| Author | SHA1 | Date | |
|---|---|---|---|
| 9599d4233d | |||
| 0c36b86ec0 |
@ -5,6 +5,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
|
|||||||
static const unsigned int snap = 32; /* snap pixel */
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
static const int topbar = 1; /* 0 means bottom bar */
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
|
static const int allowkill = 1; /* allow killing clients by default? */
|
||||||
static const char *fonts[] = { "monospace:size=10" };
|
static const char *fonts[] = { "monospace:size=10" };
|
||||||
static const char dmenufont[] = "monospace:size=10";
|
static const char dmenufont[] = "monospace:size=10";
|
||||||
static const char col_gray1[] = "#222222";
|
static const char col_gray1[] = "#222222";
|
||||||
@ -26,9 +27,9 @@ static const Rule rules[] = {
|
|||||||
* WM_CLASS(STRING) = instance, class
|
* WM_CLASS(STRING) = instance, class
|
||||||
* WM_NAME(STRING) = title
|
* WM_NAME(STRING) = title
|
||||||
*/
|
*/
|
||||||
/* class instance title tags mask isfloating monitor */
|
/* class instance title tags mask allowkill isfloating monitor */
|
||||||
{ "Gimp", NULL, NULL, 0, 1, -1 },
|
{ "Gimp", NULL, NULL, 0, 1, 1, -1 },
|
||||||
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
|
{ "Firefox", NULL, NULL, 1 << 8, 1, 0, -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
@ -80,6 +81,7 @@ static const Key keys[] = {
|
|||||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||||
{ MODKEY, XK_space, setlayout, {0} },
|
{ MODKEY, XK_space, setlayout, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
|
{ MODKEY, XK_q, toggleallowkill,{0} },
|
||||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||||
|
|||||||
98
dwm-allowkillrule-6.4.diff
Normal file
98
dwm-allowkillrule-6.4.diff
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
diff -up a/config.def.h b/config.def.h
|
||||||
|
--- a/config.def.h 2022-10-04 19:38:18.000000000 +0200
|
||||||
|
+++ b/config.def.h 2023-05-06 22:19:27.298742237 +0200
|
||||||
|
@@ -5,6 +5,7 @@ static const unsigned int borderpx = 1;
|
||||||
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
|
+static const int allowkill = 1; /* allow killing clients by default? */
|
||||||
|
static const char *fonts[] = { "monospace:size=10" };
|
||||||
|
static const char dmenufont[] = "monospace:size=10";
|
||||||
|
static const char col_gray1[] = "#222222";
|
||||||
|
@@ -26,9 +27,9 @@ static const Rule rules[] = {
|
||||||
|
* WM_CLASS(STRING) = instance, class
|
||||||
|
* WM_NAME(STRING) = title
|
||||||
|
*/
|
||||||
|
- /* class instance title tags mask isfloating monitor */
|
||||||
|
- { "Gimp", NULL, NULL, 0, 1, -1 },
|
||||||
|
- { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
|
||||||
|
+ /* class instance title tags mask allowkill isfloating monitor */
|
||||||
|
+ { "Gimp", NULL, NULL, 0, 1, 1, -1 },
|
||||||
|
+ { "Firefox", NULL, NULL, 1 << 8, 1, 0, -1 },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* layout(s) */
|
||||||
|
@@ -78,6 +79,7 @@ static const Key keys[] = {
|
||||||
|
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||||
|
{ MODKEY, XK_space, setlayout, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
|
+ { MODKEY, XK_q, toggleallowkill,{0} },
|
||||||
|
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||||
|
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||||
|
diff -up a/dwm.c b/dwm.c
|
||||||
|
--- a/dwm.c 2022-10-04 19:38:18.000000000 +0200
|
||||||
|
+++ b/dwm.c 2023-05-06 22:18:43.239357744 +0200
|
||||||
|
@@ -93,6 +93,7 @@ struct Client {
|
||||||
|
int bw, oldbw;
|
||||||
|
unsigned int tags;
|
||||||
|
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
||||||
|
+ int allowkill;
|
||||||
|
Client *next;
|
||||||
|
Client *snext;
|
||||||
|
Monitor *mon;
|
||||||
|
@@ -137,6 +138,7 @@ typedef struct {
|
||||||
|
const char *instance;
|
||||||
|
const char *title;
|
||||||
|
unsigned int tags;
|
||||||
|
+ int allowkill;
|
||||||
|
int isfloating;
|
||||||
|
int monitor;
|
||||||
|
} Rule;
|
||||||
|
@@ -212,6 +214,7 @@ static void tagmon(const Arg *arg);
|
||||||
|
static void tile(Monitor *m);
|
||||||
|
static void togglebar(const Arg *arg);
|
||||||
|
static void togglefloating(const Arg *arg);
|
||||||
|
+static void toggleallowkill(const Arg *arg);
|
||||||
|
static void toggletag(const Arg *arg);
|
||||||
|
static void toggleview(const Arg *arg);
|
||||||
|
static void unfocus(Client *c, int setfocus);
|
||||||
|
@@ -288,6 +291,7 @@ applyrules(Client *c)
|
||||||
|
/* rule matching */
|
||||||
|
c->isfloating = 0;
|
||||||
|
c->tags = 0;
|
||||||
|
+ c->allowkill = allowkill;
|
||||||
|
XGetClassHint(dpy, c->win, &ch);
|
||||||
|
class = ch.res_class ? ch.res_class : broken;
|
||||||
|
instance = ch.res_name ? ch.res_name : broken;
|
||||||
|
@@ -300,6 +304,7 @@ applyrules(Client *c)
|
||||||
|
{
|
||||||
|
c->isfloating = r->isfloating;
|
||||||
|
c->tags |= r->tags;
|
||||||
|
+ c->allowkill = r->allowkill;
|
||||||
|
for (m = mons; m && m->num != r->monitor; m = m->next);
|
||||||
|
if (m)
|
||||||
|
c->mon = m;
|
||||||
|
@@ -1006,7 +1011,7 @@ keypress(XEvent *e)
|
||||||
|
void
|
||||||
|
killclient(const Arg *arg)
|
||||||
|
{
|
||||||
|
- if (!selmon->sel)
|
||||||
|
+ if (!selmon->sel || !selmon->sel->allowkill)
|
||||||
|
return;
|
||||||
|
if (!sendevent(selmon->sel, wmatom[WMDelete])) {
|
||||||
|
XGrabServer(dpy);
|
||||||
|
@@ -1704,6 +1709,13 @@ togglebar(const Arg *arg)
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
+toggleallowkill(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ if (!selmon->sel) return;
|
||||||
|
+ selmon->sel->allowkill = !selmon->sel->allowkill;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
togglefloating(const Arg *arg)
|
||||||
|
{
|
||||||
|
if (!selmon->sel)
|
||||||
14
dwm.c
14
dwm.c
@ -92,6 +92,7 @@ struct Client {
|
|||||||
int bw, oldbw;
|
int bw, oldbw;
|
||||||
unsigned int tags;
|
unsigned int tags;
|
||||||
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
||||||
|
int allowkill;
|
||||||
Client *next;
|
Client *next;
|
||||||
Client *snext;
|
Client *snext;
|
||||||
Monitor *mon;
|
Monitor *mon;
|
||||||
@ -136,6 +137,7 @@ typedef struct {
|
|||||||
const char *instance;
|
const char *instance;
|
||||||
const char *title;
|
const char *title;
|
||||||
unsigned int tags;
|
unsigned int tags;
|
||||||
|
int allowkill;
|
||||||
int isfloating;
|
int isfloating;
|
||||||
int monitor;
|
int monitor;
|
||||||
} Rule;
|
} Rule;
|
||||||
@ -210,6 +212,7 @@ static void tagmon(const Arg *arg);
|
|||||||
static void tile(Monitor *m);
|
static void tile(Monitor *m);
|
||||||
static void togglebar(const Arg *arg);
|
static void togglebar(const Arg *arg);
|
||||||
static void togglefloating(const Arg *arg);
|
static void togglefloating(const Arg *arg);
|
||||||
|
static void toggleallowkill(const Arg *arg);
|
||||||
static void toggletag(const Arg *arg);
|
static void toggletag(const Arg *arg);
|
||||||
static void toggleview(const Arg *arg);
|
static void toggleview(const Arg *arg);
|
||||||
static void unfocus(Client *c, int setfocus);
|
static void unfocus(Client *c, int setfocus);
|
||||||
@ -286,6 +289,7 @@ applyrules(Client *c)
|
|||||||
/* rule matching */
|
/* rule matching */
|
||||||
c->isfloating = 0;
|
c->isfloating = 0;
|
||||||
c->tags = 0;
|
c->tags = 0;
|
||||||
|
c->allowkill = allowkill;
|
||||||
XGetClassHint(dpy, c->win, &ch);
|
XGetClassHint(dpy, c->win, &ch);
|
||||||
class = ch.res_class ? ch.res_class : broken;
|
class = ch.res_class ? ch.res_class : broken;
|
||||||
instance = ch.res_name ? ch.res_name : broken;
|
instance = ch.res_name ? ch.res_name : broken;
|
||||||
@ -298,6 +302,7 @@ applyrules(Client *c)
|
|||||||
{
|
{
|
||||||
c->isfloating = r->isfloating;
|
c->isfloating = r->isfloating;
|
||||||
c->tags |= r->tags;
|
c->tags |= r->tags;
|
||||||
|
c->allowkill = r->allowkill;
|
||||||
for (m = mons; m && m->num != r->monitor; m = m->next);
|
for (m = mons; m && m->num != r->monitor; m = m->next);
|
||||||
if (m)
|
if (m)
|
||||||
c->mon = m;
|
c->mon = m;
|
||||||
@ -1015,7 +1020,7 @@ keypress(XEvent *e)
|
|||||||
void
|
void
|
||||||
killclient(const Arg *arg)
|
killclient(const Arg *arg)
|
||||||
{
|
{
|
||||||
if (!selmon->sel)
|
if (!selmon->sel || !selmon->sel->allowkill)
|
||||||
return;
|
return;
|
||||||
if (!sendevent(selmon->sel, wmatom[WMDelete])) {
|
if (!sendevent(selmon->sel, wmatom[WMDelete])) {
|
||||||
XGrabServer(dpy);
|
XGrabServer(dpy);
|
||||||
@ -1721,6 +1726,13 @@ togglebar(const Arg *arg)
|
|||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
toggleallowkill(const Arg *arg)
|
||||||
|
{
|
||||||
|
if (!selmon->sel) return;
|
||||||
|
selmon->sel->allowkill = !selmon->sel->allowkill;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
togglefloating(const Arg *arg)
|
togglefloating(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user