[Bug] wlr-resize-watcher not attaching to new (restarted) wayland sessions

Summary

The static systemd user service for wlr-resize-watcher does not restart when the LxQT session is logged out. It keeps running instead, but does not attach to the new session. Running loginctl terminate-user user instead works as intended, so it is probably a LXQt bug not to close the systemd session properly.

Whonix version

Whonix 18 variants KVM and Virtualbox were tested. Other graphical variants might be affected.

Affected components

Whonix-Workstation with LXQt. Gateway might be affected, if dynamic resolution is disabled.

Steps to reproduce

  1. (Virtualbox only) Set the machine view to scaled. Otherwise no resolution change might be triggered.
  2. Boot a user session, because LXQt logout is not possible within sysmaint.
  3. Login to the initial user session via autologin or user/password.
  4. Logout via LXQt menu dialog.
  5. Relogin.

Actual Results

  1. The resolution will resize unexpectedly afer relogin.
  2. ps aux | grep wlr-resize-watcher as well as systemctl --user status wlr-resize-watcher indicate the service being running.
  3. The running instance does not prevent resolution changes, because it is attached to the wrong session.

Expected Results

A new instance of wlr-resize-watcher should run and attache to the new session, when greetd spawns a new one.

Context

Relogin, for instance to update environment variables triggers this bug for users in regular use.

Workaround

A temporary workaround for the LXQt bug not closing the systemd session properly is to create a desktop file in /etc/xdg/autostart. The downside is, that it can be disabled by the user. On the other hand the user already has permissions to stop it, so this should be of minor concern.

#/etc/xdg/autostart/wlr-resize-watcher.desktop
[Desktop Entry]
Name=Wlr Resize Watcher
Comment=Watches for and prevents resolution changes.
Type=Application
Terminal=false
## Hardcoded "sleep 3". Otherwise the desktop environment is not fully initialized,
## which results in the window being slightly outside the visible area.
Exec=bash -c "sleep 3 && /usr/bin/wlr-resize-watcher"

Result:

The user service will fail to start with the current setup, but the resize-watcher runs reliably.