feat(ags): add anim to systray items appear and destroy

This commit is contained in:
matt1432 2023-10-04 12:36:22 -04:00
parent 186fed7bfa
commit aebf9772ee

View file

@ -8,12 +8,15 @@ import { Separator } from '../misc/separator.js';
const SysTrayItem = item => MenuItem({ const SysTrayItem = item => MenuItem({
className: 'tray-item', className: 'tray-item',
child: Revealer({
transition: 'slide_right',
child: Icon({ child: Icon({
size: 24, size: 24,
}), }),
}),
submenu: item.menu, submenu: item.menu,
connections: [[item, btn => { connections: [[item, btn => {
btn.child.icon = item.icon; btn.child.child.icon = item.icon;
btn.tooltipMarkup = item.tooltipMarkup; btn.tooltipMarkup = item.tooltipMarkup;
}]] }]]
}); });
@ -39,13 +42,18 @@ export const SysTray = Revealer({
box._items.set(id, widget); box._items.set(id, widget);
box.add(widget); box.add(widget);
box.show_all(); box.show_all();
widget.child.revealChild = true;
}], }],
['onRemoved', (box, id) => { ['onRemoved', (box, id) => {
if (!box._items.has(id)) if (!box._items.has(id))
return; return;
box._items.get(id).child.revealChild = false;
setTimeout(() => {
box._items.get(id).destroy(); box._items.get(id).destroy();
box._items.delete(id); box._items.delete(id);
}, 400);
}], }],
], ],
connections: [ connections: [