From 572aa161bbe07afe52bab47bbdf158f8a9e78143 Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Tue, 15 Sep 2009 00:41:28 +0200 Subject: Entropy widget cleaned up --- entropy.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/entropy.lua b/entropy.lua index 1146a0e..97568cc 100644 --- a/entropy.lua +++ b/entropy.lua @@ -6,8 +6,7 @@ -- {{{ Grab environment local io = { open = io.open } local setmetatable = setmetatable -local math = { floor = math.floor } -local string = { format = string.format } +local math = { ceil = math.ceil } -- }}} @@ -17,8 +16,7 @@ module("vicious.entropy") -- {{{ Entropy widget type local function worker(format, poolsize) - -- Don't waste time opening the poolsize, Linux 2.6 has a default - -- entropy pool of 4096-bits, if needed specify otherwise + -- Linux 2.6 has a default entropy pool of 4096-bits if poolsize == nil then poolsize = 4096 end -- Get available entropy @@ -27,9 +25,7 @@ local function worker(format, poolsize) f:close() -- Calculate percentage - ent_avail_percent = math.floor(ent_avail * 100 / poolsize) - -- This data is intended for a progressbar - ent_avail_percent = string.format("%0d", ent_avail_percent) + ent_avail_percent = math.ceil(ent_avail * 100 / poolsize) return {ent_avail, ent_avail_percent} end -- cgit v1.2.3