diff --git a/pika-hyprland-settings/etc/skel/.config/ags/widgets/systray.js b/pika-hyprland-settings/etc/skel/.config/ags/widgets/systray.js index 574de77..55884e8 100644 --- a/pika-hyprland-settings/etc/skel/.config/ags/widgets/systray.js +++ b/pika-hyprland-settings/etc/skel/.config/ags/widgets/systray.js @@ -4,26 +4,23 @@ const { Widget } = ags; export const Systray = () => Widget.Box({ className: 'systray', connections: [[SystemTray, box => { - const arr = SystemTray.items; - box.children = arr.map(item =>{ - const icon = SystemTray.get_icon(item, 24); - if (!icon) { - return; - } - icon.set_margin_left(7); + box.children = SystemTray.items.map(item =>{ + const iconW = Widget.Icon({ + size: 24 + }); + iconW.set_margin_left(6); + iconW.icon = item.icon; const btn = Widget.Button({ - //call the Activate function when icon is clicked - //Note: if item.ItemIsMenu is true, left click should open menu - onPrimaryClick: (_, event) => item.ActivateAsync(event.get_root_coords()[1], event.get_root_coords()[2]), - //open menu on right click. - //Note: if item.Menu is not set item.ContextMenuAsync(x, y) should be called. - onSecondaryClick: (_, event) => { - item.AgsMenu.popup_at_widget(btn, 8, 2, event); - }, - //show icon - className: 'systray-icon', - child: icon, - tooltipMarkup: SystemTray.get_tooltip_markup(item) - } ); return btn;}); + onPrimaryClick: (_, event) => item.activate(event), + onSecondaryClick: (_, event) => item.openMenu(event), + child: iconW, + className: 'systray-icon', + connections: [[item, button => { + button.child.icon = item.icon; + button.tooltipMarkup = item.tooltipMarkup; + }]], + }); + return btn; + }); }]], -}); \ No newline at end of file +});