aboutsummaryrefslogtreecommitdiffstats
path: root/polybar/.config/polybar/scripts/dgpu-status.sh
diff options
context:
space:
mode:
Diffstat (limited to 'polybar/.config/polybar/scripts/dgpu-status.sh')
-rwxr-xr-xpolybar/.config/polybar/scripts/dgpu-status.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/polybar/.config/polybar/scripts/dgpu-status.sh b/polybar/.config/polybar/scripts/dgpu-status.sh
new file mode 100755
index 0000000..257c744
--- /dev/null
+++ b/polybar/.config/polybar/scripts/dgpu-status.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# Path to the dGPU on the PCI bus
+PCI_PATH="/sys/bus/pci/devices/0000:57:00.0"
+
+if [ -d "$PCI_PATH" ]; then
+ # Optional: Check if the driver is actually loaded
+ if lsmod | grep -q "nvidia"; then
+ echo "ON" # Icon for NVIDIA/GPU Active
+ else
+ echo "STBY" # Hardware present but driver unloaded
+ fi
+else
+ echo "OFF" # GPU powered down and removed
+fi