diff --git a/inxi b/inxi index fcc7e1e..b020d0d 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.1.7 +#### version: 1.1.8 #### Date: August 2 2009 ######################################################################## #### SPECIAL THANKS @@ -2186,6 +2186,43 @@ get_distro_lsb_data() eval $LOGFE } +get_gpu_temp_data() +{ + local gpu_temp='' gpu_fan='' + + # we'll try for nvidia/ati, then add if more are shown + if [[ -n $( type -p nvidia-settings ) ]];then + gpu_temp=$( nvidia-settings -q GPUCoreTemp | gawk -F ': ' ' + BEGIN { + IGNORECASE=1 + } + /Attribute (.*)[0-9]+\.$/ { + gsub(/\./, "", $2) + if ( $2 ~ /^[0-9]+$/ ) { + print $2 + } + }' + ) + elif [[ -n $( type -p aticonfig ) ]];then +# gpu_temp=$( aticonfig --adapter=0 --od-gettemperature | gawk -F ': ' ' + gpu_temp=$(echo "$sample" | gawk -F ': ' ' + BEGIN { + IGNORECASE=1 + } + /Sensor (.*)[0-9\.]+ / { + gpuTemp=gensub(/(.*) ([0-9\.]+) (.*)/, "\\2", "1", $2) + if ( gpuTemp ~ /^[0-9\.]+$/ ) { + print gpuTemp + } + }' + ) + fi + + if [[ -n $gpu_temp ]];then + echo $gpu_temp + fi +} + ## create array of gfx cards installed on system get_graphics_card_data() { @@ -4195,7 +4232,7 @@ print_sensors_data() { eval $LOGFS local mobo_temp='' cpu_temp='' psu_temp='' cpu_fan='' mobo_fan='' ps_fan='' sys_fans='' sys_fans2='' - local temp_data='' fan_data='' fan_data2='' b_is_error='false' fan_count=0 + local temp_data='' fan_data='' fan_data2='' b_is_error='false' fan_count=0 gpu_temp='' local a_sensors_working='' get_sensors_data @@ -4234,6 +4271,10 @@ print_sensors_data() if [[ -n ${a_sensors_working[2]} ]];then psu_temp="${C1}psu:${C2} ${a_sensors_working[2]} " fi + gpu_temp=$( get_gpu_temp_data ) + if [[ -n $gpu_temp ]];then + gpu_temp="${C1}gpu:${C2} ${gpu_temp}C " + fi ;; # then the fan data from main fan array 1) @@ -4301,7 +4342,7 @@ print_sensors_data() esac done fi - temp_data="$cpu_temp$mobo_temp" + temp_data="$cpu_temp$mobo_temp$psu_temp$gpu_temp" temp_data=$( create_print_line "Sensors:" "$temp_data" ) print_screen_output "$temp_data" # don't print second or subsequent lines if error data