1
- const getSongControls = require ( " ../../providers/song-controls" ) ;
2
- const getSongInfo = require ( " ../../providers/song-info" ) ;
1
+ const getSongControls = require ( ' ../../providers/song-controls' ) ;
2
+ const getSongInfo = require ( ' ../../providers/song-info' ) ;
3
3
const path = require ( 'path' ) ;
4
4
5
5
module . exports = win => {
6
- win . hide = function ( ) {
7
- win . minimize ( )
8
- win . setSkipTaskbar ( true ) ; }
6
+ win . hide = function ( ) {
7
+ win . minimize ( ) ;
8
+ win . setSkipTaskbar ( true ) ;
9
+ } ;
9
10
10
- var show = win . show ;
11
- win . show = function ( ) {
12
- win . restore ( ) ;
13
- win . focus ( ) ;
14
- win . setSkipTaskbar ( false ) ;
15
- show . apply ( win )
16
- }
11
+ const { show} = win ;
12
+ win . show = function ( ) {
13
+ win . restore ( ) ;
14
+ win . focus ( ) ;
15
+ win . setSkipTaskbar ( false ) ;
16
+ show . apply ( win ) ;
17
+ } ;
17
18
18
- win . isVisible = function ( ) {
19
- return ! win . isMinimized ( ) ;
20
- }
19
+ win . isVisible = function ( ) {
20
+ return ! win . isMinimized ( ) ;
21
+ } ;
21
22
22
- const registerCallback = getSongInfo ( win ) ;
23
- const { playPause, next, previous} = getSongControls ( win ) ;
23
+ const registerCallback = getSongInfo ( win ) ;
24
+ const { playPause, next, previous} = getSongControls ( win ) ;
24
25
25
- // If the page is ready, register the callback
26
- win . on ( "ready-to-show" , ( ) => {
27
- registerCallback ( ( songInfo ) => {
28
- //wait for song to start before setting thumbar
29
- if ( songInfo . title === '' ) {
30
- return ;
31
- }
32
- // win32 require full rewrite of components
33
- win . setThumbarButtons ( [
34
- {
35
- tooltip : 'Previous' ,
36
- icon : get ( 'backward.png' ) ,
37
- click ( ) { previous ( win . webContents ) }
38
- } , {
39
- tooltip : 'Play/Pause' ,
40
- //update icon based on play state
41
- icon : songInfo . isPaused ? get ( 'play.png' ) : get ( 'pause.png' ) ,
42
- click ( ) { playPause ( win . webContents ) }
43
- } , {
44
- tooltip : 'Next' ,
45
- icon : get ( 'forward.png' ) ,
46
- click ( ) { next ( win . webContents ) }
47
- }
48
- ] )
49
- } ) ;
50
- } ) ;
26
+ // If the page is ready, register the callback
27
+ win . on ( 'ready-to-show' , ( ) => {
28
+ registerCallback ( songInfo => {
29
+ // Wait for song to start before setting thumbar
30
+ if ( songInfo . title === '' ) {
31
+ return ;
32
+ }
33
+
34
+ // Win32 require full rewrite of components
35
+ win . setThumbarButtons ( [
36
+ {
37
+ tooltip : 'Previous' ,
38
+ icon : get ( 'backward.png' ) ,
39
+ click ( ) { previous ( win . webContents ) ; }
40
+ } , {
41
+ tooltip : 'Play/Pause' ,
42
+ // Update icon based on play state
43
+ icon : songInfo . isPaused ? get ( 'play.png' ) : get ( 'pause.png' ) ,
44
+ click ( ) { playPause ( win . webContents ) ; }
45
+ } , {
46
+ tooltip : 'Next' ,
47
+ icon : get ( 'forward.png' ) ,
48
+ click ( ) { next ( win . webContents ) ; }
49
+ }
50
+ ] ) ;
51
+ } ) ;
52
+ } ) ;
51
53
} ;
52
54
53
- //util
54
- function get ( address ) {
55
- return path . join ( __dirname , address ) ;
56
- }
55
+ // Util
56
+ function get ( address ) {
57
+ return path . join ( __dirname , address ) ;
58
+ }
0 commit comments