From 3c33226dc7c1636194491842c43dd3dd8945d3d0 Mon Sep 17 00:00:00 2001 From: kotontrion Date: Sat, 16 Nov 2024 12:07:28 +0100 Subject: lua: add actionGroup property --- examples/lua/simple-bar/widget/Bar.lua | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'examples/lua/simple-bar/widget/Bar.lua') diff --git a/examples/lua/simple-bar/widget/Bar.lua b/examples/lua/simple-bar/widget/Bar.lua index bf230bb..843e292 100644 --- a/examples/lua/simple-bar/widget/Bar.lua +++ b/examples/lua/simple-bar/widget/Bar.lua @@ -19,24 +19,16 @@ local function SysTray() return Widget.Box({ bind(tray, "items"):as(function(items) return map(items, function(item) - if item.icon_theme_path ~= nil then - App:add_icons(item.icon_theme_path) - end - - local menu = item:create_menu() - - return Widget.Button({ + return Widget.MenuButton({ tooltip_markup = bind(item, "tooltip_markup"), - on_destroy = function() - if menu ~= nil then - menu:destroy() - end - end, - on_click_release = function(self) - if menu ~= nil then - menu:popup_at_widget(self, Gdk.Gravity.SOUTH, Gdk.Gravity.NORTH, nil) - end - end, + use_popover = false, + menu_model = bind(item, "menu-model"), + action_group = bind(item, "action-group"):as(function(ag) + return { + prefix = "dbusmenu", + action_group = ag + } + end), Widget.Icon({ g_icon = bind(item, "gicon"), }), -- cgit v1.2.3