diff --git a/inxi b/inxi index 4926fe0..78c484c 100755 --- a/inxi +++ b/inxi @@ -2857,15 +2857,24 @@ get_desktop_environment() # args: $1 - desktop command for --version; $2 - search string; $3 - gawk print number get_de_version() { - local version='' get_version='--version' + local version_data='' version='' get_version='--version' case $1 in dwm|wmii) get_version='-v' ;; esac + # note, some wm send version info to stderr instead of stdout + case $1 in + dwm|scrotwm) + version_data="$( $1 $get_version )" + ;; + *) + version_data="$( $1 $get_version 2>/dev/null )" + ;; + esac - version=$( $1 $get_version 2>/dev/null | gawk ' + version=$( gawk ' BEGIN { IGNORECASE=1 } @@ -2875,7 +2884,7 @@ get_de_version() gsub(/(,|dwm-|wmii-|v|V)/, "",$'$3') print $'$3' exit # quit after first match prints - }' ) + }' <<< "$version_data" ) echo $version }