Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible regression in 1.9 -> 1.10: Node order incorrect in .focus tree attribute #8543

Open
Lcchy opened this issue Jan 23, 2025 · 1 comment
Labels
bug Not working as intended

Comments

@Lcchy
Copy link

Lcchy commented Jan 23, 2025

  • Sway Version:
    1.10

Hi, I recently came across an odd behavior of the swaymsg -t get_tree output tree, since 1.10.

The focus array attribute of nodes does not guarantee the order of nodes anymore, it does not seem to be updated when moving a window between containers.

I have created a minimal reproduction.
The idea is to create 2 containers (i.e. windows with a split) and move a third window between them.
After the move, the focus array of the containers does not get updated.
See the output of bug.sh.

I also ran a git bisect and found the cause to be 5e18ed3

Reverting this commit solves the issue for me but I am not sure of other consequences it has.

Minimal reproduction:

# sway.conf
exec ./layout.sh
#layout.sh
#!/usr/bin/env bash

foot &
foot &
sleep 0.5

swaymsg focus left
swaymsg splith
swaymsg focus right
swaymsg splith

foot bash -c "sleep 2; ./bug.sh; bash" &
# bug.sh
#!/usr/bin/env bash

swaymsg focus left
swaymsg "move left"

gp=$(swaymsg -t get_tree | jq -r '.. | select(.id? == 4) | "\(.id) \(.focus)"')
echo "Container id, Focus array ${gp}"
echo "This order is incorrect"

echo "Switching to workspace 2 and back to 1 - in order to update order. This shouldn't have any effect on the focus array."
swaymsg 'workspace number 1; workspace number 2; workspace number 1'

gp=$(swaymsg -t get_tree | jq -r '.. | select(.id? == 4) | "\(.id) \(.focus)"')
echo "Container id, Focus array ${gp}"
echo "It does! Now the order is correct"
@Lcchy Lcchy added the bug Not working as intended label Jan 23, 2025
@Lcchy Lcchy changed the title Possible regression in 1.9 -> 1.10: Node order not preserved in .focus tree attribute Possible regression in 1.9 -> 1.10: Node order incorrect in .focus tree attribute Jan 23, 2025
@emersion
Copy link
Member

cc @rpigott

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Development

No branches or pull requests

2 participants