sites

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

dwm-multimon-4-status_all-6.1.patch (6165B)


      1 From d318ffdc7ab7a365e548776a1d8ed5ccbd67cd42 Mon Sep 17 00:00:00 2001
      2 From: "Gary B. Genett" <me@garybgenett.net>
      3 Date: Mon, 24 Mar 2014 14:44:04 -0700
      4 Subject: added statusall toggle, replacing need for patch
      5 MIME-Version: 1.0
      6 Content-Type: multipart/mixed; boundary="------------1.8.3.2"
      7 
      8 This is a multi-part message in MIME format.
      9 --------------1.8.3.2
     10 Content-Type: text/plain; charset=UTF-8; format=fixed
     11 Content-Transfer-Encoding: 8bit
     12 
     13 ---
     14  config.def.h |  1 +
     15  dwm.c        | 12 ++++++------
     16  2 files changed, 7 insertions(+), 6 deletions(-)
     17 
     18 
     19 --------------1.8.3.2
     20 Content-Type: text/x-patch; name="0004-added-statusall-toggle-replacing-need-for-patch.patch"
     21 Content-Transfer-Encoding: 8bit
     22 Content-Disposition: attachment; filename="0004-added-statusall-toggle-replacing-need-for-patch.patch"
     23 
     24 diff --git a/config.def.h b/config.def.h
     25 index 92b1a461604c81c061f60780dc189a83dd697562..b4759a569dc23754dd240da51dd12607ae93e0f3 100644
     26 --- a/config.def.h
     27 +++ b/config.def.h
     28 @@ -24,20 +24,21 @@ static const Rule rules[] = {
     29  	/* class      instance    title       tags mask     isfloating   monitor */
     30  	{ "Gimp",     NULL,       NULL,       0,            True,        -1 },
     31  	{ "Firefox",  NULL,       NULL,       1 << 8,       False,       -1 },
     32  };
     33  
     34  /* layout(s) */
     35  static const float mfact      = 0.55; /* factor of master area size [0.05..0.95] */
     36  static const int nmaster      = 1;    /* number of clients in master area */
     37  static const int nviews       = 1;    /* number of tags highlighted by default */
     38  static const Bool resizehints = True; /* True means respect size hints in tiled resizals */
     39 +static const Bool statusall   = False;/* True means status is shown in all bars, not just active monitor */
     40  
     41  static const int master[1];           /* nmaster override per monitor */
     42  //static const int master[] = {1,-1}; /* monitor 0 = nmaster 1, monitor 1 = no nmaster (all vertical) */
     43  static const int views[1];            /* nviews override per monitor */
     44  //static const int views[]  = {4,~0}; /* monitor 0 = nviews 4, monitor 1 = all (all highlighted) */
     45  
     46  static const Layout layouts[] = {
     47  	/* symbol     arrange function */
     48  	{ "[]=",      tile },    /* first entry is default */
     49  	{ "><>",      NULL },    /* no layout function means floating behavior */
     50 diff --git a/dwm.c b/dwm.c
     51 index 2b3bf5f99c95180cfb5a3bb04b4181481fbe7bbd..92aa91a75a39cf1ed298a2279db9974a4f456129 100644
     52 --- a/dwm.c
     53 +++ b/dwm.c
     54 @@ -719,21 +719,21 @@ drawbar(Monitor *m) {
     55  	drw_setscheme(drw, &scheme[SchemeNorm]);
     56  	drw_text(drw, x, 0, w, bh, m->ltsymbol, 0);
     57  	x += w;
     58  	char custom[4] = {0}; // needs to be +1 of actual size, for some reason
     59  	snprintf(custom, sizeof(custom), "<%d>", m->num);
     60  	w = bmw = TEXTW(custom);
     61  	drw_setscheme(drw, m == selmon ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
     62  	drw_text(drw, x, 0, w, bh, custom, 0);
     63  	x += w;
     64  	xx = x;
     65 -	if(m == selmon) { /* status is only drawn on selected monitor */
     66 +	if(m == selmon || statusall) { /* status is only drawn on selected monitor, unless statusall is true */
     67  		w = TEXTW(stext);
     68  		x = m->ww - w;
     69  		if(x < xx) {
     70  			x = xx;
     71  			w = m->ww - xx;
     72  		}
     73  		drw_setscheme(drw, &scheme[SchemeNorm]);
     74  		drw_text(drw, x, 0, w, bh, stext, 0);
     75  	}
     76  	else
     77 @@ -779,21 +779,21 @@ enternotify(XEvent *e) {
     78  		return;
     79  	focus(c);
     80  }
     81  
     82  void
     83  expose(XEvent *e) {
     84  	Monitor *m;
     85  	XExposeEvent *ev = &e->xexpose;
     86  
     87  	if(ev->count == 0 && (m = wintomon(ev->window)))
     88 -		drawbar(m);
     89 +		statusall ? drawbars() : drawbar(m);
     90  }
     91  
     92  void
     93  focus(Client *c) {
     94  	if(!c || !ISVISIBLE(c))
     95  		for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
     96  	/* was if(selmon->sel) */
     97  	if(selmon->sel && selmon->sel != c)
     98  		unfocus(selmon->sel, False);
     99  	if(c) {
    100 @@ -1222,21 +1222,21 @@ propertynotify(XEvent *e) {
    101  			updatesizehints(c);
    102  			break;
    103  		case XA_WM_HINTS:
    104  			updatewmhints(c);
    105  			drawbars();
    106  			break;
    107  		}
    108  		if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
    109  			updatetitle(c);
    110  			if(c == c->mon->sel)
    111 -				drawbar(c->mon);
    112 +				statusall ? drawbars() : drawbar(c->mon);
    113  		}
    114  		if(ev->atom == netatom[NetWMWindowType])
    115  			updatewindowtype(c);
    116  	}
    117  }
    118  
    119  void
    120  quit(const Arg *arg) {
    121  	running = False;
    122  }
    123 @@ -1325,21 +1325,21 @@ resizemouse(const Arg *arg) {
    124  		focus(NULL);
    125  	}
    126  }
    127  
    128  void
    129  restack(Monitor *m) {
    130  	Client *c;
    131  	XEvent ev;
    132  	XWindowChanges wc;
    133  
    134 -	drawbar(m);
    135 +	statusall ? drawbars() : drawbar(m);
    136  	if(!m->sel)
    137  		return;
    138  	if(m->sel->isfloating || !m->lt[m->sellt]->arrange)
    139  		XRaiseWindow(dpy, m->sel->win);
    140  	if(m->lt[m->sellt]->arrange) {
    141  		wc.stack_mode = Below;
    142  		wc.sibling = m->barwin;
    143  		for(c = m->stack; c; c = c->snext)
    144  			if(!c->isfloating && ISVISIBLE(c)) {
    145  				XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
    146 @@ -1475,21 +1475,21 @@ setfullscreen(Client *c, Bool fullscreen) {
    147  void
    148  setlayout(const Arg *arg) {
    149  	if(!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
    150  		selmon->sellt ^= 1;
    151  	if(arg && arg->v)
    152  		selmon->lt[selmon->sellt] = (Layout *)arg->v;
    153  	strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
    154  	if(selmon->sel)
    155  		arrange(selmon);
    156  	else
    157 -		drawbar(selmon);
    158 +		statusall ? drawbars() : drawbar(selmon);
    159  }
    160  
    161  /* arg > 1.0 will set mfact absolutly */
    162  void
    163  setmfact(const Arg *arg) {
    164  	float f;
    165  
    166  	if(!arg || !selmon->lt[selmon->sellt]->arrange)
    167  		return;
    168  	f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
    169 @@ -1941,21 +1941,21 @@ updatetitle(Client *c) {
    170  	if(!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name))
    171  		gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name);
    172  	if(c->name[0] == '\0') /* hack to mark broken clients */
    173  		strcpy(c->name, broken);
    174  }
    175  
    176  void
    177  updatestatus(void) {
    178  	if(!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
    179  		strcpy(stext, "dwm-"VERSION);
    180 -	drawbar(selmon);
    181 +	statusall ? drawbars() : drawbar(selmon);
    182  }
    183  
    184  void
    185  updatewindowtype(Client *c) {
    186  	Atom state = getatomprop(c, netatom[NetWMState]);
    187  	Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
    188  
    189  	if(state == netatom[NetWMFullscreen])
    190  		setfullscreen(c, True);
    191  	if(wtype == netatom[NetWMWindowTypeDialog])
    192 
    193 --------------1.8.3.2--
    194 
    195