Skip to content

On output detach/reattach, workspaces do not return to their original output #9057

@andrewla

Description

@andrewla

Description

Expected Behavior

When outputs are removed and re-added in a few scenarios:

  • When returning to a login manager (observed with lightdm) with multiple monitors
  • When removing an external monitor for a laptop
  • When switching to a virtual terminal via ctrl-alt- and returning with multiple monitors
  • (for repro purposes) when disabling and re-enabling a display through sway

You would expect workspaces that had been assigned to the previous output to return to that output. Practically, for the case of a login manager, this means on switching users, all workspaces should return to the outputs that they had been assigned to before the switch.

Actual Behavior

In these scenarios, all workspaces return to the primary output and have to be moved back to the outputs.

Simple Repro

Start sway with the wayland backend:

WL_BACKENDS=wayland WLR_WL_OUTPUTS=2 sway &                
INNER_DISPLAY=wayland-2
INNER_SWAYSOCK=$(ls $XDG_RUNTIME_DIR/*.sock | tail -1)
WAYLAND_DISPLAY=$INNER_DISPLAY foot &                      
WAYLAND_DISPLAY=$INNER_DISPLAY foot &                  
SWAYSOCK=$INNER_SWAYSOCK swaymsg move container to workspace 2
SWAYSOCK=$INNER_SWAYSOCK swaymsg -t get_tree
SWAYSOCK=$INNER_SWAYSOCK swaymsg output WL-2 disable                          
SWAYSOCK=$INNER_SWAYSOCK swaymsg output WL-2 enable                          
SWAYSOCK=$INNER_SWAYSOCK swaymsg -t get_tree       

The output of the first get_tree will show something like

#1: root "root"
  #4: output "WL-2"
    #5: workspace "1"
      #7: con "" (xdg_shell, pid: 63931, app_id: "foot", foreign_toplevel_id: "...")
  #3: output "WL-1"
    #6: workspace "2"
      #8: con "" (xdg_shell, pid: 63954, app_id: "foot", foreign_toplevel_id: "...")

And the second will show

#1: root "root"
  #3: output "WL-1"
    #5: workspace "1"
      #7: con "" (xdg_shell, pid: 63931, app_id: "foot", foreign_toplevel_id: "...")
    #6: workspace "2"
      #8: con "" (xdg_shell, pid: 63954, app_id: "foot", foreign_toplevel_id: "...")
  #4: output "WL-2"
    #6: workspace "3"

Showing that WL-2 has been reprovisioned with an empty workspace, and workspaces 1 & 2 are assigned to output WL-1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions