waybar gpu info
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
// -*- mode: jsonc -*-
|
// -*- mode: jsonc -*-
|
||||||
{
|
{
|
||||||
|
"custom/gpu": {
|
||||||
|
"format": "{text}",
|
||||||
|
"tooltip": false,
|
||||||
|
"exec": "~/.config/waybar/scripts/gpu-info.sh",
|
||||||
|
"exec-interval": 1,
|
||||||
|
"return-type": "json"
|
||||||
|
},
|
||||||
// "layer": "top", // Waybar at top layer
|
// "layer": "top", // Waybar at top layer
|
||||||
"position": "bottom", // Waybar position (top|bottom|left|right)
|
"position": "bottom", // Waybar position (top|bottom|left|right)
|
||||||
"height": 30, // Waybar height (to be removed for auto height)
|
"height": 30, // Waybar height (to be removed for auto height)
|
||||||
@@ -29,6 +36,7 @@
|
|||||||
//"hyprland/language",
|
//"hyprland/language",
|
||||||
"battery",
|
"battery",
|
||||||
//"battery#bat2",
|
//"battery#bat2",
|
||||||
|
"custom/gpu",
|
||||||
"clock",
|
"clock",
|
||||||
"tray",
|
"tray",
|
||||||
"custom/power"
|
"custom/power"
|
||||||
@@ -104,7 +112,7 @@
|
|||||||
},
|
},
|
||||||
"tray": {
|
"tray": {
|
||||||
// "icon-size": 21,
|
// "icon-size": 21,
|
||||||
"spacing": 10,
|
"spacing": 10//,
|
||||||
// "icons": {
|
// "icons": {
|
||||||
// "blueman": "bluetooth",
|
// "blueman": "bluetooth",
|
||||||
// "TelegramDesktop": "$HOME/.local/share/icons/hicolor/16x16/apps/telegram.png"
|
// "TelegramDesktop": "$HOME/.local/share/icons/hicolor/16x16/apps/telegram.png"
|
||||||
@@ -118,11 +126,11 @@
|
|||||||
},
|
},
|
||||||
"cpu": {
|
"cpu": {
|
||||||
"interval": 1,
|
"interval": 1,
|
||||||
"format": "cpu:{usage:02}% avg-frq:{avg_frequency:4.2f}MHz",
|
"format": "cpu:{usage:02}%@{avg_frequency:4.2f}MHz",
|
||||||
"tooltip": false
|
"tooltip": false
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
"interval": 1,
|
"interval": 1,
|
||||||
"format": "mem:{:02}%"
|
"format": "mem:{:02}%"
|
||||||
},
|
},
|
||||||
"temperature": {
|
"temperature": {
|
||||||
|
|||||||
Executable
+23
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# GPU monitoring for waybar (AMD radeontop + sysfs temp)
|
||||||
|
|
||||||
|
GPU_DATA=$(timeout 1 radeontop -d - -l 1 2>/dev/null | tail -1)
|
||||||
|
|
||||||
|
if [ -z "$GPU_DATA" ]; then
|
||||||
|
echo "{\"text\": \"gpu:--\", \"tooltip\": \"Reading...\"}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
GPU=$(echo "$GPU_DATA" | grep -oP 'gpu \K[0-9.]+' | head -1)
|
||||||
|
GPU_INT=${GPU%.*}
|
||||||
|
|
||||||
|
VRAM=$(echo "$GPU_DATA" | grep -oP 'vram [\d.]+% \K[\d.]+' | head -1)
|
||||||
|
VRAM_INT=${VRAM%.*}
|
||||||
|
|
||||||
|
SCLK=$(echo "$GPU_DATA" | grep -oP 'sclk [\d.]+% \K[\d.]+' | head -1)
|
||||||
|
MCLK=$(echo "$GPU_DATA" | grep -oP 'mclk [\d.]+% \K[\d.]+' | head -1)
|
||||||
|
|
||||||
|
TEMP=$(( $(cat /sys/class/hwmon/hwmon2/temp1_input) / 1000 ))
|
||||||
|
POWER=$(( $(cat /sys/class/hwmon/hwmon2/power1_average) / 1000 ))
|
||||||
|
|
||||||
|
echo "{\"text\": \"gpu:${GPU_INT}% ${VRAM_INT}MB ${TEMP}C\", \"tooltip\": \"GPU: ${GPU}%\\nVRAM: ${VRAM}MB\\nTemp: ${TEMP}C\\nPower: ${POWER}W\\nSCLK: ${SCLK}GHz\\nMCLK: ${MCLK}GHz\"}"
|
||||||
Reference in New Issue
Block a user