Merge pull request #212 from dylanaraps/de_detection

Better DE detection.
This commit is contained in:
Dylan Araps 2016-04-02 09:33:25 +11:00
commit 19bab6499d
2 changed files with 33 additions and 4 deletions

9
1.7.md
View file

@ -1 +1,10 @@
# Neofetch 1.7 # Neofetch 1.7
### Contributers
### Info
**Desktop Environment**<br \>
- [ Linux ] Fallback to using `xprop` if `$XDG_CURRENT_DESKTOP` is empty.
- Use `$de` instead of `$XDG_CURRENT_DESKTOP` for wallpaper and theme detection.

View file

@ -775,8 +775,23 @@ getshell () {
getde () { getde () {
case "$os" in case "$os" in
"Mac OS X") de="Aqua" ;; "Mac OS X") de="Aqua" ;;
*) de="${XDG_CURRENT_DESKTOP/i3}" ;; *)
de="${XDG_CURRENT_DESKTOP/i3}"
de=${de/'X-'}
;;
esac esac
if [ -z "$de" ]; then
de="$(xprop -root | awk '/KDE_SESSION_VERSION|^_MARCO|^_MUFFIN|xfce4|xfce5/')"
case "$de" in
"KDE_SESSION_VERSION"*) de="KDE${de/* = }" ;;
*"MUFFIN"*) de="Cinnamon" ;;
*"MARCO"*) de="MATE" ;;
*"xfce4"*) de="XFCE4" ;;
*"xfce5"*) de="XFCE5" ;;
esac
fi
} }
# }}} # }}}
@ -1416,8 +1431,10 @@ getstyle () {
esac esac
if [ -n "$DISPLAY" ] && [ "$os" != "Mac OS X" ]; then if [ -n "$DISPLAY" ] && [ "$os" != "Mac OS X" ]; then
# Current DE # Get DE if user has disabled the function.
case "$XDG_CURRENT_DESKTOP" in [ -z "$de" ] && getde
case "$de" in
"KDE"*) "KDE"*)
kdeconfigdir kdeconfigdir
@ -1855,7 +1872,10 @@ getwallpaper () {
img="$(awk -F'=' '/file/ {printf $2;exit;}' "$XDG_CONFIG_HOME/nitrogen/bg-saved.cfg")" img="$(awk -F'=' '/file/ {printf $2;exit;}' "$XDG_CONFIG_HOME/nitrogen/bg-saved.cfg")"
elif type -p gsettings >/dev/null 2>&1; then elif type -p gsettings >/dev/null 2>&1; then
case "$XDG_CURRENT_DESKTOP" in # Get DE if user has disabled the function.
[ -z "$de" ] && getde
case "$de" in
"MATE"*) img="$(gsettings get org.mate.background picture-filename 2>/dev/null)" ;; "MATE"*) img="$(gsettings get org.mate.background picture-filename 2>/dev/null)" ;;
*) img="$(gsettings get org.gnome.desktop.background picture-uri 2>/dev/null)" ;; *) img="$(gsettings get org.gnome.desktop.background picture-uri 2>/dev/null)" ;;
esac esac