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.

  • Is it though a SSH tunnel? How about checking the x server environment variables?
    – user.dz
    Apr 11 '20 at 11:25
  • @user.dz: Thank you, to my understanding that requires an extra, non-portable script in the beginning.
    – false
    Apr 11 '20 at 11:29
  • It seems to me quite not obvious, How can X11 server, at display level, show info about another separate part of the X system. Display Manager (DM) is seen only as root window with respect to X server. Instead of xdpyinfo see with xwininfo -root witch is a command to show information about windows. Look for _NET_SUPPORTING_WM_CHECK in root window Then _NET_WM_NAME for that child window. If they are set with Unity. Ref: specifications.freedesktop.org/wm-spec/latest/…
    – user.dz
    Apr 11 '20 at 15:53
  • 1
    @user.dz: In the olden tymes, the vendor information was an excellent hint.
    – false
    Apr 11 '20 at 16:05
  • 1
    I am not certain if @user.dz "x server environment variables" refer to the same as I posted in an answer. And in that case, I am not certain why that won't be useful for you. Perhaps you could be more specific about what broke, and what upgrade led to that. Apr 13 '20 at 14:34

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

ps -ef | grep -i unity

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.