sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit 048e304b8a54fc31b53b716538971c0c2315d4c2
parent e3d9cc2aa5f1c298fd956b64e5e20f50aaac72fe
Author: Chris Perl <chris.perl@gmail.com>
Date:   Fri,  7 Mar 2025 10:55:52 -0500

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__.

Diffstat:
Msway/criteria.c | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git 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) {