mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 14:53:33 +00:00
proper icons for macos
This commit is contained in:
BIN
src/images/icon-highlight.png
Normal file
BIN
src/images/icon-highlight.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 292 B |
BIN
src/images/icon-highlight@2x.png
Normal file
BIN
src/images/icon-highlight@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 438 B |
BIN
src/images/icon-template.png
Normal file
BIN
src/images/icon-template.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 292 B |
BIN
src/images/icon-template@2x.png
Normal file
BIN
src/images/icon-template@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 438 B |
@@ -1,4 +1,7 @@
|
|||||||
import { Tray } from 'electron';
|
import {
|
||||||
|
NativeImage,
|
||||||
|
Tray,
|
||||||
|
} from 'electron';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import { WindowMain } from 'jslib/electron/window.main';
|
import { WindowMain } from 'jslib/electron/window.main';
|
||||||
@@ -7,13 +10,17 @@ import { DesktopConstants } from '../desktopConstants';
|
|||||||
|
|
||||||
export class TrayMain {
|
export class TrayMain {
|
||||||
private tray: Tray;
|
private tray: Tray;
|
||||||
private iconPath: string;
|
private icon: string | NativeImage;
|
||||||
|
|
||||||
constructor(private windowMain: WindowMain, private appName: string, private minToTray: () => Promise<boolean>) {
|
constructor(private windowMain: WindowMain, private appName: string, private minToTray: () => Promise<boolean>) {
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
this.iconPath = path.join(__dirname, '/images/icon.ico');
|
this.icon = path.join(__dirname, '/images/icon.ico');
|
||||||
|
} else if (process.platform === 'darwin') {
|
||||||
|
const nativeImage = NativeImage.createFromPath(path.join(__dirname, '/images/icon-template.png'));
|
||||||
|
nativeImage.setTemplateImage(true);
|
||||||
|
this.icon = nativeImage;
|
||||||
} else {
|
} else {
|
||||||
this.iconPath = path.join(__dirname, '/images/icon.png');
|
this.icon = path.join(__dirname, '/images/icon.png');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +45,7 @@ export class TrayMain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private handleHideEvent() {
|
private handleHideEvent() {
|
||||||
this.tray = new Tray(this.iconPath);
|
this.tray = new Tray(this.icon);
|
||||||
this.tray.setToolTip(this.appName);
|
this.tray.setToolTip(this.appName);
|
||||||
|
|
||||||
this.tray.on('click', () => {
|
this.tray.on('click', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user