opt: hide main window when using shortcut

This commit is contained in:
Kingtous
2022-11-26 11:40:13 +08:00
parent 03c1395565
commit f343478016
5 changed files with 52 additions and 27 deletions

View File

@@ -118,13 +118,18 @@ void runMainApp(bool startService) async {
gFFI.serverModel.startService();
}
runApp(App());
// check the startup argument, if we successfully handle the argument, we keep the main window hidden.
if (checkArguments()) {
windowManager.hide();
} else {
windowManager.show();
windowManager.focus();
}
// set window option
WindowOptions windowOptions = getHiddenTitleBarWindowOptions();
windowManager.waitUntilReadyToShow(windowOptions, () async {
restoreWindowPosition(WindowType.Main);
await windowManager.show();
await windowManager.focus();
await windowManager.setOpacity(1);
windowManager.setOpacity(1);
});
}