Skip to content

Commit

Permalink
refactor: unknown linux session emits error msg
Browse files Browse the repository at this point in the history
Provides hint if user environment variables are not as expected and
gives us a chance of running successfully anyway:

flathub/codes.merritt.Nyrna#5
  • Loading branch information
Merrit committed Jan 27, 2023
1 parent 7b7e06d commit 1ff3534
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/loading/cubit/loading_cubit.dart
Expand Up @@ -24,9 +24,16 @@ class LoadingCubit extends Cubit<LoadingState> {
// Make sure we are not running under Wayland.
if (Platform.isLinux) {
final sessionType = await (nativePlatform as Linux).sessionType();
if (sessionType != 'x11') {
emit(const LoadingWaylandError());
return;
switch (sessionType) {
case 'wayland':
emit(const LoadingWaylandError());
return;
case 'x11':
break;
default:
log.e('''
Unable to determine session type. The XDG_SESSION_TYPE environment variable is set to "$sessionType".
Please note that Wayland is not currently supported.''');
}
}

Expand Down

0 comments on commit 1ff3534

Please sign in to comment.