Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/usagewatch/linux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Usagewatch
# Show the amount of total disk used in Gigabytes
def self.uw_diskused
@df = `df`
@df = @df.split("\n").drop(1).join("\n")
@parts = @df.split(" ").map { |s| s.to_i }
@sum = 0
for i in (9..@parts.size - 1).step(6) do
Expand All @@ -16,7 +17,7 @@ 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)
df.split("\n").last.split(" ")[4].to_f.round(2)
end

# Show the percentage of CPU used
Expand Down