1
- const { TouchBar} = require ( ' electron' ) ;
1
+ const { TouchBar } = require ( " electron" ) ;
2
2
const {
3
3
TouchBarButton,
4
4
TouchBarLabel,
5
5
TouchBarSpacer,
6
6
TouchBarSegmentedControl,
7
- TouchBarScrubber
7
+ TouchBarScrubber,
8
8
} = TouchBar ;
9
9
10
10
// Songtitle label
11
11
const songTitle = new TouchBarLabel ( {
12
- label : ''
12
+ label : "" ,
13
13
} ) ;
14
14
// This will store the song controls once available
15
15
let controls = [ ] ;
@@ -22,37 +22,37 @@ const pausePlayButton = new TouchBarButton();
22
22
23
23
// The song control buttons (control functions are in the same order)
24
24
const buttons = new TouchBarSegmentedControl ( {
25
- mode : ' buttons' ,
25
+ mode : " buttons" ,
26
26
segments : [
27
27
new TouchBarButton ( {
28
- label : '⏮'
28
+ label : "⏮" ,
29
29
} ) ,
30
30
pausePlayButton ,
31
31
new TouchBarButton ( {
32
- label : '⏭'
32
+ label : "⏭" ,
33
33
} ) ,
34
34
new TouchBarButton ( {
35
- label : '👎'
35
+ label : "👎" ,
36
36
} ) ,
37
37
new TouchBarButton ( {
38
- label : '👍'
39
- } )
38
+ label : "👍" ,
39
+ } ) ,
40
40
] ,
41
- change : i => controls [ i ] ( )
41
+ change : ( i ) => controls [ i ] ( ) ,
42
42
} ) ;
43
43
44
44
// This is the touchbar object, this combines everything with proper layout
45
45
const touchBar = new TouchBar ( {
46
46
items : [
47
47
new TouchBarScrubber ( {
48
48
items : [ songImage , songTitle ] ,
49
- continuous : false
49
+ continuous : false ,
50
50
} ) ,
51
51
new TouchBarSpacer ( {
52
- size : ' flexible'
52
+ size : " flexible" ,
53
53
} ) ,
54
- buttons
55
- ]
54
+ buttons ,
55
+ ] ,
56
56
} ) ;
57
57
58
58
module . exports = win => {
@@ -74,10 +74,12 @@ module.exports = win => {
74
74
songTitle . label = songInfo . title ;
75
75
76
76
// Changes the pause button if paused
77
- pausePlayButton . label = songInfo . isPaused ? '▶️' : '⏸' ;
77
+ pausePlayButton . label = songInfo . isPaused ? "▶️" : "⏸" ;
78
78
79
79
// Get image source
80
- songImage . icon = songInfo . image ? songInfo . image . resize ( { height : 23 } ) : null ;
80
+ songImage . icon = songInfo . image
81
+ ? songInfo . image . resize ( { height : 23 } )
82
+ : null ;
81
83
82
84
win . setTouchBar ( touchBar ) ;
83
85
} ) ;
0 commit comments