Skip to content

Commit

Permalink
feat: use monochrome tray icon and fix tray icon on macOS (Fixes #88) (
Browse files Browse the repository at this point in the history
  • Loading branch information
sussycatgirl authored May 23, 2022
1 parent 784c03d commit 16e5d09
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
Binary file modified assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/iconTemplate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/iconTemplate@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ import { autoLaunch } from "./lib/autoLaunch";
import { autoUpdate } from "./lib/updater";

const WindowIcon = nativeImage.createFromPath(
path.resolve(App.getAppPath(), "assets", "icon.png"),
path.resolve(
App.getAppPath(),
"assets",
// MacOS has special size and naming requirements for tray icons
// https://stackoverflow.com/questions/41664208/electron-tray-icon-change-depending-on-dark-theme/41998326#41998326
process.platform == "darwin" ? "iconTemplate.png" : "icon.png",
),
);

WindowIcon.setTemplateImage(true);
Expand Down Expand Up @@ -234,7 +240,6 @@ function createWindow() {
}

buildMenu();
tray.setTitle("Revolt");
tray.setToolTip("Revolt");
tray.setImage(WindowIcon);
tray.on("click", function (e) {
Expand Down

0 comments on commit 16e5d09

Please sign in to comment.