ArchLabs Linux

Nvidia gpu temp

Hi all, I finaly manage to pipe my Nvidia GTX 1050 gpu temperaure into i3blocks, thing that the default config won’t do I don’t know why.
For those who want to get on tip:

[gpu-temp]
label=
#command=nvidia-smi --format=nounits,csv,noheader --query-gpu=temperature.gpu | xargs echo
command=~/bin/gputemp.sh
interval=10
#color=#598799

the script:

#!/bin/sh
if ! gputemp=$(nvidia-smi --format=nounits,csv,noheader --query-gpu=temperature.gpu | xargs echo); then
    gputemp=0
fi
if [ "$gputemp" -gt 0 ]; then
    echo "$gputemp"
else
    echo "$gputemp"
fi

I didn’t test that in i3status or polybar but I’m pretty sure it’ll work. Of course you need the Nvidia driver installed (non-free)
ps: works fine in polybar to

[module/gputemp]
type = custom/script
label = %output%
exec = nvidia-smi --format=nounits,csv,noheader --query-gpu=temperature.gpu | xargs echo
tail = true
format = <label>
format-prefix = " "
label-foreground = ${colors.blue}
label-prefix-foreground = ${colors.foreground}
format-padding = 1
4 Likes

Thx for sharing your tips @archus , top job in there.

Good work, thanks for sharing!