mirror of
https://github.com/tiyn/dwm.git
synced 2025-10-15 20:31:18 +02:00
Compare commits
4 Commits
quitprompt
...
noborder
Author | SHA1 | Date | |
---|---|---|---|
8c99c8590a | |||
937c007cf7 | |||
|
83d050ecdf | ||
|
e93e6fb5a3 |
@@ -93,7 +93,7 @@ static Key keys[] = {
|
|||||||
TAGKEYS( XK_7, 6)
|
TAGKEYS( XK_7, 6)
|
||||||
TAGKEYS( XK_8, 7)
|
TAGKEYS( XK_8, 7)
|
||||||
TAGKEYS( XK_9, 8)
|
TAGKEYS( XK_9, 8)
|
||||||
{ MODKEY|ShiftMask, XK_q, quitprompt, {0} },
|
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* button definitions */
|
/* button definitions */
|
||||||
|
30
dwm-noborder-6.2.diff
Normal file
30
dwm-noborder-6.2.diff
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
From 9102fdb9c670218373bbe83c891c8e8138d6a6f4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: redacted <redacted@example.com>
|
||||||
|
Date: Tue, 23 Apr 2019 00:39:27 +0100
|
||||||
|
Subject: [PATCH] added noborder patch
|
||||||
|
|
||||||
|
---
|
||||||
|
dwm.c | 7 +++++++
|
||||||
|
1 file changed, 7 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 4465af1..685eca1 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -1282,6 +1282,13 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
||||||
|
c->oldw = c->w; c->w = wc.width = w;
|
||||||
|
c->oldh = c->h; c->h = wc.height = h;
|
||||||
|
wc.border_width = c->bw;
|
||||||
|
+ if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
|
||||||
|
+ || &monocle == c->mon->lt[c->mon->sellt]->arrange)
|
||||||
|
+ && !c->isfullscreen && !c->isfloating) {
|
||||||
|
+ c->w = wc.width += c->bw * 2;
|
||||||
|
+ c->h = wc.height += c->bw * 2;
|
||||||
|
+ wc.border_width = 0;
|
||||||
|
+ }
|
||||||
|
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
||||||
|
configure(c);
|
||||||
|
XSync(dpy, False);
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
@@ -1,92 +0,0 @@
|
|||||||
From eb558048819ed916b272765e64e1ea795a85740e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Lerrrtaste <lerrrtaste@protonmail.com>
|
|
||||||
Date: Mon, 18 Jul 2022 12:22:39 +0200
|
|
||||||
Subject: [PATCH] This Patch replaces the default quit behavior with an dmenu
|
|
||||||
prompt. Possible selections are (Quit DWM?) "yes", "no" and "restart". The
|
|
||||||
additional confirmation can save your work from accidentally hitting the quit
|
|
||||||
key by requiring two additional keystrokes (y/yes and RET). Additionally it
|
|
||||||
allows for restarting / reloading dwm without ending the xsession and closing
|
|
||||||
all open x windows. To abort press ESC or n/no and RET.
|
|
||||||
|
|
||||||
---
|
|
||||||
config.def.h | 2 +-
|
|
||||||
dwm.c | 30 ++++++++++++++++++++++++++++++
|
|
||||||
2 files changed, 31 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
|
||||||
index a2ac963..9e3b394 100644
|
|
||||||
--- a/config.def.h
|
|
||||||
+++ b/config.def.h
|
|
||||||
@@ -94,7 +94,7 @@ static Key keys[] = {
|
|
||||||
TAGKEYS( XK_7, 6)
|
|
||||||
TAGKEYS( XK_8, 7)
|
|
||||||
TAGKEYS( XK_9, 8)
|
|
||||||
- { MODKEY|ShiftMask, XK_q, quit, {0} },
|
|
||||||
+ { MODKEY|ShiftMask, XK_q, quitprompt, {0} },
|
|
||||||
};
|
|
||||||
|
|
||||||
/* button definitions */
|
|
||||||
diff --git a/dwm.c b/dwm.c
|
|
||||||
index 7c0f978..3761ba4 100644
|
|
||||||
--- a/dwm.c
|
|
||||||
+++ b/dwm.c
|
|
||||||
@@ -188,6 +188,7 @@ static Client *nexttiled(Client *c);
|
|
||||||
static void pop(Client *c);
|
|
||||||
static void propertynotify(XEvent *e);
|
|
||||||
static void quit(const Arg *arg);
|
|
||||||
+static void quitprompt(const Arg *arg);
|
|
||||||
static Monitor *recttomon(int x, int y, int w, int h);
|
|
||||||
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
|
||||||
static void resizeclient(Client *c, int x, int y, int w, int h);
|
|
||||||
@@ -262,6 +263,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
|
||||||
};
|
|
||||||
static Atom wmatom[WMLast], netatom[NetLast];
|
|
||||||
static int running = 1;
|
|
||||||
+static int restart = 1;
|
|
||||||
static Cur *cursor[CurLast];
|
|
||||||
static Clr **scheme;
|
|
||||||
static Display *dpy;
|
|
||||||
@@ -1258,6 +1260,31 @@ quit(const Arg *arg)
|
|
||||||
running = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+void
|
|
||||||
+quitprompt(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ FILE *pp = popen("echo -e \"no\nrestart\nyes\" | dmenu -i -sb red -p \"Quit DWM?\"", "r");
|
|
||||||
+ if(pp != NULL) {
|
|
||||||
+ char buf[1024];
|
|
||||||
+ if (fgets(buf, sizeof(buf), pp) == NULL) {
|
|
||||||
+ fprintf(stderr, "Quitprompt: Error reading pipe!\n");
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ if (strcmp(buf, "yes\n") == 0) {
|
|
||||||
+ pclose(pp);
|
|
||||||
+ restart = 0;
|
|
||||||
+ quit(NULL);
|
|
||||||
+ } else if (strcmp(buf, "restart\n") == 0) {
|
|
||||||
+ pclose(pp);
|
|
||||||
+ restart = 1;
|
|
||||||
+ quit(NULL);
|
|
||||||
+ } else if (strcmp(buf, "no\n") == 0) {
|
|
||||||
+ pclose(pp);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
Monitor *
|
|
||||||
recttomon(int x, int y, int w, int h)
|
|
||||||
{
|
|
||||||
@@ -2155,5 +2182,8 @@ main(int argc, char *argv[])
|
|
||||||
run();
|
|
||||||
cleanup();
|
|
||||||
XCloseDisplay(dpy);
|
|
||||||
+ if (restart == 1) {
|
|
||||||
+ execlp("dwm", "dwm", NULL);
|
|
||||||
+ }
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.36.0
|
|
||||||
|
|
37
dwm.c
37
dwm.c
@@ -187,7 +187,6 @@ static Client *nexttiled(Client *c);
|
|||||||
static void pop(Client *);
|
static void pop(Client *);
|
||||||
static void propertynotify(XEvent *e);
|
static void propertynotify(XEvent *e);
|
||||||
static void quit(const Arg *arg);
|
static void quit(const Arg *arg);
|
||||||
static void quitprompt(const Arg *arg);
|
|
||||||
static Monitor *recttomon(int x, int y, int w, int h);
|
static Monitor *recttomon(int x, int y, int w, int h);
|
||||||
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
||||||
static void resizeclient(Client *c, int x, int y, int w, int h);
|
static void resizeclient(Client *c, int x, int y, int w, int h);
|
||||||
@@ -262,7 +261,6 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
|||||||
};
|
};
|
||||||
static Atom wmatom[WMLast], netatom[NetLast];
|
static Atom wmatom[WMLast], netatom[NetLast];
|
||||||
static int running = 1;
|
static int running = 1;
|
||||||
static int restart = 1;
|
|
||||||
static Cur *cursor[CurLast];
|
static Cur *cursor[CurLast];
|
||||||
static Clr **scheme;
|
static Clr **scheme;
|
||||||
static Display *dpy;
|
static Display *dpy;
|
||||||
@@ -1253,31 +1251,6 @@ quit(const Arg *arg)
|
|||||||
running = 0;
|
running = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
quitprompt(const Arg *arg)
|
|
||||||
{
|
|
||||||
FILE *pp = popen("echo -e \"no\nrestart\nyes\" | dmenu -i -sb red -p \"Quit DWM?\"", "r");
|
|
||||||
if(pp != NULL) {
|
|
||||||
char buf[1024];
|
|
||||||
if (fgets(buf, sizeof(buf), pp) == NULL) {
|
|
||||||
fprintf(stderr, "Quitprompt: Error reading pipe!\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (strcmp(buf, "yes\n") == 0) {
|
|
||||||
pclose(pp);
|
|
||||||
restart = 0;
|
|
||||||
quit(NULL);
|
|
||||||
} else if (strcmp(buf, "restart\n") == 0) {
|
|
||||||
pclose(pp);
|
|
||||||
restart = 1;
|
|
||||||
quit(NULL);
|
|
||||||
} else if (strcmp(buf, "no\n") == 0) {
|
|
||||||
pclose(pp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Monitor *
|
Monitor *
|
||||||
recttomon(int x, int y, int w, int h)
|
recttomon(int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
@@ -1309,6 +1282,13 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
|||||||
c->oldw = c->w; c->w = wc.width = w;
|
c->oldw = c->w; c->w = wc.width = w;
|
||||||
c->oldh = c->h; c->h = wc.height = h;
|
c->oldh = c->h; c->h = wc.height = h;
|
||||||
wc.border_width = c->bw;
|
wc.border_width = c->bw;
|
||||||
|
if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
|
||||||
|
|| &monocle == c->mon->lt[c->mon->sellt]->arrange)
|
||||||
|
&& !c->isfullscreen && !c->isfloating) {
|
||||||
|
c->w = wc.width += c->bw * 2;
|
||||||
|
c->h = wc.height += c->bw * 2;
|
||||||
|
wc.border_width = 0;
|
||||||
|
}
|
||||||
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
||||||
configure(c);
|
configure(c);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
@@ -2172,8 +2152,5 @@ main(int argc, char *argv[])
|
|||||||
run();
|
run();
|
||||||
cleanup();
|
cleanup();
|
||||||
XCloseDisplay(dpy);
|
XCloseDisplay(dpy);
|
||||||
if (restart == 1) {
|
|
||||||
execlp("dwm", "dwm", NULL);
|
|
||||||
}
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user