feat: implement tray and minimize behaviors (#13851)

This PR introduces new window behaviors, which can be enabled when the
menubar setting is active:

New Features:
- Quick open from tray icon
- Minimize to tray
- Exit to tray
- Start minimized

These changes have not yet been tested on macOS.

<img width="645" height="479" alt="image"
src="https://github.com/user-attachments/assets/7bdd13d0-5322-45a4-8e71-85c081aa0c86"
/>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Configurable menubar/tray behaviors: open on left-click, minimize to
tray, close to tray (exit to tray), and start minimized.

* **UI**
* Appearance settings add a Menubar → Window Behavior group with four
toggles; group shows only when menubar/tray is enabled (hidden on
macOS).

* **Settings**
* Tray settings persisted and exposed via the settings API with getters
and setters for each option.

* **Localization**
* Added translation keys and English strings for the new controls and
descriptions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Peng Xiao <pengxiao@outlook.com>
This commit is contained in:
Martin Pauli
2025-11-06 21:10:15 +01:00
committed by GitHub
parent 9f6ea83ac1
commit 2bd9f1a353
8 changed files with 258 additions and 29 deletions

View File

@@ -991,6 +991,42 @@ export function useAFFiNEI18N(): {
* `Display the menubar app in the tray for quick access to AFFiNE or meeting recordings.`
*/
["com.affine.appearanceSettings.menubar.description"](): string;
/**
* `Window behavior`
*/
["com.affine.appearanceSettings.menubar.windowBehavior.title"](): string;
/**
* `Quick open from tray icon`
*/
["com.affine.appearanceSettings.menubar.windowBehavior.openOnLeftClick.toggle"](): string;
/**
* `Open AFFiNE when leftclicking the tray icon.`
*/
["com.affine.appearanceSettings.menubar.windowBehavior.openOnLeftClick.description"](): string;
/**
* `Minimize to tray`
*/
["com.affine.appearanceSettings.menubar.windowBehavior.minimizeToTray.toggle"](): string;
/**
* `Minimize AFFiNE to the system tray.`
*/
["com.affine.appearanceSettings.menubar.windowBehavior.minimizeToTray.description"](): string;
/**
* `Close to tray`
*/
["com.affine.appearanceSettings.menubar.windowBehavior.closeToTray.toggle"](): string;
/**
* `Close AFFiNE to the system tray.`
*/
["com.affine.appearanceSettings.menubar.windowBehavior.closeToTray.description"](): string;
/**
* `Start minimized`
*/
["com.affine.appearanceSettings.menubar.windowBehavior.startMinimized.toggle"](): string;
/**
* `Start AFFiNE minimized to the system tray.`
*/
["com.affine.appearanceSettings.menubar.windowBehavior.startMinimized.description"](): string;
/**
* `Theme`
*/

View File

@@ -237,6 +237,15 @@
"com.affine.appearanceSettings.menubar.title": "Menubar",
"com.affine.appearanceSettings.menubar.toggle": "Enable menubar app",
"com.affine.appearanceSettings.menubar.description": "Display the menubar app in the tray for quick access to AFFiNE or meeting recordings.",
"com.affine.appearanceSettings.menubar.windowBehavior.title": "Window behavior",
"com.affine.appearanceSettings.menubar.windowBehavior.openOnLeftClick.toggle": "Quick open from tray icon",
"com.affine.appearanceSettings.menubar.windowBehavior.openOnLeftClick.description": "Open AFFiNE when leftclicking the tray icon.",
"com.affine.appearanceSettings.menubar.windowBehavior.minimizeToTray.toggle": "Minimize to tray",
"com.affine.appearanceSettings.menubar.windowBehavior.minimizeToTray.description": "Minimize AFFiNE to the system tray.",
"com.affine.appearanceSettings.menubar.windowBehavior.closeToTray.toggle": "Close to tray",
"com.affine.appearanceSettings.menubar.windowBehavior.closeToTray.description": "Close AFFiNE to the system tray.",
"com.affine.appearanceSettings.menubar.windowBehavior.startMinimized.toggle": "Start minimized",
"com.affine.appearanceSettings.menubar.windowBehavior.startMinimized.description": "Start AFFiNE minimized to the system tray.",
"com.affine.appearanceSettings.theme.title": "Theme",
"com.affine.appearanceSettings.title": "Appearance settings",
"com.affine.appearanceSettings.translucentUI.description": "Use transparency effect on the sidebar.",