The title is quite exhaustive: is there a way to retrieve the desktop environment name (e.g. Gnome, Unity, XFCE, LXDE, KDE...) from the command line or using Python?
Is there a way to retrieve the name of the Desktop Environment?
command line;desktop environment
In a Terminal input:echo $DESKTOP_SESSION if it does not help (it may be equal 'default'), tryecho $XDG_CURRENT_DESKTOP