mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
Merge branch 'styled-bars' of https://github.com/Araxeus/youtube-music into styled-bars
This commit is contained in:
@ -1,58 +0,0 @@
|
|||||||
const getSongControls = require('../../providers/song-controls');
|
|
||||||
const getSongInfo = require('../../providers/song-info');
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
module.exports = win => {
|
|
||||||
win.hide = function () {
|
|
||||||
win.minimize();
|
|
||||||
win.setSkipTaskbar(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const show = win.show;
|
|
||||||
win.show = function () {
|
|
||||||
win.restore();
|
|
||||||
win.focus();
|
|
||||||
win.setSkipTaskbar(false);
|
|
||||||
show.apply(win);
|
|
||||||
};
|
|
||||||
|
|
||||||
win.isVisible = function () {
|
|
||||||
return !win.isMinimized();
|
|
||||||
};
|
|
||||||
|
|
||||||
const registerCallback = getSongInfo(win);
|
|
||||||
const {playPause, next, previous} = getSongControls(win);
|
|
||||||
|
|
||||||
// If the page is ready, register the callback
|
|
||||||
win.on('ready-to-show', () => {
|
|
||||||
registerCallback(songInfo => {
|
|
||||||
// Wait for song to start before setting thumbar
|
|
||||||
if (songInfo.title === '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Win32 require full rewrite of components
|
|
||||||
win.setThumbarButtons([
|
|
||||||
{
|
|
||||||
tooltip: 'Previous',
|
|
||||||
icon: get('backward.png'),
|
|
||||||
click() {previous(win.webContents);}
|
|
||||||
}, {
|
|
||||||
tooltip: 'Play/Pause',
|
|
||||||
// Update icon based on play state
|
|
||||||
icon: songInfo.isPaused ? get('play.png') : get('pause.png'),
|
|
||||||
click() {playPause(win.webContents);}
|
|
||||||
}, {
|
|
||||||
tooltip: 'Next',
|
|
||||||
icon: get('forward.png'),
|
|
||||||
click() {next(win.webContents);}
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Util
|
|
||||||
function get(address) {
|
|
||||||
return path.join(__dirname, address);
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 570 B |
Binary file not shown.
|
Before Width: | Height: | Size: 545 B |
Binary file not shown.
|
Before Width: | Height: | Size: 300 B |
Binary file not shown.
|
Before Width: | Height: | Size: 468 B |
Reference in New Issue
Block a user