🐛 Bug fixes on wm tools

This commit is contained in:
LittleSheep 2024-09-01 17:53:44 +08:00
parent ed7b69f7b3
commit da2a3508d1

View File

@ -24,11 +24,11 @@ import 'package:rhythm_box/services/server/active_sourced_track.dart';
import 'package:rhythm_box/services/server/routes/playback.dart'; import 'package:rhythm_box/services/server/routes/playback.dart';
import 'package:rhythm_box/services/server/server.dart'; import 'package:rhythm_box/services/server/server.dart';
import 'package:rhythm_box/services/server/sourced_track.dart'; import 'package:rhythm_box/services/server/sourced_track.dart';
import 'package:rhythm_box/services/wm_tools.dart';
import 'package:rhythm_box/shells/system_shell.dart'; import 'package:rhythm_box/shells/system_shell.dart';
import 'package:rhythm_box/translations.dart'; import 'package:rhythm_box/translations.dart';
import 'package:rhythm_box/widgets/tracks/querying_track_info.dart'; import 'package:rhythm_box/widgets/tracks/querying_track_info.dart';
import 'package:smtc_windows/smtc_windows.dart'; import 'package:smtc_windows/smtc_windows.dart';
import 'package:window_manager/window_manager.dart';
Future<void> main(List<String> rawArgs) async { Future<void> main(List<String> rawArgs) async {
if (rawArgs.contains('web_view_title_bar')) { if (rawArgs.contains('web_view_title_bar')) {
@ -42,13 +42,7 @@ Future<void> main(List<String> rawArgs) async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
if (PlatformInfo.isDesktop) { if (PlatformInfo.isDesktop) {
await windowManager.ensureInitialized(); await WindowManagerTools.initialize();
await windowManager.setPreventClose(true);
if (PlatformInfo.isMacOS) {
await windowManager.setTitleBarStyle(TitleBarStyle.hidden);
} else {
await windowManager.setTitleBarStyle(TitleBarStyle.normal);
}
} }
if (PlatformInfo.isWindows) { if (PlatformInfo.isWindows) {
await SMTCWindows.initialize(); await SMTCWindows.initialize();