#1119967 Debian 13 Trixie: When no monitor is connected, the Xfce desktop has no icons, background image, or context menu

Package:
xfdesktop4
Source:
xfdesktop4
Description:
Xfce desktop background, icons and root menu manager
Submitter:
Logic Finity
Date:
2025-11-16 04:13:01 UTC
Severity:
normal
#1119967#5
Date:
2025-11-03 06:29:19 UTC
From:
To:
If the user runs the Xfce desktop remotely (example, using VNC) and the PC
doesn't have a monitor connected, the Xfce desktop doesn't show any icons,
background image, or a right-click menu.

This problem was found in Debian 13 Trixie.

* Steps to reproduce

  * Requirements
    - Another PC with a VNC client installed.

  * Setup (VNC server)
    - Install a VNC server: sudo apt-get install x11vnc
    - Manually run it in a console: x11vnc -display :0 -forever
    - Connect the 2nd PC's VNC client to the test PC.

  * Reproduce the bug
    - Unplug all video cables from the PC.
    - Open a console and run "xrandr" to confirm that no monitors are connected.
      - On my test PC, this is enough to eliminate the background image, desktop
icons, and right-click menu.
    - Run "xfdesktop --quit" to stop the current instance.
    - Run "xfdesktop" to start a new instance.
      - The desktop icons, background image, etc are still not loaded.

* Analysis

   - The problem occurs in xfdesktop_application_start().

         GList *monitors = xfw_screen_get_monitors(app->screen);

         for (GList *l = monitors; l != NULL; l = l->next) {
             XfwMonitor *monitor = XFW_MONITOR(l->data);
             screen_monitor_added(app->screen, monitor, app);
         }

     When a monitor is connected, xfw_screen_get_monitors() returns a list of
detected monitors. The code manually calls the handler function
screen_monitor_added(), which eventually creates an Xfce desktop for that monitor.

     But when there are NO monitors, xfw_screen_get_monitors() returns NULL, so
screen_monitor_added() is skipped. As a result, no Xfce desktop is created, no
icons, background, etc.

     Debian 12 Bookworm's xfdesktop4 (4.18.1-1)'s xfdesktop_application_start()
doesn't have this code that detects monitors and adds Xfce desktops to each
monitor. It always goes straight into creating a new Xfce desktop, even if there
are no monitors.

* Proposed solution

   - None. Based on what I've seen in xfdesktop4 4.20.1-1 in one afternoon of
code debugging, an Xfce desktop now depends on the existence of a monitor.
There's also a lot of other monitor dependent code added since 4.18.1-1. I don't
see any easy quick fix.

     The only crazy solution I can think of is for the code to provide a "fake"
or "dummy" monitor so the rest of the Xfce code can work.

     In fact I vaguely remember creating a dummy monitor in xorg.conf for VNC
purposes years ago. Maybe that's the workaround here???

#1119967#10
Date:
2025-11-03 17:30:23 UTC
From:
To:
Hey,

I'm not sure a lot of people run Xfce through VNC (or maybe other remote
desktops) but I think you should report that directly upstream (I don't have a
working remote setup so there's not much use in me doing proxy).

I would have imagined that a VNC desktop would still provide a (virtual)
monitor but I might be wrong.

In any case, feel free to open bugs on the Xfce gitlab at
https://gitlab.xfce.org

Regards,

#1119967#15
Date:
2025-11-16 04:10:19 UTC
From:
To:
As requested, I have filed the bug on the Xfce gitlab with the same info as
posted here.

https://gitlab.xfce.org/xfce/xfdesktop/-/issues/438

Regarding the VNC "virtual monitor", when I was investigating TigerVNC server,
there's a "standalone" mode where the server creates a completely virtual
desktop that can only be accessed over VNC. That might be what you're thinking
of. But the VNC mode that I'm using is what TigerVNC calls "scraping", which is
to copy images from the existing X server and transmit them to the client, thus
showing to a remote client what you're seeing on a real monitor.