added handling for multiple res for multiple screens in special cases with multiple video cards

This commit is contained in:
inxi-svn 2010-10-08 06:05:34 +00:00
parent d2411ce973
commit 34876f7f9c

27
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.4.19 #### version: 1.4.20
#### Date: October 7 2010 #### Date: October 7 2010
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
@ -2465,11 +2465,16 @@ get_graphics_glx_data()
get_graphics_res_data() get_graphics_res_data()
{ {
eval $LOGFS eval $LOGFS
local screen_resolution='' local screen_resolution='' xdpy_data='' screens_count=0
if [[ $B_X_RUNNING == 'true' && $B_ROOT != 'true' ]];then if [[ $B_X_RUNNING == 'true' && $B_ROOT != 'true' ]];then
# Added the two ?'s , because the resolution is now reported without spaces around the 'x', as in # Added the two ?'s , because the resolution is now reported without spaces around the 'x', as in
# 1400x1050 instead of 1400 x 1050. Change as of X.org version 1.3.0 # 1400x1050 instead of 1400 x 1050. Change as of X.org version 1.3.0
xdpy_data="$( xdpyinfo )"
xdpy_count=$( grep -c 'dimensions' <<< "$xdpy_data" )
# we get a bit more info from xrandr than xdpyinfo, but xrandr fails to handle
# multiple screens from different video cards
if [[ $xdpy_count -eq 1 ]];then
screen_resolution=$( xrandr | gawk ' screen_resolution=$( xrandr | gawk '
/\*/ { /\*/ {
res[++m] = gensub(/^.* ([0-9]+) ?x ?([0-9]+)[_ ].* ([0-9\.]+)\*.*$/,"\\1x\\2@\\3hz","g",$0) res[++m] = gensub(/^.* ([0-9]+) ?x ?([0-9]+)[_ ].* ([0-9\.]+)\*.*$/,"\\1x\\2@\\3hz","g",$0)
@ -2484,11 +2489,21 @@ get_graphics_res_data()
print(line) print(line)
} }
}' ) }' )
if [[ -z $screen_resolution ]];then fi
screen_resolution=$( xdpyinfo | gawk ' if [[ -z $screen_resolution || $xdpy_count -gt 1 ]];then
screen_resolution=$( gawk '
BEGIN {
IGNORECASE=1
screens = ""
separator = ""
}
/dimensions/ { /dimensions/ {
print $2 screens = screens $2 separator
}' ) separator = ", "
}
END {
print screens
}' <<< "$xdpy_data" )
fi fi
else else
screen_resolution=$( stty -F $( readlink /proc/$PPID/fd/0 ) size | gawk '{ screen_resolution=$( stty -F $( readlink /proc/$PPID/fd/0 ) size | gawk '{