sites

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

dwm-focusurgent-20160831-56a31dc.diff (1715B)


      1 Author: Jan Christoph Ebersbach <jceb@e-jc.de>
      2 URL: http://dwm.suckless.org/patches/focusurgent
      3 focusurgent selects the next window having the urgent flag regardless of the tag
      4 it is on.  The urgent flag can be artificially set with the following xdotool
      5 command on any window: xdotool selectwindow -- set_window --urgency 1
      6 
      7 Index: clean/dwm/config.def.h
      8 ===================================================================
      9 --- a/config.def.h
     10 +++ b/config.def.h
     11 @@ -59,6 +59,7 @@ static char dmenumon[2] = "0"; /* compon
     12  static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
     13  static const char *termcmd[]  = { "st", NULL };
     14  
     15 +#include "focusurgent.c"
     16  static Key keys[] = {
     17  	/* modifier                     key        function        argument */
     18  	{ MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
     19 @@ -94,6 +95,7 @@ static Key keys[] = {
     20  	TAGKEYS(                        XK_8,                      7)
     21  	TAGKEYS(                        XK_9,                      8)
     22  	{ MODKEY|ShiftMask,             XK_q,      quit,           {0} },
     23 +	{ MODKEY,                       XK_u,      focusurgent,    {0} },
     24  };
     25  
     26  /* button definitions */
     27 Index: clean/dwm/focusurgent.c
     28 ===================================================================
     29 --- /dev/null
     30 +++ b/focusurgent.c
     31 @@ -0,0 +1,14 @@
     32 +static void
     33 +focusurgent(const Arg *arg) {
     34 +	Client *c;
     35 +	int i;
     36 +	for(c=selmon->clients; c && !c->isurgent; c=c->next);
     37 +	if(c) {
     38 +		for(i=0; i < LENGTH(tags) && !((1 << i) & c->tags); i++);
     39 +		if(i < LENGTH(tags)) {
     40 +			const Arg a = {.ui = 1 << i};
     41 +			view(&a);
     42 +			focus(c);
     43 +		}
     44 +	}
     45 +}