sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit 52a61671e93953a06b6b440ede5512e8fe45b35e
parent 3330faded5ed59b19b2a1982bb52c05322b03510
Author: Brian Ashworth <bosrsf04@gmail.com>
Date:   Tue, 12 Mar 2019 22:33:49 -0400

criteria: change workspace to support regex

This changes the workspace criteria to support regex instead of basic
strings. This matches i3's behavior.

Diffstat:
Minclude/sway/criteria.h | 2+-
Msway/criteria.c | 4++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/sway/criteria.h b/include/sway/criteria.h @@ -35,7 +35,7 @@ struct criteria { bool floating; bool tiling; char urgent; // 'l' for latest or 'o' for oldest - char *workspace; + pcre *workspace; }; bool criteria_is_empty(struct criteria *criteria); diff --git a/sway/criteria.c b/sway/criteria.c @@ -208,7 +208,7 @@ static bool criteria_matches_view(struct criteria *criteria, if (criteria->workspace) { struct sway_workspace *ws = view->container->workspace; - if (!ws || strcmp(ws->name, criteria->workspace) != 0) { + if (!ws || regex_cmp(ws->name, criteria->workspace) != 0) { return false; } } @@ -515,7 +515,7 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) { } break; case T_WORKSPACE: - criteria->workspace = strdup(effective_value); + generate_regex(&criteria->workspace, effective_value); break; case T_INVALID: break;