Adding riodraw patch

pull/96/head
bakkeby 3 years ago
parent b4758c388d
commit 1d092253e3

@ -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

@ -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} ),

@ -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}

@ -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

@ -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

@ -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));
}

@ -0,0 +1 @@
static void riodraw(const Arg *arg);

@ -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/
*/

Loading…
Cancel
Save