summaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-01 13:36:23 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-01 13:36:23 +1100
commitd05b124609ca56c99ff9ef32aa2e5217bcde295e (patch)
tree1cb164dbf4b9bac9f41296e19c6c666a16487cb3 /src/widgets
parentcleanup: dispose of file monitors when unneeded (diff)
downloadcaelestia-shell-d05b124609ca56c99ff9ef32aa2e5217bcde295e.tar.gz
caelestia-shell-d05b124609ca56c99ff9ef32aa2e5217bcde295e.tar.bz2
caelestia-shell-d05b124609ca56c99ff9ef32aa2e5217bcde295e.zip
feat: thumbnailer utility
Fix large images in notifications being slow GTK css background image is really slow for scaling for some reason, so thumbnail
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/notification.tsx9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/widgets/notification.tsx b/src/widgets/notification.tsx
index b2a10be..0dfd368 100644
--- a/src/widgets/notification.tsx
+++ b/src/widgets/notification.tsx
@@ -1,4 +1,5 @@
import { desktopEntrySubs } from "@/utils/icons";
+import Thumbnailer from "@/utils/thumbnailer";
import { setupCustomTooltip } from "@/utils/widgets";
import { bind, GLib, register, timeout, Variable } from "astal";
import { Astal, Gtk, Widget } from "astal/gtk3";
@@ -58,9 +59,11 @@ const Image = ({ compact, icon }: { compact?: boolean; icon: string }) => {
<box
valign={Gtk.Align.START}
className={`image ${compact ? "small" : ""}`}
- css={`
- background-image: url("${icon}");
- `}
+ setup={self =>
+ Thumbnailer.thumbnail(icon)
+ .then(p => (self.css = `background-image: url("${p}");`))
+ .catch(console.error)
+ }
/>
);
if (Astal.Icon.lookup_icon(icon))