Skip to content

Commit

Permalink
Fix tray path on non darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-james-watson committed Nov 10, 2024
1 parent 320a9d6 commit 21df87c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
50 changes: 25 additions & 25 deletions app/main/lib/tray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import path from "path";
import packageJson from "../../../package.json";
import { Settings } from "../../types/settings";
import {
checkIdle,
checkInWorkingHours,
createBreak,
getBreakTime,
startBreakNow,
checkIdle,
checkInWorkingHours,
createBreak,
getBreakTime,
startBreakNow
} from "./breaks";
import {
getDisableEndTime,
getSettings,
setDisableEndTime,
setSettings,
getDisableEndTime,
getSettings,
setDisableEndTime,
setSettings
} from "./store";
import { createSettingsWindow } from "./windows";

Expand Down Expand Up @@ -59,22 +59,22 @@ function getDisableTimeRemaining(): string {
}

export function buildTray(): void {
if (!tray) {
let imgPath;

if (process.platform === "darwin") {
imgPath =
process.env.NODE_ENV === "development"
? "resources/tray/tray-IconTemplate.png"
: path.join(resourcesPath, "tray", "tray-IconTemplate.png");
} else {
imgPath =
process.env.NODE_ENV === "development"
? "resources/tray/icon.png"
: path.join(resourcesPath, "tray", "icon.png");
}

tray = new Tray(imgPath);
if (!tray) {
let imgPath;

if (process.platform === "darwin") {
imgPath =
process.env.NODE_ENV === "development"
? "resources/tray/tray-IconTemplate.png"
: path.join(resourcesPath, "tray", "tray-IconTemplate.png");
} else {
imgPath =
process.env.NODE_ENV === "development"
? "resources/tray/icon.png"
: path.join(app.getAppPath(), "..", "tray", "icon.png");
}

tray = new Tray(imgPath);

// On windows, context menu will not show on left click by default
if (process.platform === "win32") {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 21df87c

Please sign in to comment.