Add electron tray icon
From https://github.com/vector-im/riot-web/pull/2960 Makes riot minimise to the tray on windows / linux.
This commit is contained in:
parent
231adbcd31
commit
d11bcdad5f
2 changed files with 76 additions and 1 deletions
|
@ -26,6 +26,8 @@ if (check_squirrel_hooks()) return;
|
|||
const electron = require('electron');
|
||||
const url = require('url');
|
||||
|
||||
const tray = require('./tray');
|
||||
|
||||
const VectorMenu = require('./vectormenu');
|
||||
|
||||
let vectorConfig = {};
|
||||
|
@ -180,6 +182,12 @@ electron.app.on('ready', () => {
|
|||
mainWindow.loadURL(`file://${__dirname}/../../webapp/index.html`);
|
||||
electron.Menu.setApplicationMenu(VectorMenu);
|
||||
|
||||
// Create trayIcon icon
|
||||
tray.create(mainWindow, {
|
||||
icon_path: icon_path,
|
||||
brand: vectorConfig.brand || 'Riot'
|
||||
});
|
||||
|
||||
mainWindow.once('ready-to-show', () => {
|
||||
mainWindow.show();
|
||||
});
|
||||
|
@ -187,7 +195,7 @@ electron.app.on('ready', () => {
|
|||
mainWindow = null;
|
||||
});
|
||||
mainWindow.on('close', (e) => {
|
||||
if (process.platform == 'darwin' && !appQuitting) {
|
||||
if (!appQuitting && (tray.hasTray() || process.platform == 'darwin')) {
|
||||
// On Mac, closing the window just hides it
|
||||
// (this is generally how single-window Mac apps
|
||||
// behave, eg. Mail.app)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue