Files
custum-hyprpanel/modules/bar/notifications/index.js
2024-06-26 02:00:53 -07:00

36 lines
935 B
JavaScript

const notifs = await Service.import("notifications");
export const Notifications = () => {
return {
component: Widget.Box({
hpack: "start",
hexpand: true,
child: Widget.Button({
hpack: "start",
hexpand: true,
class_name: "bar-notifications",
child: Widget.Label({
hpack: "center",
hexpand: true,
class_name: "bar-notifications-label",
setup: (self) => {
self.hook(notifs, () => {
if (notifs.dnd) {
return (self.label = "󰂛");
} else if (notifs.notifications.length > 0) {
return (self.label = "󱅫");
} else {
return (self.label = "󰂚");
}
});
},
}),
}),
}),
isVisible: true,
props: {
on_primary_click: () => App.toggleWindow("notificationsmenu"),
},
};
};