This commit is contained in:
inxi-svn 2011-05-19 06:58:31 +00:00
parent 58fccc20a1
commit 4759c85833

124
inxi
View file

@ -2602,74 +2602,76 @@ detect_desktop_environment()
fi fi
desktop_environment="KDE $version" desktop_environment="KDE $version"
# note: fluxbox has a positive PID for blackbox, so I think most desktops can be detected # note: fluxbox has a positive PID for blackbox, so I think most desktops can be detected
# with some work. # with some work
elif [[ -n $( type -p xprop ) ]];then else
xprop_root="$( xprop -root 2>/dev/null )"
ps_aux="$( ps aux )" ps_aux="$( ps aux )"
if [[ -n $( grep -Eis '\"xfce4\"' <<< "$xprop_root" ) ]];then if [[ -n $( type -p xprop ) ]];then
version=$( xfdesktop --version 2>/dev/null | grep -Eosi 'xfdesktop version [0-9\.]+' | gawk '{print $3}' ) xprop_root="$( xprop -root 2>/dev/null )"
if [[ -n $version ]];then if [[ -n $( grep -Eis '\"xfce4\"' <<< "$xprop_root" ) ]];then
version=" $version" version=$( xfdesktop --version 2>/dev/null | grep -Eosi 'xfdesktop version [0-9\.]+' | gawk '{print $3}' )
else if [[ -n $version ]];then
version="4" version=" $version"
fi else
desktop_environment="Xfce${version}" version="4"
elif [[ -n $( grep -is '\"xfce5\"' <<< "$xprop_root" ) ]];then fi
version=$( xfdesktop --version 2>/dev/null | grep -Eosi 'xfdesktop version [0-9\.]+' | gawk '{print $3}' ) desktop_environment="Xfce${version}"
if [[ -n $version ]];then elif [[ -n $( grep -is '\"xfce5\"' <<< "$xprop_root" ) ]];then
version=" $version" version=$( xfdesktop --version 2>/dev/null | grep -Eosi 'xfdesktop version [0-9\.]+' | gawk '{print $3}' )
else if [[ -n $version ]];then
version="5" version=" $version"
fi else
desktop_environment="Xfce${version}" version="5"
elif [[ -n $( grep -is 'BLACKBOX_PID' <<< "$xprop_root" ) ]];then fi
if [[ -n $( grep -is 'fluxbox' <<< "$ps_aux" | grep -v 'grep' ) ]];then desktop_environment="Xfce${version}"
version=$( fluxbox --version 2>/dev/null | grep -Esi 'fluxbox [[:digit:]]' | gawk '{print $2}' ) elif [[ -n $( grep -is 'BLACKBOX_PID' <<< "$xprop_root" ) ]];then
if [[ -n $( grep -is 'fluxbox' <<< "$ps_aux" | grep -v 'grep' ) ]];then
version=$( fluxbox --version 2>/dev/null | grep -Esi 'fluxbox [[:digit:]]' | gawk '{print $2}' )
if [[ -n $version ]];then
version=" $version"
fi
desktop_environment="Fluxbox${version}"
else
desktop_environment='Blackbox'
fi
elif [[ -n $( grep -is 'OPENBOX_PID' <<< "$xprop_root" ) ]];then
version=$( openbox --version 2>/dev/null | grep -Esi 'openbox [[:digit:]]' | gawk '{print $2}' )
if [[ -n $version ]];then if [[ -n $version ]];then
version=" $version" version=" $version"
fi fi
desktop_environment="Fluxbox${version}" if [[ -n $( grep -is 'lxde' <<< "$ps_aux" | grep -v 'grep' ) ]];then
else if [[ -n $version ]];then
desktop_environment='Blackbox' version=" (Openbox $version)"
fi fi
elif [[ -n $( grep -is 'OPENBOX_PID' <<< "$xprop_root" ) ]];then desktop_environment="LXDE${version}"
version=$( openbox --version 2>/dev/null | grep -Esi 'openbox [[:digit:]]' | gawk '{print $2}' ) else
if [[ -n $version ]];then desktop_environment="Openbox${version}"
version=" $version"
fi
if [[ -n $( grep -is 'lxde' <<< "$ps_aux" | grep -v 'grep' ) ]];then
if [[ -n $version ]];then
version=" (Openbox $version)"
fi fi
desktop_environment="LXDE${version}" elif [[ -n $( grep -is 'ICEWM' <<< "$xprop_root" ) ]];then
else version=$( icewm --version 2>/dev/null | grep -Esi 'iceWM [[:digit:]]' | gawk '{gsub(/,/, ""); print $2}' )
desktop_environment="Openbox${version}" if [[ -n $version ]];then
version=" $version"
fi
desktop_environment="IceWM${version}"
fi fi
elif [[ -n $( grep -is 'ICEWM' <<< "$xprop_root" ) ]];then # a few manual hacks for things that don't id with xprop, these are just good guesses
version=$( icewm --version 2>/dev/null | grep -Esi 'iceWM [[:digit:]]' | gawk '{gsub(/,/, ""); print $2}' ) else
if [[ -n $version ]];then if [[ -n $( grep -is 'fvwm-crystal' <<< "$ps_aux" | grep -v 'grep' ) ]];then
version=" $version" version=$( fvwm --version 2>/dev/null | grep -Esi 'fvwm [[:digit:]]' | gawk '{print $2}' )
if [[ -n $version ]];then
version=" $version"
fi
desktop_environment="FVWM-Crystal${version}"
elif [[ -n $( grep -is 'fvwm' <<< "$ps_aux" | grep -v 'grep' ) ]];then
version=$( fvwm --version 2>/dev/null | grep -Esi 'fvwm [[:digit:]]' | gawk '{print $2}' )
if [[ -n $version ]];then
version=" $version"
fi
desktop_environment="FVWM${version}"
elif [[ -n $( grep -is 'pekwm' <<< "$ps_aux" | grep -v 'grep' ) ]];then
desktop_environment='pekwm'
elif [[ -n $( grep -is 'awesome' <<< "$ps_aux" | grep -v 'grep' ) ]];then
desktop_environment='Awesome'
fi fi
desktop_environment="IceWM${version}"
fi
# a few manual hacks for things that don't id with xprop, these are just good guesses
else
if [[ -n $( grep -is 'fvwm-crystal' <<< "$ps_aux" | grep -v 'grep' ) ]];then
version=$( fvwm --version 2>/dev/null | grep -Esi 'fvwm [[:digit:]]' | gawk '{print $2}' )
if [[ -n $version ]];then
version=" $version"
fi
desktop_environment="FVWM-Crystal${version}"
elif [[ -n $( grep -is 'fvwm' <<< "$ps_aux" | grep -v 'grep' ) ]];then
version=$( fvwm --version 2>/dev/null | grep -Esi 'fvwm [[:digit:]]' | gawk '{print $2}' )
if [[ -n $version ]];then
version=" $version"
fi
desktop_environment="FVWM${version}"
elif [[ -n $( grep -is 'pekwm' <<< "$ps_aux" | grep -v 'grep' ) ]];then
desktop_environment='pekwm'
elif [[ -n $( grep -is 'awesome' <<< "$ps_aux" | grep -v 'grep' ) ]];then
desktop_environment='Awesome'
fi fi
fi fi
echo $desktop_environment echo $desktop_environment