sites

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

commit 4848ac0a24058de328e405863687240730859fc2
parent 3e1b505c6053767867d7c7c80d70b919ef9da400
Author: Jack Bird <jack.bird@durham.ac.uk>
Date:   Thu, 29 Jul 2021 23:19:56 +0100

[dwm][patch][focusmaster] Added focusmaster-return patch.

Allows for returning to the client you switched from.

Diffstat:
Adwm.suckless.org/patches/focusmaster/dwm-focusmaster-return-20210729-138b405.diff | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdwm.suckless.org/patches/focusmaster/index.md | 7+++++++
2 files changed, 87 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/focusmaster/dwm-focusmaster-return-20210729-138b405.diff b/dwm.suckless.org/patches/focusmaster/dwm-focusmaster-return-20210729-138b405.diff @@ -0,0 +1,80 @@ +From 36c4e246ad47333f2b8a82610ba2adebeb2043b2 Mon Sep 17 00:00:00 2001 +From: Jack Bird <jack.bird@durham.ac.uk> +Date: Thu, 29 Jul 2021 21:39:33 +0100 +Subject: [PATCH] Able to switch to master from anywhere in the stack and can + also return to the previously selected client from the master + +--- + dwm.c | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +diff --git a/dwm.c b/dwm.c +index 5e4d494..eab8d57 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -127,6 +127,7 @@ struct Monitor { + Client *clients; + Client *sel; + Client *stack; ++ Client *stackfocused; + Monitor *next; + Window barwin; + const Layout *lt[2]; +@@ -167,6 +168,7 @@ static void enternotify(XEvent *e); + static void expose(XEvent *e); + static void focus(Client *c); + static void focusin(XEvent *e); ++static void focusmaster(const Arg *arg); + static void focusmon(const Arg *arg); + static void focusstack(const Arg *arg); + static Atom getatomprop(Client *c, Atom prop); +@@ -660,6 +662,9 @@ detach(Client *c) + { + Client **tc; + ++ if (c == c->mon->stackfocused) ++ c->mon->stackfocused = NULL; ++ + for (tc = &c->mon->clients; *tc && *tc != c; tc = &(*tc)->next); + *tc = c->next; + } +@@ -816,6 +821,28 @@ focusin(XEvent *e) + setfocus(selmon->sel); + } + ++void ++focusmaster(const Arg *arg) ++{ ++ Client *master; ++ ++ if (selmon->nmaster > 1) ++ return; ++ ++ master = nexttiled(selmon->clients); ++ ++ if (!master) ++ return; ++ ++ if (selmon->sel == master) { ++ if (master->mon->stackfocused) ++ focus(master->mon->stackfocused); ++ } else { ++ master->mon->stackfocused = master->mon->sel; ++ focus(master); ++ } ++} ++ + void + focusmon(const Arg *arg) + { +@@ -1203,6 +1230,7 @@ nexttiled(Client *c) + void + pop(Client *c) + { ++ c->mon->stackfocused = nexttiled(c->mon->clients); + detach(c); + attach(c); + focus(c); +-- +2.32.0 + diff --git a/dwm.suckless.org/patches/focusmaster/index.md b/dwm.suckless.org/patches/focusmaster/index.md @@ -5,6 +5,11 @@ Description ----------- Switch focus to the (tiled) master client from anywhere in the stack. +focusmaster-return +------------------ +Switch to the master from anywhere in the stack, when the master is selected +return to the client switched from using the same keybind. + Configuration ------------- Add the following line to the keys array in your config.h (or config.def.h) to bind Mod+Ctrl+Space to focusmaster. @@ -14,7 +19,9 @@ Add the following line to the keys array in your config.h (or config.def.h) to b Download -------- * [dwm-focusmaster-20200717-bb2e722.diff](dwm-focusmaster-20200717-bb2e722.diff) (2020.07.17) +* [dwm-focusmaster-return-20210729-138b405.diff](dwm-focusmaster-return-20210729-138b405.diff) (2021.07.29) Author ------ * Mateus Auler - <mateusauler at protonmail dot com> +* Jack Bird - <jack.bird@dur.ac.uk> (focusmaster return patch)