#1009850 Hide .desktop menu item in X-only desktops (e.g. XFCE4)?

Package:
foot
Source:
foot
Description:
Fast, lightweight and minimalistic Wayland terminal emulator
Submitter:
"Trent W. Buck"
Date:
2022-04-19 05:30:03 UTC
Severity:
wishlist
#1009850#5
Date:
2022-04-19 05:27:22 UTC
From:
To:
XFCE 4.16 (Debian 11) doesn't support Wayland apps.
However, foot still appears in its menu.
When clicking the menu, there is no user-visible impact of an error.
This appears in .xsession-errors:

    info: main.c:356: version: 1.6.4 +ime
    info: main.c:363: arch: x86_64/64-bit
    info: main.c:367: locale: en_AU.UTF-8
     err: config.c:2109: no configuration found, using defaults
     err: wayland.c:1111: failed to connect to wayland; no compositor running?
    info: main.c:523: goodbye


Can you make the menu item only appear where it will work (e.g. whitelist/blacklist named desktop environments)?

Obviously you cannot pop up an X11 error message -- you don't want to implement X at all.
However, at least XFCE (usually) accepts XDG notify events.
So you could send a notification message to cause an error popup, e.g.

    Wayland environment not found.  Is your desktop X11-only?