Added thumbar buttons
win32 taskbar controls and svg icons to png
This commit is contained in:
parent
e2738a7ffa
commit
4291396ce1
6 changed files with 39 additions and 0 deletions
|
@ -268,6 +268,7 @@ const CiderBase = {
|
||||||
win.webContents.setZoomFactor(screen.getPrimaryDisplay().scaleFactor)
|
win.webContents.setZoomFactor(screen.getPrimaryDisplay().scaleFactor)
|
||||||
|
|
||||||
mpris.connect(win)
|
mpris.connect(win)
|
||||||
|
mpris.SetButtons(win, false)
|
||||||
|
|
||||||
lastfm.authenticate()
|
lastfm.authenticate()
|
||||||
// Discord
|
// Discord
|
||||||
|
@ -275,6 +276,7 @@ const CiderBase = {
|
||||||
ipcMain.on('playbackStateDidChange', (_event, a) => {
|
ipcMain.on('playbackStateDidChange', (_event, a) => {
|
||||||
app.media = a;
|
app.media = a;
|
||||||
discord.updateActivity(a)
|
discord.updateActivity(a)
|
||||||
|
mpris.SetButtons(win, a)
|
||||||
mpris.updateState(a)
|
mpris.updateState(a)
|
||||||
lastfm.scrobbleSong(a)
|
lastfm.scrobbleSong(a)
|
||||||
lastfm.updateNowPlayingSong(a)
|
lastfm.updateNowPlayingSong(a)
|
||||||
|
@ -283,6 +285,7 @@ const CiderBase = {
|
||||||
ipcMain.on('nowPlayingItemDidChange', (_event, a) => {
|
ipcMain.on('nowPlayingItemDidChange', (_event, a) => {
|
||||||
app.media = a;
|
app.media = a;
|
||||||
discord.updateActivity(a)
|
discord.updateActivity(a)
|
||||||
|
mpris.SetButtons(win, a)
|
||||||
mpris.updateAttributes(a)
|
mpris.updateAttributes(a)
|
||||||
lastfm.scrobbleSong(a)
|
lastfm.scrobbleSong(a)
|
||||||
lastfm.updateNowPlayingSong(a)
|
lastfm.updateNowPlayingSong(a)
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
const { nativeImage } = require("electron");
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
let mediaPlayer = null;
|
let mediaPlayer = null;
|
||||||
|
|
||||||
module.exports = {
|
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.
|
* 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