1
0
Fork 0
mirror of https://github.com/lcpz/awesome-copycats.git synced 2026-03-23 05:55:12 +00:00

mem widget Gb conversion

This commit is contained in:
Toma Adrian Ionut 2022-06-06 14:13:46 +03:00
parent 6dc2872c3a
commit 897db4cd76

View file

@ -190,10 +190,20 @@ theme.mail = lain.widget.imap({
-- }) -- })
-- MEM -- MEM
function round_one_decimal(num)
return math.floor(num * 10) / 10
end
local memicon = wibox.widget.imagebox(theme.widget_mem) local memicon = wibox.widget.imagebox(theme.widget_mem)
local mem = lain.widget.mem({ local mem = lain.widget.mem({
settings = function() 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 end
}) })
@ -264,11 +274,11 @@ theme.volume = lain.widget.alsa({
end end
}) })
theme.volume.widget:buttons(awful.util.table.join( theme.volume.widget:buttons(awful.util.table.join(
awful.button({}, 4, function () awful.button({}, 4, function()
awful.util.spawn("amixer set Master 1%+") awful.util.spawn("amixer set Master 1%+")
theme.volume.update() theme.volume.update()
end), end),
awful.button({}, 5, function () awful.button({}, 5, function()
awful.util.spawn("amixer set Master 1%-") awful.util.spawn("amixer set Master 1%-")
theme.volume.update() theme.volume.update()
end) end)
@ -310,11 +320,11 @@ function theme.at_screen_connect(s)
-- We need one layoutbox per screen. -- We need one layoutbox per screen.
s.mylayoutbox = awful.widget.layoutbox(s) s.mylayoutbox = awful.widget.layoutbox(s)
s.mylayoutbox:buttons(my_table.join( s.mylayoutbox:buttons(my_table.join(
awful.button({}, 1, function () awful.layout.inc( 1) end), awful.button({}, 1, function() awful.layout.inc(1) end),
awful.button({}, 2, function () awful.layout.set( awful.layout.layouts[1] ) end), awful.button({}, 2, function() awful.layout.set(awful.layout.layouts[1]) end),
awful.button({}, 3, function () awful.layout.inc(-1) end), awful.button({}, 3, function() awful.layout.inc(-1) end),
awful.button({}, 4, function () awful.layout.inc( 1) end), awful.button({}, 4, function() awful.layout.inc(1) end),
awful.button({}, 5, function () awful.layout.inc(-1) end))) awful.button({}, 5, function() awful.layout.inc(-1) end)))
-- Create a taglist widget -- Create a taglist widget
s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, awful.util.taglist_buttons) s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, awful.util.taglist_buttons)