minor changes to tray functionality

This commit is contained in:
Jeremy Kauffman 2017-11-08 17:26:46 -05:00
parent 7a0a0c468e
commit 350c4dc98c
3 changed files with 8 additions and 4 deletions

View file

@ -8,9 +8,9 @@ Web UI version numbers should always match the corresponding version of LBRY App
## [Unreleased] ## [Unreleased]
### Added ### Added
* The app now closes to the system tray unless specifically requested to quit. (#374)
* Added new window menu options for reloading and help. * Added new window menu options for reloading and help.
* Rewards are now marked in transaction history (#660) * Rewards are now marked in transaction history (#660)
* Minimize LBRY app to tray (issue #374)
* *
### Changed ### Changed

View file

@ -213,7 +213,7 @@ function createWindow () {
// Registers shortcut for closing(quitting) the app // Registers shortcut for closing(quitting) the app
globalShortcut.register('Alt+F4', () => safeQuit()); globalShortcut.register('Alt+F4', () => safeQuit());
win.webContents.send('window-is-focussed', null); win.webContents.send('window-is-focused', null);
}); });
// Menu bar // Menu bar
@ -238,7 +238,11 @@ function createTray () {
// This needs to be done as for linux the context menu doesn't update automatically(docs) // This needs to be done as for linux the context menu doesn't update automatically(docs)
function updateTray() { function updateTray() {
let contextMenu = Menu.buildFromTemplate(getMenuTemplate()); let contextMenu = Menu.buildFromTemplate(getMenuTemplate());
tray.setContextMenu(contextMenu); if (tray) {
tray.setContextMenu(contextMenu);
} else {
console.log("How did update tray get called without a tray?");
}
} }
function getMenuTemplate () { function getMenuTemplate () {

View file

@ -39,7 +39,7 @@ ipcRenderer.on("open-menu", (event, uri) => {
const dock = remote.app.dock; const dock = remote.app.dock;
ipcRenderer.on("window-is-focussed", (event, data) => { ipcRenderer.on("window-is-focused", (event, data) => {
if (!dock) return; if (!dock) return;
app.store.dispatch({ type: types.WINDOW_FOCUSED }); app.store.dispatch({ type: types.WINDOW_FOCUSED });
dock.setBadge(""); dock.setBadge("");