fix: Fix tray window continuously getting smaller

This commit is contained in:
2026-05-31 22:13:02 -05:00
parent 1b38554df0
commit 532ef77b6f
2 changed files with 12 additions and 7 deletions
+2
View File
@@ -2,6 +2,8 @@ export const MANAGEMENT_URL = 'https://vpn.vyntehome.com';
export const GATEWAY_HOST = new URL(MANAGEMENT_URL).host;
export const APP_NAME = "Vynte Connect";
export const POLL_INTERVAL_MS = 5000;
export const WINDOW_WIDTH = 384;
export const WINDOW_HEIGHT = 420;
export const DEFAULT_STATUS = {
state: "checking",
title: `Checking ${GATEWAY_HOST}`,
+10 -7
View File
@@ -1,7 +1,7 @@
import { app, BrowserWindow, ipcMain, nativeImage, shell, Tray } from 'electron';
import path from 'node:path';
import started from 'electron-squirrel-startup';
import { APP_NAME, DEFAULT_STATUS, GATEWAY_HOST, MANAGEMENT_URL, POLL_INTERVAL_MS } from './config';
import { APP_NAME, DEFAULT_STATUS, GATEWAY_HOST, MANAGEMENT_URL, POLL_INTERVAL_MS, WINDOW_HEIGHT, WINDOW_WIDTH } from './config';
import { NetBirdClient } from './netbird';
import { baseStatus, normalizeStatus } from './status';
@@ -145,8 +145,8 @@ async function logout() {
function createWindow() {
window = new BrowserWindow({
width: 384,
height: 430,
width: WINDOW_WIDTH,
height: WINDOW_HEIGHT,
show: false,
resizable: false,
frame: false,
@@ -171,10 +171,13 @@ function createWindow() {
function showWindow() {
const bounds = tray.getBounds();
const windowBounds = window.getBounds();
const x = Math.round(bounds.x + bounds.width - windowBounds.width);
const y = Math.round(bounds.y - windowBounds.height - 8);
window.setPosition(Math.max(x, 0), Math.max(y, 0), false);
const x = Math.round(bounds.x - WINDOW_WIDTH);
const y = Math.round(bounds.y - WINDOW_HEIGHT);
window.setBounds({
width: WINDOW_WIDTH,
height: WINDOW_HEIGHT,
x, y
});
window.show();
window.focus();
broadcastStatus();