mirror of
https://github.com/tuxdotrs/tpanel.git
synced 2025-10-10 12:51:54 +05:30
feat: add notifications widget
This commit is contained in:
21
widgets/notifications/icon.tsx
Normal file
21
widgets/notifications/icon.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Gtk } from "astal/gtk4";
|
||||
import Notifd from "gi://AstalNotifd";
|
||||
import { fileExists, isIcon } from "./notifd";
|
||||
|
||||
export const Icon = (notification: Notifd.Notification) => {
|
||||
const icon =
|
||||
notification.image || notification.appIcon || notification.desktopEntry;
|
||||
if (!icon) return null;
|
||||
if (fileExists(icon))
|
||||
return (
|
||||
<box hexpand={false} vexpand={false} valign={Gtk.Align.CENTER}>
|
||||
<image file={icon} />
|
||||
</box>
|
||||
);
|
||||
else if (isIcon(icon))
|
||||
return (
|
||||
<box hexpand={false} vexpand={false} valign={Gtk.Align.CENTER}>
|
||||
<image iconName={icon} />
|
||||
</box>
|
||||
);
|
||||
};
|
Reference in New Issue
Block a user