diff options
| author | Chris Perl <chris.perl@gmail.com> | 2025-03-07 10:55:52 -0500 |
|---|---|---|
| committer | Simon Ser <contact@emersion.fr> | 2025-03-07 17:53:40 +0100 |
| commit | 048e304b8a54fc31b53b716538971c0c2315d4c2 (patch) | |
| tree | bda32d7e19c0662feb40f3fabdfefdd318d87369 | |
| parent | e3d9cc2aa5f1c298fd956b64e5e20f50aaac72fe (diff) | |
Remove constraint that con->view != NULL to use __focused__ criteria
To use something like:
[con_id=__focused__] mark --add --toggle foo
The container must currently have a view. However, it is possible to
focus parent containers that do not have a view. For example, via:
focus parent
Since containers without views can be the focused (meaning the container
is marked "focused": true in the output of: swaymsg -t get_tree), it
seems reasonable that a view is not required to target a container via
__focused__.
| -rw-r--r-- | sway/criteria.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sway/criteria.c b/sway/criteria.c index 0aefa008..29f73f69 100644 --- a/sway/criteria.c +++ b/sway/criteria.c @@ -630,8 +630,7 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) { if (strcmp(value, "__focused__") == 0) { struct sway_seat *seat = input_manager_current_seat(); struct sway_container *focus = seat_get_focused_container(seat); - struct sway_view *view = focus ? focus->view : NULL; - criteria->con_id = view ? view->container->node.id : 0; + criteria->con_id = focus ? focus->node.id : 0; } else { criteria->con_id = strtoul(value, &endptr, 10); if (*endptr != 0) { |
