diff --git a/src/renderer/notification-handler.ts b/src/renderer/notification-handler.ts index 5fc094c1..960fbbc8 100644 --- a/src/renderer/notification-handler.ts +++ b/src/renderer/notification-handler.ts @@ -78,24 +78,30 @@ export default class NotificationHandler { } const display = this.externalDisplay || electron.screen.getPrimaryDisplay(); - this.settings.corner.x = display.workArea.x - (isMac || isLinux ? 20 : 10); - this.settings.corner.y = display.workArea.y + (isMac || isLinux ? 20 : 10); + this.settings.corner.x = display.workArea.x; + this.settings.corner.y = display.workArea.y; // update corner x/y based on corner of screen where notification should appear const workAreaWidth = display.workAreaSize.width; const workAreaHeight = display.workAreaSize.height; + const offSet = (isMac || isLinux ? 20 : 10); switch (this.settings.startCorner) { case 'upper-right': - this.settings.corner.x += workAreaWidth; + this.settings.corner.x += workAreaWidth - offSet; + this.settings.corner.y += offSet; break; case 'lower-right': - this.settings.corner.x += workAreaWidth; - this.settings.corner.y += workAreaHeight; + this.settings.corner.x += workAreaWidth - offSet; + this.settings.corner.y += workAreaHeight - offSet; break; case 'lower-left': - this.settings.corner.y += workAreaHeight; + this.settings.corner.x += offSet; + this.settings.corner.y += workAreaHeight - offSet; break; case 'upper-left': + this.settings.corner.x += offSet; + this.settings.corner.y += offSet; + break; default: // no change needed break; diff --git a/src/renderer/preload-main.ts b/src/renderer/preload-main.ts index 7418241c..3fb4a5f7 100644 --- a/src/renderer/preload-main.ts +++ b/src/renderer/preload-main.ts @@ -1,4 +1,4 @@ -import { contextBridge, ipcRenderer, webFrame } from 'electron'; +import { contextBridge, ipcRenderer, remote, webFrame } from 'electron'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { apiCmds, apiName } from '../common/api-interface'; @@ -22,6 +22,7 @@ const minMemoryFetchInterval = 4 * 60 * 60 * 1000; const maxMemoryFetchInterval = 12 * 60 * 60 * 1000; const snackBar = new SnackBar(); const banner = new MessageBanner(); +const notification = remote.require('../renderer/notification').notification; /** * creates API exposed from electron. @@ -81,6 +82,8 @@ if (ssfWindow.ssf) { registerRestartFloater: ssfWindow.ssf.registerRestartFloater, setCloudConfig: ssfWindow.ssf.setCloudConfig, checkMediaPermission: ssfWindow.ssf.checkMediaPermission, + showNotification: notification.showNotification, + closeNotification: notification.hideNotification, }); }