[dwm] regex

From: Manuel Badzong <lists_AT_badzong.com>
Date: Sat, 2 Dec 2006 19:00:51 +0100

Hi

I just tried to apply tags to programs (classes) using rules[] in
config.h. Is there any reason why all the supplied configs use patterns
like "Firefox.*", which is more complex as just "Firefox" but results
exactly the same (in a regex point of view)?

As I tried to apply multiple Tags to one class I found out that dwm is
using traditional regexes. This is not really bad, but if I want to use
something like (IMO this is the only useful way to use the tag regexes):

"\(net\|dev\)"

The correct config.h regex is:

"\\(net\\|dev\\)"
(The backslash is a compiler escape)

This works fine (in a regex point of view, not yet in dwm's) but to
ease things I would propose to use extended regexes, to make it work
like:

"(net|dev)"

Which is definitely more readable.

But yet dwm is not able to apply multiple tags to a class because it
stops checking the classes after the first match. If this is the
desired behavior, regexes for the tags are useless and strcmp should
be used instead.

Here's my patch for 2.5.

Cheers, Manuel

Received on Sat Dec 02 2006 - 19:00:36 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:33:20 UTC