commit
559cbe26eb
6 changed files with 39 additions and 0 deletions
|
@ -268,6 +268,7 @@ const CiderBase = {
|
|||
win.webContents.setZoomFactor(screen.getPrimaryDisplay().scaleFactor)
|
||||
|
||||
mpris.connect(win)
|
||||
mpris.SetButtons(win, false)
|
||||
|
||||
lastfm.authenticate()
|
||||
// Discord
|
||||
|
@ -275,6 +276,7 @@ const CiderBase = {
|
|||
ipcMain.on('playbackStateDidChange', (_event, a) => {
|
||||
app.media = a;
|
||||
discord.updateActivity(a)
|
||||
mpris.SetButtons(win, a)
|
||||
mpris.updateState(a)
|
||||
lastfm.scrobbleSong(a)
|
||||
lastfm.updateNowPlayingSong(a)
|
||||
|
@ -283,6 +285,7 @@ const CiderBase = {
|
|||
ipcMain.on('nowPlayingItemDidChange', (_event, a) => {
|
||||
app.media = a;
|
||||
discord.updateActivity(a)
|
||||
mpris.SetButtons(win, a)
|
||||
mpris.updateAttributes(a)
|
||||
lastfm.scrobbleSong(a)
|
||||
lastfm.updateNowPlayingSong(a)
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
const { nativeImage } = require("electron");
|
||||
const path = require('path')
|
||||
|
||||
let mediaPlayer = null;
|
||||
|
||||
module.exports = {
|
||||
|
@ -102,6 +105,39 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
|
||||
SetButtons: (win, attributes) => {
|
||||
if (process.platform === 'win32') { // Set the Windows Thumbnail Toolbar Buttons
|
||||
win.setThumbarButtons([
|
||||
{
|
||||
tooltip: 'Previous',
|
||||
icon: nativeImage.createFromPath(path.join(__dirname, 'thumbaricons/backwardPng.png')),
|
||||
click() {
|
||||
console.log("Clicked the bc taskbar button!")
|
||||
win.webContents.executeJavaScript('MusicKitInterop.previousTrack()').catch(err => console.error(err))
|
||||
}
|
||||
},
|
||||
{
|
||||
tooltip: attributes.status ? 'Pause' : 'Play',
|
||||
//tooltip: 'Play',
|
||||
icon: attributes.status ? nativeImage.createFromPath(path.join(__dirname, 'thumbaricons/pausePng.png')) : nativeImage.createFromPath(path.join(__dirname, 'thumbaricons/playPng.png')),
|
||||
click() {
|
||||
console.log("Clicked the pl taskbar button!")
|
||||
win.webContents.executeJavaScript('MusicKitInterop.pausePlay()').catch(err => console.error(err))
|
||||
}
|
||||
},
|
||||
{
|
||||
tooltip: 'Next',
|
||||
icon: nativeImage.createFromPath(path.join(__dirname, 'thumbaricons/forwardPng.png')),
|
||||
click() {
|
||||
console.log("Clicked the fw taskbar button!")
|
||||
win.webContents.executeJavaScript('MusicKitInterop.nextTrack()').catch(err => console.error(err))
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Closes the MPRIS interface.
|
||||
*/
|
||||
|
|
BIN
src/main/thumbaricons/backwardPng.png
Normal file
BIN
src/main/thumbaricons/backwardPng.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
BIN
src/main/thumbaricons/forwardPng.png
Normal file
BIN
src/main/thumbaricons/forwardPng.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
src/main/thumbaricons/pausePng.png
Normal file
BIN
src/main/thumbaricons/pausePng.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
BIN
src/main/thumbaricons/playPng.png
Normal file
BIN
src/main/thumbaricons/playPng.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
Loading…
Add table
Add a link
Reference in a new issue