Merge branch 'stoatchat:main' into feat/minimise-to-tray-startup

This commit is contained in:
Mihai 2026-02-17 21:12:04 +01:00 committed by GitHub
commit 3189a6c30e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 7 deletions

View File

@ -58,7 +58,7 @@ if (!process.env.PLATFORM) {
description: STRINGS.description, description: STRINGS.description,
productName: STRINGS.name, productName: STRINGS.name,
productDescription: STRINGS.description, productDescription: STRINGS.description,
runtimeVersion: "21.08", runtimeVersion: "25.08",
icon: `${ASSET_DIR}/icon.png`, icon: `${ASSET_DIR}/icon.png`,
categories: ["Network"], categories: ["Network"],
modules: [ modules: [

View File

@ -1,6 +1,6 @@
import { updateElectronApp } from "update-electron-app"; import { IUpdateInfo, updateElectronApp } from "update-electron-app";
import { BrowserWindow, app, shell } from "electron"; import { BrowserWindow, app, shell, Notification } from "electron";
import started from "electron-squirrel-startup"; import started from "electron-squirrel-startup";
import { autoLaunch } from "./native/autoLaunch"; import { autoLaunch } from "./native/autoLaunch";
@ -24,9 +24,19 @@ if (!config.hardwareAcceleration) {
// ensure only one copy of the application can run // ensure only one copy of the application can run
const acquiredLock = app.requestSingleInstanceLock(); const acquiredLock = app.requestSingleInstanceLock();
const onNotifyUser = (_info: IUpdateInfo) => {
const notification = new Notification({
title: 'Update Available',
body: 'Restart the app to install the update.',
silent: true
})
notification.show()
}
if (acquiredLock) { if (acquiredLock) {
// start auto update logic // start auto update logic
updateElectronApp(); updateElectronApp({onNotifyUser})
// create and configure the app when electron is ready // create and configure the app when electron is ready
app.on("ready", () => { app.on("ready", () => {

View File

@ -28,8 +28,12 @@ export function initTray() {
tray.setToolTip("Stoat for Desktop"); tray.setToolTip("Stoat for Desktop");
tray.setImage(trayIcon); tray.setImage(trayIcon);
tray.on("click", () => { tray.on("click", () => {
mainWindow.show(); if (mainWindow.isVisible()) {
mainWindow.focus(); mainWindow.hide();
} else {
mainWindow.show();
mainWindow.focus();
}
}); });
} }

View File

@ -120,7 +120,7 @@ export function createMainWindow() {
// rebind zoom controls to be more sensible // rebind zoom controls to be more sensible
mainWindow.webContents.on("before-input-event", (event, input) => { mainWindow.webContents.on("before-input-event", (event, input) => {
if (input.control && input.key === "=") { if (input.control && (input.key === "=" || input.key === "+")) {
// zoom in (+) // zoom in (+)
event.preventDefault(); event.preventDefault();
mainWindow.webContents.setZoomLevel( mainWindow.webContents.setZoomLevel(