nit: prettier

This commit is contained in:
TC
2021-01-12 21:16:29 +01:00
parent 77e24f41a5
commit f1ddb92886
2 changed files with 22 additions and 20 deletions

View File

@ -1,18 +1,18 @@
const {Notification} = require('electron'); const { Notification } = require("electron");
const notify = info => { const notify = info => {
let notificationImage = 'assets/youtube-music.png'; let notificationImage = 'assets/youtube-music.png';
if (info.image) { if (info.image) {
notificationImage = info.image.resize({height: 256, width: 256}); notificationImage = info.image.resize({ height: 256, width: 256 });
} }
// Fill the notification with content // Fill the notification with content
const notification = { const notification = {
title: info.title || 'Playing', title: info.title || "Playing",
body: info.artist, body: info.artist,
icon: notificationImage, icon: notificationImage,
silent: true silent: true,
}; };
// Send the notification // Send the notification
new Notification(notification).show(); new Notification(notification).show();

View File

@ -1,15 +1,15 @@
const {TouchBar} = require('electron'); const { TouchBar } = require("electron");
const { const {
TouchBarButton, TouchBarButton,
TouchBarLabel, TouchBarLabel,
TouchBarSpacer, TouchBarSpacer,
TouchBarSegmentedControl, TouchBarSegmentedControl,
TouchBarScrubber TouchBarScrubber,
} = TouchBar; } = TouchBar;
// Songtitle label // Songtitle label
const songTitle = new TouchBarLabel({ const songTitle = new TouchBarLabel({
label: '' label: "",
}); });
// This will store the song controls once available // This will store the song controls once available
let controls = []; let controls = [];
@ -22,23 +22,23 @@ const pausePlayButton = new TouchBarButton();
// The song control buttons (control functions are in the same order) // The song control buttons (control functions are in the same order)
const buttons = new TouchBarSegmentedControl({ const buttons = new TouchBarSegmentedControl({
mode: 'buttons', mode: "buttons",
segments: [ segments: [
new TouchBarButton({ new TouchBarButton({
label: '⏮' label: "⏮",
}), }),
pausePlayButton, pausePlayButton,
new TouchBarButton({ new TouchBarButton({
label: '⏭' label: "⏭",
}), }),
new TouchBarButton({ new TouchBarButton({
label: '👎' label: "👎",
}), }),
new TouchBarButton({ new TouchBarButton({
label: '👍' label: "👍",
}) }),
], ],
change: i => controls[i]() change: (i) => controls[i](),
}); });
// This is the touchbar object, this combines everything with proper layout // This is the touchbar object, this combines everything with proper layout
@ -46,13 +46,13 @@ const touchBar = new TouchBar({
items: [ items: [
new TouchBarScrubber({ new TouchBarScrubber({
items: [songImage, songTitle], items: [songImage, songTitle],
continuous: false continuous: false,
}), }),
new TouchBarSpacer({ new TouchBarSpacer({
size: 'flexible' size: "flexible",
}), }),
buttons buttons,
] ],
}); });
module.exports = win => { module.exports = win => {
@ -74,10 +74,12 @@ module.exports = win => {
songTitle.label = songInfo.title; songTitle.label = songInfo.title;
// Changes the pause button if paused // Changes the pause button if paused
pausePlayButton.label = songInfo.isPaused ? '▶️' : '⏸'; pausePlayButton.label = songInfo.isPaused ? "▶️" : "⏸";
// Get image source // Get image source
songImage.icon = songInfo.image ? songInfo.image.resize({height: 23}) : null; songImage.icon = songInfo.image
? songInfo.image.resize({ height: 23 })
: null;
win.setTouchBar(touchBar); win.setTouchBar(touchBar);
}); });