Skip to content

Commit 271d525

Browse files
committed
fix interactive notifications icon
1 parent 61eb236 commit 271d525

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"productName": "YouTube Music",
1616
"mac": {
1717
"identity": null,
18+
"files": ["!plugins/{taskbar-mediacontrol,notifications/snoretoast}${/*}"],
1819
"target": [
1920
{
2021
"target": "dmg",
@@ -28,6 +29,7 @@
2829
},
2930
"win": {
3031
"icon": "assets/generated/icons/win/icon.ico",
32+
"files": ["!plugins/touchbar${/*}"],
3133
"target": [
3234
"nsis",
3335
"portable"
@@ -38,6 +40,7 @@
3840
},
3941
"linux": {
4042
"icon": "assets/generated/icons/png",
43+
"files": ["!plugins/{touchbar,taskbar-mediacontrol,notifications/snoretoast}${/*}"],
4144
"category": "AudioVideo",
4245
"target": [
4346
"AppImage",

plugins/notifications/back.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ const is = require("electron-is");
33
const registerCallback = require("../../providers/song-info");
44
const { notificationImage } = require("./utils");
55

6-
const setupInteractive = require("./interactive")
7-
86
const notify = (info, options) => {
97

108
// Fill the notification with content
@@ -41,6 +39,6 @@ const setup = (options) => {
4139
module.exports = (win, options) => {
4240
// Register the callback for new song information
4341
is.windows() && options.interactive ?
44-
setupInteractive(win, options.unpauseNotification) :
42+
require("./snoretoast/interactive")(win, options.unpauseNotification) :
4543
setup(options);
4644
};

plugins/notifications/interactive.js renamed to plugins/notifications/snoretoast/interactive.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
const { notificationImage, icons } = require("./utils");
2-
const getSongControls = require('../../providers/song-controls');
3-
const registerCallback = require("../../providers/song-info");
4-
const notifier = require("node-notifier");
1+
const { notificationImage, icons } = require("../utils");
2+
const getSongControls = require('../../../providers/song-controls');
3+
const registerCallback = require("../../../providers/song-info");
4+
const WindowsToaster = require('node-notifier').WindowsToaster;
5+
6+
const notifier = new WindowsToaster({
7+
withFallback: true,
8+
// see https://github.com/th-ch/youtube-music/pull/591
9+
customPath: require("path").join(__dirname, 'snoretoast-x64.exe')
10+
});
511

612
//store song controls reference on launch
713
let controls;
@@ -17,11 +23,11 @@ module.exports = (win, unpauseNotification) => {
1723

1824
// Register songInfoCallback
1925
registerCallback(songInfo => {
20-
if (!songInfo.isPaused && (songInfo.url !== currentUrl || notificationOnUnpause)) {
26+
if (!songInfo.isPaused && (songInfo.url !== currentUrl || notificationOnUnpause)) {
2127
currentUrl = songInfo.url;
2228
sendToaster(songInfo);
23-
}
24-
});
29+
}
30+
});
2531

2632
win.webContents.once("closed", () => {
2733
deleteNotification()
@@ -48,7 +54,7 @@ function sendToaster(songInfo) {
4854
//download image and get path
4955
let imgSrc = notificationImage(songInfo, true);
5056
toDelete = {
51-
//app id undefined - will break buttons
57+
appID: "com.github.th-ch.youtube-music",
5258
title: songInfo.title || "Playing",
5359
message: songInfo.artist,
5460
id: parseInt(Math.random() * 1000000, 10),
545 KB
Binary file not shown.

0 commit comments

Comments
 (0)