From 08b47a50cbd090a58ca219ca4b226d2de99abc60 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sun, 15 Nov 2026 09:45:35 +0800 Subject: [PATCH] feat(flutter): add the DRM capture switch to the Wayland settings card and home warnings Settings > General > Wayland gets a "Use DRM screen capture" checkbox on an installed Linux client, with the explanation shown below it: it skips the Wayland screen sharing prompt (the login screen too), may not work on every device, and switching it disconnects current sessions. Flatpak and AppImage are not installed builds, so they do not show it. On the home page, an installed client with the option off now offers an "Enable" button on the Wayland session and Wayland login screen warnings, and shows neither warning once it is on. Builds that are not installed, and clients where the option is fixed, keep the existing warnings. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01P1grQ39ByRWPUtTBdTzEBF --- flutter/lib/consts.dart | 1 + .../lib/desktop/pages/desktop_home_page.dart | 21 ++++++++++++++++++- .../desktop/pages/desktop_setting_page.dart | 8 +++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/flutter/lib/consts.dart b/flutter/lib/consts.dart index 2b0d2c7d1..d81b904c5 100644 --- a/flutter/lib/consts.dart +++ b/flutter/lib/consts.dart @@ -105,6 +105,7 @@ const String kOptionAutoDisconnectTimeout = "auto-disconnect-timeout"; const String kOptionEnableHwcodec = "enable-hwcodec"; const String kOptionAllowAutoRecordIncoming = "allow-auto-record-incoming"; const String kOptionAllowAutoRecordOutgoing = "allow-auto-record-outgoing"; +const String kOptionAllowDrmCapture = "allow-drm-capture"; const String kOptionHideRecordingButton = "hide-recording-button"; const String kOptionVideoSaveDirectory = "video-save-directory"; const String kOptionAccessMode = "access-mode"; diff --git a/flutter/lib/desktop/pages/desktop_home_page.dart b/flutter/lib/desktop/pages/desktop_home_page.dart index e6f5a41aa..0917f9534 100644 --- a/flutter/lib/desktop/pages/desktop_home_page.dart +++ b/flutter/lib/desktop/pages/desktop_home_page.dart @@ -549,7 +549,26 @@ class _DesktopHomePageState extends State )); } } - if (bind.mainCurrentIsWayland()) { + final installed = bind.mainIsInstalled(); + if (installed && mainGetBoolOptionSync(kOptionAllowDrmCapture)) { + // DRM capture reaches the session and the login screen: no warning. + } else if (installed && + !isOptionFixed(kOptionAllowDrmCapture) && + (bind.mainCurrentIsWayland() || bind.mainIsLoginWayland())) { + final currentIsWayland = bind.mainCurrentIsWayland(); + LinuxCards.add(buildInstallCard( + "Warning", + currentIsWayland ? "wayland-drm-tip" : "login-wayland-drm-tip", + "Enable", () async { + await mainSetBoolOption(kOptionAllowDrmCapture, true); + setState(() {}); + }, + marginTop: LinuxCards.isEmpty ? 20.0 : 5.0, + help: 'Help', + link: currentIsWayland + ? 'https://rustdesk.com/docs/en/client/linux/#x11-required' + : 'https://rustdesk.com/docs/en/client/linux/#login-screen')); + } else if (bind.mainCurrentIsWayland()) { LinuxCards.add(buildInstallCard( "Warning", "wayland_experiment_tip", "", () async {}, marginTop: LinuxCards.isEmpty ? 20.0 : 5.0, diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart index 730d75827..6d9a1a527 100644 --- a/flutter/lib/desktop/pages/desktop_setting_page.dart +++ b/flutter/lib/desktop/pages/desktop_setting_page.dart @@ -2890,6 +2890,14 @@ class _WaylandCardState extends State { "true"; final children = [ + if (isLinux && bind.mainIsInstalled() && !bind.isOutgoingOnly()) ...[ + _OptionCheckBox( + context, 'Use DRM screen capture', kOptionAllowDrmCapture), + Align( + alignment: Alignment.topLeft, + child: Text(translate('drm-capture-tip')), + ).marginOnly(left: _kCardLeftMargin), + ], if (restoreToken.isNotEmpty) _buildClearScreenSelection(context, restoreToken), if (hasShortcutsPermission)