[wiki] [sites] [dwm][PATCH] updated emptyview for version 6.2 and added a config option. || MLquest8

From: <git_AT_suckless.org>
Date: Sat, 20 Jun 2020 15:29:54 +0200

commit a223578fd404a653f88664cf454d04bc89deeed5
Author: MLquest8 <miskuzius_AT_gmail.com>
Date: Sat Jun 20 17:28:05 2020 +0400

    [dwm][PATCH] updated emptyview for version 6.2 and added a config
    option.

diff --git a/dwm.suckless.org/patches/emptyview/dwm-emptyview-6.2.diff b/dwm.suckless.org/patches/emptyview/dwm-emptyview-6.2.diff
new file mode 100644
index 00000000..14658408
--- /dev/null
+++ b/dwm.suckless.org/patches/emptyview/dwm-emptyview-6.2.diff
_AT_@ -0,0 +1,82 @@
+From ab269c1682bd17fb9c2666f8d1df397dd894718d Mon Sep 17 00:00:00 2001
+From: MLquest8 <miskuzius_AT_gmail.com>
+Date: Sat, 20 Jun 2020 16:58:37 +0400
+Subject: [PATCH] updated for version 6.2. Added startontag option.
+
+---
+ config.def.h | 1 +
+ dwm.c | 18 +++++++++---------
+ 2 files changed, 10 insertions(+), 9 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..960e21a 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -5,6 +5,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
+ static const unsigned int snap = 32; /* snap pixel */
+ static const int showbar = 1; /* 0 means no bar */
+ static const int topbar = 1; /* 0 means bottom bar */
++static const int startontag = 1; /* 0 means no tag active on start */
+ static const char *fonts[] = { "monospace:size=10" };
+ static const char dmenufont[] = "monospace:size=10";
+ static const char col_gray1[] = "#222222";
+diff --git a/dwm.c b/dwm.c
+index 9fd0286..2f21157 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -309,7 +309,9 @@ applyrules(Client *c)
+ XFree(ch.res_class);
+ if (ch.res_name)
+ XFree(ch.res_name);
+- c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags];
++ if(c->tags & TAGMASK) c->tags = c->tags & TAGMASK;
++ else if(c->mon->tagset[c->mon->seltags]) c->tags = c->mon->tagset[c->mon->seltags];
++ else c->tags = 1;
+ }
+
+ int
+_AT_@ -634,7 +636,7 @@ createmon(void)
+ Monitor *m;
+
+ m = ecalloc(1, sizeof(Monitor));
+- m->tagset[0] = m->tagset[1] = 1;
++ m->tagset[0] = m->tagset[1] = startontag ? 1 : 0;
+ m->mfact = mfact;
+ m->nmaster = nmaster;
+ m->showbar = showbar;
+_AT_@ -1417,7 +1419,7 @@ sendmon(Client *c, Monitor *m)
+ detach(c);
+ detachstack(c);
+ c->mon = m;
+- c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
++ c->tags = (m->tagset[m->seltags] ? m->tagset[m->seltags] : 1);
+ attach(c);
+ attachstack(c);
+ focus(NULL);
+_AT_@ -1742,11 +1744,9 @@ toggleview(const Arg *arg)
+ {
+ unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
+
+- if (newtagset) {
+- selmon->tagset[selmon->seltags] = newtagset;
+- focus(NULL);
+- arrange(selmon);
+- }
++ selmon->tagset[selmon->seltags] = newtagset;
++ focus(NULL);
++ arrange(selmon);
+ }
+
+ void
+_AT_@ -2038,7 +2038,7 @@ updatewmhints(Client *c)
+ void
+ view(const Arg *arg)
+ {
+- if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
++ if(arg->ui && (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
+ return;
+ selmon->seltags ^= 1; /* toggle sel tagset */
+ if (arg->ui & TAGMASK)
+--
+2.26.2
+
diff --git a/dwm.suckless.org/patches/emptyview/index.md b/dwm.suckless.org/patches/emptyview/index.md
index b85711b8..aa68d1b0 100644
--- a/dwm.suckless.org/patches/emptyview/index.md
+++ b/dwm.suckless.org/patches/emptyview/index.md
_AT_@ -8,12 +8,17 @@ toggle the last tag out of view. So i created a patch to allow no tag at all to
 be selected.
 
 With this patch, dwm will start with no tag selected. When you start a client
-with no tag rule and no tag selected, it gets opened in the first tag.
+with no tag rule and no tag selected, it gets opened in the first tag.
+
+Version 6.2 has a `startontag` option(default 1) which tells dwm to bring
+the first tag in view on launch as usual. 0 means no tag active at start.
 
 Download
 --------
+* [dwm-emptyview-6.2.diff](dwm-emptyview-6.2.diff) (20/06/2020)
 * [dwm-emptyview-6.0.diff](dwm-emptyview-6.0.diff) (1753b) (20130330)
 
 Authors
 -------
+* MLquest8 (update for 6.2 and config option) (miskuzius at gmail.com)
 * Markus Teich - `<teichm at in dot tum dot de>`
Received on Sat Jun 20 2020 - 15:29:54 CEST

This archive was generated by hypermail 2.3.0 : Sat Jun 20 2020 - 15:36:42 CEST