[wiki] [sites] Added the accessnthmonitor patch for dwm || Temmo Junkhoff

From: <git_AT_suckless.org>
Date: Thu, 29 Apr 2021 14:11:09 +0200

commit afbc8ca368bf9476df9d01d0f25ff44b8ec531c3
Author: Temmo Junkhoff <temmojunkhoff_AT_firemail.cc>
Date: Thu Apr 29 14:07:08 2021 +0200

    Added the accessnthmonitor patch for dwm
    
    Added a site for a patch to dwm.suckless.org.

diff --git a/dwm.suckless.org/patches/accessnthmonitor/accessnthmon.diff b/dwm.suckless.org/patches/accessnthmonitor/accessnthmon.diff
new file mode 100644
index 00000000..a65ec152
--- /dev/null
+++ b/dwm.suckless.org/patches/accessnthmonitor/accessnthmon.diff
_AT_@ -0,0 +1,100 @@
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..8595a71 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -49,7 +49,10 @@ static const Layout layouts[] = {
+ { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
+ { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
+ { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
+- { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
++ { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, \
++ { ALTMOD, KEY, focusnthmon, {.i = TAG } }, \
++ { ALTMOD|ShiftMask, KEY, tagnthmon, {.i = TAG } },
++
+
+ /* helper for spawning shell commands in the pre dwm-5.0 fashion */
+ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
+diff --git a/dwm.c b/dwm.c
+index b0b3466..96fa0bd 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -161,6 +161,7 @@ static void destroynotify(XEvent *e);
+ static void detach(Client *c);
+ static void detachstack(Client *c);
+ static Monitor *dirtomon(int dir);
++static Monitor *numtomon(int num);
+ static void drawbar(Monitor *m);
+ static void drawbars(void);
+ static void enternotify(XEvent *e);
+_AT_@ -168,6 +169,7 @@ static void expose(XEvent *e);
+ static void focus(Client *c);
+ static void focusin(XEvent *e);
+ static void focusmon(const Arg *arg);
++static void focusnthmon(const Arg *arg);
+ static void focusstack(const Arg *arg);
+ static Atom getatomprop(Client *c, Atom prop);
+ static int getrootptr(int *x, int *y);
+_AT_@ -209,6 +211,7 @@ static void sigchld(int unused);
+ static void spawn(const Arg *arg);
+ static void tag(const Arg *arg);
+ static void tagmon(const Arg *arg);
++static void tagnthmon(const Arg *arg);
+ static void tile(Monitor *);
+ static void togglebar(const Arg *arg);
+ static void togglefloating(const Arg *arg);
+_AT_@ -693,6 +696,18 @@ dirtomon(int dir)
+ return m;
+ }
+
++Monitor *
++numtomon(int num)
++{
++ Monitor *m = NULL;
++ int i = 0;
++
++ for(m = mons, i=0; m->next && i < num; m = m->next){
++ i++;
++ }
++ return m;
++}
++
+ void
+ drawbar(Monitor *m)
+ {
+_AT_@ -830,6 +845,21 @@ focusmon(const Arg *arg)
+ focus(NULL);
+ }
+
++void
++focusnthmon(const Arg *arg)
++{
++ Monitor *m;
++
++ if (!mons->next)
++ return;
++
++ if ((m = numtomon(arg->i)) == selmon)
++ return;
++ unfocus(selmon->sel, 0);
++ selmon = m;
++ focus(NULL);
++}
++
+ void
+ focusstack(const Arg *arg)
+ {
+_AT_@ -1671,6 +1701,14 @@ tagmon(const Arg *arg)
+ sendmon(selmon->sel, dirtomon(arg->i));
+ }
+
++void
++tagnthmon(const Arg *arg)
++{
++ if (!selmon->sel || !mons->next)
++ return;
++ sendmon(selmon->sel, numtomon(arg->i));
++}
++
+ void
+ tile(Monitor *m)
+ {
diff --git a/dwm.suckless.org/patches/accessnthmonitor/index.md b/dwm.suckless.org/patches/accessnthmonitor/index.md
new file mode 100644
index 00000000..67ba57a4
--- /dev/null
+++ b/dwm.suckless.org/patches/accessnthmonitor/index.md
_AT_@ -0,0 +1,15 @@
+accessnthmonitor
+=====
+
+Description
+-----------
+This patch allows to focus a specific monitor or send windows to a specific monitor.
+
+
+Download
+--------
+* [accessnthmon.diff](accessnthmon.diff)
+
+Authors
+-------
+* Temmo Junkhoff - <temmojunkhoff_AT_firemail.cc>
Received on Thu Apr 29 2021 - 14:11:09 CEST

This archive was generated by hypermail 2.3.0 : Thu Apr 29 2021 - 14:13:01 CEST