mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
fix: quit properly in tray
This commit is contained in:
parent
46a72f99cd
commit
6da51782ad
6 changed files with 13 additions and 7 deletions
|
@ -9,7 +9,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc && copyfiles -u 1 src/**/*.html src/**/**/*.css src/**/**/*.js ts-out/ && copyfiles package.json ts-out/ && copyfiles assets/**/** ts-out/",
|
"build": "tsc && copyfiles -u 1 src/**/*.html src/**/**/*.css src/**/**/*.js ts-out/ && copyfiles package.json ts-out/ && copyfiles assets/**/** ts-out/",
|
||||||
"watch": "tsc -w",
|
"watch": "tsc -w",
|
||||||
"start": "pnpm run build && electron ./ts-out/main.js",
|
"start": "pnpm run build && electron --trace-warnings ./ts-out/main.js",
|
||||||
"startThemeManager": "pnpm run build && electron ./ts-out/main.js themes",
|
"startThemeManager": "pnpm run build && electron ./ts-out/main.js themes",
|
||||||
"startKeybindManager": "pnpm run build && electron ./ts-out/main.js keybinds",
|
"startKeybindManager": "pnpm run build && electron ./ts-out/main.js keybinds",
|
||||||
"startWayland": "pnpm run build && electron ./ts-out/main.js --ozone-platform-hint=auto --enable-features=WebRTCPipeWireCapturer,WaylandWindowDecorations --disable-gpu",
|
"startWayland": "pnpm run build && electron ./ts-out/main.js --ozone-platform-hint=auto --enable-features=WebRTCPipeWireCapturer,WaylandWindowDecorations --disable-gpu",
|
||||||
|
|
|
@ -83,6 +83,9 @@ export function registerIpc(passedWindow: BrowserWindow): void {
|
||||||
passedWindow.hide();
|
passedWindow.hide();
|
||||||
});
|
});
|
||||||
ipcMain.on("win-quit", () => {
|
ipcMain.on("win-quit", () => {
|
||||||
|
app.quit();
|
||||||
|
});
|
||||||
|
ipcMain.on("win-forceQuit", () => {
|
||||||
app.exit();
|
app.exit();
|
||||||
});
|
});
|
||||||
ipcMain.on("get-app-version", (event) => {
|
ipcMain.on("get-app-version", (event) => {
|
||||||
|
|
|
@ -112,7 +112,7 @@ setInterval(() => {
|
||||||
tManager.onclick = () => ipcRenderer.send("openManagerWindow");
|
tManager.onclick = () => ipcRenderer.send("openManagerWindow");
|
||||||
fQuit.textContent = "Force Quit";
|
fQuit.textContent = "Force Quit";
|
||||||
fQuit.id = "acForceQuit";
|
fQuit.id = "acForceQuit";
|
||||||
fQuit.onclick = () => ipcRenderer.send("win-quit");
|
fQuit.onclick = () => ipcRenderer.send("win-forceQuit");
|
||||||
advanced.insertAdjacentElement("afterend", acSettings);
|
advanced.insertAdjacentElement("afterend", acSettings);
|
||||||
advanced.insertAdjacentElement("afterend", tManager);
|
advanced.insertAdjacentElement("afterend", tManager);
|
||||||
advanced.insertAdjacentElement("afterend", fQuit);
|
advanced.insertAdjacentElement("afterend", fQuit);
|
||||||
|
|
|
@ -30,6 +30,7 @@ function registerCustomHandler(): void {
|
||||||
types: ["screen", "window"]
|
types: ["screen", "window"]
|
||||||
})
|
})
|
||||||
.then((sources) => {
|
.then((sources) => {
|
||||||
|
if (!sources) return callback({});
|
||||||
console.log(sources);
|
console.log(sources);
|
||||||
if (process.platform === "linux" && process.env.XDG_SESSION_TYPE?.toLowerCase() === "wayland") {
|
if (process.platform === "linux" && process.env.XDG_SESSION_TYPE?.toLowerCase() === "wayland") {
|
||||||
console.log("WebRTC Capturer detected, skipping window creation."); //assume webrtc capturer is used
|
console.log("WebRTC Capturer detected, skipping window creation."); //assume webrtc capturer is used
|
||||||
|
|
|
@ -12,13 +12,13 @@ import * as fs from "fs";
|
||||||
import contextMenu from "electron-context-menu";
|
import contextMenu from "electron-context-menu";
|
||||||
import os from "os";
|
import os from "os";
|
||||||
import RPCServer from "arrpc";
|
import RPCServer from "arrpc";
|
||||||
import {tray} from "../tray.js";
|
import {isQuitting, tray} from "../tray.js";
|
||||||
import {iconPath, init} from "../main.js";
|
import {iconPath, init} from "../main.js";
|
||||||
import {getConfig, setConfig, firstRun} from "../common/config.js";
|
import {getConfig, setConfig, firstRun} from "../common/config.js";
|
||||||
import {getWindowState, setWindowState} from "../common/windowState.js";
|
import {getWindowState, setWindowState} from "../common/windowState.js";
|
||||||
export let mainWindows: BrowserWindow[] = [];
|
export let mainWindows: BrowserWindow[] = [];
|
||||||
export let inviteWindow: BrowserWindow;
|
export let inviteWindow: BrowserWindow;
|
||||||
let forceQuit = false;
|
export let forceQuit = false;
|
||||||
let osType = os.type();
|
let osType = os.type();
|
||||||
contextMenu({
|
contextMenu({
|
||||||
showSaveImageAs: true,
|
showSaveImageAs: true,
|
||||||
|
@ -252,7 +252,7 @@ function doAfterDefiningTheWindow(passedWindow: BrowserWindow): void {
|
||||||
x: passedWindow.getPosition()[0],
|
x: passedWindow.getPosition()[0],
|
||||||
y: passedWindow.getPosition()[1]
|
y: passedWindow.getPosition()[1]
|
||||||
});
|
});
|
||||||
if (getConfig("minimizeToTray")) {
|
if (getConfig("minimizeToTray") && !isQuitting) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
passedWindow.hide();
|
passedWindow.hide();
|
||||||
} else if (!getConfig("minimizeToTray")) {
|
} else if (!getConfig("minimizeToTray")) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {createSettingsWindow} from "./settings/main.js";
|
||||||
import {getConfig, getConfigLocation, setConfig} from "./common/config.js";
|
import {getConfig, getConfigLocation, setConfig} from "./common/config.js";
|
||||||
import {getDisplayVersion} from "./common/version.js";
|
import {getDisplayVersion} from "./common/version.js";
|
||||||
export let tray: Tray;
|
export let tray: Tray;
|
||||||
|
export let isQuitting = false;
|
||||||
let trayIcon = "ac_plug_colored";
|
let trayIcon = "ac_plug_colored";
|
||||||
void app.whenReady().then(async () => {
|
void app.whenReady().then(async () => {
|
||||||
// REVIEW - app will hang at startup if line above is awaited.
|
// REVIEW - app will hang at startup if line above is awaited.
|
||||||
|
@ -85,8 +86,9 @@ void app.whenReady().then(async () => {
|
||||||
{
|
{
|
||||||
label: `Quit ${clientName}`,
|
label: `Quit ${clientName}`,
|
||||||
click() {
|
click() {
|
||||||
// NOTE - Temporary fix for app not actually quitting
|
//NOTE - It would be better to unify isQuitting with forceQuit in window.ts that's used on macOS
|
||||||
app.exit();
|
isQuitting = true;
|
||||||
|
app.quit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in a new issue