diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-02-26 09:24:07 -0300 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-02-27 09:30:07 -0300 |
| commit | a65abe79ea29a591ee07f4f864eb854d4d139df1 (patch) | |
| tree | 96861454b72a3530ddf2420188c1365e8e26d72a | |
| parent | f1aacabc534eff81a8d666a9f2df16c7294fa9e4 (diff) | |
| download | mullvadvpn-a65abe79ea29a591ee07f4f864eb854d4d139df1.tar.xz mullvadvpn-a65abe79ea29a591ee07f4f864eb854d4d139df1.zip | |
Show Mullvad logo in notifications on Linux
| -rw-r--r-- | gui/packages/desktop/assets/images/icon-notification.png | bin | 0 -> 8365 bytes | |||
| -rw-r--r-- | gui/packages/desktop/src/main/notification-controller.ts | 16 |
2 files changed, 15 insertions, 1 deletions
diff --git a/gui/packages/desktop/assets/images/icon-notification.png b/gui/packages/desktop/assets/images/icon-notification.png Binary files differnew file mode 100644 index 0000000000..4f0b49935e --- /dev/null +++ b/gui/packages/desktop/assets/images/icon-notification.png diff --git a/gui/packages/desktop/src/main/notification-controller.ts b/gui/packages/desktop/src/main/notification-controller.ts index 44ed5d2482..0ecad34566 100644 --- a/gui/packages/desktop/src/main/notification-controller.ts +++ b/gui/packages/desktop/src/main/notification-controller.ts @@ -1,4 +1,5 @@ -import { app, Notification, shell } from 'electron'; +import { app, nativeImage, NativeImage, Notification, shell } from 'electron'; +import path from 'path'; import config from '../config.json'; import { TunnelStateTransition } from '../shared/daemon-rpc-types'; @@ -9,6 +10,16 @@ export default class NotificationController { private presentedNotifications: { [key: string]: boolean } = {}; private pendingNotifications: Notification[] = []; private notificationTitle = process.platform === 'linux' ? app.getName() : ''; + private notificationIcon?: NativeImage; + + constructor() { + if (process.platform === 'linux') { + const basePath = path.resolve(path.join(__dirname, '../../assets/images')); + this.notificationIcon = nativeImage.createFromPath( + path.join(basePath, 'icon-notification.png'), + ); + } + } public notifyTunnelState(tunnelState: TunnelStateTransition) { switch (tunnelState.state) { @@ -56,6 +67,7 @@ export default class NotificationController { title: this.notificationTitle, body: 'Inconsistent internal version information, please restart the app', silent: true, + icon: this.notificationIcon, }); this.scheduleNotification(notification); }); @@ -67,6 +79,7 @@ export default class NotificationController { title: this.notificationTitle, body: `You are running an unsupported app version. Please upgrade to ${upgradeVersion} now to ensure your security`, silent: true, + icon: this.notificationIcon, }); notification.on('click', () => { @@ -95,6 +108,7 @@ export default class NotificationController { title: this.notificationTitle, body: message, silent: true, + icon: this.notificationIcon, }); if (lastAnnouncement) { |
