code cleanup/ simplified

This commit is contained in:
Luka5W 2023-12-14 11:07:36 +00:00
parent 9a9a89ea73
commit e47db962d0
1 changed files with 7 additions and 6 deletions

View File

@ -26,7 +26,7 @@ local logout_menu_widget = wibox.widget {
layout = wibox.container.margin
},
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
gears.shape.rounded_rect(cr, width, height, 4)
end,
widget = wibox.container.background,
}
@ -58,11 +58,11 @@ local function worker(user_args)
local onpoweroff = args.onpoweroff or function() awful.spawn.with_shell("shutdown now") end
local menu_items = {
{ name = 'Log out', icon_name = 'log-out.svg', command = function () logout_menu_widget:set_bg('#00000000') onlogout() end },
{ name = 'Lock', icon_name = 'lock.svg', command = function () logout_menu_widget:set_bg('#00000000') onlock() end },
{ name = 'Reboot', icon_name = 'refresh-cw.svg', command = function () logout_menu_widget:set_bg('#00000000') onreboot() end },
{ name = 'Suspend', icon_name = 'moon.svg', command = function () logout_menu_widget:set_bg('#00000000') onsuspend() end },
{ name = 'Power off', icon_name = 'power.svg', command = function () logout_menu_widget:set_bg('#00000000') onpoweroff() end },
{ name = 'Log out', icon_name = 'log-out.svg', command = onlogout },
{ name = 'Lock', icon_name = 'lock.svg', command = onlock },
{ name = 'Reboot', icon_name = 'refresh-cw.svg', command = onreboot },
{ name = 'Suspend', icon_name = 'moon.svg', command = onsuspend },
{ name = 'Power off', icon_name = 'power.svg', command = onpoweroff },
}
for _, item in ipairs(menu_items) do
@ -109,6 +109,7 @@ local function worker(user_args)
row:buttons(awful.util.table.join(awful.button({}, 1, function()
popup.visible = not popup.visible
logout_menu_widget:set_bg('#00000000')
item.command()
end)))