diff --git a/packages/shared/IpcChannel.ts b/packages/shared/IpcChannel.ts index aec1d57b43..906080eb54 100644 --- a/packages/shared/IpcChannel.ts +++ b/packages/shared/IpcChannel.ts @@ -47,6 +47,7 @@ export enum IpcChannel { App_MacRequestProcessTrust = 'app:mac-request-process-trust', App_QuoteToMain = 'app:quote-to-main', + App_ShowMainWindow = 'app:show-main-window', App_SetDisableHardwareAcceleration = 'app:set-disable-hardware-acceleration', Notification_Send = 'notification:send', diff --git a/src/main/ipc.ts b/src/main/ipc.ts index 4cb3402414..2df69ec415 100644 --- a/src/main/ipc.ts +++ b/src/main/ipc.ts @@ -909,6 +909,7 @@ export function registerIpc(mainWindow: BrowserWindow, app: Electron.App) { SelectionService.registerIpcHandler() ipcMain.handle(IpcChannel.App_QuoteToMain, (_, text: string) => windowService.quoteToMainWindow(text)) + ipcMain.handle(IpcChannel.App_ShowMainWindow, () => windowService.showMainWindow()) ipcMain.handle(IpcChannel.App_SetDisableHardwareAcceleration, (_, isDisable: boolean) => { configManager.setDisableHardwareAcceleration(isDisable) diff --git a/src/main/services/WindowService.ts b/src/main/services/WindowService.ts index 3f96497e63..86dc14d12d 100644 --- a/src/main/services/WindowService.ts +++ b/src/main/services/WindowService.ts @@ -375,15 +375,15 @@ export class WindowService { mainWindow.hide() - //for mac users, should hide dock icon if close to tray if (isMac && isTrayOnClose) { - app.dock?.hide() + const quickAssistantEnabled = configManager.getEnableQuickAssistant() + if (!quickAssistantEnabled) { + app.dock?.hide() - mainWindow.once('show', () => { - //restore the window can hide by cmd+h when the window is shown again - // https://github.com/electron/electron/pull/47970 - app.dock?.show() - }) + mainWindow.once('show', () => { + app.dock?.show() + }) + } } }) diff --git a/src/preload/index.ts b/src/preload/index.ts index dc08e9a2df..a6eec48be3 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -487,6 +487,7 @@ const api = { }) => ipcRenderer.invoke(IpcChannel.AgentToolPermission_Response, payload) }, quoteToMainWindow: (text: string) => ipcRenderer.invoke(IpcChannel.App_QuoteToMain, text), + openMainWindow: () => ipcRenderer.invoke(IpcChannel.App_ShowMainWindow), setDisableHardwareAcceleration: (isDisable: boolean) => ipcRenderer.invoke(IpcChannel.App_SetDisableHardwareAcceleration, isDisable), trace: { diff --git a/src/renderer/src/windows/mini/home/components/Footer.tsx b/src/renderer/src/windows/mini/home/components/Footer.tsx index 04b4164404..c31f96d56b 100644 --- a/src/renderer/src/windows/mini/home/components/Footer.tsx +++ b/src/renderer/src/windows/mini/home/components/Footer.tsx @@ -64,6 +64,16 @@ const Footer: FC = ({ : t('miniwindow.footer.esc_back') })} + { + window.api.openMainWindow() + window.api.miniWindow.hide() + }}> + 打开主窗口 + {route === 'home' && !canUseBackspace && ( = ({ )} + window.api?.openMainWindow?.()} $isWindowFocus={isWindowFocus}> + + 打开主窗口 + {onRegenerate && (