aboutsummaryrefslogtreecommitdiffstats
path: root/sway/criteria.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/criteria.c')
-rw-r--r--sway/criteria.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/sway/criteria.c b/sway/criteria.c
index 39d300ea..9077aa9b 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 size_t id_size = snprintf(NULL, 0, "%zu", id) + 1;
370 char *id_str = malloc(id_size);
371 snprintf(id_str, id_size, "%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:
@@ -452,13 +461,18 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) {
452 criteria->tiling = true; 461 criteria->tiling = true;
453 break; 462 break;
454 case T_URGENT: 463 case T_URGENT:
455 if (strcmp(effective_value, "latest") == 0) { 464 if (strcmp(effective_value, "latest") == 0 ||
465 strcmp(effective_value, "newest") == 0 ||
466 strcmp(effective_value, "last") == 0 ||
467 strcmp(effective_value, "recent") == 0) {
456 criteria->urgent = 'l'; 468 criteria->urgent = 'l';
457 } else if (strcmp(effective_value, "oldest") == 0) { 469 } else if (strcmp(effective_value, "oldest") == 0 ||
470 strcmp(effective_value, "first") == 0) {
458 criteria->urgent = 'o'; 471 criteria->urgent = 'o';
459 } else { 472 } else {
460 error = 473 error =
461 strdup("The value for 'urgent' must be 'latest' or 'oldest'"); 474 strdup("The value for 'urgent' must be 'first', 'last', "
475 "'latest', 'newest', 'oldest' or 'recent'");
462 } 476 }
463 break; 477 break;
464 case T_WORKSPACE: 478 case T_WORKSPACE: