From d73d0cf8ce1f7afa0d13254c096b5129a4b334aa Mon Sep 17 00:00:00 2001 From: Araxeus <78568641+Araxeus@users.noreply.github.com> Date: Thu, 1 Apr 2021 15:39:07 +0300 Subject: [PATCH] fix duplicate notification --- plugins/notifications/back.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/notifications/back.js b/plugins/notifications/back.js index 65e4337b..0d390307 100644 --- a/plugins/notifications/back.js +++ b/plugins/notifications/back.js @@ -18,7 +18,7 @@ const notify = (info, options) => { }; // Send the notification - currentNotification = new Notification(notification); + const currentNotification = new Notification(notification); currentNotification.show() return currentNotification; @@ -27,11 +27,13 @@ const notify = (info, options) => { module.exports = (win, options) => { const registerCallback = getSongInfo(win); let oldNotification; + let oldTitle = ""; win.on("ready-to-show", () => { // Register the callback for new song information registerCallback(songInfo => { // If song is playing send notification - if (!songInfo.isPaused) { + if (!songInfo.isPaused && songInfo.title !== oldTitle) { + oldTitle = songInfo.title; // Close the old notification oldNotification?.close(); // This fixes a weird bug that would cause the notification to be updated instead of showing