mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
Wait for song to start before setting thumbar
This commit is contained in:
@ -8,9 +8,12 @@ module.exports = win => {
|
|||||||
|
|
||||||
// If the page is ready, register the callback
|
// If the page is ready, register the callback
|
||||||
win.on("ready-to-show", () => {
|
win.on("ready-to-show", () => {
|
||||||
// Register the callback
|
|
||||||
registerCallback((songInfo) => {
|
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([
|
win.setThumbarButtons([
|
||||||
{
|
{
|
||||||
tooltip: 'Previous',
|
tooltip: 'Previous',
|
||||||
@ -18,6 +21,7 @@ module.exports = win => {
|
|||||||
click () { previous(win.webContents) }
|
click () { previous(win.webContents) }
|
||||||
}, {
|
}, {
|
||||||
tooltip: 'Play/Pause',
|
tooltip: 'Play/Pause',
|
||||||
|
//update icon based on play state
|
||||||
icon: songInfo.isPaused ? get('play.png') : get('pause.png'),
|
icon: songInfo.isPaused ? get('play.png') : get('pause.png'),
|
||||||
click () { playPause(win.webContents) }
|
click () { playPause(win.webContents) }
|
||||||
} , {
|
} , {
|
||||||
@ -30,6 +34,7 @@ module.exports = win => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//util
|
||||||
function get (address) {
|
function get (address) {
|
||||||
return path.join(__dirname,address);
|
return path.join(__dirname,address);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user