Files
hyprland/config/ags/widget/control_center/PanelButton.js
T
2024-05-18 15:14:03 +05:45

26 lines
692 B
JavaScript

import PanelButton from "../PanelButton.js";
import { WINDOW_NAME } from "./Window.js";
const notifications = await Service.import("notifications");
const NotificationIcon = () =>
Widget.Icon({
class_name: "panel-control-center",
setup: (self) => {
self.hook(notifications, () => {
self.toggleClassName("empty", notifications.notifications.length == 0);
self.icon = notifications.dnd
? "notifications-disabled-symbolic"
: "notifications-symbolic";
});
},
});
export default () =>
PanelButton({
window: WINDOW_NAME,
child: NotificationIcon(),
on_clicked: () => {
App.toggleWindow(WINDOW_NAME);
},
});