aboutsummaryrefslogtreecommitdiffstats
path: root/sway/criteria.c
diff options
context:
space:
mode:
authorLibravatar Ian Fan <ianfan0@gmail.com>2018-07-29 11:16:28 +0100
committerLibravatar Ian Fan <ianfan0@gmail.com>2018-08-06 14:17:58 +0100
commit11ac66d6fef118077731fccdaecc350257b8942a (patch)
treed931e04519453d5da44b57c0af8303797e590926 /sway/criteria.c
parentcommands: allow "first", "last", "newest" and "recent" as values for urgent c... (diff)
downloadsway-11ac66d6fef118077731fccdaecc350257b8942a.tar.gz
sway-11ac66d6fef118077731fccdaecc350257b8942a.tar.zst
sway-11ac66d6fef118077731fccdaecc350257b8942a.zip
commands: allow __focused__ for con_id criterion
Diffstat (limited to 'sway/criteria.c')
-rw-r--r--sway/criteria.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sway/criteria.c b/sway/criteria.c
index dd995c4b..2fa9878b 100644
--- a/sway/criteria.c
+++ b/sway/criteria.c
@@ -361,8 +361,17 @@ static char *get_focused_prop(enum criteria_token token) {
361 } 361 }
362 } 362 }
363 break; 363 break;
364 case T_CON_ID: // These do not support __focused__ 364 case T_CON_ID:
365 case T_CON_MARK: 365 if (view->swayc == NULL) {
366 return NULL;
367 }
368 size_t id = view->swayc->id;
369 int len = snprintf(NULL, 0, "%zu", id) + 1;
370 char *id_str = malloc(len);
371 snprintf(id_str, len, "%zu", id);
372 value = id_str;
373 break;
374 case T_CON_MARK: // These do not support __focused__
366 case T_FLOATING: 375 case T_FLOATING:
367#ifdef HAVE_XWAYLAND 376#ifdef HAVE_XWAYLAND
368 case T_ID: 377 case T_ID:
@@ -425,7 +434,7 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) {
425 case T_CON_ID: 434 case T_CON_ID:
426 criteria->con_id = strtoul(effective_value, &endptr, 10); 435 criteria->con_id = strtoul(effective_value, &endptr, 10);
427 if (*endptr != 0) { 436 if (*endptr != 0) {
428 error = strdup("The value for 'con_id' should be numeric"); 437 error = strdup("The value for 'con_id' should be '__focused__' or numeric");
429 } 438 }
430 break; 439 break;
431 case T_CON_MARK: 440 case T_CON_MARK: