aboutsummaryrefslogtreecommitdiff
path: root/entropy.lua
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2009-09-15 00:41:28 +0200
committerAdrian C. (anrxc) <anrxc@sysphere.org>2009-09-15 00:41:28 +0200
commit7410bc0086c7783344b4362ce3d8cba340f517cd (patch)
tree9b2bda456f44ff6efc5262e2113660b24e08b724 /entropy.lua
parent549c8bc5ba8bba9501915c2ba1303955a44de0be (diff)
downloadvicious-legacy-7410bc0086c7783344b4362ce3d8cba340f517cd.tar.xz
Entropy widget cleaned up
Diffstat (limited to 'entropy.lua')
-rw-r--r--entropy.lua10
1 files 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