diff options
author | Brian Ashworth <RedSoxFan@users.noreply.github.com> | 2018-08-08 15:26:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-08 15:26:44 -0400 |
commit | 3c26536267e13859eb6088ce0192579f10ac871f (patch) | |
tree | a4676629358071b0f0748dde33a32d82c9a58175 /sway/criteria.c | |
parent | 776b9b7e1fa72ebc4f7e79de280ea5dd9901787e (diff) | |
parent | e28101e6e1ed757fe8a7402c5123ee7e58546895 (diff) | |
download | sway-3c26536267e13859eb6088ce0192579f10ac871f.tar.xz |
Merge branch 'master' into master
Diffstat (limited to 'sway/criteria.c')
-rw-r--r-- | sway/criteria.c | 26 |
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) { } } break; - case T_CON_ID: // These do not support __focused__ - case T_CON_MARK: + case T_CON_ID: + if (view->swayc == NULL) { + return NULL; + } + size_t id = view->swayc->id; + size_t id_size = snprintf(NULL, 0, "%zu", id) + 1; + char *id_str = malloc(id_size); + 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_ID: @@ -425,7 +434,7 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) { case T_CON_ID: criteria->con_id = strtoul(effective_value, &endptr, 10); if (*endptr != 0) { - error = strdup("The value for 'con_id' should be numeric"); + error = strdup("The value for 'con_id' should be '__focused__' or numeric"); } break; case T_CON_MARK: @@ -452,13 +461,18 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) { criteria->tiling = true; break; case T_URGENT: - if (strcmp(effective_value, "latest") == 0) { + if (strcmp(effective_value, "latest") == 0 || + strcmp(effective_value, "newest") == 0 || + strcmp(effective_value, "last") == 0 || + strcmp(effective_value, "recent") == 0) { criteria->urgent = 'l'; - } else if (strcmp(effective_value, "oldest") == 0) { + } else if (strcmp(effective_value, "oldest") == 0 || + strcmp(effective_value, "first") == 0) { criteria->urgent = 'o'; } else { error = - strdup("The value for 'urgent' must be 'latest' or 'oldest'"); + strdup("The value for 'urgent' must be 'first', 'last', " + "'latest', 'newest', 'oldest' or 'recent'"); } break; case T_WORKSPACE: |