summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--config.def.h9
-rw-r--r--config.mk10
-rw-r--r--patch/include.c3
-rw-r--r--patch/include.h3
-rw-r--r--patch/riodraw.c72
-rw-r--r--patch/riodraw.h1
-rw-r--r--patches.def.h7
8 files changed, 106 insertions, 5 deletions
diff --git a/README.md b/README.md
index cc89b8a..57d56aa 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
+2021-02-11 - Added the riodraw patch
+
2021-01-22 - Added the placemouse patch
2021-01-02 - Added the Layoutmenu patch
@@ -474,6 +476,10 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- adds a keyboard shortcut to restart dwm or alternatively by using kill -HUP dwmpid
- additionally dwm can quit cleanly by using kill -TERM dwmpid
+ - [riodraw](https://github.com/bakkeby/patches/blob/master/dwm/dwm-riodraw-6.2.diff)
+ - adds rio-like drawing to resize the selected client (backported from instantWM)
+ - depends on an external tool slop being installed
+
- [rotatestack](https://dwm.suckless.org/patches/rotatestack/)
- let's you rotate through the stack using keyboard shortcuts
diff --git a/config.def.h b/config.def.h
index dc70ffe..9bad46f 100644
--- a/config.def.h
+++ b/config.def.h
@@ -52,6 +52,9 @@ static const int focusonwheel = 0;
static int floatposgrid_x = 5; /* float grid columns */
static int floatposgrid_y = 5; /* float grid rows */
#endif // FLOATPOS_PATCH
+#if RIODRAW_PATCH
+static const char slopstyle[] = "-t 0 -c 0.92,0.85,0.69,0.3"; /* do NOT define -f (format) here */
+#endif // RIODRAW_PATCH
#if BAR_STATUSPADDING_PATCH
static const int horizpadbar = 2; /* horizontal padding for statusbar */
static const int vertpadbar = 0; /* vertical padding for statusbar */
@@ -768,6 +771,9 @@ static Key keys[] = {
#if SWAPFOCUS_PATCH && PERTAG_PATCH
{ MODKEY, XK_s, swapfocus, {.i = -1 } },
#endif // SWAPFOCUS_PATCH
+ #if RIODRAW_PATCH
+ { MODKEY|ControlMask, XK_s, riodraw, {0} },
+ #endif // RIODRAW_PATCH
#if SWITCHCOL_PATCH
{ MODKEY, XK_v, switchcol, {0} },
#endif // SWITCHCOL_PATCH
@@ -1438,6 +1444,9 @@ static IPCCommand ipccommands[] = {
#if MOVERESIZE_PATCH
IPCCOMMAND( moveresize, 1, {ARG_TYPE_STR} ),
#endif // MOVERESIZE_PATCH
+ #if RIODRAW_PATCH
+ IPCCOMMAND( riodraw, 1, {ARG_TYPE_NONE} ),
+ #endif // RIODRAW_PATCH
#if PUSH_PATCH || PUSH_NO_MASTER_PATCH
IPCCOMMAND( pushdown, 1, {ARG_TYPE_NONE} ),
IPCCOMMAND( pushup, 1, {ARG_TYPE_NONE} ),
diff --git a/config.mk b/config.mk
index 0ff4840..2f2b695 100644
--- a/config.mk
+++ b/config.mk
@@ -23,9 +23,9 @@ FREETYPEINC = /usr/include/freetype2
#KVMLIB = -lkvm
# Uncomment this for the alpha patch / BAR_ALPHA_PATCH
-#XRENDER = -lXrender
+XRENDER = -lXrender
-# Uncomment this for the mpdcontrol patch / MPDCONTROL_PATCH
+# Uncomment this for the mdpcontrol patch / MDPCONTROL_PATCH
#MPDCLIENT = -lmpdclient
# Uncomment for the pango patch / BAR_PANGO_PATCH
@@ -33,14 +33,14 @@ FREETYPEINC = /usr/include/freetype2
#PANGOLIB = `pkg-config --libs xft pango pangoxft`
# Uncomment for the ipc patch / IPC_PATCH
-#YAJLLIBS = -lyajl
-#YAJLINC = -I/usr/include/yajl
+YAJLLIBS = -lyajl
+YAJLINC = -I/usr/include/yajl
# Uncomment this for the rounded corners patch / ROUNDED_CORNERS_PATCH
#XEXTLIB = -lXext
# Uncomment this for the swallow patch / SWALLOW_PATCH
-#XCBLIBS = -lX11-xcb -lxcb -lxcb-res
+XCBLIBS = -lX11-xcb -lxcb -lxcb-res
# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC} ${YAJLINC} ${PANGOINC}
diff --git a/patch/include.c b/patch/include.c
index 49590a7..6ddb2f9 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -197,6 +197,9 @@
#if RESTARTSIG_PATCH
#include "restartsig.c"
#endif
+#if RIODRAW_PATCH
+#include "riodraw.c"
+#endif
#if ROTATESTACK_PATCH
#include "rotatestack.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index 8703af1..b3fe1cb 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -193,6 +193,9 @@
#if RESTARTSIG_PATCH
#include "restartsig.h"
#endif
+#if RIODRAW_PATCH
+#include "riodraw.h"
+#endif
#if ROTATESTACK_PATCH
#include "rotatestack.h"
#endif
diff --git a/patch/riodraw.c b/patch/riodraw.c
new file mode 100644
index 0000000..ace3acc
--- /dev/null
+++ b/patch/riodraw.c
@@ -0,0 +1,72 @@
+/* drag out an area using slop and resize the selected window to it. */
+void
+riodraw(const Arg *arg)
+{
+ char str[100];
+ int i;
+ char strout[100];
+ int dimensions[4];
+ int width, height, x, y;
+ char tmpstring[30] = {0};
+ char slopcmd[100] = "slop -f x%xx%yx%wx%hx ";
+ int firstchar = 0;
+ int counter = 0;
+ Monitor *m;
+ Client *c;
+
+ if (!selmon->sel)
+ return;
+ strcat(slopcmd, slopstyle);
+ FILE *fp = popen(slopcmd, "r");
+
+ while (fgets(str, 100, fp) != NULL)
+ strcat(strout, str);
+
+ pclose(fp);
+
+ if (strlen(strout) < 6)
+ return;
+
+ for (i = 0; i < strlen(strout); i++){
+ if (!firstchar) {
+ if (strout[i] == 'x')
+ firstchar = 1;
+ continue;
+ }
+
+ if (strout[i] != 'x')
+ tmpstring[strlen(tmpstring)] = strout[i];
+ else {
+ dimensions[counter] = atoi(tmpstring);
+ counter++;
+ memset(tmpstring,0,strlen(tmpstring));
+ }
+ }
+
+ x = dimensions[0];
+ y = dimensions[1];
+ width = dimensions[2];
+ height = dimensions[3];
+
+ if (!selmon->sel)
+ return;
+
+ c = selmon->sel;
+
+ if (width > 50 && height > 50 && x > -40 && y > -40 && width < selmon->mw + 40 && height < selmon->mh + 40 &&
+ (abs(c->w - width) > 20 || abs(c->h - height) > 20 || abs(c->x - x) > 20 || abs(c->y - y) > 20)) {
+ if ((m = recttomon(x, y, width, height)) != selmon) {
+ sendmon(c, m);
+ unfocus(selmon->sel, 0, NULL);
+ selmon = m;
+ focus(NULL);
+ }
+
+ if (!c->isfloating)
+ togglefloating(NULL);
+ resizeclient(c, x, y, width - (c->bw * 2), height - (c->bw * 2));
+ arrange(selmon);
+ } else
+ fprintf(stderr, "error %s", strout);
+ memset(tmpstring,0,strlen(tmpstring));
+} \ No newline at end of file
diff --git a/patch/riodraw.h b/patch/riodraw.h
new file mode 100644
index 0000000..549da9e
--- /dev/null
+++ b/patch/riodraw.h
@@ -0,0 +1 @@
+static void riodraw(const Arg *arg); \ No newline at end of file
diff --git a/patches.def.h b/patches.def.h
index 39b58a8..737fec2 100644
--- a/patches.def.h
+++ b/patches.def.h
@@ -769,6 +769,13 @@
*/
#define RESTARTSIG_PATCH 0
+/* Adds rio-like drawing to resize the selected client.
+ * This depends on an external tool slop being installed.
+ * This patch was backported from instantWM.
+ * https://github.com/bakkeby/patches/blob/master/dwm/dwm-riodraw-6.2.diff
+ */
+#define RIODRAW_PATCH 0
+
/* This patch let's you rotate through the stack using keyboard shortcuts.
* https://dwm.suckless.org/patches/rotatestack/
*/