commit 99a372c58d81e3092d07cb73af9c0da772d61131
Author: dimarogiv <[email protected]>
Date:   Thu Jul 20 15:11:46 2023 +0300

    The focusbynum patch added

diff --git 
a/dwm.suckless.org/patches/focusbynum/dwm-focusbynum-20230720-e81f17d.diff 
b/dwm.suckless.org/patches/focusbynum/dwm-focusbynum-20230720-e81f17d.diff
new file mode 100644
index 00000000..deb114d5
--- /dev/null
+++ b/dwm.suckless.org/patches/focusbynum/dwm-focusbynum-20230720-e81f17d.diff
@@ -0,0 +1,65 @@
+From a6b3831c14ecec2d6da4cce031f6dada64ac7565 Mon Sep 17 00:00:00 2001
+From: dimarogiv <[email protected]>
+Date: Thu, 20 Jul 2023 14:22:32 +0300
+Subject: [PATCH] With this patch you can focus on any of the currently open
+ windows on the current tagset with just one key combination
+
+---
+ config.def.h |  8 ++++++++
+ dwm.c        | 14 ++++++++++++++
+ 2 files changed, 22 insertions(+)
+
+diff --git a/config.def.h b/config.def.h
+index 9efa774..c3718fe 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -94,6 +94,14 @@ static const Key keys[] = {
+       TAGKEYS(                        XK_7,                      6)
+       TAGKEYS(                        XK_8,                      7)
+       TAGKEYS(                        XK_9,                      8)
++      { MODKEY|ShiftMask,             XK_j,      focusbynum,     {.i = 0} },
++      { MODKEY|ShiftMask,             XK_k,      focusbynum,     {.i = 1} },
++      { MODKEY|ShiftMask,             XK_l,      focusbynum,     {.i = 2} },
++      { MODKEY|ShiftMask,             XK_colon,  focusbynum,     {.i = 3} },
++      { MODKEY|ShiftMask,             XK_f,      focusbynum,     {.i = 4} },
++      { MODKEY|ShiftMask,             XK_d,      focusbynum,     {.i = 5} },
++      { MODKEY|ShiftMask,             XK_s,      focusbynum,     {.i = 6} },
++      { MODKEY|ShiftMask,             XK_a,      focusbynum,     {.i = 7} },
+       { MODKEY|ShiftMask,             XK_q,      quit,           {0} },
+ };
+ 
+diff --git a/dwm.c b/dwm.c
+index f1d86b2..54eb2e2 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -211,6 +211,7 @@ static void tagmon(const Arg *arg);
+ static void tile(Monitor *m);
+ static void togglebar(const Arg *arg);
+ static void togglefloating(const Arg *arg);
++static void focusbynum(const Arg *arg);
+ static void toggletag(const Arg *arg);
+ static void toggleview(const Arg *arg);
+ static void unfocus(Client *c, int setfocus);
+@@ -1735,6 +1736,19 @@ togglefloating(const Arg *arg)
+       arrange(selmon);
+ }
+ 
++void
++focusbynum(const Arg *arg)
++{
++      int i;
++      Client *c;
++
++      i = 0;
++      c = nexttiled(selmon->clients);
++
++      for (; c && i < arg->i; c = nexttiled(c->next), i++);
++      focus(c);
++}
++
+ void
+ toggletag(const Arg *arg)
+ {
+-- 
+2.41.0
+
diff --git a/dwm.suckless.org/patches/focusbynum/index.md 
b/dwm.suckless.org/patches/focusbynum/index.md
new file mode 100644
index 00000000..2682019c
--- /dev/null
+++ b/dwm.suckless.org/patches/focusbynum/index.md
@@ -0,0 +1,34 @@
+focusbynum
+==========
+
+Description
+-----------
+This patch allows you to focus on a window with the corresponding number
+in the stack on the current tagset just one key combination.
+
+For example, there are 5 windows opened in the currently active tagset.
+To access the 3rd window press ModKey+l.
+
+All of the key combinations are enabled in the current config.def.h file
+are listed below in the corresponding order:
+1. ModKey+j 
+2. ModKey+k
+3. ModKey+l
+4. ModKey+:
+5. ModKey+f
+6. ModKey+d
+7. ModKey+s
+8. ModKey+a
+
+You can edit the key combinations however you want in the config.h file.
+
+You can add any number of key combinations with the focusbynum function,
+specifying the corresponding window number assigned to the .i variable.
+
+Download
+--------
+* [dwm-focusbynum-20230720-e81f17d.diff](dwm-focusbynum-20230720-e81f17d.diff)
+
+Author
+------
+* Dima Rogiv - <[email protected]>


Reply via email to