Let's assume we have a computer with Ubuntu Desktop installed on it. There are a few desktop environments (DE) installed such as: Unity, Gnome, KDE, XFCE, Mate, etc.
Also few users have their accounts and they regularly using the computer. Each user could change its DE according to its free will 🙂
How to determinate which is the current user's desktop environment, for certain user, through CLI within limited environment?
This question could be fragmented in this way:
-
In which file is stored this information?
-
What is the best way to read it through a script executed within an limited environment such as
ssh
session orcron
? -
How to read this information for random user?
-
I'm finding for one line command solution if it is possible.
Best Answer
Finally, I've managed to create script, that has 100% success with several dozen attempts within 13 different desktop environments.
The script analysis the content of each
/proc/$PID/envion
file of the subject user and determine which is its current desktop environment.Usage:
More results:
:)