amd gpu
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
|
||||
|
||||
set $mod Mod4
|
||||
set $LeftMonitor HDMI-0
|
||||
set $RightMonitor DP-4
|
||||
set $LeftMonitor HDMI-A-0
|
||||
set $RightMonitor DisplayPort-0
|
||||
|
||||
# Font for window titles. Will also be used by the bar unless a different font
|
||||
# is used in the bar {} block below.
|
||||
|
||||
34
.config/polybar/amd-gpu.sh
Executable file
34
.config/polybar/amd-gpu.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Base path for AMD GPU sysfs
|
||||
GPU_BASE_PATH="/sys/class/drm/card1/device"
|
||||
|
||||
# Check if AMD GPU sysfs exists
|
||||
if [ ! -d "$GPU_BASE_PATH" ]; then
|
||||
echo "---"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get GPU usage
|
||||
GPU_UTIL=$(cat "$GPU_BASE_PATH/gpu_busy_percent" 2>/dev/null || echo "N/A")
|
||||
|
||||
# Base path for hwmon (temperature and power readings)
|
||||
HWMON_PATH="$GPU_BASE_PATH/hwmon/hwmon0"
|
||||
|
||||
# Get GPU temperature
|
||||
TEMP_PATH="$HWMON_PATH/temp1_input"
|
||||
if [ -f "$TEMP_PATH" ]; then
|
||||
GPU_TEMP=$(($(cat "$TEMP_PATH") / 1000)) # Convert from millidegrees to degrees
|
||||
else
|
||||
GPU_TEMP="N/A"
|
||||
fi
|
||||
|
||||
# Get GPU power usage
|
||||
POWER_PATH="$HWMON_PATH/power1_average"
|
||||
if [ -f "$POWER_PATH" ]; then
|
||||
GPU_POWER=$(($(cat "$POWER_PATH") / 1000000)) # Convert from microwatts to watts
|
||||
else
|
||||
GPU_POWER="N/A"
|
||||
fi
|
||||
|
||||
echo "GPU ${GPU_UTIL}%, ${GPU_TEMP}°C, ${GPU_POWER}W"
|
||||
1
.config/waybar/amd-gpu.sh
Symbolic link
1
.config/waybar/amd-gpu.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../polybar/amd-gpu.sh
|
||||
Reference in New Issue
Block a user