Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tray menu updated. Fixes #2 #5

Merged
merged 1 commit into from
Aug 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 67 additions & 1 deletion tray.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@ const path = require('path');
const electron = require('electron');

const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const shell = electron.shell;
let tray = null;

function activate(command) {
const appWindow = BrowserWindow.getAllWindows()[0];
// Extra measure in order to be shown
appWindow.show();
appWindow.webContents.send(command);
}

exports.create = win => {
if (process.platform === 'darwin' || tray) {
return;
Expand All @@ -21,9 +30,66 @@ exports.create = win => {
};

const contextMenu = electron.Menu.buildFromTemplate([{
label: 'Toggle',
label: 'Open Tusk',
click() {
toggleWin();
}
}, {
type: 'separator'
}, {
label: 'Search',
click() {
toggleWin();
activate('search');
}
}, {
label: 'New Tag',
click() {
toggleWin();
activate('new-tag');
}
}, {
label: 'New Note',
click() {
toggleWin();
activate('new-note');
}
}, {
label: 'New Notebook',
click() {
toggleWin();
activate('new-notebook');
}
}, {
type: 'separator'
}, {
label: 'Toggle Dark Mode',
click() {
toggleWin();
activate('toggle-dark-mode');
}
}, {
label: 'Toggle Black Mode',
click() {
toggleWin();
activate('toggle-black-mode');
}
}, {
type: 'separator'
}, {
label: `Settings`,
click() {
shell.openExternal('https://www.evernote.com/Settings.action');
}
}, {
label: `Report Issue`,
click() {
shell.openExternal(`https://github.com/champloohq/tusk/issues/new`);
}
}, {
label: `Latest Release`,
click() {
shell.openExternal(`https://github.com/champloohq/tusk/releases/latest`);
}
}, {
type: 'separator'
Expand Down