dotfiles/.local/bin/conky_radeon
2019-06-13 20:12:29 +02:00

19 lines
421 B
Bash
Executable file

#!/bin/bash
# Exemple (par défaut si aucun argument donné)
# ./conky_radeon gpu perc
# Autre exemple
# ./conky_radeon vram mb
stats=$(sudo radeontop -d- -l1)
#stats=$(cat /dev/shm/radeontop | tail -n 1 | tr -d '\n')
perc() {
echo "$stats" | grep -Eo "$1 [0-9.]{3,5}%" | cut -d' ' -f2
}
mb() {
echo "$stats" | grep -Eo "$1 [0-9.]{3,5}% [0-9.]+mb" | cut -d' ' -f3 | sed 's/mb/M/g'
}
echo "$(${2:-perc} ${1:-gpu})"