Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
add dock menu
Browse files Browse the repository at this point in the history
  • Loading branch information
trazyn committed Nov 2, 2017
1 parent 8606f4a commit 7d6f5c4
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,40 @@ let trayMenu = [
}
}
];
let dockMenu = [
{
label: 'Toggle Player',
accelerator: 'Space',
click() {
mainWindow.show();
mainWindow.webContents.send('player-toggle');
}
},
{
label: 'Next',
accelerator: 'Right',
click() {
mainWindow.show();
mainWindow.webContents.send('player-next');
}
},
{
label: 'Previous',
accelerator: 'Left',
click() {
mainWindow.show();
mainWindow.webContents.send('player-previous');
}
},
{
label: 'Like',
accelerator: 'Cmd+L',
click() {
mainWindow.show();
mainWindow.webContents.send('player-like');
}
},
];

function updateMenu(playing) {
if (!isOsx) {
Expand Down Expand Up @@ -524,6 +558,7 @@ const createMainWindow = () => {
version: pkg.version
});
app.dock.setIcon(`${__dirname}/src/assets/dock.png`);
app.dock.setMenu(Menu.buildFromTemplate(dockMenu));
}

updateMenu();
Expand Down

0 comments on commit 7d6f5c4

Please sign in to comment.