From bf383809996bf196c44ead83c32ba382adbe1346 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Fri, 21 Feb 2025 15:28:26 -0500 Subject: [PATCH] Use system source for update notifications --- src/extension.js | 3 +++ src/utils.js | 17 +++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/extension.js b/src/extension.js index 800edd5..4bb9c6c 100644 --- a/src/extension.js +++ b/src/extension.js @@ -88,6 +88,9 @@ export default class DashToPanelExtension extends Extension { _('Dash to Panel has been updated!'), _(`You are now running version ${this.metadata.version}.`), 'software-update-available-symbolic', + Gio.icon_new_for_string( + `${this.path}/img/dash-to-panel-logo-light.svg`, + ), { text: _(`See what's new`), func: () => diff --git a/src/utils.js b/src/utils.js index 90c1dbc..0d30578 100644 --- a/src/utils.js +++ b/src/utils.js @@ -528,18 +528,24 @@ export const getPoint = function (coords) { return new Graphene.Point(coords) } -export const notify = function (title, body, iconName, action, isTransient) { - let source = new MessageTray.Source({ - title: 'Dash to Panel', - }) +export const notify = function ( + title, + body, + sourceIconName, + notificationIcon, + action, + isTransient, +) { + let source = MessageTray.getSystemSource() let notification = new MessageTray.Notification({ source, title, body, isTransient: isTransient || false, + gicon: notificationIcon || null, }) - if (iconName) source.iconName = iconName + if (sourceIconName) source.iconName = sourceIconName if (action) { if (!(action instanceof Array)) { @@ -549,7 +555,6 @@ export const notify = function (title, body, iconName, action, isTransient) { action.forEach((a) => notification.addAction(a.text, a.func)) } - Main.messageTray.add(source) source.addNotification(notification) }