@@ -58,7 +58,7 @@ class AppCubit extends Cubit<AppState> {
5858 /// blocking the UI, since none of the data fetched here is critical.
5959 Future <void > _init () async {
6060 await _checkForFirstRun ();
61- await _checkLinuxSessionType ();
61+ _checkLinuxSessionType ();
6262 await _fetchVersionData ();
6363 await _fetchReleaseNotes ();
6464 _listenToSystemTrayEvents ();
@@ -74,19 +74,19 @@ class AppCubit extends Cubit<AppState> {
7474 }
7575
7676 /// For Linux, checks if the session type is Wayland.
77- Future < void > _checkLinuxSessionType () async {
77+ void _checkLinuxSessionType () {
7878 if (defaultTargetPlatform != TargetPlatform .linux) return ;
7979
80- final sessionType = await (_nativePlatform as Linux ).sessionType () ;
80+ final sessionType = (_nativePlatform as Linux ).sessionType;
8181
8282 final unknownSessionMsg = '''
8383Unable to determine session type. The XDG_SESSION_TYPE environment variable is set to "$sessionType ".
8484Please note that Wayland is not currently supported.''' ;
8585
8686 const waylandNotSupportedMsg = '''
87- Wayland is not currently supported.
87+ Wayland is currently supported only on KDE Plasma .
8888
89- Only xwayland apps will be detected.
89+ For other desktop environments, only xwayland apps will be detected.
9090
9191If Wayland support is important to you, consider voting on the issue:
9292
@@ -106,12 +106,19 @@ env QT_QPA_PLATFORM=xcb <app>
106106
107107Otherwise, [consider signing in using X11 instead](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/).''' ;
108108
109- switch (sessionType) {
110- case 'wayland' :
111- log.w (waylandNotSupportedMsg);
112- emit (state.copyWith (linuxSessionMessage: waylandNotSupportedMsg));
113- return ;
114- case 'x11' :
109+ emit (state.copyWith (sessionType: sessionType));
110+
111+ log.i ('Session type: $sessionType ' );
112+
113+ switch (sessionType.displayProtocol) {
114+ case DisplayProtocol .wayland:
115+ if (sessionType.environment == DesktopEnvironment .kde) {
116+ log.i ('KDE Wayland session detected and is supported, proceeding.' );
117+ } else {
118+ log.w (waylandNotSupportedMsg);
119+ emit (state.copyWith (linuxSessionMessage: waylandNotSupportedMsg));
120+ }
121+ case DisplayProtocol .x11:
115122 break ;
116123 default :
117124 log.w (unknownSessionMsg);
@@ -202,4 +209,10 @@ Otherwise, [consider signing in using X11 instead](https://docs.fedoraproject.or
202209 return false ;
203210 }
204211 }
212+
213+ @override
214+ Future <void > close () async {
215+ await _nativePlatform.dispose ();
216+ await super .close ();
217+ }
205218}
0 commit comments