notifpopups: shrink image

This commit is contained in:
2 * r + 2 * t 2025-02-23 16:48:26 +11:00
parent a8f9d452e5
commit dda2fad264
2 changed files with 11 additions and 5 deletions

View file

@ -42,9 +42,14 @@ label.icon {
background-size: cover; background-size: cover;
background-position: center; background-position: center;
margin-top: lib.s(3);
min-width: lib.s(64); min-width: lib.s(64);
min-height: lib.s(64); min-height: lib.s(64);
margin-top: lib.s(3);
&.small {
min-width: lib.s(48);
min-height: lib.s(48);
}
} }
.summary { .summary {

View file

@ -51,18 +51,19 @@ const AppIcon = ({ appIcon, desktopEntry }: { appIcon: string; desktopEntry: str
return icon ? <icon className="app-icon" icon={icon} /> : null; return icon ? <icon className="app-icon" icon={icon} /> : null;
}; };
const Image = ({ icon }: { icon: string }) => { const Image = ({ popup, icon }: { popup?: boolean; icon: string }) => {
if (GLib.file_test(icon, GLib.FileTest.EXISTS)) if (GLib.file_test(icon, GLib.FileTest.EXISTS))
return ( return (
<box <box
valign={Gtk.Align.START} valign={Gtk.Align.START}
className="image" className={`image ${popup ? "small" : ""}`}
css={` css={`
background-image: url("${icon}"); background-image: url("${icon}");
`} `}
/> />
); );
if (Astal.Icon.lookup_icon(icon)) return <icon valign={Gtk.Align.START} className="image" icon={icon} />; if (Astal.Icon.lookup_icon(icon))
return <icon valign={Gtk.Align.START} className={`image ${popup ? "small" : ""}`} icon={icon} />;
return null; return null;
}; };
@ -93,7 +94,7 @@ export default class Notification extends Widget.Box {
</box> </box>
<box hexpand className="separator" /> <box hexpand className="separator" />
<box className="content"> <box className="content">
{notification.image && <Image icon={notification.image} />} {notification.image && <Image popup={popup} icon={notification.image} />}
<box vertical> <box vertical>
<label className="summary" xalign={0} label={notification.summary} truncate /> <label className="summary" xalign={0} label={notification.summary} truncate />
{notification.body && ( {notification.body && (