From d6aeb2b9ac110cc04ec93d76b0998b2adf6310ff Mon Sep 17 00:00:00 2001 From: Harald Hope Date: Fri, 9 Jun 2017 12:25:27 -0700 Subject: [PATCH] one I think final patch to correct tty res for ancient systems. --- inxi | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/inxi b/inxi index 9506b0a..b09cc51 100755 --- a/inxi +++ b/inxi @@ -6502,13 +6502,14 @@ get_graphics_glx_data() } ## return screen resolution / tty resolution +## args: $1 - reg/tty get_graphics_res_data() { eval $LOGFS - local screen_resolution='' xdpy_data='' screens_count=0 tty_session='' - + local screen_resolution='' xdpy_data='' screens_count=0 tty_session='' option=$1 + # if [[ $B_SHOW_DISPLAY_DATA == 'true' && $B_ROOT != 'true' ]];then - if [[ $B_SHOW_DISPLAY_DATA == 'true' ]];then + if [[ $B_SHOW_DISPLAY_DATA == 'true' && $option != 'tty' ]];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 $DISPLAY_OPT 2>/dev/null )" @@ -12824,9 +12825,9 @@ print_graphics_data() local res_tty='Resolution' xorg_data='' display_server_string='' chip_id='' local spacer='' driver='' driver_string='' driver_plural='' direct_render_string='' local separator_loaded='' separator_unloaded='' separator_failed='' - local loaded='' unloaded='' failed='' display_server_string='' + local loaded='' unloaded='' failed='' display_server_string='' b_force_tty='false' local line_starter='Graphics:' part_1_data='' part_2_data='' b_advanced='true' - local screen_resolution="$( get_graphics_res_data )" + local screen_resolution="$( get_graphics_res_data 'reg' )" # set A_DISPLAY_SERVER_DATA get_graphics_display_server_data @@ -12905,7 +12906,12 @@ print_graphics_data() fi # some basic error handling: if [[ -z $screen_resolution ]];then - screen_resolution='N/A' + screen_resolution="$( get_graphics_res_data 'tty' )" + if [[ -z $screen_resolution ]];then + screen_resolution='N/A' + else + b_force_tty='true' + fi fi # note: fix this, we may find a display server that has no version if [[ -z $display_vendor || -z $display_version ]];then @@ -12936,7 +12942,7 @@ print_graphics_data() res_tty='tty size' fi # || -n ${screen_resolution/*@*/} - if [[ $B_SHOW_DISPLAY_DATA != 'true' || $B_RUNNING_IN_DISPLAY != 'true' ]];then + if [[ $b_force_tty == 'true' || $B_SHOW_DISPLAY_DATA != 'true' || $B_RUNNING_IN_DISPLAY != 'true' ]];then res_tty='tty size' fi