diff --git a/modules/notifpopups.tsx b/modules/notifpopups.tsx index f83d9dec..8b95f986 100644 --- a/modules/notifpopups.tsx +++ b/modules/notifpopups.tsx @@ -1,6 +1,7 @@ import { GLib, register, timeout } from "astal"; import { Astal, Gtk, Widget } from "astal/gtk3"; import AstalNotifd from "gi://AstalNotifd"; +import { desktopEntrySubs } from "../utils/icons"; const urgencyToString = (urgency: AstalNotifd.Urgency) => { switch (urgency) { @@ -23,7 +24,18 @@ const getTime = (time: number) => { return messageTime.format("%d/%m"); }; -const Icon = ({ icon }: { icon: string }) => { +const AppIcon = ({ appIcon, desktopEntry }: { appIcon: string; desktopEntry: string }) => { + // Try app icon + let icon = Astal.Icon.lookup_icon(appIcon) && appIcon; + // Try desktop entry + if (!icon) { + if (desktopEntrySubs.hasOwnProperty(desktopEntry)) icon = desktopEntrySubs[desktopEntry]; + else if (Astal.Icon.lookup_icon(desktopEntry)) icon = desktopEntry; + } + return icon ? : null; +}; + +const Image = ({ icon }: { icon: string }) => { if (GLib.file_test(icon, GLib.FileTest.EXISTS)) return ( - {(notification.appIcon || notification.desktopEntry) && ( - - )} +