Files
dotfiles/config/astal/components/notifications/icon.tsx
T

27 lines
748 B
TypeScript

import { Gtk } from "astal/gtk4";
import Notifd from "gi://AstalNotifd";
import { fileExists, isIcon } from "./helper";
export function NotificationIcon(notification: Notifd.Notification) {
if ( notification.image || notification.appIcon || notification.desktopEntry) {
const icon = notification.image || notification.appIcon || notification.desktopEntry;
if (fileExists(icon)) {
return (
<box hexpand={false} valign={Gtk.Align.CENTER} child={
<image file={icon} />
}>
</box>
);
} else if (isIcon(icon)) {
return (
<box hexpand={false} valign={Gtk.Align.CENTER} child={
<image iconName={icon} />
}>
</box>
);
}
}
return null;
}