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 | Merge pull request #2564 from ppascher/master (diff) | |
download | sway-29f5cc7508ffe8f267e52b7c39c6525ccfab1e45.tar.gz sway-29f5cc7508ffe8f267e52b7c39c6525ccfab1e45.tar.zst sway-29f5cc7508ffe8f267e52b7c39c6525ccfab1e45.zip |
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, | |||
160 | } | 160 | } |
161 | 161 | ||
162 | if (criteria->window_role) { | 162 | if (criteria->window_role) { |
163 | // TODO | 163 | const char *role = view_get_window_role(view); |
164 | if (!role || regex_cmp(role, criteria->window_role) != 0) { | ||
165 | return false; | ||
166 | } | ||
164 | } | 167 | } |
165 | 168 | ||
166 | if (criteria->window_type != ATOM_LAST) { | 169 | if (criteria->window_type != ATOM_LAST) { |
@@ -368,7 +371,7 @@ static char *get_focused_prop(enum criteria_token token) { | |||
368 | value = view_get_shell(view); | 371 | value = view_get_shell(view); |
369 | break; | 372 | break; |
370 | case T_TITLE: | 373 | case T_TITLE: |
371 | value = view_get_class(view); | 374 | value = view_get_title(view); |
372 | break; | 375 | break; |
373 | case T_WORKSPACE: | 376 | case T_WORKSPACE: |
374 | { | 377 | { |
@@ -388,21 +391,21 @@ static char *get_focused_prop(enum criteria_token token) { | |||
388 | snprintf(id_str, id_size, "%zu", id); | 391 | snprintf(id_str, id_size, "%zu", id); |
389 | value = id_str; | 392 | value = id_str; |
390 | break; | 393 | break; |
391 | case T_CON_MARK: // These do not support __focused__ | ||
392 | case T_FLOATING: | ||
393 | #ifdef HAVE_XWAYLAND | 394 | #ifdef HAVE_XWAYLAND |
394 | case T_CLASS: | 395 | case T_CLASS: |
395 | value = view_get_class(view); | 396 | value = view_get_class(view); |
396 | break; | 397 | break; |
397 | case T_ID: | ||
398 | case T_INSTANCE: | 398 | case T_INSTANCE: |
399 | value = view_get_instance(view); | 399 | value = view_get_instance(view); |
400 | break; | 400 | break; |
401 | case T_WINDOW_ROLE: | 401 | case T_WINDOW_ROLE: |
402 | value = view_get_class(view); | 402 | value = view_get_window_role(view); |
403 | break; | 403 | break; |
404 | case T_WINDOW_TYPE: | 404 | case T_WINDOW_TYPE: // These do not support __focused__ |
405 | case T_ID: | ||
405 | #endif | 406 | #endif |
407 | case T_CON_MARK: | ||
408 | case T_FLOATING: | ||
406 | case T_TILING: | 409 | case T_TILING: |
407 | case T_URGENT: | 410 | case T_URGENT: |
408 | case T_INVALID: | 411 | case T_INVALID: |