Skip to content

Commit df8c77c

Browse files
committed
Wait for song to start before setting thumbar
1 parent 41796ae commit df8c77c

File tree

1 file changed

+7
-2
lines changed
  • plugins/taskbar-mediacontrol

1 file changed

+7
-2
lines changed

plugins/taskbar-mediacontrol/back.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,20 @@ module.exports = win => {
88

99
// If the page is ready, register the callback
1010
win.on("ready-to-show", () => {
11-
// Register the callback
1211
registerCallback((songInfo) => {
13-
// Song information changed, so lets update the the playPause button
12+
//wait for song to start before setting thumbar
13+
if(songInfo.title === '') {
14+
return;
15+
}
16+
// win32 require full rewrite of components
1417
win.setThumbarButtons([
1518
{
1619
tooltip: 'Previous',
1720
icon: get('backward.png'),
1821
click () { previous(win.webContents) }
1922
}, {
2023
tooltip: 'Play/Pause',
24+
//update icon based on play state
2125
icon: songInfo.isPaused ? get('play.png') : get('pause.png'),
2226
click () { playPause(win.webContents) }
2327
} , {
@@ -30,6 +34,7 @@ module.exports = win => {
3034
});
3135
};
3236

37+
//util
3338
function get (address) {
3439
return path.join(__dirname,address);
3540
}

0 commit comments

Comments
 (0)