sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 6d9768476bda822fcafbd5c78dc4bb9fa5f13744
parent 3818889a2d41855de435531355bff1f665425510
Author: Randoragon <randoragongamedev@gmail.com>
Date:   Sat, 10 Feb 2024 20:57:50 +0100

[dwm][patch][movethrow] Fix patch for 6.2 and 6.4

Years ago I submitted this patch with a few errors, unfortunately.
Those have been fixed. This updated version also works on 6.4.

Diffstat:
Mdwm.suckless.org/patches/movethrow/dwm-movethrow-6.2.diff | 100+++++++++++++++++++++++++++++++++++++++----------------------------------------
1 file changed, 49 insertions(+), 51 deletions(-)

diff --git a/dwm.suckless.org/patches/movethrow/dwm-movethrow-6.2.diff b/dwm.suckless.org/patches/movethrow/dwm-movethrow-6.2.diff @@ -1,37 +1,28 @@ -From cb4947f8dfd02a5103c9e28d60a428bf81088796 Mon Sep 17 00:00:00 2001 -From: Randoragon <randoragongamedev@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(+) +This patch is heavily inspired by the moveplace patch. It allows 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. diff --git a/config.def.h b/config.def.h -index 1c0b587..e873d28 100644 +index 1c0b587..cd8b0a7 100644 --- a/config.def.h +++ b/config.def.h @@ -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 }}, ++ { MODKEY|ShiftMask, XK_Up, movethrow, {.ui = DIR_N }}, ++ { MODKEY|ShiftMask, XK_Down, movethrow, {.ui = DIR_S }}, ++ { MODKEY|ShiftMask, XK_Left, movethrow, {.ui = DIR_W }}, ++ { MODKEY|ShiftMask, XK_Right, movethrow, {.ui = DIR_E }}, ++ { MODKEY|ShiftMask, XK_m, movethrow, {.ui = DIR_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 +index 4465af1..16f4b08 100644 --- a/dwm.c +++ b/dwm.c @@ -66,6 +66,7 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, @@ -42,7 +33,15 @@ index 4465af1..df1eb05 100644 typedef union { int i; -@@ -1192,6 +1193,44 @@ movemouse(const Arg *arg) +@@ -183,6 +184,7 @@ static void maprequest(XEvent *e); + static void monocle(Monitor *m); + static void motionnotify(XEvent *e); + static void movemouse(const Arg *arg); ++static void movethrow(const Arg *arg); + static Client *nexttiled(Client *c); + static void pop(Client *); + static void propertynotify(XEvent *e); +@@ -1192,6 +1194,46 @@ movemouse(const Arg *arg) } } @@ -52,41 +51,40 @@ index 4465af1..df1eb05 100644 + Client *c; + int nh, nw, nx, ny; + c = selmon->sel; ++ if (!c) ++ return; + 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; -+ } ++ 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); -+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, nw/2, nh/2); ++ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, nw/2, nh/2); +} + Client * nexttiled(Client *c) { --- -2.27.0 -