From 4759c8583304874ee46348da7cbb8fb0680361cf Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Thu, 19 May 2011 06:58:31 +0000 Subject: [PATCH] bug fix --- inxi | 124 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 63 insertions(+), 61 deletions(-) diff --git a/inxi b/inxi index 91191af..62a91f6 100755 --- a/inxi +++ b/inxi @@ -2602,74 +2602,76 @@ detect_desktop_environment() fi desktop_environment="KDE $version" # note: fluxbox has a positive PID for blackbox, so I think most desktops can be detected - # with some work. - elif [[ -n $( type -p xprop ) ]];then - xprop_root="$( xprop -root 2>/dev/null )" + # with some work + else ps_aux="$( ps aux )" - if [[ -n $( grep -Eis '\"xfce4\"' <<< "$xprop_root" ) ]];then - version=$( xfdesktop --version 2>/dev/null | grep -Eosi 'xfdesktop version [0-9\.]+' | gawk '{print $3}' ) - if [[ -n $version ]];then - version=" $version" - else - version="4" - fi - desktop_environment="Xfce${version}" - elif [[ -n $( grep -is '\"xfce5\"' <<< "$xprop_root" ) ]];then - version=$( xfdesktop --version 2>/dev/null | grep -Eosi 'xfdesktop version [0-9\.]+' | gawk '{print $3}' ) - if [[ -n $version ]];then - version=" $version" - else - version="5" - fi - desktop_environment="Xfce${version}" - 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 $( type -p xprop ) ]];then + xprop_root="$( xprop -root 2>/dev/null )" + if [[ -n $( grep -Eis '\"xfce4\"' <<< "$xprop_root" ) ]];then + version=$( xfdesktop --version 2>/dev/null | grep -Eosi 'xfdesktop version [0-9\.]+' | gawk '{print $3}' ) + if [[ -n $version ]];then + version=" $version" + else + version="4" + fi + desktop_environment="Xfce${version}" + elif [[ -n $( grep -is '\"xfce5\"' <<< "$xprop_root" ) ]];then + version=$( xfdesktop --version 2>/dev/null | grep -Eosi 'xfdesktop version [0-9\.]+' | gawk '{print $3}' ) + if [[ -n $version ]];then + version=" $version" + else + version="5" + fi + desktop_environment="Xfce${version}" + 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 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 - version=" $version" - fi - if [[ -n $( grep -is 'lxde' <<< "$ps_aux" | grep -v 'grep' ) ]];then - if [[ -n $version ]];then - version=" (Openbox $version)" + if [[ -n $( grep -is 'lxde' <<< "$ps_aux" | grep -v 'grep' ) ]];then + if [[ -n $version ]];then + version=" (Openbox $version)" + fi + desktop_environment="LXDE${version}" + else + desktop_environment="Openbox${version}" fi - desktop_environment="LXDE${version}" - else - desktop_environment="Openbox${version}" + elif [[ -n $( grep -is 'ICEWM' <<< "$xprop_root" ) ]];then + version=$( icewm --version 2>/dev/null | grep -Esi 'iceWM [[:digit:]]' | gawk '{gsub(/,/, ""); print $2}' ) + if [[ -n $version ]];then + version=" $version" + fi + desktop_environment="IceWM${version}" fi - elif [[ -n $( grep -is 'ICEWM' <<< "$xprop_root" ) ]];then - version=$( icewm --version 2>/dev/null | grep -Esi 'iceWM [[:digit:]]' | gawk '{gsub(/,/, ""); print $2}' ) - if [[ -n $version ]];then - version=" $version" + # 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 - 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 echo $desktop_environment