mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fixing tray icon color on macOS Big Sur (#1595)
* Using trayTemplate icon Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Clean up nativeTheme import Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Using light icon for tray Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Removing unused tray icons Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
1 parent
111c518bf5
commit
06568fa232
7 files changed
+3
-6
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
|
Before Width: | Height: | Size: 448 B |
Binary file not shown.
|
Before Width: | Height: | Size: 973 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB |
+3
-6
@@ -1,6 +1,6 @@
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import packageInfo from "../../package.json";
|
import packageInfo from "../../package.json";
|
||||||
import { dialog, Menu, NativeImage, nativeTheme, Tray } from "electron";
|
import { dialog, Menu, NativeImage, Tray } from "electron";
|
||||||
import { autorun } from "mobx";
|
import { autorun } from "mobx";
|
||||||
import { showAbout } from "./menu";
|
import { showAbout } from "./menu";
|
||||||
import { AppUpdater } from "./app-updater";
|
import { AppUpdater } from "./app-updater";
|
||||||
@@ -16,14 +16,11 @@ import { exitApp } from "./exit-app";
|
|||||||
// note: instance of Tray should be saved somewhere, otherwise it disappears
|
// note: instance of Tray should be saved somewhere, otherwise it disappears
|
||||||
export let tray: Tray;
|
export let tray: Tray;
|
||||||
|
|
||||||
// refresh icon when MacOS dark/light theme has changed
|
export function getTrayIcon(): string {
|
||||||
nativeTheme?.on("updated", () => tray?.setImage(getTrayIcon()));
|
|
||||||
|
|
||||||
export function getTrayIcon(isDark = nativeTheme.shouldUseDarkColors): string {
|
|
||||||
return path.resolve(
|
return path.resolve(
|
||||||
__static,
|
__static,
|
||||||
isDevelopment ? "../build/tray" : "icons", // copied within electron-builder extras
|
isDevelopment ? "../build/tray" : "icons", // copied within electron-builder extras
|
||||||
`tray_icon${isDark ? "_dark" : ""}.png`
|
"trayIconTemplate.png"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user