aboutsummaryrefslogtreecommitdiffstats
path: root/polybar/.config
diff options
context:
space:
mode:
Diffstat (limited to 'polybar/.config')
-rw-r--r--polybar/.config/polybar/config.ini19
-rwxr-xr-xpolybar/.config/polybar/scripts/dgpu-status.sh15
2 files changed, 34 insertions, 0 deletions
diff --git a/polybar/.config/polybar/config.ini b/polybar/.config/polybar/config.ini
index 5c35631..09656ec 100644
--- a/polybar/.config/polybar/config.ini
+++ b/polybar/.config/polybar/config.ini
@@ -120,6 +120,25 @@ format-prefix-foreground = ${colors.magenta}
label = %gb_used% %percentage_used%%
label-foreground = ${colors.foreground}
+[module/gpu-status]
+type = custom/script
+
+; Path to the helper script we just created
+exec = ~/.config/polybar/scripts/dgpu-status.sh
+
+; Update interval in seconds
+interval = 5
+
+; Professional styling
+format-prefix = "dGPU Status: "
+format-padding = 1
+format-background = ${colors.background-alt}
+format-foreground = ${colors.primary}
+
+; Optional: Left-click to open a terminal and toggle
+; click-left = st -e sudo gpu-switch on
+; click-right = st -e sudo gpu-switch off
+
;[module/wlan]
;inherit = network-base
;interface-type = wireless
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