diff --git a/lib/usagewatch/linux.rb b/lib/usagewatch/linux.rb index f0a2b32..7aa0572 100644 --- a/lib/usagewatch/linux.rb +++ b/lib/usagewatch/linux.rb @@ -16,7 +16,12 @@ def self.uw_diskused # Show the percentage of disk used. def self.uw_diskused_perc df = `df --total` - df.split(" ").last.to_f.round(2) + parts = df.split(" ") + perc = parts.last + if perc == "-" # ubuntu adds - for path instead of blank like others. + perc = parts[-2] + end + perc.to_f.round(2) end # Show the percentage of CPU used