mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-21 09:31:20 -08:00
Restore old behaviour of maximize button toggling fullscreen (#1832)
This commit is contained in:
1 parent
aa48b025c7
commit
3b34d5cf96
5 files changed
+16
-10
No files matched your search
@@ -281,18 +281,22 @@ function createWindow() {
|
||||
});
|
||||
|
||||
handleIpc('window-actions', (e, action) => {
|
||||
if (mainWindow === null) return;
|
||||
switch (action) {
|
||||
case 'close':
|
||||
mainWindow?.close();
|
||||
mainWindow.close();
|
||||
break;
|
||||
case 'hide':
|
||||
mainWindow?.hide();
|
||||
mainWindow.hide();
|
||||
break;
|
||||
case 'minimize':
|
||||
mainWindow?.minimize();
|
||||
mainWindow.minimize();
|
||||
break;
|
||||
case 'maximize':
|
||||
mainWindow?.maximize();
|
||||
case 'toggle-maximize':
|
||||
if (mainWindow.isMaximized())
|
||||
mainWindow.unmaximize();
|
||||
else
|
||||
mainWindow.maximize();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
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'),
|
||||
toggleMaximize: () => ipcRenderer.invoke(IPC_CHANNELS.WINDOW_ACTIONS, 'toggle-maximize'),
|
||||
getStorage: async (type) => {
|
||||
return {
|
||||
get: (key) =>
|
||||
@@ -37,5 +37,5 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
openFile: (path) => ipcRenderer.invoke(IPC_CHANNELS.OPEN_FILE, path),
|
||||
ghGet: (req) => ipcRenderer.invoke(IPC_CHANNELS.GH_FETCH, req),
|
||||
setPresence: (options) => ipcRenderer.invoke(IPC_CHANNELS.DISCORD_PRESENCE, options),
|
||||
getInstallDir: () => ipcRenderer.invoke(IPC_CHANNELS.GET_FOLDER, 'exe')
|
||||
getInstallDir: () => ipcRenderer.invoke(IPC_CHANNELS.GET_FOLDER, 'exe'),
|
||||
} satisfies IElectronAPI);
|
||||
Vendored
+1
-1
@@ -45,7 +45,7 @@ export interface IElectronAPI {
|
||||
close: () => void;
|
||||
hide: () => void;
|
||||
minimize: () => void;
|
||||
maximize: () => void;
|
||||
toggleMaximize: () => void;
|
||||
showDecorations: (decorations: boolean) => void;
|
||||
setTranslations: (translations: Record<string, string>) => void;
|
||||
i18nOverride: () => Promise<string | false>;
|
||||
|
||||
@@ -25,7 +25,9 @@ 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' | 'hide') => void;
|
||||
[IPC_CHANNELS.WINDOW_ACTIONS]: (
|
||||
action: 'close' | 'minimize' | 'toggle-maximize' | 'hide'
|
||||
) => void;
|
||||
[IPC_CHANNELS.LOG]: (type: 'info' | 'error' | 'warn', ...args: unknown[]) => void;
|
||||
[IPC_CHANNELS.OPEN_DIALOG]: (
|
||||
options: OpenDialogOptions
|
||||
|
||||
@@ -234,7 +234,7 @@ export function TopBar({
|
||||
</div>
|
||||
<div
|
||||
className="flex items-center justify-center hover:bg-background-60 rounded-full w-7 h-7"
|
||||
onClick={() => electron.api.maximize()}
|
||||
onClick={() => electron.api.toggleMaximize()}
|
||||
>
|
||||
<MaximiseIcon />
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user