sites

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

dwm-focusmaster-20200717-bb2e722.diff (958B)


      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,17 @@ 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 +
     37 +	c = nexttiled(selmon->clients);
     38 +
     39 +	if (c)
     40 +		focus(c);
     41 +}
     42 -- 
     43 2.27.0
     44