diff options
Diffstat (limited to 'sway/criteria.c')
-rw-r--r-- | sway/criteria.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sway/criteria.c b/sway/criteria.c index c4fe6ecc..5c305193 100644 --- a/sway/criteria.c +++ b/sway/criteria.c | |||
@@ -173,9 +173,8 @@ static char *parse_criteria_name(enum criteria_type *type, char *name) { | |||
173 | char *error = malloc(len); | 173 | char *error = malloc(len); |
174 | snprintf(error, len, fmt, name); | 174 | snprintf(error, len, fmt, name); |
175 | return error; | 175 | return error; |
176 | } else if (*type == CRIT_INSTANCE || *type == CRIT_URGENT || | 176 | } else if (*type == CRIT_URGENT || *type == CRIT_WINDOW_ROLE || |
177 | *type == CRIT_WINDOW_ROLE || *type == CRIT_WINDOW_TYPE) { | 177 | *type == CRIT_WINDOW_TYPE) { |
178 | |||
179 | // (we're just being helpful here) | 178 | // (we're just being helpful here) |
180 | const char *fmt = "\"%s\" criteria currently unsupported, " | 179 | const char *fmt = "\"%s\" criteria currently unsupported, " |
181 | "no window will match this"; | 180 | "no window will match this"; |
@@ -272,6 +271,16 @@ static bool criteria_test(swayc_t *cont, list_t *tokens) { | |||
272 | } | 271 | } |
273 | break; | 272 | break; |
274 | case CRIT_INSTANCE: | 273 | case CRIT_INSTANCE: |
274 | if (!cont->instance) { | ||
275 | // ignore | ||
276 | } else if (strcmp(crit->raw, "focused") == 0) { | ||
277 | swayc_t *focused = get_focused_view(&root_container); | ||
278 | if (focused->instance && strcmp(cont->instance, focused->instance) == 0) { | ||
279 | matches++; | ||
280 | } | ||
281 | } else if (crit->regex && regexec(crit->regex, cont->instance, 0, NULL, 0) == 0) { | ||
282 | matches++; | ||
283 | } | ||
275 | break; | 284 | break; |
276 | case CRIT_TITLE: | 285 | case CRIT_TITLE: |
277 | if (!cont->name) { | 286 | if (!cont->name) { |