Restore old behaviour of maximize button toggling fullscreen (#1832)

This commit is contained in:
Sapphire authored and GitHub committed 2026-05-04 15:25:16 +02:00
1 parent aa48b025c7
commit 3b34d5cf96
5 files changed
+16 -10

No files matched your search

+9 -5
View File
@@ -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;
}
});
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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>;
+3 -1
View File
@@ -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
+1 -1
View File
@@ -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>