Re: [hackers] [tabbed][PATCH] Use utf8 for window name

2020-06-10 Thread Laslo Hunhold
On Thu, 11 Jun 2020 11:42:40 +0500
Nikita Zlobin  wrote:

Dear Nikita,

> One more reason to propose utf. I have read this to better understand
> Xft: https://keithp.com/~keithp/talks/xtc2001/paper
> 
> It mentions, that Xft requires unicode. Not sure, what unicode type is
> meant, but at least Xft manual hs Utf(x) suffixed functions, though no
> with Ucs(x).

exactly, UTF-8 should be everywhere. There are other complexities in
program and it's a myth to me why people are still trying to keep the
encoding space heterogenous. I know there are legacy applications and
file formats, but that shouldn't be our worry.

With best regards

Laslo



Re: [hackers] [tabbed][PATCH] Use utf8 for window name

2020-06-10 Thread Nikita Zlobin
In Wed, 10 Jun 2020 22:09:01 +0200
Hiltjo Posthuma  wrote:

> On Thu, Jun 04, 2020 at 02:13:49PM +0500, Nikita Zlobin wrote:
> > At least some desktop tools (non-mainstream) are in trouble with
> > tabbed window name. At the moment of try I have only tint2 and
> > rofi. First just showes intitled, but second - "Invalid encoding".
> > Though xfwm4 has no problem with compound text names. ---
> >  tabbed.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tabbed.c b/tabbed.c
> > index af207c8..4ee4277 100644
> > --- a/tabbed.c
> > +++ b/tabbed.c
> > @@ -1296,8 +1296,8 @@ xsettitle(Window w, const char *str)
> >  {
> > XTextProperty xtp;
> >  
> > -   if (XmbTextListToTextProperty(dpy, (char **)&str, 1,
> > -   XCompoundTextStyle, &xtp) == Success) {
> > +   if (Xutf8TextListToTextProperty(dpy, (char **)&str, 1,
> > +   XUTF8StringStyle, &xtp) == Success) {
> > XSetTextProperty(dpy, w, &xtp, wmatom[WMName]);
> > XSetTextProperty(dpy, w, &xtp, XA_WM_NAME);
> > XFree(xtp.value);
> > -- 
> > 2.26.2
> > 
> > 
> 
> Hi,
> 
> Just curious, whats your system locale?
> 
> Can you show the output of `locale`?
> 

One more reason to propose utf. I have read this to better understand
Xft: https://keithp.com/~keithp/talks/xtc2001/paper

It mentions, that Xft requires unicode. Not sure, what unicode type is
meant, but at least Xft manual hs Utf(x) suffixed functions, though no
with Ucs(x).



Re: [hackers] [tabbed][PATCH] Use utf8 for window name

2020-06-10 Thread Nikita Zlobin
In Wed, 10 Jun 2020 22:09:01 +0200
Hiltjo Posthuma  wrote:

> On Thu, Jun 04, 2020 at 02:13:49PM +0500, Nikita Zlobin wrote:
> > At least some desktop tools (non-mainstream) are in trouble with
> > tabbed window name. At the moment of try I have only tint2 and
> > rofi. First just showes intitled, but second - "Invalid encoding".
> > Though xfwm4 has no problem with compound text names. ---
> >  tabbed.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tabbed.c b/tabbed.c
> > index af207c8..4ee4277 100644
> > --- a/tabbed.c
> > +++ b/tabbed.c
> > @@ -1296,8 +1296,8 @@ xsettitle(Window w, const char *str)
> >  {
> > XTextProperty xtp;
> >  
> > -   if (XmbTextListToTextProperty(dpy, (char **)&str, 1,
> > -   XCompoundTextStyle, &xtp) == Success) {
> > +   if (Xutf8TextListToTextProperty(dpy, (char **)&str, 1,
> > +   XUTF8StringStyle, &xtp) == Success) {
> > XSetTextProperty(dpy, w, &xtp, wmatom[WMName]);
> > XSetTextProperty(dpy, w, &xtp, XA_WM_NAME);
> > XFree(xtp.value);
> > -- 
> > 2.26.2
> > 
> > 
> 
> Hi,
> 
> Just curious, whats your system locale?
> 
> Can you show the output of `locale`?
> 

$ locale
LANG=ru_RU.utf8
LC_CTYPE="ru_RU.utf8"
LC_NUMERIC=POSIX
LC_TIME="ru_RU.utf8"
LC_COLLATE="ru_RU.utf8"
LC_MONETARY="ru_RU.utf8"
LC_MESSAGES="ru_RU.utf8"
LC_PAPER="ru_RU.utf8"
LC_NAME="ru_RU.utf8"
LC_ADDRESS="ru_RU.utf8"
LC_TELEPHONE="ru_RU.utf8"
LC_MEASUREMENT="ru_RU.utf8"
LC_IDENTIFICATION="ru_RU.utf8"
LC_ALL=



Re: [hackers] [tabbed][PATCH] Fix clients BadDrawable at cleanup with multiple tabs

2020-06-10 Thread Nikita Zlobin
In Wed, 10 Jun 2020 22:10:02 +0200
Hiltjo Posthuma  wrote:

> On Thu, Jun 04, 2020 at 04:01:17PM +0500, Nikita Zlobin wrote:
> > unmanage() after killclient() causes at least one BadDrawable from
> > client. For urxvtd it can crash entire daemon.
> > ---
> >  tabbed.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tabbed.c b/tabbed.c
> > index 4ee4277..6b53d94 100644
> > --- a/tabbed.c
> > +++ b/tabbed.c
> > @@ -219,10 +219,10 @@ cleanup(void)
> > focus(i);
> > killclient(NULL);
> > XReparentWindow(dpy, clients[i]->win, root, 0, 0);
> > -   unmanage(i);
> > }
> > free(clients);
> > clients = NULL;
> > +   XSync(dpy, False);
> >  
> > XFreePixmap(dpy, dc.drawable);
> > XFreeGC(dpy, dc.gc);
> > -- 
> > 2.26.2
> > 
> > 
> 
> Hi,
> 
> Is this the correct way to fix it or just a workaround?
> 

It's unlikely to be perfect. Yet I'm new with bare X11 api. But as for
unmanage() call - it seems for me unnecessary in this place, at least
its's source of problem.

And XSync() call - also no idea if necessary, added only because it is
in in unmanaged() too :/ . To make less changes that I don't understand.



Re: [hackers] [tabbed][PATCH] Fix clients BadDrawable at cleanup with multiple tabs

2020-06-10 Thread Hiltjo Posthuma
On Thu, Jun 04, 2020 at 04:01:17PM +0500, Nikita Zlobin wrote:
> unmanage() after killclient() causes at least one BadDrawable from client.
> For urxvtd it can crash entire daemon.
> ---
>  tabbed.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tabbed.c b/tabbed.c
> index 4ee4277..6b53d94 100644
> --- a/tabbed.c
> +++ b/tabbed.c
> @@ -219,10 +219,10 @@ cleanup(void)
>   focus(i);
>   killclient(NULL);
>   XReparentWindow(dpy, clients[i]->win, root, 0, 0);
> - unmanage(i);
>   }
>   free(clients);
>   clients = NULL;
> + XSync(dpy, False);
>  
>   XFreePixmap(dpy, dc.drawable);
>   XFreeGC(dpy, dc.gc);
> -- 
> 2.26.2
> 
> 

Hi,

Is this the correct way to fix it or just a workaround?

-- 
Kind regards,
Hiltjo



Re: [hackers] [tabbed][PATCH] Use utf8 for window name

2020-06-10 Thread Hiltjo Posthuma
On Thu, Jun 04, 2020 at 02:13:49PM +0500, Nikita Zlobin wrote:
> At least some desktop tools (non-mainstream) are in trouble with tabbed 
> window name.
> At the moment of try I have only tint2 and rofi. First just showes intitled, 
> but
> second - "Invalid encoding". Though xfwm4 has no problem with compound text 
> names.
> ---
>  tabbed.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tabbed.c b/tabbed.c
> index af207c8..4ee4277 100644
> --- a/tabbed.c
> +++ b/tabbed.c
> @@ -1296,8 +1296,8 @@ xsettitle(Window w, const char *str)
>  {
>   XTextProperty xtp;
>  
> - if (XmbTextListToTextProperty(dpy, (char **)&str, 1,
> - XCompoundTextStyle, &xtp) == Success) {
> + if (Xutf8TextListToTextProperty(dpy, (char **)&str, 1,
> + XUTF8StringStyle, &xtp) == Success) {
>   XSetTextProperty(dpy, w, &xtp, wmatom[WMName]);
>   XSetTextProperty(dpy, w, &xtp, XA_WM_NAME);
>   XFree(xtp.value);
> -- 
> 2.26.2
> 
> 

Hi,

Just curious, whats your system locale?

Can you show the output of `locale`?

-- 
Kind regards,
Hiltjo



What about other patches (Re: [hackers] [tabbed][PATCH] Use PWD xprop to set workdir for spawned clients)

2020-06-10 Thread Nikita Zlobin
In Thu, 4 Jun 2020 16:21:40 -0400
Daniel Moch  wrote:

> On Thu, Jun 04, 2020 at 11:26:15AM +0500, Nikita Zlobin wrote:
> > Somewhat disconvenient after true multitab terminals, that new term
> > tabs don't inherit workdir from previous active. Here is some
> > attempt to make such a bond.
> 
> My memory is that terminals in this case inherit their working
> directory from the parent shell, and not from the previous active
> tab. I confirmed this by installing and testing with xfce4-terminal.
> 
> I'm not in favor of this change.
> 

I would like to know whether other patches, which happened to be after
this, need to be rebased before it?

There are two fixes, on top of this enhancement patch.

I'm sorry for a bit of annoyance with too much sends - just learned to
properly send patches with git. Once got ok, I decided to resend all,
that I did not send by this way yet.



Re: [hackers] [dwm][PATCH] Update Vanity Gaps to master

2020-06-10 Thread Michel Boaventura
‐‐‐ Original Message ‐‐‐
On Wednesday, June 10, 2020 12:11 PM, Hiltjo Posthuma  
wrote:

> On Wed, Jun 10, 2020 at 02:03:48PM +, Michel Boaventura wrote:
>
> > Hi,
> > This patch brings Vanity Gaps to master, because the current patch on the 
> > site does not apply after f09418b.
> > Thanks.
>
> > From c35fd03ec002e1f4476a75203ff9b5cbcc630177 Mon Sep 17 00:00:00 2001
> > From: Michel Boaventura michel.boavent...@protonmail.com
> > Date: Wed, 10 Jun 2020 10:46:51 -0300
> > Subject: [PATCH] Update Vanity Gaps to master
> >
> > config.def.h | 21 +++
> > dwm.c | 154 +++
> > 2 files changed, 163 insertions(+), 12 deletions(-)
> > diff --git a/config.def.h b/config.def.h
> > index 1c0b587..0927c2d 100644
> > --- a/config.def.h
> > +++ b/config.def.h
> > @@ -3,6 +3,11 @@
> > /* appearance /
> > static const unsigned int borderpx = 1; / border pixel of windows /
> > static const unsigned int snap = 32; / snap pixel /
> > +static const unsigned int gappih = 10; / horiz inner gap between windows /
> > +static const unsigned int gappiv = 10; / vert inner gap between windows /
> > +static const unsigned int gappoh = 10; / horiz outer gap between windows 
> > and screen edge /
> > +static const unsigned int gappov = 10; / vert outer gap between windows 
> > and screen edge /
> > +static const int smartgaps = 0; / 1 means no outer gap when there is only 
> > one window /
> > static const int showbar = 1; / 0 means no bar /
> > static const int topbar = 1; / 0 means bottom bar */static const char 
> > *fonts[] = { "monospace:size=10" };
> > @@ -70,6 +75,22 @@ static Key keys[] = {
> > { MODKEY, XK_d, incnmaster, {.i = -1 } },
> > { MODKEY, XK_h, setmfact, {.f = -0.05} },
> > { MODKEY, XK_l, setmfact, {.f = +0.05} },
> >
> > -   { MODKEY|Mod4Mask, XK_h, incrgaps, {.i = +1 } },
> > -   { MODKEY|Mod4Mask, XK_l, incrgaps, {.i = -1 } },
> > -   { MODKEY|Mod4Mask|ShiftMask, XK_h, incrogaps, {.i = +1 } },
> > -   { MODKEY|Mod4Mask|ShiftMask, XK_l, incrogaps, {.i = -1 } },
> > -   { MODKEY|Mod4Mask|ControlMask, XK_h, incrigaps, {.i = +1 } },
> > -   { MODKEY|Mod4Mask|ControlMask, XK_l, incrigaps, {.i = -1 } },
> > -   { MODKEY|Mod4Mask, XK_0, togglegaps, {0} },
> > -   { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} },
> > -   { MODKEY, XK_y, incrihgaps, {.i = +1 } },
> > -   { MODKEY, XK_o, incrihgaps, {.i = -1 } },
> > -   { MODKEY|ControlMask, XK_y, incrivgaps, {.i = +1 } },
> > -   { MODKEY|ControlMask, XK_o, incrivgaps, {.i = -1 } },
> > -   { MODKEY|Mod4Mask, XK_y, incrohgaps, {.i = +1 } },
> > -   { MODKEY|Mod4Mask, XK_o, incrohgaps, {.i = -1 } },
> > -   { MODKEY|ShiftMask, XK_y, incrovgaps, {.i = +1 } },
> > -   { MODKEY|ShiftMask, XK_o, incrovgaps, {.i = -1 } },
> > { MODKEY, XK_Return, zoom, {0} },
> > { MODKEY, XK_Tab, view, {0} },
> > { MODKEY|ShiftMask, XK_c, killclient, {0} },
> > diff --git a/dwm.c b/dwm.c
> > index 9fd0286..50dbbaf 100644
> > --- a/dwm.c
> > +++ b/dwm.c
> > @@ -119,6 +119,10 @@ struct Monitor {
> > int by; /* bar geometry /
> > int mx, my, mw, mh; / screen size /
> > int wx, wy, ww, wh; / window area */
> > -   int gappih; /* horizontal gap between windows */
> > -   int gappiv; /* vertical gap between windows */
> > -   int gappoh; /* horizontal outer gaps */
> > -   int gappov; /* vertical outer gaps */
> > unsigned int seltags;
> > unsigned int sellt;
> > unsigned int tagset[2];
> > @@ -200,6 +204,16 @@ static void sendmon(Client *c, Monitor *m);
> > static void setclientstate(Client *c, long state);
> > static void setfocus(Client *c);
> > static void setfullscreen(Client *c, int fullscreen);
> > +static void setgaps(int oh, int ov, int ih, int iv);
> > +static void incrgaps(const Arg *arg);
> > +static void incrigaps(const Arg *arg);
> > +static void incrogaps(const Arg *arg);
> > +static void incrohgaps(const Arg *arg);
> > +static void incrovgaps(const Arg *arg);
> > +static void incrihgaps(const Arg *arg);
> > +static void incrivgaps(const Arg *arg);
> > +static void togglegaps(const Arg *arg);
> > +static void defaultgaps(const Arg *arg);
> > static void setlayout(const Arg *arg);
> > static void setmfact(const Arg arg);
> > static void setup(void);
> > @@ -241,6 +255,7 @@ static char stext[256];
> > static int screen;
> > static int sw, sh; / X display screen geometry width, height /
> > static int bh, blw = 0; / bar geometry /
> > +static int enablegaps = 1; / enables gaps, used by togglegaps /
> > static int lrpad; / sum of left and right padding for text */static int 
> > (*xerrorxlib)(Display *, XErrorEvent *);
> > static unsigned int numlockmask = 0;
> > @@ -639,6 +654,10 @@ createmon(void)
> > m->nmaster = nmaster;
> > m->showbar = showbar;
> > m->topbar = topbar;
> >
> > -   m->gappih = gappih;
> > -   m->gappiv = gappiv;
> > -   m->gappoh = gapp

[hackers] [dwm][PATCH] Update Vanity Gaps to master

2020-06-10 Thread Michel Boaventura
Hi,

This patch brings Vanity Gaps to master, because the current patch on the site 
does not apply after f09418b.

Thanks.From c35fd03ec002e1f4476a75203ff9b5cbcc630177 Mon Sep 17 00:00:00 2001
From: Michel Boaventura 
Date: Wed, 10 Jun 2020 10:46:51 -0300
Subject: [PATCH] Update Vanity Gaps to master

---
 config.def.h |  21 +++
 dwm.c| 154 +++
 2 files changed, 163 insertions(+), 12 deletions(-)

diff --git a/config.def.h b/config.def.h
index 1c0b587..0927c2d 100644
--- a/config.def.h
+++ b/config.def.h
@@ -3,6 +3,11 @@
 /* appearance */
 static const unsigned int borderpx  = 1;/* border pixel of windows */
 static const unsigned int snap  = 32;   /* snap pixel */
+static const unsigned int gappih= 10;   /* horiz inner gap between windows */
+static const unsigned int gappiv= 10;   /* vert inner gap between windows */
+static const unsigned int gappoh= 10;   /* horiz outer gap between windows and screen edge */
+static const unsigned int gappov= 10;   /* vert outer gap between windows and screen edge */
+static const int smartgaps  = 0;/* 1 means no outer gap when there is only one window */
 static const int showbar= 1;/* 0 means no bar */
 static const int topbar = 1;/* 0 means bottom bar */
 static const char *fonts[]  = { "monospace:size=10" };
@@ -70,6 +75,22 @@ static Key keys[] = {
 	{ MODKEY,   XK_d,  incnmaster, {.i = -1 } },
 	{ MODKEY,   XK_h,  setmfact,   {.f = -0.05} },
 	{ MODKEY,   XK_l,  setmfact,   {.f = +0.05} },
+	{ MODKEY|Mod4Mask,  XK_h,  incrgaps,   {.i = +1 } },
+	{ MODKEY|Mod4Mask,  XK_l,  incrgaps,   {.i = -1 } },
+	{ MODKEY|Mod4Mask|ShiftMask,XK_h,  incrogaps,  {.i = +1 } },
+	{ MODKEY|Mod4Mask|ShiftMask,XK_l,  incrogaps,  {.i = -1 } },
+	{ MODKEY|Mod4Mask|ControlMask,  XK_h,  incrigaps,  {.i = +1 } },
+	{ MODKEY|Mod4Mask|ControlMask,  XK_l,  incrigaps,  {.i = -1 } },
+	{ MODKEY|Mod4Mask,  XK_0,  togglegaps, {0} },
+	{ MODKEY|Mod4Mask|ShiftMask,XK_0,  defaultgaps,{0} },
+	{ MODKEY,   XK_y,  incrihgaps, {.i = +1 } },
+	{ MODKEY,   XK_o,  incrihgaps, {.i = -1 } },
+	{ MODKEY|ControlMask,   XK_y,  incrivgaps, {.i = +1 } },
+	{ MODKEY|ControlMask,   XK_o,  incrivgaps, {.i = -1 } },
+	{ MODKEY|Mod4Mask,  XK_y,  incrohgaps, {.i = +1 } },
+	{ MODKEY|Mod4Mask,  XK_o,  incrohgaps, {.i = -1 } },
+	{ MODKEY|ShiftMask, XK_y,  incrovgaps, {.i = +1 } },
+	{ MODKEY|ShiftMask, XK_o,  incrovgaps, {.i = -1 } },
 	{ MODKEY,   XK_Return, zoom,   {0} },
 	{ MODKEY,   XK_Tab,view,   {0} },
 	{ MODKEY|ShiftMask, XK_c,  killclient, {0} },
diff --git a/dwm.c b/dwm.c
index 9fd0286..50dbbaf 100644
--- a/dwm.c
+++ b/dwm.c
@@ -119,6 +119,10 @@ struct Monitor {
 	int by;   /* bar geometry */
 	int mx, my, mw, mh;   /* screen size */
 	int wx, wy, ww, wh;   /* window area  */
+	int gappih;   /* horizontal gap between windows */
+	int gappiv;   /* vertical gap between windows */
+	int gappoh;   /* horizontal outer gaps */
+	int gappov;   /* vertical outer gaps */
 	unsigned int seltags;
 	unsigned int sellt;
 	unsigned int tagset[2];
@@ -200,6 +204,16 @@ static void sendmon(Client *c, Monitor *m);
 static void setclientstate(Client *c, long state);
 static void setfocus(Client *c);
 static void setfullscreen(Client *c, int fullscreen);
+static void setgaps(int oh, int ov, int ih, int iv);
+static void incrgaps(const Arg *arg);
+static void incrigaps(const Arg *arg);
+static void incrogaps(const Arg *arg);
+static void incrohgaps(const Arg *arg);
+static void incrovgaps(const Arg *arg);
+static void incrihgaps(const Arg *arg);
+static void incrivgaps(const Arg *arg);
+static void togglegaps(const Arg *arg);
+static void defaultgaps(const Arg *arg);
 static void setlayout(const Arg *arg);
 static void setmfact(const Arg *arg);
 static void setup(void);
@@ -241,6 +255,7 @@ static char stext[256];
 static int screen;
 static int sw, sh;   /* X display screen geometry width, height */
 static int bh, blw = 0;  /* bar geometry */
+static int enablegaps = 1;   /* enables gaps, used by togglegaps */
 static int lrpad;/* sum of left and right padding for text */
 static int (*xerrorxlib)(Display *, XErrorEvent *);
 static unsigned int numlockmask = 0;
@@ -639,6 +654,10 @@ createmon(void)
 	m->nmaster = nmaster;
 	m->showbar = showbar;
 	m->topbar = topbar;
+	m->gappih = gappih;
+	m->gappiv = gappiv;
+	m->gappoh = gappoh;
+	m->gappov = gappov;
 	m->

Re: [hackers] [dwm][PATCH] Update Vanity Gaps to master

2020-06-10 Thread Hiltjo Posthuma
On Wed, Jun 10, 2020 at 03:20:35PM +, Michel Boaventura wrote:
> ‐‐‐ Original Message ‐‐‐
> On Wednesday, June 10, 2020 12:11 PM, Hiltjo Posthuma 
>  wrote:
> 
> > On Wed, Jun 10, 2020 at 02:03:48PM +, Michel Boaventura wrote:
> >
> > > Hi,
> > > This patch brings Vanity Gaps to master, because the current patch on the 
> > > site does not apply after f09418b.
> > > Thanks.
> >
> > > From c35fd03ec002e1f4476a75203ff9b5cbcc630177 Mon Sep 17 00:00:00 2001
> > > From: Michel Boaventura michel.boavent...@protonmail.com
> > > Date: Wed, 10 Jun 2020 10:46:51 -0300
> > > Subject: [PATCH] Update Vanity Gaps to master
> > >
> > > config.def.h | 21 +++
> > > dwm.c | 154 +++
> > > 2 files changed, 163 insertions(+), 12 deletions(-)
> > > diff --git a/config.def.h b/config.def.h
> > > index 1c0b587..0927c2d 100644
> > > --- a/config.def.h
> > > +++ b/config.def.h
> > > @@ -3,6 +3,11 @@
> > > /* appearance /
> > > static const unsigned int borderpx = 1; / border pixel of windows /
> > > static const unsigned int snap = 32; / snap pixel /
> > > +static const unsigned int gappih = 10; / horiz inner gap between windows 
> > > /
> > > +static const unsigned int gappiv = 10; / vert inner gap between windows /
> > > +static const unsigned int gappoh = 10; / horiz outer gap between windows 
> > > and screen edge /
> > > +static const unsigned int gappov = 10; / vert outer gap between windows 
> > > and screen edge /
> > > +static const int smartgaps = 0; / 1 means no outer gap when there is 
> > > only one window /
> > > static const int showbar = 1; / 0 means no bar /
> > > static const int topbar = 1; / 0 means bottom bar */static const char 
> > > *fonts[] = { "monospace:size=10" };
> > > @@ -70,6 +75,22 @@ static Key keys[] = {
> > > { MODKEY, XK_d, incnmaster, {.i = -1 } },
> > > { MODKEY, XK_h, setmfact, {.f = -0.05} },
> > > { MODKEY, XK_l, setmfact, {.f = +0.05} },
> > >
> > > -   { MODKEY|Mod4Mask, XK_h, incrgaps, {.i = +1 } },
> > > -   { MODKEY|Mod4Mask, XK_l, incrgaps, {.i = -1 } },
> > > -   { MODKEY|Mod4Mask|ShiftMask, XK_h, incrogaps, {.i = +1 } },
> > > -   { MODKEY|Mod4Mask|ShiftMask, XK_l, incrogaps, {.i = -1 } },
> > > -   { MODKEY|Mod4Mask|ControlMask, XK_h, incrigaps, {.i = +1 } },
> > > -   { MODKEY|Mod4Mask|ControlMask, XK_l, incrigaps, {.i = -1 } },
> > > -   { MODKEY|Mod4Mask, XK_0, togglegaps, {0} },
> > > -   { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} },
> > > -   { MODKEY, XK_y, incrihgaps, {.i = +1 } },
> > > -   { MODKEY, XK_o, incrihgaps, {.i = -1 } },
> > > -   { MODKEY|ControlMask, XK_y, incrivgaps, {.i = +1 } },
> > > -   { MODKEY|ControlMask, XK_o, incrivgaps, {.i = -1 } },
> > > -   { MODKEY|Mod4Mask, XK_y, incrohgaps, {.i = +1 } },
> > > -   { MODKEY|Mod4Mask, XK_o, incrohgaps, {.i = -1 } },
> > > -   { MODKEY|ShiftMask, XK_y, incrovgaps, {.i = +1 } },
> > > -   { MODKEY|ShiftMask, XK_o, incrovgaps, {.i = -1 } },
> > > { MODKEY, XK_Return, zoom, {0} },
> > > { MODKEY, XK_Tab, view, {0} },
> > > { MODKEY|ShiftMask, XK_c, killclient, {0} },
> > > diff --git a/dwm.c b/dwm.c
> > > index 9fd0286..50dbbaf 100644
> > > --- a/dwm.c
> > > +++ b/dwm.c
> > > @@ -119,6 +119,10 @@ struct Monitor {
> > > int by; /* bar geometry /
> > > int mx, my, mw, mh; / screen size /
> > > int wx, wy, ww, wh; / window area */
> > > -   int gappih; /* horizontal gap between windows */
> > > -   int gappiv; /* vertical gap between windows */
> > > -   int gappoh; /* horizontal outer gaps */
> > > -   int gappov; /* vertical outer gaps */
> > > unsigned int seltags;
> > > unsigned int sellt;
> > > unsigned int tagset[2];
> > > @@ -200,6 +204,16 @@ static void sendmon(Client *c, Monitor *m);
> > > static void setclientstate(Client *c, long state);
> > > static void setfocus(Client *c);
> > > static void setfullscreen(Client *c, int fullscreen);
> > > +static void setgaps(int oh, int ov, int ih, int iv);
> > > +static void incrgaps(const Arg *arg);
> > > +static void incrigaps(const Arg *arg);
> > > +static void incrogaps(const Arg *arg);
> > > +static void incrohgaps(const Arg *arg);
> > > +static void incrovgaps(const Arg *arg);
> > > +static void incrihgaps(const Arg *arg);
> > > +static void incrivgaps(const Arg *arg);
> > > +static void togglegaps(const Arg *arg);
> > > +static void defaultgaps(const Arg *arg);
> > > static void setlayout(const Arg *arg);
> > > static void setmfact(const Arg arg);
> > > static void setup(void);
> > > @@ -241,6 +255,7 @@ static char stext[256];
> > > static int screen;
> > > static int sw, sh; / X display screen geometry width, height /
> > > static int bh, blw = 0; / bar geometry /
> > > +static int enablegaps = 1; / enables gaps, used by togglegaps /
> > > static int lrpad; / sum of left and right padding for text */static 
> > > int (*xerrorxlib)(Display *, XE

Re: [hackers] [dwm][PATCH] Update Vanity Gaps to master

2020-06-10 Thread Hiltjo Posthuma
On Wed, Jun 10, 2020 at 02:03:48PM +, Michel Boaventura wrote:
> Hi,
> 
> This patch brings Vanity Gaps to master, because the current patch on the 
> site does not apply after f09418b.
> 
> Thanks.

> From c35fd03ec002e1f4476a75203ff9b5cbcc630177 Mon Sep 17 00:00:00 2001
> From: Michel Boaventura 
> Date: Wed, 10 Jun 2020 10:46:51 -0300
> Subject: [PATCH] Update Vanity Gaps to master
> 
> ---
>  config.def.h |  21 +++
>  dwm.c| 154 +++
>  2 files changed, 163 insertions(+), 12 deletions(-)
> 
> diff --git a/config.def.h b/config.def.h
> index 1c0b587..0927c2d 100644
> --- a/config.def.h
> +++ b/config.def.h
> @@ -3,6 +3,11 @@
>  /* appearance */
>  static const unsigned int borderpx  = 1;/* border pixel of windows */
>  static const unsigned int snap  = 32;   /* snap pixel */
> +static const unsigned int gappih= 10;   /* horiz inner gap between 
> windows */
> +static const unsigned int gappiv= 10;   /* vert inner gap between 
> windows */
> +static const unsigned int gappoh= 10;   /* horiz outer gap between 
> windows and screen edge */
> +static const unsigned int gappov= 10;   /* vert outer gap between 
> windows and screen edge */
> +static const int smartgaps  = 0;/* 1 means no outer gap when 
> there is only one window */
>  static const int showbar= 1;/* 0 means no bar */
>  static const int topbar = 1;/* 0 means bottom bar */
>  static const char *fonts[]  = { "monospace:size=10" };
> @@ -70,6 +75,22 @@ static Key keys[] = {
>   { MODKEY,   XK_d,  incnmaster, {.i = -1 } },
>   { MODKEY,   XK_h,  setmfact,   {.f = -0.05} 
> },
>   { MODKEY,   XK_l,  setmfact,   {.f = +0.05} 
> },
> + { MODKEY|Mod4Mask,  XK_h,  incrgaps,   {.i = +1 } },
> + { MODKEY|Mod4Mask,  XK_l,  incrgaps,   {.i = -1 } },
> + { MODKEY|Mod4Mask|ShiftMask,XK_h,  incrogaps,  {.i = +1 } },
> + { MODKEY|Mod4Mask|ShiftMask,XK_l,  incrogaps,  {.i = -1 } },
> + { MODKEY|Mod4Mask|ControlMask,  XK_h,  incrigaps,  {.i = +1 } },
> + { MODKEY|Mod4Mask|ControlMask,  XK_l,  incrigaps,  {.i = -1 } },
> + { MODKEY|Mod4Mask,  XK_0,  togglegaps, {0} },
> + { MODKEY|Mod4Mask|ShiftMask,XK_0,  defaultgaps,{0} },
> + { MODKEY,   XK_y,  incrihgaps, {.i = +1 } },
> + { MODKEY,   XK_o,  incrihgaps, {.i = -1 } },
> + { MODKEY|ControlMask,   XK_y,  incrivgaps, {.i = +1 } },
> + { MODKEY|ControlMask,   XK_o,  incrivgaps, {.i = -1 } },
> + { MODKEY|Mod4Mask,  XK_y,  incrohgaps, {.i = +1 } },
> + { MODKEY|Mod4Mask,  XK_o,  incrohgaps, {.i = -1 } },
> + { MODKEY|ShiftMask, XK_y,  incrovgaps, {.i = +1 } },
> + { MODKEY|ShiftMask, XK_o,  incrovgaps, {.i = -1 } },
>   { MODKEY,   XK_Return, zoom,   {0} },
>   { MODKEY,   XK_Tab,view,   {0} },
>   { MODKEY|ShiftMask, XK_c,  killclient, {0} },
> diff --git a/dwm.c b/dwm.c
> index 9fd0286..50dbbaf 100644
> --- a/dwm.c
> +++ b/dwm.c
> @@ -119,6 +119,10 @@ struct Monitor {
>   int by;   /* bar geometry */
>   int mx, my, mw, mh;   /* screen size */
>   int wx, wy, ww, wh;   /* window area  */
> + int gappih;   /* horizontal gap between windows */
> + int gappiv;   /* vertical gap between windows */
> + int gappoh;   /* horizontal outer gaps */
> + int gappov;   /* vertical outer gaps */
>   unsigned int seltags;
>   unsigned int sellt;
>   unsigned int tagset[2];
> @@ -200,6 +204,16 @@ static void sendmon(Client *c, Monitor *m);
>  static void setclientstate(Client *c, long state);
>  static void setfocus(Client *c);
>  static void setfullscreen(Client *c, int fullscreen);
> +static void setgaps(int oh, int ov, int ih, int iv);
> +static void incrgaps(const Arg *arg);
> +static void incrigaps(const Arg *arg);
> +static void incrogaps(const Arg *arg);
> +static void incrohgaps(const Arg *arg);
> +static void incrovgaps(const Arg *arg);
> +static void incrihgaps(const Arg *arg);
> +static void incrivgaps(const Arg *arg);
> +static void togglegaps(const Arg *arg);
> +static void defaultgaps(const Arg *arg);
>  static void setlayout(const Arg *arg);
>  static void setmfact(const Arg *arg);
>  static void setup(void);
> @@ -241,6 +255,7 @@ static char stext[256];
>  static int screen;
>  static int sw, sh;   /* X display screen geometry width, height */
>  static int bh, blw = 0;  /* bar geometry */
> +static int enablegaps = 1;   /*