From 9a9a89ea73c98294522a43ac5b2b23518b6d5c80 Mon Sep 17 00:00:00 2001 From: Luka5W <74739057+Luka5W@users.noreply.github.com> Date: Thu, 14 Dec 2023 09:11:51 +0000 Subject: [PATCH 1/2] fixed widget button bg color, fixed rows fg color --- logout-menu-widget/logout-menu.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/logout-menu-widget/logout-menu.lua b/logout-menu-widget/logout-menu.lua index 9a634f1..9215ccf 100644 --- a/logout-menu-widget/logout-menu.lua +++ b/logout-menu-widget/logout-menu.lua @@ -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 = 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 }, + { 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 }, } for _, item in ipairs(menu_items) do @@ -86,12 +86,13 @@ local function worker(user_args) margins = 8, layout = wibox.container.margin }, + fg = beautiful.fg_normal, bg = beautiful.bg_normal, widget = wibox.container.background } - row:connect_signal("mouse::enter", function(c) c:set_bg(beautiful.bg_focus) end) - row:connect_signal("mouse::leave", function(c) c:set_bg(beautiful.bg_normal) end) + row:connect_signal("mouse::enter", function(c) c:set_bg(beautiful.bg_focus) c:set_fg(beautiful.fg_focus) end) + row:connect_signal("mouse::leave", function(c) c:set_bg(beautiful.bg_normal) c:set_fg(beautiful.fg_normal) end) local old_cursor, old_wibox row:connect_signal("mouse::enter", function() From e47db962d0cf7a1c315fafef8788a2e518b5d082 Mon Sep 17 00:00:00 2001 From: Luka5W <74739057+Luka5W@users.noreply.github.com> Date: Thu, 14 Dec 2023 11:07:36 +0000 Subject: [PATCH 2/2] code cleanup/ simplified --- logout-menu-widget/logout-menu.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/logout-menu-widget/logout-menu.lua b/logout-menu-widget/logout-menu.lua index 9215ccf..2ba7b6f 100644 --- a/logout-menu-widget/logout-menu.lua +++ b/logout-menu-widget/logout-menu.lua @@ -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)))