diff --git a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp index 2307aff4f..1c68614e1 100644 --- a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp @@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "platform/linux/file_utilities_linux.h" #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION +#include "base/platform/linux/base_linux_app_launch_context.h" #include "platform/linux/linux_xdp_open_with_dialog.h" #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION @@ -24,7 +25,9 @@ namespace File { void UnsafeOpenUrl(const QString &url) { #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION try { - if (Gio::AppInfo::launch_default_for_uri(url.toStdString())) { + if (Gio::AppInfo::launch_default_for_uri( + url.toStdString(), + base::Platform::AppLaunchContext())) { return; } } catch (const Glib::Error &e) { @@ -53,7 +56,8 @@ void UnsafeLaunch(const QString &filepath) { #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION try { if (Gio::AppInfo::launch_default_for_uri( - Glib::filename_to_uri(filepath.toStdString()))) { + Glib::filename_to_uri(filepath.toStdString()), + base::Platform::AppLaunchContext())) { return; } } catch (const Glib::Error &e) { diff --git a/Telegram/SourceFiles/platform/linux/linux_xdp_open_with_dialog.cpp b/Telegram/SourceFiles/platform/linux/linux_xdp_open_with_dialog.cpp index 22d3b0b02..e57c5744a 100644 --- a/Telegram/SourceFiles/platform/linux/linux_xdp_open_with_dialog.cpp +++ b/Telegram/SourceFiles/platform/linux/linux_xdp_open_with_dialog.cpp @@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/platform/base_platform_info.h" #include "base/platform/linux/base_linux_glibmm_helper.h" #include "base/platform/linux/base_linux_xdp_utilities.h" +#include "base/platform/linux/base_linux_wayland_integration.h" #include "core/application.h" #include "window/window_controller.h" #include "base/random.h" @@ -77,6 +78,17 @@ bool ShowXDPOpenWithDialog(const QString &filepath) { const auto handleToken = Glib::ustring("tdesktop") + std::to_string(base::RandomValue()); + const auto activationToken = []() -> std::optional { + using base::Platform::WaylandIntegration; + if (const auto integration = WaylandIntegration::Instance()) { + if (const auto token = integration->activationToken() + ; !token.isNull()) { + return Glib::ustring(token.toStdString()); + } + } + return std::nullopt; + }(); + auto uniqueName = connection->get_unique_name(); uniqueName.erase(0, 1); uniqueName.replace(uniqueName.find('.'), 1, 1, '_'); @@ -133,6 +145,12 @@ bool ShowXDPOpenWithDialog(const QString &filepath) { "ask", Glib::Variant::create(true) }, + activationToken + ? std::pair{ + "activation_token", + Glib::Variant::create(*activationToken) + } + : std::pair{}, }), }), fdList, diff --git a/Telegram/lib_base b/Telegram/lib_base index d69b49fdd..500731e1f 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit d69b49fdd7bcb0b3414bc66fb34606dd56f695ba +Subproject commit 500731e1f9a4a8b98e388e7a06b91b41d8df7211 diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 4768e7ee0..a7117df83 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 4768e7ee03aa22f64f73dc13016d5bd94a047496 +Subproject commit a7117df837db39e8d2e4590dd6b0434415f79264