python get desktop environment code example Example: python get desktop environment import os os.environ.get('DESKTOP_SESSION') # OUTPUT # 'gnome'