sites

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

dwm-emptyview-6.2.diff (2666B)


      1 From ab269c1682bd17fb9c2666f8d1df397dd894718d Mon Sep 17 00:00:00 2001
      2 From: MLquest8 <miskuzius@gmail.com>
      3 Date: Sat, 20 Jun 2020 16:58:37 +0400
      4 Subject: [PATCH] updated for version 6.2. Added startontag option.
      5 
      6 ---
      7  config.def.h |  1 +
      8  dwm.c        | 18 +++++++++---------
      9  2 files changed, 10 insertions(+), 9 deletions(-)
     10 
     11 diff --git a/config.def.h b/config.def.h
     12 index 1c0b587..960e21a 100644
     13 --- a/config.def.h
     14 +++ b/config.def.h
     15 @@ -5,6 +5,7 @@ static const unsigned int borderpx  = 1;        /* border pixel of windows */
     16  static const unsigned int snap      = 32;       /* snap pixel */
     17  static const int showbar            = 1;        /* 0 means no bar */
     18  static const int topbar             = 1;        /* 0 means bottom bar */
     19 +static const int startontag         = 1;        /* 0 means no tag active on start */
     20  static const char *fonts[]          = { "monospace:size=10" };
     21  static const char dmenufont[]       = "monospace:size=10";
     22  static const char col_gray1[]       = "#222222";
     23 diff --git a/dwm.c b/dwm.c
     24 index 9fd0286..2f21157 100644
     25 --- a/dwm.c
     26 +++ b/dwm.c
     27 @@ -309,7 +309,9 @@ applyrules(Client *c)
     28  		XFree(ch.res_class);
     29  	if (ch.res_name)
     30  		XFree(ch.res_name);
     31 -	c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags];
     32 +	if(c->tags & TAGMASK)                    c->tags = c->tags & TAGMASK;
     33 +	else if(c->mon->tagset[c->mon->seltags]) c->tags = c->mon->tagset[c->mon->seltags];
     34 +	else                                     c->tags = 1;
     35  }
     36  
     37  int
     38 @@ -634,7 +636,7 @@ createmon(void)
     39  	Monitor *m;
     40  
     41  	m = ecalloc(1, sizeof(Monitor));
     42 -	m->tagset[0] = m->tagset[1] = 1;
     43 +	m->tagset[0] = m->tagset[1] = startontag ? 1 : 0;
     44  	m->mfact = mfact;
     45  	m->nmaster = nmaster;
     46  	m->showbar = showbar;
     47 @@ -1417,7 +1419,7 @@ sendmon(Client *c, Monitor *m)
     48  	detach(c);
     49  	detachstack(c);
     50  	c->mon = m;
     51 -	c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
     52 +	c->tags = (m->tagset[m->seltags] ? m->tagset[m->seltags] : 1);
     53  	attach(c);
     54  	attachstack(c);
     55  	focus(NULL);
     56 @@ -1742,11 +1744,9 @@ toggleview(const Arg *arg)
     57  {
     58  	unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
     59  
     60 -	if (newtagset) {
     61 -		selmon->tagset[selmon->seltags] = newtagset;
     62 -		focus(NULL);
     63 -		arrange(selmon);
     64 -	}
     65 +	selmon->tagset[selmon->seltags] = newtagset;
     66 +	focus(NULL);
     67 +	arrange(selmon);
     68  }
     69  
     70  void
     71 @@ -2038,7 +2038,7 @@ updatewmhints(Client *c)
     72  void
     73  view(const Arg *arg)
     74  {
     75 -	if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
     76 +	if(arg->ui && (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
     77  		return;
     78  	selmon->seltags ^= 1; /* toggle sel tagset */
     79  	if (arg->ui & TAGMASK)
     80 -- 
     81 2.26.2
     82