From daa8ea5ab2f9c6d7dec23c5087a2adebe726c0c6 Mon Sep 17 00:00:00 2001 From: Julian Sparber Date: Sat, 27 Jan 2024 14:18:41 +0100 Subject: [PATCH] messageTray: Support setting notification icon by name Since we now display the source icon and an image for the notification, it's quite common to set an icon from a name. Therefore add a convenience property to do so. Part-of: --- js/ui/messageTray.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 7427b4a51..479044a3a 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -431,6 +431,17 @@ export const Notification = GObject.registerClass({ this.emit('updated', params.clear); } + get iconName() { + if (this.gicon instanceof Gio.ThemedIcon) + return this.gicon.iconName; + else + return null; + } + + set iconName(iconName) { + this.gicon = new Gio.ThemedIcon({name: iconName}); + } + // addAction: // @label: the label for the action's button // @callback: the callback for the action