mirror of
https://github.com/swaywm/sway.git
synced 2024-11-11 21:14:10 +01:00
commands: allow __focused__ for con_id criterion
This commit is contained in:
parent
710f27d0d2
commit
11ac66d6fe
@ -361,8 +361,17 @@ static char *get_focused_prop(enum criteria_token token) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_CON_ID: // These do not support __focused__
|
case T_CON_ID:
|
||||||
case T_CON_MARK:
|
if (view->swayc == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
size_t id = view->swayc->id;
|
||||||
|
int len = snprintf(NULL, 0, "%zu", id) + 1;
|
||||||
|
char *id_str = malloc(len);
|
||||||
|
snprintf(id_str, len, "%zu", id);
|
||||||
|
value = id_str;
|
||||||
|
break;
|
||||||
|
case T_CON_MARK: // These do not support __focused__
|
||||||
case T_FLOATING:
|
case T_FLOATING:
|
||||||
#ifdef HAVE_XWAYLAND
|
#ifdef HAVE_XWAYLAND
|
||||||
case T_ID:
|
case T_ID:
|
||||||
@ -425,7 +434,7 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) {
|
|||||||
case T_CON_ID:
|
case T_CON_ID:
|
||||||
criteria->con_id = strtoul(effective_value, &endptr, 10);
|
criteria->con_id = strtoul(effective_value, &endptr, 10);
|
||||||
if (*endptr != 0) {
|
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;
|
break;
|
||||||
case T_CON_MARK:
|
case T_CON_MARK:
|
||||||
|
@ -582,7 +582,9 @@ The following attributes may be matched with:
|
|||||||
the currently focused window.
|
the currently focused window.
|
||||||
|
|
||||||
*con\_id*
|
*con\_id*
|
||||||
Compare against the internal container ID, which you can find via IPC.
|
Compare against the internal container ID, which you can find via IPC. If
|
||||||
|
value is \_\_focused\_\_, then the id must be the same as that of the
|
||||||
|
currently focused window.
|
||||||
|
|
||||||
*con\_mark*
|
*con\_mark*
|
||||||
Compare against the window marks. Can be a regular expression.
|
Compare against the window marks. Can be a regular expression.
|
||||||
|
Loading…
Reference in New Issue
Block a user