From f4670cf2d728b22744c7a635bacc186d3bcb7238 Mon Sep 17 00:00:00 2001 From: Pete Brumm Date: Fri, 9 Dec 2016 11:36:58 -0600 Subject: [PATCH] fixing disk space issues on ubuntu --- lib/usagewatch/linux.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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