Update pika-hyprland-settings/etc/skel/.config/ags/widgets/systray.js
This commit is contained in:
parent
72b0ec3898
commit
c243cbef27
@ -4,26 +4,23 @@ const { Widget } = ags;
|
|||||||
export const Systray = () => Widget.Box({
|
export const Systray = () => Widget.Box({
|
||||||
className: 'systray',
|
className: 'systray',
|
||||||
connections: [[SystemTray, box => {
|
connections: [[SystemTray, box => {
|
||||||
const arr = SystemTray.items;
|
box.children = SystemTray.items.map(item =>{
|
||||||
box.children = arr.map(item =>{
|
const iconW = Widget.Icon({
|
||||||
const icon = SystemTray.get_icon(item, 24);
|
size: 24
|
||||||
if (!icon) {
|
});
|
||||||
return;
|
iconW.set_margin_left(6);
|
||||||
}
|
iconW.icon = item.icon;
|
||||||
icon.set_margin_left(7);
|
|
||||||
const btn = Widget.Button({
|
const btn = Widget.Button({
|
||||||
//call the Activate function when icon is clicked
|
onPrimaryClick: (_, event) => item.activate(event),
|
||||||
//Note: if item.ItemIsMenu is true, left click should open menu
|
onSecondaryClick: (_, event) => item.openMenu(event),
|
||||||
onPrimaryClick: (_, event) => item.ActivateAsync(event.get_root_coords()[1], event.get_root_coords()[2]),
|
child: iconW,
|
||||||
//open menu on right click.
|
className: 'systray-icon',
|
||||||
//Note: if item.Menu is not set item.ContextMenuAsync(x, y) should be called.
|
connections: [[item, button => {
|
||||||
onSecondaryClick: (_, event) => {
|
button.child.icon = item.icon;
|
||||||
item.AgsMenu.popup_at_widget(btn, 8, 2, event);
|
button.tooltipMarkup = item.tooltipMarkup;
|
||||||
},
|
}]],
|
||||||
//show icon
|
});
|
||||||
className: 'systray-icon',
|
return btn;
|
||||||
child: icon,
|
});
|
||||||
tooltipMarkup: SystemTray.get_tooltip_markup(item)
|
|
||||||
} ); return btn;});
|
|
||||||
}]],
|
}]],
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user