mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Use system source for update notifications
This commit is contained in:
@@ -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: () =>
|
||||
|
||||
17
src/utils.js
17
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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user