fix(agsV2 notifs): don't render icon if not found
This commit is contained in:
parent
29ad4ad55a
commit
99e2b17754
1 changed files with 12 additions and 10 deletions
|
@ -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,14 +48,16 @@ const NotifIcon = ({ notifObj }: {
|
||||||
min-height: 78px;
|
min-height: 78px;
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<icon
|
{icon && (
|
||||||
icon={icon}
|
<icon
|
||||||
css="font-size: 58px;"
|
icon={icon}
|
||||||
halign={Gtk.Align.CENTER}
|
css="font-size: 58px;"
|
||||||
hexpand
|
halign={Gtk.Align.CENTER}
|
||||||
valign={Gtk.Align.CENTER}
|
hexpand
|
||||||
vexpand
|
valign={Gtk.Align.CENTER}
|
||||||
/>
|
vexpand
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</box>
|
</box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue