summaryrefslogtreecommitdiff
path: root/sb-gpu
diff options
context:
space:
mode:
authorJoshua Drake <joshua.ellis.drake@gmail.com>2024-01-31 12:00:10 -0600
committerJoshua Drake <joshua.ellis.drake@gmail.com>2024-01-31 12:00:10 -0600
commit1da1b72c557e24d4d225cebb32af3592b1e4a7df (patch)
tree289aab697c229447466f7829fa274c1eb68e658d /sb-gpu
parentea81343cdfeb6e9c09e1bf45a8ef0935459f15b5 (diff)
Added Nvidia GPU support. Needs to be made more robust.HEADmaster
Diffstat (limited to 'sb-gpu')
-rwxr-xr-xsb-gpu10
1 files changed, 9 insertions, 1 deletions
diff --git a/sb-gpu b/sb-gpu
index b0ab382..dfd24d7 100755
--- a/sb-gpu
+++ b/sb-gpu
@@ -1,5 +1,5 @@
#!/bin/sh
-
+lspci -k | grep -q "VGA compatible controller: NVIDIA" && NVIDIACard=1
getGPUClock() {
sed -n "s/[0-9]: //g;/*/ {s/\s.*//; p}" /sys/class/drm/card1/device/pp_dpm_sclk
}
@@ -13,6 +13,9 @@ getGPUVRAM() {
usedRAM=$(cat /sys/class/drm/card1/device/mem_info_vram_used)
numfmt --to=iec $usedRAM --format %2.2f
}
+getNVIDIA() {
+ nvidia-smi | sed '10!d;s/ //g;s/^.*\([0-9][0-9]C\)/\1/;s/P[0-9]/ /;s/|/ /g;s/D.*$//'
+}
case $BLOCK_BUTTON in
#1) notify-send "RadeonTop" "$(radeontop)" ;;
@@ -22,4 +25,9 @@ case $BLOCK_BUTTON in
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
+if [ "$NVIDIACard" ]
+then
+printf "%s\n" "$(getNVIDIA)"
+else
printf "%s %s %s%% 🌡️%s°\n" "$(getGPUClock)" "$(getGPUVRAM)" "$(getGPUBusy)" "$(getGPUTemperature)"
+fi