Skip to content

Commit

Permalink
fix: Window size on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Losses committed Nov 24, 2024
1 parent 8c5542b commit 8bb6162
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ void main(List<String> arguments) async {
final windowSizeSetting =
await settingsManager.getValue<String>(windowSizeKey) ?? 'normal';

final windowSize = windowSizes[windowSizeSetting]!;
final firstView = WidgetsBinding.instance.platformDispatcher.views.first;
final windowSize = Platform.isWindows
? windowSizes[windowSizeSetting]!
: windowSizes[windowSizeSetting]! / firstView.devicePixelRatio;
appWindow.size = windowSize;

mainLoop();
Expand Down
7 changes: 6 additions & 1 deletion lib/screens/settings_theme/settings_theme.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:fluent_ui/fluent_ui.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:bitsdojo_window/bitsdojo_window.dart';
Expand Down Expand Up @@ -116,7 +118,10 @@ class _SettingsThemeState extends State<SettingsTheme> {

await SettingsManager().setValue(windowSizeKey, newWindowSize);

final size = windowSizes[newWindowSize]!;
final firstView = WidgetsBinding.instance.platformDispatcher.views.first;
final size = Platform.isWindows
? windowSizes[newWindowSize]!
: windowSizes[newWindowSize]! / firstView.devicePixelRatio;
appWindow.size = size;
}

Expand Down

0 comments on commit 8bb6162

Please sign in to comment.