Electron fixes macos (#1797)

This commit is contained in:
lucas lelievre
2026-03-26 08:09:10 +01:00
committed by GitHub
parent ed96742680
commit a9f553729e
5 changed files with 8 additions and 5 deletions

View File

@@ -273,6 +273,9 @@ function createWindow() {
case 'close':
mainWindow?.close();
break;
case 'hide':
mainWindow?.hide();
break;
case 'minimize':
mainWindow?.minimize();
break;
@@ -454,9 +457,7 @@ app.whenReady().then(async () => {
logger.info('SlimeVR started!');
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('before-quit', async (event) => {

View File

@@ -12,6 +12,7 @@ contextBridge.exposeInMainWorld('electronAPI', {
openUrl: (url) => ipcRenderer.invoke(IPC_CHANNELS.OPEN_URL, url),
osStats: () => ipcRenderer.invoke(IPC_CHANNELS.OS_STATS),
close: () => ipcRenderer.invoke(IPC_CHANNELS.WINDOW_ACTIONS, 'close'),
hide: () => ipcRenderer.invoke(IPC_CHANNELS.WINDOW_ACTIONS, 'hide'),
minimize: () => ipcRenderer.invoke(IPC_CHANNELS.WINDOW_ACTIONS, 'minimize'),
maximize: () => ipcRenderer.invoke(IPC_CHANNELS.WINDOW_ACTIONS, 'maximize'),
getStorage: async (type) => {

View File

@@ -43,6 +43,7 @@ export interface IElectronAPI {
openLogsFolder: () => Promise<void>;
openConfigFolder: () => Promise<void>;
close: () => void;
hide: () => void;
minimize: () => void;
maximize: () => void;
showDecorations: (decorations: boolean) => void;

View File

@@ -25,7 +25,7 @@ export const IPC_CHANNELS = {
export interface IpcInvokeMap {
[IPC_CHANNELS.OPEN_URL]: (url: string) => void;
[IPC_CHANNELS.OS_STATS]: () => Promise<OSStats>;
[IPC_CHANNELS.WINDOW_ACTIONS]: (action: 'close' | 'minimize' | 'maximize') => void;
[IPC_CHANNELS.WINDOW_ACTIONS]: (action: 'close' | 'minimize' | 'maximize' | 'hide') => void;
[IPC_CHANNELS.LOG]: (type: 'info' | 'error' | 'warn', ...args: unknown[]) => void;
[IPC_CHANNELS.OPEN_DIALOG]: (
options: OpenDialogOptions

View File

@@ -81,7 +81,7 @@ export function TopBar({
}
if (config?.useTray && !dontTray) {
electron.api.minimize();
electron.api.hide();
} else if (
config?.connectedTrackersWarning &&
connectedIMUTrackers.filter(