tray: filter out empty tray items (#717)

This commit is contained in:
end-4 2024-08-03 21:23:46 +07:00 committed by GitHub
commit 78f622963f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,15 +3,15 @@ import SystemTray from 'resource:///com/github/Aylur/ags/service/systemtray.js';
const { Box, Icon, Button, Revealer } = Widget;
const { Gravity } = imports.gi.Gdk;
const SysTrayItem = (item) => Button({
const SysTrayItem = (item) => item.id !== null ? Button({
className: 'bar-systray-item',
child: Icon({hpack: 'center'}).bind('icon', item, 'icon'),
child: Icon({ hpack: 'center' }).bind('icon', item, 'icon'),
setup: (self) => self
.hook(item, (self) => self.tooltipMarkup = item['tooltip-markup'])
,
onPrimaryClick: (_, event) => item.activate(event),
onSecondaryClick: (btn, event) => item.menu.popup_at_widget(btn, Gravity.SOUTH, Gravity.NORTH, null),
});
}) : null;
export const Tray = (props = {}) => {
const trayContent = Box({