levnikmyskin / hyprland-virtual-desktops

A plugin for the Hyprland compositor, implementing virtual-desktop functionality.
BSD 3-Clause "New" or "Revised" License
102 stars 9 forks source link

disconnecting a monitor behavior #11

Closed LaptopDev closed 8 months ago

LaptopDev commented 8 months ago

Many clients are not visible or accessible after disconnecting a secondary monitor in a 2-monitor > 1-monitor-configuration change.

As an example, when I move a client to workspace 2 on vdesk 1, and disconnect my monitor, the only way to retrieve the client on the now blank screen is with a dispatcher and/or custom hook script. With the secondary monitor disconnected, I hoped this plugin would move workspace-affected existing clients to accessible workspaces, which, for a monitor count of 1 I gather is any odd numbered hyprland workspace: 1,3,5,7,9 (accessible through switching to vdesks 1,2,3,4, and 5, respectively). It would be very helpful for the behavior of preserving workspace-affected clients by moving them to these single-monitor-setup-accessible workspaces to be implemented, possibly byway of a new rememberlayout parameter which enables this behavior when there is only a single monitor connected.

levnikmyskin commented 8 months ago

Hey, thank you for your report. Could you:

  1. Provide simple instructions to reproduce this;
  2. When this happens open a terminal and post here the output of hyprctl workspaces and hyprctl clients;
  3. Run hyprctl dispatch vdeskreset. Does this solve your issue?
LaptopDev commented 8 months ago
Summary Before writing this and getting to this point, I first tried `hyprctl dispatch vdesk reset`, which didn't fix anything, because I entered the command incorrectly. (Correctly) Entering `hyprctl dispatch vdeskreset` practically resolves the issue.
    1. I load into my hyprland desktop environment with both monitors connected.
    2. I open firefox to this issue on workspace 1 (screen 1 on vdesk 1).
    3. I move to workspace 2 (screen 2 on vdesk 1) and open terminal.
    4. I execute hyprctl workspaces:
    workspace ID 1 (1) on monitor eDP-1:
    monitorID: 0
    windows: 2
    hasfullscreen: 0
    lastwindow: 0x2b045a0
    lastwindowtitle: Terminal
    
    workspace ID 2 (2) on monitor DP-1:
    monitorID: 1
    windows: 1
    hasfullscreen: 0
    lastwindow: 0x2b08970
    lastwindowtitle: Terminal
    1. I execute hyprctl clients:
      
      Window 2b08970 -> Terminal:
      mapped: 1
      hidden: 0
      at: 1549,13
      size: 1893,1053
      workspace: 2 (2)
      floating: 0
      monitor: 1
      class: gnome-terminal-server
      title: Terminal
      initialClass: gnome-terminal-server
      initialTitle: Terminal
      pid: 105865
      xwayland: 0
      pinned: 0
      fullscreen: 0
      fullscreenmode: 0
      fakefullscreen: 0
      grouped: 0
      swallowing: 0
      focusHistoryID: 2

    Window 28fdb90 -> disconnecting a monitor behavior · Issue #11 · levnikmyskin/hyprland-virtual-desktops — Mozilla Firefox: mapped: 1 hidden: 0 at: 13,13 size: 747,934 workspace: 1 (1) floating: 0 monitor: 0 class: firefox title: disconnecting a monitor behavior · Issue #11 · levnikmyskin/hyprland-virtual-desktops — Mozilla Firefox initialClass: firefox initialTitle: Mozilla Firefox pid: 104792 xwayland: 0 pinned: 0 fullscreen: 0 fullscreenmode: 0 fakefullscreen: 0 grouped: 0 swallowing: 0 focusHistoryID: 1

    Window 2b045a0 -> Terminal: mapped: 1 hidden: 0 at: 776,13 size: 747,934 workspace: 1 (1) floating: 0 monitor: 0 class: gnome-terminal-server title: Terminal initialClass: gnome-terminal-server initialTitle: Terminal pid: 105865 xwayland: 0 pinned: 0 fullscreen: 0 fullscreenmode: 0 fakefullscreen: 0 grouped: 0 swallowing: 0 focusHistoryID: 0

    6. I disconnect my secondary display (DP-1) displaying a terminal client through workspace 2.
    7. After my laptop screen returns from a quick black screen, I run `hyprctl workspaces` again (at this point my terminal client from workspace 2 has been disappeared):

    workspace ID 1 (1) on monitor eDP-1: monitorID: 0 windows: 2 hasfullscreen: 0 lastwindow: 0x2b045a0 lastwindowtitle: Terminal — wl-copy

    workspace ID 2 (2) on monitor eDP-1: monitorID: 0 windows: 1 hasfullscreen: 0 lastwindow: 0x2b08970 lastwindowtitle: Terminal

    8. And I run `hyprctl clients` again:

    Window 2b08970 -> Terminal: mapped: 1 hidden: 0 at: 13,13 size: 1510,934 workspace: 2 (2) floating: 0 monitor: 0 class: gnome-terminal-server title: Terminal initialClass: gnome-terminal-server initialTitle: Terminal pid: 105865 xwayland: 0 pinned: 0 fullscreen: 0 fullscreenmode: 0 fakefullscreen: 0 grouped: 0 swallowing: 0 focusHistoryID: 2

    Window 28fdb90 -> disconnecting a monitor behavior · Issue #11 · levnikmyskin/hyprland-virtual-desktops — Mozilla Firefox: mapped: 1 hidden: 0 at: 13,13 size: 747,934 workspace: 1 (1) floating: 0 monitor: 0 class: firefox title: disconnecting a monitor behavior · Issue #11 · levnikmyskin/hyprland-virtual-desktops — Mozilla Firefox initialClass: firefox initialTitle: Mozilla Firefox pid: 104792 xwayland: 0 pinned: 0 fullscreen: 0 fullscreenmode: 0 fakefullscreen: 0 grouped: 0 swallowing: 0 focusHistoryID: 1

    Window 2b045a0 -> Terminal — wl-copy: mapped: 1 hidden: 0 at: 776,13 size: 747,934 workspace: 1 (1) floating: 0 monitor: 0 class: gnome-terminal-server title: Terminal — wl-copy initialClass: gnome-terminal-server initialTitle: Terminal pid: 105865 xwayland: 0 pinned: 0 fullscreen: 0 fullscreenmode: 0 fakefullscreen: 0 grouped: 0 swallowing: 0 focusHistoryID: 0

    
    9. I run `hyprctl dispatch vdeskreset`, and can access the terminal client on workspace 3 on vdesk2, as expected.

Thank you

LaptopDev commented 8 months ago

The issue is practically resolved, however, I still think it would be pragmatic to implement this behavior automatically, maybe through a plugin configuration setting.