diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-09-02 20:06:25 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-09-04 08:23:50 +1000 |
commit | 29f5cc7508ffe8f267e52b7c39c6525ccfab1e45 (patch) | |
tree | aac4f01e76ba1e97fb8ac9eb0c405b98ea785682 /sway/criteria.c | |
parent | 0b61bae8fb2923d044e743d5816a72f05adc94e3 (diff) |
Implement window_role criteria token
Depends on https://github.com/swaywm/wlroots/pull/1226
Diffstat (limited to 'sway/criteria.c')
-rw-r--r-- | sway/criteria.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sway/criteria.c b/sway/criteria.c index acc70d1b..feca904a 100644 --- a/sway/criteria.c +++ b/sway/criteria.c @@ -160,7 +160,10 @@ static bool criteria_matches_view(struct criteria *criteria, } if (criteria->window_role) { - // TODO + const char *role = view_get_window_role(view); + if (!role || regex_cmp(role, criteria->window_role) != 0) { + return false; + } } if (criteria->window_type != ATOM_LAST) { @@ -368,7 +371,7 @@ static char *get_focused_prop(enum criteria_token token) { value = view_get_shell(view); break; case T_TITLE: - value = view_get_class(view); + value = view_get_title(view); break; case T_WORKSPACE: { @@ -388,21 +391,21 @@ static char *get_focused_prop(enum criteria_token token) { snprintf(id_str, id_size, "%zu", id); value = id_str; break; - case T_CON_MARK: // These do not support __focused__ - case T_FLOATING: #ifdef HAVE_XWAYLAND case T_CLASS: value = view_get_class(view); break; - case T_ID: case T_INSTANCE: value = view_get_instance(view); break; case T_WINDOW_ROLE: - value = view_get_class(view); + value = view_get_window_role(view); break; - case T_WINDOW_TYPE: + case T_WINDOW_TYPE: // These do not support __focused__ + case T_ID: #endif + case T_CON_MARK: + case T_FLOATING: case T_TILING: case T_URGENT: case T_INVALID: |