@@ -4,23 +4,29 @@ import path from "path";
4
4
import packageJson from "../../../package.json" ;
5
5
import { Settings } from "../../types/settings" ;
6
6
import {
7
- checkIdle ,
8
- checkInWorkingHours ,
9
- createBreak ,
10
- getBreakTime ,
11
- startBreakNow
7
+ checkIdle ,
8
+ checkInWorkingHours ,
9
+ createBreak ,
10
+ getBreakTime ,
11
+ startBreakNow ,
12
12
} from "./breaks" ;
13
13
import {
14
- getDisableEndTime ,
15
- getSettings ,
16
- setDisableEndTime ,
17
- setSettings
14
+ getDisableEndTime ,
15
+ getSettings ,
16
+ setDisableEndTime ,
17
+ setSettings ,
18
18
} from "./store" ;
19
19
import { createSettingsWindow } from "./windows" ;
20
20
21
21
let tray : Tray ;
22
22
let lastMinsLeft = 0 ;
23
23
24
+ const rootPath = path . dirname ( app . getPath ( "exe" ) ) ;
25
+ const resourcesPath =
26
+ process . platform === "darwin"
27
+ ? path . resolve ( rootPath , ".." , "Resources" )
28
+ : rootPath ;
29
+
24
30
function checkDisableTimeout ( ) {
25
31
const disableEndTime = getDisableEndTime ( ) ;
26
32
@@ -55,20 +61,19 @@ function getDisableTimeRemaining(): string {
55
61
export function buildTray ( ) : void {
56
62
if ( ! tray ) {
57
63
let imgPath ;
64
+
58
65
if ( process . platform === "darwin" ) {
59
66
imgPath =
60
67
process . env . NODE_ENV === "development"
61
68
? "resources/tray/tray-IconTemplate.png"
62
- : path . join (
63
- process . resourcesPath ,
64
- "app/resources/tray/tray-IconTemplate.png"
65
- ) ;
69
+ : path . join ( resourcesPath , "tray" , "tray-IconTemplate.png" ) ;
66
70
} else {
67
71
imgPath =
68
72
process . env . NODE_ENV === "development"
69
73
? "resources/tray/icon.png"
70
- : path . join ( process . resourcesPath , "app/resources/ tray/ icon.png" ) ;
74
+ : path . join ( resourcesPath , "tray" , " icon.png") ;
71
75
}
76
+
72
77
tray = new Tray ( imgPath ) ;
73
78
74
79
// On windows, context menu will not show on left click by default
0 commit comments