lxqt / lxqt-panel

The LXQt desktop panel
https://lxqt-project.org
GNU Lesser General Public License v2.1
180 stars 135 forks source link

Settings not applied for dual monitor setup under wayland #2073

Open stefonarch opened 3 months ago

stefonarch commented 3 months ago

The configuration shows all options for positioning, but only the resolution is applied and the panel stays on the first monitor. Desktop has the same issue as can be seen here. Note: the screenshot shows what can be seen on the main monitor - "monitor 1" and the resolution of the second monitor is less.

immagine

If changing the monitor where it should appear and restarting the panel the settings will be applied correctly.

If disconnecting the monitor with a panel on it this will not be moved automatically to the other monitor, panel module restart is needed too.

Expected Behavior

Apply setting on the fly

Current Behavior

Restarting is needed under wayland.

  1. Assign a monitor to a panel in a dual monitor setup
  2. See dimension changed but not placement
  3. Restart panel module

Possible solution

tsujan commented 3 months ago

As Qt can't get window positions under Wayland, it can't get screen positions either. Nothing can be done about this with Qt methods unless Qt-Wayland devs enhance them.

stefonarch commented 3 months ago

The panel gets positioned by anchors with layer-shell-qt - the only issue here is that a panel restart is needed to apply settings.

stefonarch commented 1 month ago

This happens also when adding a new panel on monitor2: it appears on monitor 1, and will be moved only to monitor 2 when restarting the panel module. So it looks just impossible to add a panel on a second monitor if this it not known or fixed.

Same when disconnecting a monitor: its panel disappears and will be moved to the remaining monitor only after restarting panel or session.

marcusbritanicus commented 1 month ago

As Qt can't get window positions under Wayland, it can't get screen positions either. Nothing can be done about this with Qt methods unless Qt-Wayland devs enhance them.

Qt also cannot do anything about this. This information needs to be given by the compositor. But wayland is built for security and so compositors are not required to share with you the available geometry or window positions. So, Qt will not get this information from anywhere.

The panel gets positioned by anchors with layer-shell-qt - the only issue here is that a panel restart is needed to apply settings.

If I am correct, I think all layer-shell-qt can be applied without explicit restart. Which setting exactly is causing the problem?

stefonarch commented 1 month ago

As I said: the new panel knows well about it's resolution (the one from the second monitor) but can't position itself there without restarting. The setting would be desktop=1 in panel.conf under [panel id] for a new panel on the second monitor.

Restart automatically panel process when adding or moving a panel under wayland would be enough. On monitor disconnect/connect the same.

marcusbritanicus commented 1 month ago

Restart automatically panel process when adding or moving a panel under wayland would be enough. On monitor disconnect/connect the same.

I think just destroying the existing layer-surface, and creating a new one with new output should automatically move the panel to the new output. I will be busy till Tuesday. I will do a few tests on Wayfire and ping back here.

PS: If I am not making sense, then I have not understood the question and please ignore me.

stefonarch commented 1 month ago

I think just destroying the existing layer-surface, and creating a new one with new output should automatically move the panel to the new output.

Basically that is was happens when reconnecting it, so yes, I think you're right.

stefonarch commented 1 week ago

I've found a workaround in kanshi for both panel and desktop (which under some circumstances needs a restart too). reload-module :

#!/bin/bash
qdbus org.lxqt.session /LXQtSession org.lxqt.session.stopModule lxqt-"$1".desktop
sleep 0.1
qdbus org.lxqt.session /LXQtSession org.lxqt.session.startModule lxqt-"$1".desktop

~/.config/kanshi/config for every profile:

profile foo {
    output eDP-1 {
    enable
    ....
    }
    exec sleep 1 && restart-module desktop
    exec sleep 1 && restart-module panel
}

sleep is only needed when plugging it in/out, otherwise not.