diff --git a/config/awesome/elemental/dashboard/amarena.lua b/config/awesome/elemental/dashboard/amarena.lua index 6a4e48b..9735ccb 100644 --- a/config/awesome/elemental/dashboard/amarena.lua +++ b/config/awesome/elemental/dashboard/amarena.lua @@ -176,7 +176,7 @@ local disk_hover_text = wibox.widget { awesome.connect_signal("evil::disk", function(used, total) disk_arc.value = used * 100 / total - disk_hover_text_value.markup = helpers.colorize_text(tostring(total - used).."G", x.color4) + disk_hover_text_value.markup = helpers.colorize_text(tostring(helpers.round(total - used, 1)).."G", x.color4) end) local disk_icon = wibox. widget { diff --git a/config/awesome/evil/disk.lua b/config/awesome/evil/disk.lua index 92aed0f..70ba26a 100644 --- a/config/awesome/evil/disk.lua +++ b/config/awesome/evil/disk.lua @@ -1,25 +1,25 @@ -- Provides: -- evil::disk --- used (integer - giga bytes) --- total (integer - giga bytes) +-- used (integer - mega bytes) +-- total (integer - mega bytes) local awful = require("awful") +local helpers = require("helpers") local update_interval = 180 -- every 3 minutes -- Use /dev/sdxY according to your setup local disk_script = [[ bash -c " - df -kh /dev/sda1 | tail -1 | awk '{printf \"%d@%d\", $4, $3}' + df -kH -B 1MB /dev/sda1 | tail -1 | awk '{printf \"%d@%d\", $4, $3}' " ]] - -- Periodically get disk space info awful.widget.watch(disk_script, update_interval, function(_, stdout) -- Get `available` and `used` instead of `used` and `total`, -- since the total size reported by the `df` command includes -- the 5% storage reserved for `root`, which is misleading. - local available = stdout:match('^(.*)@') - local used = stdout:match('@(.*)$') - awesome.emit_signal("evil::disk", tonumber(used), tonumber(available) + tonumber(used)) + local available = tonumber(stdout:match('^(.*)@')) / 1000 + local used = tonumber(stdout:match('@(.*)$')) / 1000 + awesome.emit_signal("evil::disk", used, used + available) end)