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
713let 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 ) ,
0 commit comments