mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
added handling for multiple res for multiple screens in special cases with multiple video cards
This commit is contained in:
parent
d2411ce973
commit
34876f7f9c
53
inxi
53
inxi
|
@ -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,31 +2465,46 @@ 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
|
||||||
screen_resolution=$( xrandr | gawk '
|
xdpy_data="$( xdpyinfo )"
|
||||||
/\*/ {
|
xdpy_count=$( grep -c 'dimensions' <<< "$xdpy_data" )
|
||||||
res[++m] = gensub(/^.* ([0-9]+) ?x ?([0-9]+)[_ ].* ([0-9\.]+)\*.*$/,"\\1x\\2@\\3hz","g",$0)
|
# we get a bit more info from xrandr than xdpyinfo, but xrandr fails to handle
|
||||||
}
|
# multiple screens from different video cards
|
||||||
END {
|
if [[ $xdpy_count -eq 1 ]];then
|
||||||
for (n in res) {
|
screen_resolution=$( xrandr | gawk '
|
||||||
if (res[n] ~ /^[[:digit:]]+x[[:digit:]]+/) {
|
/\*/ {
|
||||||
line = line ? line ", " res[n] : res[n]
|
res[++m] = gensub(/^.* ([0-9]+) ?x ?([0-9]+)[_ ].* ([0-9\.]+)\*.*$/,"\\1x\\2@\\3hz","g",$0)
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
for (n in res) {
|
||||||
|
if (res[n] ~ /^[[:digit:]]+x[[:digit:]]+/) {
|
||||||
|
line = line ? line ", " res[n] : res[n]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (line) {
|
||||||
|
print(line)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (line) {
|
|
||||||
print(line)
|
|
||||||
}
|
|
||||||
}' )
|
|
||||||
if [[ -z $screen_resolution ]];then
|
|
||||||
screen_resolution=$( xdpyinfo | gawk '
|
|
||||||
/dimensions/ {
|
|
||||||
print $2
|
|
||||||
}' )
|
}' )
|
||||||
fi
|
fi
|
||||||
|
if [[ -z $screen_resolution || $xdpy_count -gt 1 ]];then
|
||||||
|
screen_resolution=$( gawk '
|
||||||
|
BEGIN {
|
||||||
|
IGNORECASE=1
|
||||||
|
screens = ""
|
||||||
|
separator = ""
|
||||||
|
}
|
||||||
|
/dimensions/ {
|
||||||
|
screens = screens $2 separator
|
||||||
|
separator = ", "
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
print screens
|
||||||
|
}' <<< "$xdpy_data" )
|
||||||
|
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 '{
|
||||||
print $2"x"$1
|
print $2"x"$1
|
||||||
|
|
Loading…
Reference in a new issue