dwm-focusmaster-20210804-138b405.diff (1038B)
1 From 3e020d93df3aaec92d2daa142cd1f0d5301b3197 Mon Sep 17 00:00:00 2001 2 From: Mateus Auler <mateusauler@protonmail.com> 3 Date: Fri, 17 Jul 2020 12:36:36 -0300 4 Subject: [PATCH] Ability to map a key combination to switch focus to 5 the master window. 6 7 --- 8 dwm.c | 16 ++++++++++++++++ 9 1 file changed, 16 insertions(+) 10 11 diff --git a/dwm.c b/dwm.c 12 index 9fd0286..be01927 100644 13 --- a/dwm.c 14 +++ b/dwm.c 15 @@ -235,6 +235,8 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee); 16 static int xerrorstart(Display *dpy, XErrorEvent *ee); 17 static void zoom(const Arg *arg); 18 19 +static void focusmaster(const Arg *arg); 20 + 21 /* variables */ 22 static const char broken[] = "broken"; 23 static char stext[256]; 24 @@ -2150,3 +2152,19 @@ main(int argc, char *argv[]) 25 XCloseDisplay(dpy); 26 return EXIT_SUCCESS; 27 } 28 + 29 +void 30 +focusmaster(const Arg *arg) 31 +{ 32 + Client *c; 33 + 34 + if (selmon->nmaster < 1) 35 + return; 36 + if (!selmon->sel || (selmon->sel->isfullscreen && lockfullscreen)) 37 + return; 38 + 39 + c = nexttiled(selmon->clients); 40 + 41 + if (c) 42 + focus(c); 43 +} 44 -- 45 2.27.0 46