Files
custum-hyprpanel/modules/bar/notifications/index.ts
Jas Singh 2908ff7dd6 Added 3 new styles for bar buttons. (#168)
* Added a new style called split for bar buttons

* Added wavy button styles.

* Added padding configuration

* Update bar padding

* Fix styling for battery style2

* Fix icon only setting for bar

* Update types and options

* Add button style to exported theme props.

* Fix top margin for menus.
2024-08-24 00:01:21 -07:00

56 lines
2.0 KiB
TypeScript

import Gdk from 'gi://Gdk?version=3.0';
import { openMenu } from "../utils.js";
import options from "options";
const { show_total } = options.bar.notifications;
const notifs = await Service.import("notifications");
export const Notifications = () => {
return {
component: Widget.Box({
hpack: "start",
className: Utils.merge([options.theme.bar.buttons.style.bind("value"), show_total.bind("value")], (style, showTotal) => {
const styleMap = {
default: "style1",
split: "style2",
wave: "style3",
};
return `notifications ${styleMap[style]} ${!showTotal ? "no-label" : ""}`;
}),
child: Widget.Box({
hpack: "start",
class_name: "bar-notifications",
children: Utils.merge(
[notifs.bind("notifications"), notifs.bind("dnd"), show_total.bind("value")],
(notif, dnd, showTotal) => {
const notifIcon = Widget.Label({
hpack: "center",
class_name: "bar-button-icon notifications txt-icon bar",
label: dnd ? "󰂛" : notif.length > 0 ? "󱅫" : "󰂚",
});
const notifLabel = Widget.Label({
hpack: "center",
class_name: "bar-button-label notifications",
label: notif.length.toString(),
});
if (showTotal) {
return [notifIcon, notifLabel];
}
return [notifIcon];
},
),
}),
}),
isVisible: true,
boxClass: "notifications",
props: {
on_primary_click: (clicked: any, event: Gdk.Event) => {
openMenu(clicked, event, "notificationsmenu");
},
},
};
};