Fix sketchybar disk usage showing incorrect percentage
Monitor /System/Volumes/Data instead of / since root is a read-only APFS snapshot with minimal usage. Also fix inverted formula that was calculating 100-used instead of just using the capacity value directly.
This commit is contained in:
@@ -632,8 +632,9 @@ in
|
||||
text = ''
|
||||
#!/bin/bash
|
||||
|
||||
# df $5 can show free% on some APFS setups; calculate used% explicitly
|
||||
DISK_USAGE=$(df -H / | grep -v Filesystem | awk '{gsub(/%/,"",$5); printf "%.0f%%", 100-$5}')
|
||||
# Monitor /System/Volumes/Data which contains user data on APFS
|
||||
# The root / is a read-only snapshot with minimal usage
|
||||
DISK_USAGE=$(df -H /System/Volumes/Data | grep -v Filesystem | awk '{print $5}')
|
||||
|
||||
${pkgs.sketchybar}/bin/sketchybar --set $NAME label="$DISK_USAGE"
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user