[wiki] [sites] [dwm][patch] inplacerotate: Add functionality for all clients rotation || Miles Alan

From: <git_AT_suckless.org>
Date: Sun, 26 Apr 2020 23:46:48 +0200

commit 21723ec346395af1013afb9524fd8aac720a7e1b
Author: Miles Alan <m_AT_milesalan.com>
Date: Sun Apr 26 16:44:58 2020 -0500

    [dwm][patch] inplacerotate: Add functionality for all clients rotation

diff --git a/dwm.suckless.org/patches/inplacerotate/dwm-inplacerotate-6.2.diff b/dwm.suckless.org/patches/inplacerotate/dwm-inplacerotate-6.2.diff
index 4f6bca46..d331368b 100644
--- a/dwm.suckless.org/patches/inplacerotate/dwm-inplacerotate-6.2.diff
+++ b/dwm.suckless.org/patches/inplacerotate/dwm-inplacerotate-6.2.diff
_AT_@ -1,33 +1,36 @@
-From 78ae9e1513e5c9c91f7ca89f421e7aa71f88202f Mon Sep 17 00:00:00 2001
+From 75012a6ab9cc1b6c319af7f4ae7d682b16a66ce3 Mon Sep 17 00:00:00 2001
 From: Miles Alan <m_AT_milesalan.com>
-Date: Tue, 14 Jan 2020 23:14:18 -0600
-Subject: [PATCH] Add inplacerotate fn to rotate master/stack clients inplace
+Date: Sun, 26 Apr 2020 16:05:43 -0500
+Subject: [PATCH] Add inplacerotate fn to rotate all, master, or stacks clients
+ inplace
+
+CW (+2) or CCW (-2) Rotates all windows.
+CW (+1) or CCW (-1) Rotates master xor stack windows (depending on focus).
 
-Rotates all client xor stack windows (depending on focus) CW (+1) or CCW (-1).
 Focus position stays 'in-place' so the area of the screen you are focused
 on remains unchanged.
-
-Mod + Shift + {J,K} to rotate {CW,CCW}
 ---
- config.def.h | 2 ++
- dwm.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 56 insertions(+)
+ config.def.h | 4 ++++
+ dwm.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 63 insertions(+)
 
 diff --git a/config.def.h b/config.def.h
-index 1c0b587..0f846ab 100644
+index 1c0b587..9bcb792 100644
 --- a/config.def.h
 +++ b/config.def.h
-_AT_@ -66,6 +66,8 @@ static Key keys[] = {
+_AT_@ -66,6 +66,10 @@ static Key keys[] = {
          { MODKEY, XK_b, togglebar, {0} },
          { MODKEY, XK_j, focusstack, {.i = +1 } },
          { MODKEY, XK_k, focusstack, {.i = -1 } },
 + { MODKEY|ShiftMask, XK_j, inplacerotate, {.i = +1} },
 + { MODKEY|ShiftMask, XK_k, inplacerotate, {.i = -1} },
++ { MODKEY|ShiftMask, XK_h, inplacerotate, {.i = +2} },
++ { MODKEY|ShiftMask, XK_l, inplacerotate, {.i = -2} },
          { MODKEY, XK_i, incnmaster, {.i = +1 } },
          { MODKEY, XK_d, incnmaster, {.i = -1 } },
          { MODKEY, XK_h, setmfact, {.f = -0.05} },
 diff --git a/dwm.c b/dwm.c
-index 4465af1..73c699b 100644
+index 4465af1..3930680 100644
 --- a/dwm.c
 +++ b/dwm.c
 _AT_@ -175,6 +175,7 @@ static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
_AT_@ -38,7 +41,7 @@ index 4465af1..73c699b 100644
  static void keypress(XEvent *e);
  static void killclient(const Arg *arg);
  static void manage(Window w, XWindowAttributes *wa);
-_AT_@ -2147,3 +2148,56 @@ main(int argc, char *argv[])
+_AT_@ -2147,3 +2148,61 @@ main(int argc, char *argv[])
          XCloseDisplay(dpy);
          return EXIT_SUCCESS;
  }
_AT_@ -69,7 +72,7 @@ index 4465af1..73c699b 100644
 + unsigned int selidx = 0, i = 0;
 + Client *c = NULL, *stail = NULL, *mhead = NULL, *mtail = NULL, *shead = NULL;
 +
-+ // Shift client
++ // Determine positionings for insertclient
 + for (c = selmon->clients; c; c = c->next) {
 + if (ISVISIBLE(c) && !(c->isfloating)) {
 + if (selmon->sel == c) { selidx = i; }
_AT_@ -80,10 +83,15 @@ index 4465af1..73c699b 100644
 + i++;
 + }
 + }
-+ if (arg->i < 0 && selidx >= selmon->nmaster) insertclient(stail, shead, 1);
-+ if (arg->i > 0 && selidx >= selmon->nmaster) insertclient(shead, stail, 0);
-+ if (arg->i < 0 && selidx < selmon->nmaster) insertclient(mtail, mhead, 1);
-+ if (arg->i > 0 && selidx < selmon->nmaster) insertclient(mhead, mtail, 0);
++
++ // All clients rotate
++ if (arg->i == 2) insertclient(selmon->clients, stail, 0);
++ if (arg->i == -2) insertclient(stail, selmon->clients, 1);
++ // Stack xor master rotate
++ if (arg->i == -1 && selidx >= selmon->nmaster) insertclient(stail, shead, 1);
++ if (arg->i == 1 && selidx >= selmon->nmaster) insertclient(shead, stail, 0);
++ if (arg->i == -1 && selidx < selmon->nmaster) insertclient(mtail, mhead, 1);
++ if (arg->i == 1 && selidx < selmon->nmaster) insertclient(mhead, mtail, 0);
 +
 + // Restore focus position
 + i = 0;
diff --git a/dwm.suckless.org/patches/inplacerotate/index.md b/dwm.suckless.org/patches/inplacerotate/index.md
index 362cc913..9bba150c 100644
--- a/dwm.suckless.org/patches/inplacerotate/index.md
+++ b/dwm.suckless.org/patches/inplacerotate/index.md
_AT_@ -3,17 +3,21 @@ inplacerotate
 
 Description
 -----------
-This patch provides a keybinding to rotate all clients in the currently
-selected area (master or stack) without affecting the other area.
-
-This allows you to shift the ordering of clients in the master / stack area
-without worrying clients will transfer between the master / stack (nmaster)
-boundry. If your current focus is in the master area, clients in the master
-rotate and stack clients are left alone. And inversely, if you're focused on
-a client in the stack, stack clients are rotated but master clients are left
-alone. Also in addition to not affecting the nmaster boundry, the focused
-client is always kept fixed on the current position (e.g. the screen focus
-area doesn't change) making this a fully 'in-place' rotation.
+This patch provides keybindings to perform 'in place' rotations (in that
+clients are rotated but the focus position in the stack is unchanged).
+
+The argument for the `inplacerotate` function affects the behavior of
+the rotation as follows:
+
+*-1/+1* -> CCW/CW inplace master OR stack rotation (based on focus position)
+
+Shifts the ordering of clients in the master / stack area without worrying
+clients will transfer between the master / stack (nmaster) boundry. If
+your current focus is in the master area, clients in the master rotate and
+stack clients are left alone. And inversely, if you're focused on a client
+in the stack, stack clients are rotated but master clients are left alone.
+
+*-2/+2* -> CCW/CW inplace all clients rotation.
 
 
 Download
Received on Sun Apr 26 2020 - 23:46:48 CEST

This archive was generated by hypermail 2.3.0 : Sun Apr 26 2020 - 23:48:45 CEST