mirror of
https://github.com/tuxdotrs/tpanel.git
synced 2025-10-10 21:01:54 +05:30
30 lines
827 B
TypeScript
30 lines
827 B
TypeScript
import { Astal, Gdk } from "astal/gtk4";
|
|
import Notifd from "gi://AstalNotifd";
|
|
import { bind } from "astal";
|
|
import { NotificationWidget } from "./notification";
|
|
|
|
export const WINDOW_NAME = "notifications";
|
|
|
|
export const Notifications = (gdkmonitor: Gdk.Monitor) => {
|
|
const notifd = Notifd.get_default();
|
|
const { TOP, RIGHT } = Astal.WindowAnchor;
|
|
|
|
return (
|
|
<window
|
|
name={WINDOW_NAME}
|
|
cssClasses={["notifications"]}
|
|
gdkmonitor={gdkmonitor}
|
|
anchor={TOP | RIGHT}
|
|
visible={bind(notifd, "notifications").as(
|
|
(notifications) => notifications.length > 0,
|
|
)}
|
|
>
|
|
<box vertical={true} spacing={10}>
|
|
{bind(notifd, "notifications").as((notifications) =>
|
|
notifications.map((n) => <NotificationWidget n={n} />),
|
|
)}
|
|
</box>
|
|
</window>
|
|
);
|
|
};
|