I have a legacy program (since 1992) on a dedicated remote machine as an X-client that while starting up tries to fix all kinds of oddities using xmodmap
and the like. Starting with 18.04 I note that many of these fixes no longer work.
How can (or should) the X-client detect that unity is running on the X-server? Or, to put it differently: What information does unity offer to X-clients beyond xdpyinfo and the like?
The connecting X-servers are more than 50 of various configurations (XQuartz, Ubuntu, Cygwin, and many Linuxes I never heard of before). They connect indirectly to the X-client otherwise known as a server.
Note that you may have more than one session manager available at your server. See e.g. https://unix.stackexchange.com/questions/288545/handling-multiple-window-managers-multiple-xsessionrc-files . I am not certain if any combination of session managers provides a stable ecosystem, though. I have even seen mixed comments about having 2 different session managers running at the same time in different clients, although I never tried it myself.
So I am not certain if you want to check whether unity is available, it is currently running, or if the session you are connecting to is managed by unity.
You could start checking the values of a few environment variables. E.g.,
XDG_CURRENT_DESKTOP
,GDMSESSION
,DESKTOP_SESSION
.I guess you are not interested in the output of