summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@codeispoetry.ru>2017-02-06 12:32:06 +0000
committerAndrej Mihajlov <and@codeispoetry.ru>2017-02-06 12:32:06 +0000
commit409b633f23c3a96db4c5c363a15b3dc2bc815441 (patch)
treee47a65e7b27b117fc1bc93b23ba61eff6e3908e8 /app
parentcc4362f9f0edb702ed85820addaf13d7ee758423 (diff)
downloadmullvadvpn-409b633f23c3a96db4c5c363a15b3dc2bc815441.tar.xz
mullvadvpn-409b633f23c3a96db4c5c363a15b3dc2bc815441.zip
Add tray menu
Diffstat (limited to 'app')
-rw-r--r--app/assets/trayicon.pngbin0 -> 950 bytes
-rw-r--r--app/assets/trayicon@2x.pngbin0 -> 1316 bytes
-rw-r--r--app/main.js4
-rw-r--r--app/tray.js24
4 files changed, 28 insertions, 0 deletions
diff --git a/app/assets/trayicon.png b/app/assets/trayicon.png
new file mode 100644
index 0000000000..3888745a8f
--- /dev/null
+++ b/app/assets/trayicon.png
Binary files differ
diff --git a/app/assets/trayicon@2x.png b/app/assets/trayicon@2x.png
new file mode 100644
index 0000000000..3b5f364903
--- /dev/null
+++ b/app/assets/trayicon@2x.png
Binary files differ
diff --git a/app/main.js b/app/main.js
index e923df1a8b..001a28c863 100644
--- a/app/main.js
+++ b/app/main.js
@@ -1,6 +1,7 @@
import path from 'path';
import url from 'url';
import {app, crashReporter, BrowserWindow, Menu} from 'electron';
+import trayMenu from './tray';
const isDevelopment = (process.env.NODE_ENV === 'development');
@@ -51,6 +52,9 @@ app.on('ready', async () => {
show: false
});
+ // initialize tray menu
+ trayMenu.setup();
+
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
diff --git a/app/tray.js b/app/tray.js
new file mode 100644
index 0000000000..c93b207d0d
--- /dev/null
+++ b/app/tray.js
@@ -0,0 +1,24 @@
+import path from 'path';
+import { app, Menu, Tray } from 'electron';
+
+class TrayMenu {
+
+ trayImpl = null;
+
+ setup() {
+ const iconPath = path.join(__dirname, "assets/trayicon.png");
+ this.trayImpl = new Tray(iconPath);
+
+ const contextMenu = Menu.buildFromTemplate([
+ {label: 'Item1', type: 'radio'},
+ {label: 'Item2', type: 'radio'},
+ {label: 'Item3', type: 'radio', checked: true},
+ {label: 'Item4', type: 'radio'}
+ ]);
+
+ this.trayImpl.setContextMenu(contextMenu);
+ }
+
+}
+
+module.exports = new TrayMenu();