New version, tarball, man page. New option -! 40 which lets you get gfx information out of X.

Default will get data from display :0, but if you append :[display-number] to -! 40, it will
use that display instead, for example: inxi -! 40:1 would get information from display 1. Note
that most multi-monitor setups use :0 for both monitors, depending on how it's setup.

This will also let users see any desktop information based on xrop -root output, but it will
depend how it works based on how environmental variables have been set. gnome and kde, which use XDG for
primary detection would not work, for example.
This commit is contained in:
Harald Hope 2017-06-08 19:29:55 -07:00
parent 5c36ac8447
commit 8d651eb345
3 changed files with 46 additions and 7 deletions

26
inxi
View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
########################################################################
#### Script Name: inxi
#### Version: 2.3.14
#### Version: 2.3.15
#### Date: 2017-06-08
#### Patch Number: 00
########################################################################
@ -417,6 +417,7 @@ DCOPOBJ="default"
DEBUG=0 # Set debug levels from 1-10 (8-10 trigger logging levels)
# Debug Buffer Index, index into a debug buffer storing debug messages until inxi is 'all up'
DEBUG_BUFFER_INDEX=0
DISPLAY_OPT='' # for console switches
## note: the debugger rerouting to /dev/null has been moved to the end of the get_parameters function
## so -@[number] debug levels can be set if there is a failure, otherwise you can't even see the errors
SED_I='-i' # for gnu sed, will be set to -i '' for bsd sed
@ -3018,6 +3019,15 @@ get_parameters()
33)
B_FORCE_DMIDECODE='true'
;;
40*)
DISPLAY=${OPTARG/40/}
if [[ $DISPLAY == '' ]];then
DISPLAY=':0'
fi
DISPLAY_OPT="-display $DISPLAY"
B_SHOW_DISPLAY_DATA='true'
B_RUNNING_IN_DISPLAY='true'
;;
ftp*)
ALTERNATE_FTP="$OPTARG"
;;
@ -3207,6 +3217,7 @@ show_options()
print_lines_basic "1" "-! 31" "Turns off hostname in output. Useful if showing output from servers etc."
print_lines_basic "1" "-! 32" "Turns on hostname in output. Overrides global B_SHOW_HOST='false'"
print_lines_basic "1" "-! 33" "Forces use of dmidecode data instead of /sys where relevant (-M)."
print_lines_basic "1" "-! 40" "Will try to get display data out of X. Default gets it from display :0. If you use this format: -40:1 it would get it from display 1 instead, or any display you specify as long as there is no space between -40 and the :[display-number]."
if [[ $1 == 'full' ]];then
print_screen_output " "
@ -5086,7 +5097,7 @@ get_desktop_environment()
# did we find it? If not, start the xprop tests
if [[ -z $desktop_environment ]];then
if type -p xprop &>/dev/null;then
xprop_root="$( xprop -root 2>/dev/null )"
xprop_root="$( xprop -root $DISPLAY_OPT 2>/dev/null )"
fi
# note that cinnamon split from gnome, and and can now be id'ed via xprop,
# but it will still trigger the next gnome true case, so this needs to go before gnome test
@ -6396,7 +6407,7 @@ get_graphics_glx_data()
# if [[ $B_SHOW_DISPLAY_DATA == 'true' && $B_ROOT != 'true' ]];then
if [[ $B_SHOW_DISPLAY_DATA == 'true' ]];then
IFS=$'\n'
A_GLX_DATA=( $( glxinfo 2>/dev/null | gawk -F ': ' '
A_GLX_DATA=( $( eval glxinfo $DISPLAY_OPT 2>/dev/null | gawk -F ': ' '
# the real question here though is why this function is even here, seems
# just to be a complicated way to pack/print a variable, but maybe the
# original idea was to handle > 1 cases of detections I guess
@ -6487,12 +6498,12 @@ get_graphics_res_data()
if [[ $B_SHOW_DISPLAY_DATA == 'true' ]];then
# 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
xdpy_data="$( xdpyinfo 2>/dev/null )"
xdpy_data="$( xdpyinfo $DISPLAY_OPT 2>/dev/null )"
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 $DISPLAY_OPT 2>/dev/null | gawk '
/\*/ {
res[++m] = gensub(/^.* ([0-9]+) ?x ?([0-9]+)[_ ].* ([0-9\.]+)\*.*$/,"\\1x\\2@\\3hz","g",$0)
}
@ -6578,7 +6589,7 @@ get_graphics_display_server_data()
# A failover mechanism is in place. (if $version is empty, the release number is parsed instead)
# xdpy_info="$( xdpyinfo )"
IFS=","
a_display_vendor_working=( $( xdpyinfo 2>/dev/null | gawk -F': +' '
a_display_vendor_working=( $( xdpyinfo $DISPLAY_OPT 2>/dev/null | gawk -F': +' '
BEGIN {
IGNORECASE=1
vendorString=""
@ -12900,7 +12911,8 @@ print_graphics_data()
root_x_string="${root_x_string}out of X"
res_tty='tty size'
fi
if [[ $B_RUNNING_IN_DISPLAY != 'true' || -n ${screen_resolution/*@*/} ]];then
# || -n ${screen_resolution/*@*/}
if [[ $B_SHOW_DISPLAY_DATA != 'true' || $B_RUNNING_IN_DISPLAY != 'true' ]];then
res_tty='tty size'
fi

7
inxi.1
View file

@ -530,6 +530,13 @@ Turns on hostname in System line. Overrides inxi config file value (if set): B_S
.TP
.B \-! 33
Force use of \fBdmidecode\fR. This will override \fB/sys\fR data in some lines, like \fB\-M\fR.
.TP
.B \-! 40
Will try to get display data out of X. Default gets display info from display \fB:0\fR. If you use this format: \fB\-40:1\fR
it would get it from display \fB1\fR instead, or any display you specify as long as there is no space
between \fB\-40\fR and the \fB:[display id]\fR."
.SH DEBUGGING OPTIONS
.TP
.B \-%

View file

@ -1,3 +1,23 @@
=====================================================================================
Version: 2.3.15
Patch Version: 00
Script Date: 2017-06-08
-----------------------------------
Changes:
-----------------------------------
New version, tarball, man page. New option -! 40 which lets you get gfx information out of X.
Default will get data from display :0, but if you append :[display-number] to -! 40, it will
use that display instead, for example: inxi -! 40:1 would get information from display 1. Note
that most multi-monitor setups use :0 for both monitors, depending on how it's setup.
This will also let users see any desktop information based on xrop -root output, but it will
depend how it works based on how environmental variables have been set. gnome and kde, which use XDG for
primary detection would not work, for example.
-----------------------------------
-- Harald Hope - Thu, 08 Jun 2017 19:25:21 -0700
=====================================================================================
Version: 2.3.14
Patch Version: 00