Skip to content

Commit aa17844

Browse files
committed
Merge remote-tracking branch 'origin/windows' into main
2 parents 427cd70 + 883e5e8 commit aa17844

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

index.js

+19-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,21 @@ const itemBuilder = require('./modules/itemBuilder')
77
const { importConfig, exportConfig } = require('./modules/configuration')
88

99
// set some variables
10+
const isWindows = process.platform === 'win32'
1011
let refreshInterval = settings.get('refreshInterval') * 60 * 1000 // default to 30 minutes
1112
let win, tray
1213

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+
1325
// open the preferences window
1426
const openPreferences = () => {
1527
log.info('Opening preferences window')
@@ -19,7 +31,7 @@ const openPreferences = () => {
1931
// create the preference window
2032
win = new BrowserWindow({
2133
width: 850,
22-
height: 670,
34+
height: isWindows ? 700 : 670,
2335
webPreferences: {
2436
nodeIntegration: true,
2537
contextIsolation: false
@@ -70,6 +82,9 @@ const buildTray = async () => {
7082
// create the tray if one doesnt exist
7183
if (!tray) tray = new Tray(PATHS.MENUBAR_ICONS.TRANSPARENT)
7284

85+
// open tray on click on windows
86+
isWindows && tray.on('click', () => tray.popUpContextMenu())
87+
7388
// set the tray icon to be transparent to indicate reload
7489
tray.setImage(PATHS.MENUBAR_ICONS.TRANSPARENT)
7590

@@ -95,9 +110,9 @@ const buildTray = async () => {
95110
})
96111
} else {
97112
// otherwise, set the tray title
98-
if (config.titleTemplate) {
113+
if (!isWindows && config.titleTemplate) {
99114
trayTitle = await hass.render(config.titleTemplate)
100-
} else if (config.title) {
115+
} else if (!isWindows && config.title) {
101116
trayTitle = config.title
102117
}
103118

@@ -146,7 +161,7 @@ app.on('open-file', async (event, path) => {
146161
app.on('ready', async () => {
147162
log.info('App is ready')
148163
// hide from dock
149-
app.dock.hide()
164+
!isWindows && app.dock.hide()
150165
const autoRebuild = () => {
151166
// build the tray
152167
buildTray()

0 commit comments

Comments
 (0)