fix(agsV2 notifs): don't render icon if not found

This commit is contained in:
matt1432 2024-11-12 14:27:10 -05:00
parent 29ad4ad55a
commit 99e2b17754

View file

@ -24,7 +24,7 @@ const setTime = (time: number): string => GLib.DateTime
const NotifIcon = ({ notifObj }: { const NotifIcon = ({ notifObj }: {
notifObj: AstalNotifd.Notification notifObj: AstalNotifd.Notification
}) => { }) => {
let icon: string; let icon: string | undefined;
if (notifObj.get_image() && notifObj.get_image() !== '') { if (notifObj.get_image() && notifObj.get_image() !== '') {
icon = notifObj.get_image(); icon = notifObj.get_image();
@ -36,7 +36,7 @@ const NotifIcon = ({ notifObj }: {
else { else {
icon = Applications.fuzzy_query( icon = Applications.fuzzy_query(
notifObj.get_app_name(), notifObj.get_app_name(),
)[0].get_icon_name(); )[0]?.get_icon_name();
} }
return ( return (
@ -48,6 +48,7 @@ const NotifIcon = ({ notifObj }: {
min-height: 78px; min-height: 78px;
`} `}
> >
{icon && (
<icon <icon
icon={icon} icon={icon}
css="font-size: 58px;" css="font-size: 58px;"
@ -56,6 +57,7 @@ const NotifIcon = ({ notifObj }: {
valign={Gtk.Align.CENTER} valign={Gtk.Align.CENTER}
vexpand vexpand
/> />
)}
</box> </box>
); );
}; };