mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-22 00:13:09 +08:00
Merge 0eaf95110e into 8ab375161d
This commit is contained in:
commit
4b713ff75e
@ -47,6 +47,7 @@ export enum IpcChannel {
|
|||||||
App_MacRequestProcessTrust = 'app:mac-request-process-trust',
|
App_MacRequestProcessTrust = 'app:mac-request-process-trust',
|
||||||
|
|
||||||
App_QuoteToMain = 'app:quote-to-main',
|
App_QuoteToMain = 'app:quote-to-main',
|
||||||
|
App_ShowMainWindow = 'app:show-main-window',
|
||||||
App_SetDisableHardwareAcceleration = 'app:set-disable-hardware-acceleration',
|
App_SetDisableHardwareAcceleration = 'app:set-disable-hardware-acceleration',
|
||||||
|
|
||||||
Notification_Send = 'notification:send',
|
Notification_Send = 'notification:send',
|
||||||
|
|||||||
@ -909,6 +909,7 @@ export function registerIpc(mainWindow: BrowserWindow, app: Electron.App) {
|
|||||||
SelectionService.registerIpcHandler()
|
SelectionService.registerIpcHandler()
|
||||||
|
|
||||||
ipcMain.handle(IpcChannel.App_QuoteToMain, (_, text: string) => windowService.quoteToMainWindow(text))
|
ipcMain.handle(IpcChannel.App_QuoteToMain, (_, text: string) => windowService.quoteToMainWindow(text))
|
||||||
|
ipcMain.handle(IpcChannel.App_ShowMainWindow, () => windowService.showMainWindow())
|
||||||
|
|
||||||
ipcMain.handle(IpcChannel.App_SetDisableHardwareAcceleration, (_, isDisable: boolean) => {
|
ipcMain.handle(IpcChannel.App_SetDisableHardwareAcceleration, (_, isDisable: boolean) => {
|
||||||
configManager.setDisableHardwareAcceleration(isDisable)
|
configManager.setDisableHardwareAcceleration(isDisable)
|
||||||
|
|||||||
@ -375,16 +375,16 @@ export class WindowService {
|
|||||||
|
|
||||||
mainWindow.hide()
|
mainWindow.hide()
|
||||||
|
|
||||||
//for mac users, should hide dock icon if close to tray
|
|
||||||
if (isMac && isTrayOnClose) {
|
if (isMac && isTrayOnClose) {
|
||||||
|
const quickAssistantEnabled = configManager.getEnableQuickAssistant()
|
||||||
|
if (!quickAssistantEnabled) {
|
||||||
app.dock?.hide()
|
app.dock?.hide()
|
||||||
|
|
||||||
mainWindow.once('show', () => {
|
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()
|
app.dock?.show()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
mainWindow.on('closed', () => {
|
mainWindow.on('closed', () => {
|
||||||
|
|||||||
@ -487,6 +487,7 @@ const api = {
|
|||||||
}) => ipcRenderer.invoke(IpcChannel.AgentToolPermission_Response, payload)
|
}) => ipcRenderer.invoke(IpcChannel.AgentToolPermission_Response, payload)
|
||||||
},
|
},
|
||||||
quoteToMainWindow: (text: string) => ipcRenderer.invoke(IpcChannel.App_QuoteToMain, text),
|
quoteToMainWindow: (text: string) => ipcRenderer.invoke(IpcChannel.App_QuoteToMain, text),
|
||||||
|
openMainWindow: () => ipcRenderer.invoke(IpcChannel.App_ShowMainWindow),
|
||||||
setDisableHardwareAcceleration: (isDisable: boolean) =>
|
setDisableHardwareAcceleration: (isDisable: boolean) =>
|
||||||
ipcRenderer.invoke(IpcChannel.App_SetDisableHardwareAcceleration, isDisable),
|
ipcRenderer.invoke(IpcChannel.App_SetDisableHardwareAcceleration, isDisable),
|
||||||
trace: {
|
trace: {
|
||||||
|
|||||||
@ -64,6 +64,16 @@ const Footer: FC<FooterProps> = ({
|
|||||||
: t('miniwindow.footer.esc_back')
|
: t('miniwindow.footer.esc_back')
|
||||||
})}
|
})}
|
||||||
</Tag>
|
</Tag>
|
||||||
|
<Tag
|
||||||
|
bordered={false}
|
||||||
|
style={{ cursor: 'pointer' }}
|
||||||
|
className="nodrag"
|
||||||
|
onClick={() => {
|
||||||
|
window.api.openMainWindow()
|
||||||
|
window.api.miniWindow.hide()
|
||||||
|
}}>
|
||||||
|
打开主窗口
|
||||||
|
</Tag>
|
||||||
{route === 'home' && !canUseBackspace && (
|
{route === 'home' && !canUseBackspace && (
|
||||||
<Tag
|
<Tag
|
||||||
bordered={false}
|
bordered={false}
|
||||||
|
|||||||
@ -183,6 +183,10 @@ const WindowFooter: FC<FooterProps> = ({
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</OpButton>
|
</OpButton>
|
||||||
|
<OpButton onClick={() => window.api?.openMainWindow?.()} $isWindowFocus={isWindowFocus}>
|
||||||
|
<CircleX size={14} className="btn-icon" />
|
||||||
|
打开主窗口
|
||||||
|
</OpButton>
|
||||||
{onRegenerate && (
|
{onRegenerate && (
|
||||||
<OpButton onClick={handleRegenerate} $isWindowFocus={isWindowFocus} data-hovered={isRegenerateHovered}>
|
<OpButton onClick={handleRegenerate} $isWindowFocus={isWindowFocus} data-hovered={isRegenerateHovered}>
|
||||||
<RefreshIcon size={14} className="btn-icon" />
|
<RefreshIcon size={14} className="btn-icon" />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user