Skip to content

Commit

Permalink
feat: hide application to dock macos (AppFlowy-IO#5592)
Browse files Browse the repository at this point in the history
* feat: hide application to tray macos

* chore: enable reopen the app after closing it

* fix: remove tray

* fix: remove asset

---------

Co-authored-by: Lucas.Xu <[email protected]>
  • Loading branch information
Xazin and LucasXu0 authored Jun 20, 2024
1 parent 8ca541b commit d8b3216
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 0 additions & 5 deletions frontend/appflowy_flutter/lib/startup/tasks/windows.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ class InitAppWindowTask extends LaunchTask with WindowListener {
await windowManager.show();
await windowManager.focus();

if (PlatformExtension.isWindows) {
// Hide title bar on Windows, we implement a custom solution elsewhere
await windowManager.setTitleBarStyle(TitleBarStyle.hidden);
}

if (position != null) {
await windowManager.setPosition(position);
}
Expand Down
10 changes: 10 additions & 0 deletions frontend/appflowy_flutter/macos/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ import FlutterMacOS
@NSApplicationMain
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return false
}

override func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
if !flag {
for window in sender.windows {
window.makeKeyAndOrderFront(self)
}
}

return true
}
}
1 change: 1 addition & 0 deletions frontend/appflowy_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ dependencies:

# BitsDojo Window for Windows
bitsdojo_window: ^0.1.6

flutter_highlight: ^0.7.0

dev_dependencies:
Expand Down

0 comments on commit d8b3216

Please sign in to comment.