dwm-focusbynum-20230720-e81f17d.diff - sites - public wiki contents of suckless… | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-focusbynum-20230720-e81f17d.diff (2123B) | |
--- | |
1 From a6b3831c14ecec2d6da4cce031f6dada64ac7565 Mon Sep 17 00:00:00 2001 | |
2 From: dimarogiv <[email protected]> | |
3 Date: Thu, 20 Jul 2023 14:22:32 +0300 | |
4 Subject: [PATCH] With this patch you can focus on any of the currently o… | |
5 windows on the current tagset with just one key combination | |
6 | |
7 --- | |
8 config.def.h | 8 ++++++++ | |
9 dwm.c | 14 ++++++++++++++ | |
10 2 files changed, 22 insertions(+) | |
11 | |
12 diff --git a/config.def.h b/config.def.h | |
13 index 9efa774..c3718fe 100644 | |
14 --- a/config.def.h | |
15 +++ b/config.def.h | |
16 @@ -94,6 +94,14 @@ static const Key keys[] = { | |
17 TAGKEYS( XK_7, 6) | |
18 TAGKEYS( XK_8, 7) | |
19 TAGKEYS( XK_9, 8) | |
20 + { MODKEY|ShiftMask, XK_j, focusbynum, {.i … | |
21 + { MODKEY|ShiftMask, XK_k, focusbynum, {.i … | |
22 + { MODKEY|ShiftMask, XK_l, focusbynum, {.i … | |
23 + { MODKEY|ShiftMask, XK_colon, focusbynum, {.i … | |
24 + { MODKEY|ShiftMask, XK_f, focusbynum, {.i … | |
25 + { MODKEY|ShiftMask, XK_d, focusbynum, {.i … | |
26 + { MODKEY|ShiftMask, XK_s, focusbynum, {.i … | |
27 + { MODKEY|ShiftMask, XK_a, focusbynum, {.i … | |
28 { MODKEY|ShiftMask, XK_q, quit, {0} … | |
29 }; | |
30 | |
31 diff --git a/dwm.c b/dwm.c | |
32 index f1d86b2..54eb2e2 100644 | |
33 --- a/dwm.c | |
34 +++ b/dwm.c | |
35 @@ -211,6 +211,7 @@ static void tagmon(const Arg *arg); | |
36 static void tile(Monitor *m); | |
37 static void togglebar(const Arg *arg); | |
38 static void togglefloating(const Arg *arg); | |
39 +static void focusbynum(const Arg *arg); | |
40 static void toggletag(const Arg *arg); | |
41 static void toggleview(const Arg *arg); | |
42 static void unfocus(Client *c, int setfocus); | |
43 @@ -1735,6 +1736,19 @@ togglefloating(const Arg *arg) | |
44 arrange(selmon); | |
45 } | |
46 | |
47 +void | |
48 +focusbynum(const Arg *arg) | |
49 +{ | |
50 + int i; | |
51 + Client *c; | |
52 + | |
53 + i = 0; | |
54 + c = nexttiled(selmon->clients); | |
55 + | |
56 + for (; c && i < arg->i; c = nexttiled(c->next), i++); | |
57 + focus(c); | |
58 +} | |
59 + | |
60 void | |
61 toggletag(const Arg *arg) | |
62 { | |
63 -- | |
64 2.41.0 | |
65 |