From df8c77cd3e0ecd0fb3876e36ea84937110d99720 Mon Sep 17 00:00:00 2001 From: Araxeus <78568641+Araxeus@users.noreply.github.com> Date: Mon, 22 Mar 2021 03:01:46 +0200 Subject: [PATCH] Wait for song to start before setting thumbar --- plugins/taskbar-mediacontrol/back.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/taskbar-mediacontrol/back.js b/plugins/taskbar-mediacontrol/back.js index eeaf429f..ebf81d07 100644 --- a/plugins/taskbar-mediacontrol/back.js +++ b/plugins/taskbar-mediacontrol/back.js @@ -8,9 +8,12 @@ module.exports = win => { // If the page is ready, register the callback win.on("ready-to-show", () => { - // Register the callback registerCallback((songInfo) => { - // Song information changed, so lets update the the playPause button + //wait for song to start before setting thumbar + if(songInfo.title === '') { + return; + } + // win32 require full rewrite of components win.setThumbarButtons([ { tooltip: 'Previous', @@ -18,6 +21,7 @@ module.exports = win => { click () { previous(win.webContents) } }, { tooltip: 'Play/Pause', + //update icon based on play state icon: songInfo.isPaused ? get('play.png') : get('pause.png'), click () { playPause(win.webContents) } } , { @@ -30,6 +34,7 @@ module.exports = win => { }); }; +//util function get (address) { return path.join(__dirname,address); } \ No newline at end of file