Align fullscreen return button with project actions
This commit is contained in:
@@ -6,6 +6,7 @@ import { app, BrowserWindow, dialog, ipcMain, shell } from 'electron';
|
||||
import { registerHostApiProxyHandlers } from './ipc/host-api-proxy';
|
||||
import { registerTranscriptExportHandler } from './ipc/transcript-export';
|
||||
import { registerConversationLinkContextMenuHandler } from './ipc/conversation-link-context-menu';
|
||||
import { registerWindowFullscreenHandlers } from './ipc/window-fullscreen';
|
||||
import { applyProxySettings } from './proxy';
|
||||
import { syncLaunchAtStartupSettingFromStore } from './launch-at-startup';
|
||||
import { getAllSettings, getSetting, resetSettings, setSetting, type AppSettings } from '../utils/store';
|
||||
@@ -254,6 +255,7 @@ export function registerIpcHandlers(
|
||||
if (!window || window.isDestroyed()) throw new Error('Main window is unavailable');
|
||||
return window;
|
||||
};
|
||||
const bindWindowFullscreen = registerWindowFullscreenHandlers(requireRequestWindow);
|
||||
registerHostApiProxyHandlers(hostApiContext);
|
||||
registerTranscriptExportHandler(getMainWindow);
|
||||
registerConversationLinkContextMenuHandler(getMainWindow);
|
||||
@@ -272,7 +274,10 @@ export function registerIpcHandlers(
|
||||
return leases;
|
||||
};
|
||||
const bindWindow = (window: BrowserWindow): void => {
|
||||
if (!window.isDestroyed() && !window.webContents.isDestroyed()) bindRenderer(window.webContents);
|
||||
if (!window.isDestroyed() && !window.webContents.isDestroyed()) {
|
||||
bindRenderer(window.webContents);
|
||||
bindWindowFullscreen(window);
|
||||
}
|
||||
};
|
||||
const initialWindow = getMainWindow();
|
||||
if (initialWindow) bindWindow(initialWindow);
|
||||
|
||||
20
electron/main/ipc/window-fullscreen.ts
Normal file
20
electron/main/ipc/window-fullscreen.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { ipcMain, type BrowserWindow } from 'electron';
|
||||
|
||||
export function registerWindowFullscreenHandlers(
|
||||
requireWindow: (event: Electron.IpcMainInvokeEvent) => BrowserWindow,
|
||||
): (window: BrowserWindow) => void {
|
||||
ipcMain.handle('window:isFullScreen', (event) => requireWindow(event).isFullScreen());
|
||||
|
||||
const boundWindows = new WeakSet<BrowserWindow>();
|
||||
return (window: BrowserWindow): void => {
|
||||
if (window.isDestroyed() || window.webContents.isDestroyed() || boundWindows.has(window)) return;
|
||||
boundWindows.add(window);
|
||||
|
||||
const notify = (fullscreen: boolean): void => {
|
||||
if (window.isDestroyed() || window.webContents.isDestroyed()) return;
|
||||
window.webContents.send('window:fullscreen-changed', fullscreen);
|
||||
};
|
||||
window.on('enter-full-screen', () => notify(true));
|
||||
window.on('leave-full-screen', () => notify(false));
|
||||
};
|
||||
}
|
||||
@@ -33,6 +33,7 @@ const validInvokeChannels = [
|
||||
'window:maximize',
|
||||
'window:close',
|
||||
'window:isMaximized',
|
||||
'window:isFullScreen',
|
||||
'settings:get',
|
||||
'settings:set',
|
||||
'settings:setMany',
|
||||
@@ -64,6 +65,7 @@ const validInvokeChannels = [
|
||||
];
|
||||
|
||||
const validEventChannels = [
|
||||
'window:fullscreen-changed',
|
||||
'navigate',
|
||||
'cloud-agent-link',
|
||||
'update:status-changed',
|
||||
|
||||
Reference in New Issue
Block a user