[wiki] [sites] Add movethrow dwm patch || Randoragon

From: <git_AT_suckless.org>
Date: Tue, 30 Jun 2020 12:16:04 +0200

commit fa0a27c1c7d6bb44aa27d2ba9a36420e58dbd7ff
Author: Randoragon <randoragongamedev_AT_gmail.com>
Date: Tue Jun 30 12:15:13 2020 +0200

    Add movethrow dwm patch

diff --git a/dwm.suckless.org/patches/movethrow/dwm-movethrow-6.2.diff b/dwm.suckless.org/patches/movethrow/dwm-movethrow-6.2.diff
new file mode 100644
index 00000000..b8b40e63
--- /dev/null
+++ b/dwm.suckless.org/patches/movethrow/dwm-movethrow-6.2.diff
_AT_@ -0,0 +1,91 @@
+From cb4947f8dfd02a5103c9e28d60a428bf81088796 Mon Sep 17 00:00:00 2001
+From: Randoragon <randoragongamedev_AT_gmail.com>
+Date: Tue, 30 Jun 2020 11:13:55 +0200
+Subject: [PATCH] windowthrow patch
+
+This patch is heavily inspired by the moveplace patch. It allows you to
+"throw" windows in 4 directions, which makes them floating (if not
+floating already) and then moves them in the chosen direction until they
+hit the border of the screen. Unlike moveplace, the windows get to keep
+their original size. Additionally, there's a "middle direction" defined
+which simply centers a window on the screen.
+---
+ config.def.h | 4 ++++
+ dwm.c | 38 ++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 42 insertions(+)
+
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..e873d28 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -84,6 +84,11 @@ static Key keys[] = {
+ { MODKEY, XK_period, focusmon, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
+ { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
++ { MODKEY|ShiftMask, XK_Up, movethrow, {.ui = WIN_N }},
++ { MODKEY|ShiftMask, XK_Down, movethrow, {.ui = WIN_S }},
++ { MODKEY|ShiftMask, XK_Left, movethrow, {.ui = WIN_W }},
++ { MODKEY|ShiftMask, XK_Right, movethrow, {.ui = WIN_E }},
++ { MODKEY|ShiftMask, XK_m, movethrow, {.ui = WIN_C }},
+ TAGKEYS( XK_1, 0)
+ TAGKEYS( XK_2, 1)
+ TAGKEYS( XK_3, 2)
+diff --git a/dwm.c b/dwm.c
+index 4465af1..df1eb05 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -66,6 +66,7 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
+ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
+ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
+ ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
++enum { DIR_N, DIR_W, DIR_C, DIR_E, DIR_S, }; /* coordinates for movethrow */
+
+ typedef union {
+ int i;
+_AT_@ -1192,6 +1193,43 @@ movemouse(const Arg *arg)
+ }
+ }
+
++void
++movethrow(const Arg *arg)
++{
++ Client *c;
++ int nh, nw, nx, ny;
++ c = selmon->sel;
++ if (selmon->lt[selmon->sellt]->arrange && !c->isfloating)
++ togglefloating(NULL);
++ nw = c->w;
++ nh = c->h;
++ switch(arg->ui) {
++ case DIR_N:
++ nx = c->x;
++ ny = selmon->wy;
++ break;
++ case DIR_E:
++ nx = selmon->wx + selmon->ww - c->w - c->bw*2;
++ ny = c->y;
++ break;
++ case DIR_S:
++ nx = c->x;
++ ny = selmon->wy + selmon->wh - c->h - c->bw*2;
++ break;
++ case DIR_W:
++ nx = selmon->wx;
++ ny = c->y;
++ break;
++ case DIR_C:
++ nx = selmon->wx + ((selmon->ww - c->w - c->bw*2) / 2);
++ ny = selmon->wy + ((selmon->wh - c->h - c->bw*2) / 2);
++ break;
++ default:
++ return;
++ }
++ resize(c, nx, ny, nw, nh, True);
++}
++
+ Client *
+ nexttiled(Client *c)
+ {
+--
+2.27.0
+
diff --git a/dwm.suckless.org/patches/movethrow/index.md b/dwm.suckless.org/patches/movethrow/index.md
new file mode 100644
index 00000000..5ac82d56
--- /dev/null
+++ b/dwm.suckless.org/patches/movethrow/index.md
_AT_@ -0,0 +1,24 @@
+movethrow
+=========
+
+Description
+-----------
+This patch is very similar to [moveplace](https://dwm.suckless.org/patches/moveplace/),
+but with slightly altered functionality.
+
+It allows you to "throw" windows in 4 directions. Thrown windows will be moved along
+just the X or Y axis as far as possible without them exceeding the screen borders.
+Unlike in [moveplace](https://dwm.suckless.org/patches/moveplace/), they get to keep their
+original size. There's also an option to center a window.
+
+This patch modifies the `config.def.h` file, be sure to copy your preferred bindings
+to `config.h`.
+
+Download
+--------
+* [dwm-movethrow-6.2.diff](dwm-movethrow-6.2.diff)
+
+Authors
+------
+* Randoragon - `<`randoragongamedev_AT_gmail.com`>`
+* cd (original moveplace)
Received on Tue Jun 30 2020 - 12:16:04 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 30 2020 - 12:24:44 CEST