diff --git a/roles/waybar/files/waybar/modules/storage.sh b/roles/waybar/files/waybar/modules/storage.sh index 1189be8..735232b 100755 --- a/roles/waybar/files/waybar/modules/storage.sh +++ b/roles/waybar/files/waybar/modules/storage.sh @@ -2,9 +2,10 @@ warning=85 critical=95 +target="$1" # Detect slash FSType -fstype=$(df -l "$1" --output=fstype | sed 1d) +fstype=$(findmnt -nT "$target" -o FSTYPE) # Set query cmd if [[ -z "$fstype" ]] @@ -12,10 +13,10 @@ then exit elif [[ "$fstype" == zfs ]] then - zfsroot=$(echo $1 | sed 's:/.*::') + zfsroot=$(echo $target | sed 's:/.*::') pcent=$(zpool list -o cap -H $zfsroot | tr -d '%') else - pcent=$(df "$1" --output="pcent" 2>/dev/null | sed 1d | tr -d ' ' | tr -d '%') + pcent=$(df "$target" --output="pcent" 2>/dev/null | sed 1d | tr -d ' ' | tr -d '%') fi json_fmt='{"text": "%s" , "class": "%s" }\n'