mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 09:33:10 -07:00
destroy tray on windows + osx only
This commit is contained in:
parent
527839cb4c
commit
de67b36629
4 changed files with 26 additions and 15 deletions
|
|
@ -40,8 +40,8 @@
|
|||
"devDependencies": {
|
||||
"@eslint/js": "^9.36.0",
|
||||
"@types/node": "^24.6.1",
|
||||
"@types/react": "^19.1.16",
|
||||
"@types/react-dom": "^19.1.9",
|
||||
"@types/react": "^19.1.17",
|
||||
"@types/react-dom": "^19.1.11",
|
||||
"@typescript-eslint/eslint-plugin": "^8.45.0",
|
||||
"@typescript-eslint/parser": "^8.45.0",
|
||||
"@vitejs/plugin-react": "^5.0.4",
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import {
|
|||
getColorScheme,
|
||||
getEnableSystemTray,
|
||||
} from '@/main/modules/config';
|
||||
import { createTray, updateTrayState } from '@/main/modules/tray';
|
||||
import { createTray, updateTrayState, destroyTray } from '@/main/modules/tray';
|
||||
import { getConfigDir, openPathHandler, openUrl } from '@/utils/node/path';
|
||||
import { logError } from '@/utils/node/logging';
|
||||
import { stopFrontend as stopSillyTavernFrontend } from '@/main/modules/sillytavern';
|
||||
|
|
@ -229,7 +229,11 @@ export function setupIPCHandlers() {
|
|||
|
||||
ipcMain.handle('app:setEnableSystemTray', async (_, enabled: boolean) => {
|
||||
await setConfig('enableSystemTray', enabled);
|
||||
createTray();
|
||||
if (enabled) {
|
||||
createTray();
|
||||
} else {
|
||||
destroyTray();
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle(
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import {
|
|||
MenuItemConstructorOptions,
|
||||
} from 'electron';
|
||||
import { join } from 'path';
|
||||
import { resourcesPath } from 'process';
|
||||
import { resourcesPath, platform } from 'process';
|
||||
import { getEnableSystemTray } from './config';
|
||||
import { getMainWindow } from './window';
|
||||
import type { CpuMetrics, MemoryMetrics, GpuMetrics } from './monitoring';
|
||||
|
|
@ -233,4 +233,11 @@ export function updateTrayMenu() {
|
|||
}
|
||||
}
|
||||
|
||||
export function destroyTray() {
|
||||
if (tray && platform !== 'linux') {
|
||||
tray.destroy();
|
||||
tray = null;
|
||||
}
|
||||
}
|
||||
|
||||
export const isTrayActive = () => tray !== null;
|
||||
|
|
|
|||
20
yarn.lock
20
yarn.lock
|
|
@ -1457,21 +1457,21 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/react-dom@npm:^19.1.9":
|
||||
version: 19.1.9
|
||||
resolution: "@types/react-dom@npm:19.1.9"
|
||||
"@types/react-dom@npm:^19.1.11":
|
||||
version: 19.1.11
|
||||
resolution: "@types/react-dom@npm:19.1.11"
|
||||
peerDependencies:
|
||||
"@types/react": ^19.0.0
|
||||
checksum: 10c0/34c8dda86c1590b3ef0e7ecd38f9663a66ba2dd69113ba74fb0adc36b83bbfb8c94c1487a2505282a5f7e5e000d2ebf36f4c0fd41b3b672f5178fd1d4f1f8f58
|
||||
checksum: 10c0/417da6414f43ea2e416ab19666f78f8a29b349f4273ee6d8d468516606c65ee0e6f31939cd3255dfaf466a50a5cdf16b6fd988cf7e9aaf678c61d1fff81e5c20
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/react@npm:^19.1.16":
|
||||
version: 19.1.16
|
||||
resolution: "@types/react@npm:19.1.16"
|
||||
"@types/react@npm:^19.1.17":
|
||||
version: 19.1.17
|
||||
resolution: "@types/react@npm:19.1.17"
|
||||
dependencies:
|
||||
csstype: "npm:^3.0.2"
|
||||
checksum: 10c0/3d781f715f15f308b601d74142fae77c65679c318a3bb0a319df898f39095e738ba7ed7061cec971b19b6d33969ef9cd50fec92b034024ef3fcc25bb9a2eb3d0
|
||||
checksum: 10c0/8a8369ea00fc961f0884be4d1da4a039b2b6445de9c8b690ed0ebe15acfb0b1f27005278fef1fe39a1722a30f4415778b790d0089e2b30019371c61355ea316f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
|
@ -3865,8 +3865,8 @@ __metadata:
|
|||
"@mantine/core": "npm:8.3.1"
|
||||
"@mantine/hooks": "npm:8.3.1"
|
||||
"@types/node": "npm:^24.6.1"
|
||||
"@types/react": "npm:^19.1.16"
|
||||
"@types/react-dom": "npm:^19.1.9"
|
||||
"@types/react": "npm:^19.1.17"
|
||||
"@types/react-dom": "npm:^19.1.11"
|
||||
"@types/yauzl": "npm:^2.10.3"
|
||||
"@typescript-eslint/eslint-plugin": "npm:^8.45.0"
|
||||
"@typescript-eslint/parser": "npm:^8.45.0"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue