From 3d690c26d8915a4ef7a4bf8977effe4eaf0d0465 Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Sun, 20 Sep 2026 13:27:47 -0400 Subject: [PATCH] hopefully fixup UP on linux when backgrounded --- lib/controllers/unified_push.dart | 1 + lib/main.dart | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/controllers/unified_push.dart b/lib/controllers/unified_push.dart index f637156..b9af5b2 100644 --- a/lib/controllers/unified_push.dart +++ b/lib/controllers/unified_push.dart @@ -68,6 +68,7 @@ class UnifiedPushController extends AsyncNotifier { await windowManager.isFocused().onError((_, _) => false) && ref.watch(KeyController.provider(KeyController.roomKey)) == event.roomId)) { + if (isInBackground) exit(0); return; } diff --git a/lib/main.dart b/lib/main.dart index 80c2649..58289f0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -88,7 +88,13 @@ void main(List args) async { FlutterError.onError = (FlutterErrorDetails details) => showError(details.exception.toString(), details.stack); - if (!isInBackground) { + if (isInBackground) { + await ProviderContainer().read(UnifiedPushController.provider.future); + + // In case it didn't exit for some reason + await Future.delayed(Duration(seconds: 20)); + exit(0); + } else { runApp( ProviderScope( retry: (_, _) => null,