mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-05-11 18:36:11 +02:00
fix: linux, window, workaround, mint, mate (#10146)
* refact: linux, window, workaround, mint, mate Signed-off-by: fufesou <linlong1266@gmail.com> * refact: case insensitive Signed-off-by: fufesou <linlong1266@gmail.com> --------- Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
parent
b8d36b6558
commit
bd0a33e467
6 changed files with 161 additions and 17 deletions
|
@ -1,6 +1,7 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:back_button_interceptor/back_button_interceptor.dart';
|
||||
import 'package:desktop_multi_window/desktop_multi_window.dart';
|
||||
|
@ -3459,6 +3460,35 @@ Widget buildPresetPasswordWarning() {
|
|||
);
|
||||
}
|
||||
|
||||
bool get isLinuxMateDesktop =>
|
||||
isLinux &&
|
||||
(Platform.environment['XDG_CURRENT_DESKTOP']?.toLowerCase() == 'mate' ||
|
||||
Platform.environment['XDG_SESSION_DESKTOP']?.toLowerCase() == 'mate' ||
|
||||
Platform.environment['DESKTOP_SESSION']?.toLowerCase() == 'mate');
|
||||
|
||||
Map<String, dynamic>? _linuxOsDistro;
|
||||
|
||||
String getLinuxOsDistroId() {
|
||||
if (_linuxOsDistro == null) {
|
||||
String osInfo = bind.getOsDistroInfo();
|
||||
if (osInfo.isEmpty) {
|
||||
_linuxOsDistro = {};
|
||||
} else {
|
||||
try {
|
||||
_linuxOsDistro = jsonDecode(osInfo);
|
||||
} catch (e) {
|
||||
debugPrint('Failed to parse os info: $e');
|
||||
// Don't call `bind.getOsDistroInfo()` again if failed to parse osInfo.
|
||||
_linuxOsDistro = {};
|
||||
}
|
||||
}
|
||||
}
|
||||
return (_linuxOsDistro?['id'] ?? '') as String;
|
||||
}
|
||||
|
||||
bool get isLinuxMint =>
|
||||
getLinuxOsDistroId().toLowerCase().contains('linuxmint');
|
||||
|
||||
// https://github.com/leanflutter/window_manager/blob/87dd7a50b4cb47a375b9fc697f05e56eea0a2ab3/lib/src/widgets/virtual_window_frame.dart#L44
|
||||
Widget buildVirtualWindowFrame(BuildContext context, Widget child) {
|
||||
boxShadow() => isMainDesktopWindow
|
||||
|
|
|
@ -483,7 +483,16 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
|||
child = keyListenerBuilder(context, child);
|
||||
}
|
||||
if (isLinux) {
|
||||
child = buildVirtualWindowFrame(context, child);
|
||||
// `(!(isLinuxMateDesktop || isLinuxMint))` is not used here for clarity.
|
||||
// `isLinuxMint` will call ffi function.
|
||||
if (!isLinuxMateDesktop) {
|
||||
if (!isLinuxMint) {
|
||||
debugPrint(
|
||||
'Linux distro is not linuxmint, and desktop is not mate, '
|
||||
'so we build virtual window frame.');
|
||||
child = buildVirtualWindowFrame(context, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
return child;
|
||||
},
|
||||
|
|
|
@ -1828,5 +1828,9 @@ class RustdeskImpl {
|
|||
throw UnimplementedError("sessionGetConnToken");
|
||||
}
|
||||
|
||||
String getOsDistroInfo({dynamic hint}) {
|
||||
return '';
|
||||
}
|
||||
|
||||
void dispose() {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue