mirror of
https://github.com/lcpz/awesome-copycats.git
synced 2026-03-22 21:45:11 +00:00
mem widget Gb conversion
This commit is contained in:
parent
6dc2872c3a
commit
897db4cd76
|
|
@ -190,10 +190,20 @@ theme.mail = lain.widget.imap({
|
|||
-- })
|
||||
|
||||
-- MEM
|
||||
function round_one_decimal(num)
|
||||
return math.floor(num * 10) / 10
|
||||
end
|
||||
|
||||
local memicon = wibox.widget.imagebox(theme.widget_mem)
|
||||
local mem = lain.widget.mem({
|
||||
settings = function()
|
||||
widget:set_markup(markup.font(theme.font, " " .. mem_now.used .. " MB "))
|
||||
local mem_used = mem_now.used
|
||||
if mem_used >= 1000 then
|
||||
mem_used = round_one_decimal(mem_used / 1000)
|
||||
widget:set_markup(markup.font(theme.font, " " .. mem_used .. " Gb "))
|
||||
else
|
||||
widget:set_markup(markup.font(theme.font, " " .. mem_used .. " MB "))
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue