@@ -7,9 +7,21 @@ const itemBuilder = require('./modules/itemBuilder')
7
7
const { importConfig, exportConfig } = require ( './modules/configuration' )
8
8
9
9
// set some variables
10
+ const isWindows = process . platform === 'win32'
10
11
let refreshInterval = settings . get ( 'refreshInterval' ) * 60 * 1000 // default to 30 minutes
11
12
let win , tray
12
13
14
+ if ( isWindows && app . isPackaged && process . argv . length >= 2 ) {
15
+ ( async ( ) => {
16
+ await app . whenReady ( )
17
+ dialog . showErrorBox ( {
18
+ title : 'Feature Not Supported' ,
19
+ message : 'Please import the configuration file from the preferences window.'
20
+ } )
21
+ process . exit ( )
22
+ } ) ( )
23
+ }
24
+
13
25
// open the preferences window
14
26
const openPreferences = ( ) => {
15
27
log . info ( 'Opening preferences window' )
@@ -19,7 +31,7 @@ const openPreferences = () => {
19
31
// create the preference window
20
32
win = new BrowserWindow ( {
21
33
width : 850 ,
22
- height : 670 ,
34
+ height : isWindows ? 700 : 670 ,
23
35
webPreferences : {
24
36
nodeIntegration : true ,
25
37
contextIsolation : false
@@ -70,6 +82,9 @@ const buildTray = async () => {
70
82
// create the tray if one doesnt exist
71
83
if ( ! tray ) tray = new Tray ( PATHS . MENUBAR_ICONS . TRANSPARENT )
72
84
85
+ // open tray on click on windows
86
+ isWindows && tray . on ( 'click' , ( ) => tray . popUpContextMenu ( ) )
87
+
73
88
// set the tray icon to be transparent to indicate reload
74
89
tray . setImage ( PATHS . MENUBAR_ICONS . TRANSPARENT )
75
90
@@ -95,9 +110,9 @@ const buildTray = async () => {
95
110
} )
96
111
} else {
97
112
// otherwise, set the tray title
98
- if ( config . titleTemplate ) {
113
+ if ( ! isWindows && config . titleTemplate ) {
99
114
trayTitle = await hass . render ( config . titleTemplate )
100
- } else if ( config . title ) {
115
+ } else if ( ! isWindows && config . title ) {
101
116
trayTitle = config . title
102
117
}
103
118
@@ -146,7 +161,7 @@ app.on('open-file', async (event, path) => {
146
161
app . on ( 'ready' , async ( ) => {
147
162
log . info ( 'App is ready' )
148
163
// hide from dock
149
- app . dock . hide ( )
164
+ ! isWindows && app . dock . hide ( )
150
165
const autoRebuild = ( ) => {
151
166
// build the tray
152
167
buildTray ( )
0 commit comments