Tray service doesn't work from preload file, so use ipc.

This commit is contained in:
Keith Maika 2022-01-07 14:03:19 -05:00
parent ac7a137f4e
commit a7394ce138
No known key found for this signature in database
GPG Key ID: F71740E8722C75F1
2 changed files with 5 additions and 3 deletions

View File

@ -149,6 +149,9 @@ function createWindow() {
return process.versions.electron;
});
ipcMain.handle('trayService.showEnvelope', () => trayService.showEnvelope());
ipcMain.handle('trayService.hideEnvelope', () => trayService.hideEnvelope());
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows

View File

@ -1,6 +1,5 @@
const {ipcRenderer, contextBridge} = require('electron');
const keytar = require('keytar');
const trayService = require(__dirname + '/modules/tray-service');
contextBridge.exposeInMainWorld('api', {
send(channel, ...data) {
@ -39,10 +38,10 @@ contextBridge.exposeInMainWorld('api', {
},
trayService: {
showEnvelope() {
trayService.showEnvelope();
ipcRenderer.invoke('trayService.showEnvelope')
},
hideEnvelope() {
trayService.hideEnvelope();
ipcRenderer.invoke('trayService.hideEnvelope')
}
},
keytar: {