File tree 1 file changed +7
-2
lines changed
plugins/taskbar-mediacontrol
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -8,16 +8,20 @@ module.exports = win => {
8
8
9
9
// If the page is ready, register the callback
10
10
win . on ( "ready-to-show" , ( ) => {
11
- // Register the callback
12
11
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
14
17
win . setThumbarButtons ( [
15
18
{
16
19
tooltip : 'Previous' ,
17
20
icon : get ( 'backward.png' ) ,
18
21
click ( ) { previous ( win . webContents ) }
19
22
} , {
20
23
tooltip : 'Play/Pause' ,
24
+ //update icon based on play state
21
25
icon : songInfo . isPaused ? get ( 'play.png' ) : get ( 'pause.png' ) ,
22
26
click ( ) { playPause ( win . webContents ) }
23
27
} , {
@@ -30,6 +34,7 @@ module.exports = win => {
30
34
} ) ;
31
35
} ;
32
36
37
+ //util
33
38
function get ( address ) {
34
39
return path . join ( __dirname , address ) ;
35
40
}
You can’t perform that action at this time.
0 commit comments