From 29f5cc7508ffe8f267e52b7c39c6525ccfab1e45 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 2 Sep 2018 20:06:25 +1000 Subject: Implement window_role criteria token Depends on https://github.com/swaywm/wlroots/pull/1226 --- sway/criteria.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'sway/criteria.c') 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: -- cgit v1.2.3