From 2717d15af51646f719774794b8595070573897ad Mon Sep 17 00:00:00 2001 From: Nuno Silva Date: Sat, 18 Nov 2023 17:08:39 +0000 Subject: [PATCH] fix SI prefixes - lower 'm' is milli, not mega - lower 'g' is unassigned - 'G' is 10^9, 'Gi' is 2^30 see https://en.wikipedia.org/wiki/Metric_prefix --- fs-widget/fs-widget.lua | 2 +- net-speed-widget/net-speed.lua | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs-widget/fs-widget.lua b/fs-widget/fs-widget.lua index ca76193..2e16df0 100644 --- a/fs-widget/fs-widget.lua +++ b/fs-widget/fs-widget.lua @@ -159,7 +159,7 @@ local function worker(user_args) { text = math.floor(disks[v].used / 1024 / 1024) .. '/' - .. math.floor(disks[v].size / 1024 / 1024) .. 'GB(' + .. math.floor(disks[v].size / 1024 / 1024) .. 'GiB(' .. math.floor(disks[v].perc) .. '%)', widget = wibox.widget.textbox }, diff --git a/net-speed-widget/net-speed.lua b/net-speed-widget/net-speed.lua index 6dd3b05..928b1e6 100644 --- a/net-speed-widget/net-speed.lua +++ b/net-speed-widget/net-speed.lua @@ -29,15 +29,15 @@ local function convert_to_h(bytes) dim = 'kb/s' elseif bits < 1000000000 then speed = bits/1000000 - dim = 'mb/s' + dim = 'Mb/s' elseif bits < 1000000000000 then speed = bits/1000000000 - dim = 'gb/s' + dim = 'Gb/s' else speed = tonumber(bits) dim = 'b/s' end - return math.floor(speed + 0.5) .. dim + return math.floor(speed + 0.5) .. ' ' .. dim end local function split(string_to_split, separator)