Skip to content

Commit

Permalink
xo lint --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Araxeus committed Mar 22, 2021
1 parent 17e6319 commit 5285680
Showing 1 changed file with 49 additions and 47 deletions.
96 changes: 49 additions & 47 deletions plugins/taskbar-mediacontrol/back.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,58 @@
const getSongControls = require("../../providers/song-controls");
const getSongInfo = require("../../providers/song-info");
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);}
win.hide = function () {
win.minimize();
win.setSkipTaskbar(true);
};

var show = win.show;
win.show = function () {
win.restore();
win.focus();
win.setSkipTaskbar(false);
show.apply(win)
}
const {show} = win;
win.show = function () {
win.restore();
win.focus();
win.setSkipTaskbar(false);
show.apply(win);
};

win.isVisible = function () {
return !win.isMinimized();
}
win.isVisible = function () {
return !win.isMinimized();
};

const registerCallback = getSongInfo(win);
const { playPause, next, previous} = getSongControls(win);
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) }
}
])
});
});
// 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);
}
// Util
function get(address) {
return path.join(__dirname, address);
}

0 comments on commit 5285680

Please sign in to comment.