Merge branch 'stoatchat:main' into feat/minimise-to-tray-startup
This commit is contained in:
commit
3189a6c30e
|
|
@ -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: [
|
||||||
|
|
|
||||||
16
src/main.ts
16
src/main.ts
|
|
@ -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", () => {
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue