feat: support custom minimize, maximize and close (#9847)

* feat: add window control functionality for Windows and Linux

- Introduced new IPC channels for window management: minimize, maximize, unmaximize, close, and check maximized state.
- Implemented window control buttons in the UI, allowing users to minimize, maximize, and close the application.
- Enhanced Navbar and TabContainer components to include window controls, improving user experience on non-Mac platforms.
- Styled window control buttons for better visual integration.

This update enhances the application's usability by providing essential window management features.

* add tooltip

* fix macos

* lint error

* update i18n

* lint

* fix: add WindowControls to MinApp popup and improve hover styles

- Add WindowControls component to MinappPopupContainer title bar for Windows/Linux
- Fix ButtonsGroup overlap with WindowControls by adding proper margin
- Improve WindowControls hover background visibility by using rgba(128,128,128,0.3)
- Ensure WindowControls is positioned at the right edge of title bar

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* lint

* add types

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
beyondkmp
2025-09-05 12:30:01 +08:00
committed by GitHub
parent 19846c7e01
commit b1a39e9b38
19 changed files with 326 additions and 30 deletions
+14
View File
@@ -438,6 +438,20 @@ const api = {
cherryin: {
generateSignature: (params: { method: string; path: string; query: string; body: Record<string, any> }) =>
ipcRenderer.invoke(IpcChannel.Cherryin_GetSignature, params)
},
windowControls: {
minimize: (): Promise<void> => ipcRenderer.invoke(IpcChannel.Windows_Minimize),
maximize: (): Promise<void> => ipcRenderer.invoke(IpcChannel.Windows_Maximize),
unmaximize: (): Promise<void> => ipcRenderer.invoke(IpcChannel.Windows_Unmaximize),
close: (): Promise<void> => ipcRenderer.invoke(IpcChannel.Windows_Close),
isMaximized: (): Promise<boolean> => ipcRenderer.invoke(IpcChannel.Windows_IsMaximized),
onMaximizedChange: (callback: (isMaximized: boolean) => void): (() => void) => {
const channel = IpcChannel.Windows_MaximizedChanged
ipcRenderer.on(channel, (_, isMaximized: boolean) => callback(isMaximized))
return () => {
ipcRenderer.removeAllListeners(channel)
}
}
}
}