How can I get to know what my desktop environment is using Python? I like the result to be gnome or KDE or else.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Tested in Ubuntu 9.10:
Edit 2: As comments say, this is beginning to be even less reliable with newer GNOME versions. I’m now also running Ubuntu 18.04, and it returns ‘ubuntu’ instead of the prior ‘gnome’.
Edit 1: As mentioned in comments below, this approach will not work for more some OSes. The other two answers provide workarounds.