diff --git a/cw_core/lib/window_size.dart b/cw_core/lib/window_size.dart index dffbfab99..4a084897d 100644 --- a/cw_core/lib/window_size.dart +++ b/cw_core/lib/window_size.dart @@ -9,6 +9,9 @@ Future setDefaultMinimumWindowSize() async { if (!Platform.isMacOS) return; try { + // A small delay to confirm that our native platform channels are ready + await Future.delayed(const Duration(milliseconds: 100)); + final result = await _channel.invokeMethod( 'setMinWindowSize', {'width': 500, 'height': 700}, @@ -19,5 +22,21 @@ Future setDefaultMinimumWindowSize() async { } } on PlatformException catch (e) { printV("Failed to set minimum window size: '${e.message}'."); + } on MissingPluginException catch (e) { + printV("Native utils plugin not available yet: '${e.message}'. Retrying..."); + // We give it a longer delay this time around, and then retry + await Future.delayed(const Duration(milliseconds: 500)); + try { + final result = await _channel.invokeMethod( + 'setMinWindowSize', + {'width': 500, 'height': 700}, + ) as bool; + + if (!result) { + printV("Failed to set minimum window size on retry."); + } + } catch (retryError) { + printV("Failed to set minimum window size after retry: '$retryError'."); + } } }