Proper DE detection is available in upstream:
http://cgit.freedesktop.org/xdg/xdg-utils/tree/scripts/xdg-utils-common.in#n248
Proper DE detection is available in upstream:
http:// cgit.freedeskto p.org/xdg/ xdg-utils/ tree/scripts/ xdg-utils- common. in#n248