mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
taskbar-mediacontrol plugin
Add UI Control to windows taskbar preview
This commit is contained in:
35
plugins/taskbar-mediacontrol/back.js
Normal file
35
plugins/taskbar-mediacontrol/back.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
const getSongControls = require("../../providers/song-controls");
|
||||||
|
const getSongInfo = require("../../providers/song-info");
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
module.exports = win => {
|
||||||
|
const registerCallback = getSongInfo(win);
|
||||||
|
const { playPause, next, previous} = getSongControls(win);
|
||||||
|
|
||||||
|
// If the page is ready, register the callback
|
||||||
|
win.on("ready-to-show", () => {
|
||||||
|
// Register the callback
|
||||||
|
registerCallback((songInfo) => {
|
||||||
|
// Song information changed, so lets update the the playPause button
|
||||||
|
win.setThumbarButtons([
|
||||||
|
{
|
||||||
|
tooltip: 'Previous',
|
||||||
|
icon: get('backward.png'),
|
||||||
|
click () { previous(win.webContents) }
|
||||||
|
}, {
|
||||||
|
tooltip: 'Play/Pause',
|
||||||
|
icon: songInfo.isPaused ? get('play.png') : get('pause.png'),
|
||||||
|
click () { playPause(win.webContents) }
|
||||||
|
} , {
|
||||||
|
tooltip: 'Next',
|
||||||
|
icon: get('forward.png'),
|
||||||
|
click () { next(win.webContents) }
|
||||||
|
}
|
||||||
|
])
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function get (address) {
|
||||||
|
return path.join(__dirname,address);
|
||||||
|
}
|
||||||
BIN
plugins/taskbar-mediacontrol/backward.png
Normal file
BIN
plugins/taskbar-mediacontrol/backward.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 570 B |
BIN
plugins/taskbar-mediacontrol/forward.png
Normal file
BIN
plugins/taskbar-mediacontrol/forward.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 545 B |
BIN
plugins/taskbar-mediacontrol/pause.png
Normal file
BIN
plugins/taskbar-mediacontrol/pause.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 300 B |
BIN
plugins/taskbar-mediacontrol/play.png
Normal file
BIN
plugins/taskbar-mediacontrol/play.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 468 B |
Reference in New Issue
Block a user