Ping.

On Wed, Apr 23, 2014 at 12:44:38PM -0500, Kent R. Spillner wrote:
> I think I sent this out a long time ago but never followed up on it.  :(
> 
> According to cwmrc(5) you can configure an autogroup like so:
> 
>     autogroup group windowname,windowclass
> 
> However, parse.y doesn't actually accept that syntax; you have to put
> quotes around windowname,windowclass so they're recognized as a single
> string value, and then conf_autogroup() splits them apart later.
> 
> This diff adds support to parse.y for recognizing the literal syntax
> as specified in the man page without the need for quotes (while
> retaining support for the quoted values for backwards compatibility).
> 
> For example, today you have to put this in your .cwmrc:
> 
>     autogroup 2 "Navigator,Firefox"
> 
> But with this diff you could use the following instead:
> 
>     autogroup 2 Navigator,Firefox
> 
> 
> Index: calmwm.h
> ===================================================================
> RCS file: /work/cvsroot/xenocara/app/cwm/calmwm.h,v
> retrieving revision 1.259
> diff -p -u -r1.259 calmwm.h
> --- calmwm.h  8 Feb 2014 02:49:30 -0000       1.259
> +++ calmwm.h  23 Apr 2014 17:32:02 -0000
> @@ -500,7 +500,8 @@ void                       menuq_clear(struct menu_q *);
>  int                   parse_config(const char *, struct conf *);
>  
>  void                  conf_atoms(void);
> -void                  conf_autogroup(struct conf *, int, const char *);
> +void                  conf_autogroup(struct conf *, int, const char *,
> +                          const char *);
>  int                   conf_bind_kbd(struct conf *, const char *,
>                            const char *);
>  int                   conf_bind_mouse(struct conf *, const char *,
> Index: conf.c
> ===================================================================
> RCS file: /work/cvsroot/xenocara/app/cwm/conf.c,v
> retrieving revision 1.173
> diff -p -u -r1.173 conf.c
> --- conf.c    21 Apr 2014 12:52:14 -0000      1.173
> +++ conf.c    23 Apr 2014 17:18:11 -0000
> @@ -78,19 +78,31 @@ conf_cmd_remove(struct conf *c, const ch
>       }
>  }
>  void
> -conf_autogroup(struct conf *c, int no, const char *val)
> +conf_autogroup(struct conf *c, int no, const char *class, const char *name)
>  {
>       struct autogroupwin     *aw;
>       char                    *p;
> +     const char              *tmp;
>  
>       aw = xcalloc(1, sizeof(*aw));
>  
> -     if ((p = strchr(val, ',')) == NULL) {
> -             aw->name = NULL;
> -             aw->class = xstrdup(val);
> +     if ((p = strchr(class, ',')) == NULL) {
> +             if (name == NULL)
> +                     aw->name = NULL;
> +             else
> +                     aw->name = xstrdup(name);
> +
> +             aw->class = xstrdup(class);
>       } else {
> +             tmp = class;
> +
>               *(p++) = '\0';
> -             aw->name = xstrdup(val);
> +
> +             if (name == NULL)
> +                     aw->name = xstrdup(tmp);
> +             else
> +                     aw->name = xstrdup(name);
> +
>               aw->class = xstrdup(p);
>       }
>       aw->num = no;
> Index: parse.y
> ===================================================================
> RCS file: /work/cvsroot/xenocara/app/cwm/parse.y,v
> retrieving revision 1.58
> diff -p -u -r1.58 parse.y
> --- parse.y   30 Jan 2014 22:41:16 -0000      1.58
> +++ parse.y   23 Apr 2014 17:10:49 -0000
> @@ -152,8 +152,18 @@ main             : FONTNAME STRING               {
>                               yyerror("invalid autogroup: %d", $2);
>                               YYERROR;
>                       }
> -                     conf_autogroup(conf, $2, $3);
> +                     conf_autogroup(conf, $2, $3, NULL);
>                       free($3);
> +             }
> +             | AUTOGROUP NUMBER STRING ',' STRING    {
> +                     if ($2 < 0 || $2 > 9) {
> +                             free($3);
> +                             yyerror("invalid autogroup: %d", $2);
> +                             YYERROR;
> +                     }
> +                     conf_autogroup(conf, $2, $5, $3);
> +                     free($3);
> +                     free($5);
>               }
>               | IGNORE STRING {
>                       conf_ignore(conf, $2);
> 

Reply via email to