diff --git a/src/lib/platform/Wayland.h b/src/lib/platform/Wayland.h index bf4056bd8..d4950ea30 100644 --- a/src/lib/platform/Wayland.h +++ b/src/lib/platform/Wayland.h @@ -1,11 +1,13 @@ /* * Deskflow -- mouse and keyboard sharing utility + * SPDX-FileCopyrightText: (C) 2025 Deskflow Developers * SPDX-FileCopyrightText: (C) 2024 Symless Ltd. * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception */ #pragma once +#include #include namespace deskflow::platform { @@ -34,4 +36,31 @@ inline bool isWayland() return session != nullptr && std::string(session) == "wayland"; } +/** + * @brief isFlatpak + * @return Returns true if we are running as flatpak + */ +inline bool isFlatpak() +{ + return QFileInfo::exists(QStringLiteral("/.flatpak-info")); +} + +/** + * @brief isSnap + * @return Returns true if we are running as a snap + */ +inline bool isSnap() +{ + return qEnvironmentVariableIsSet("SNAP"); +} + +/** + * @brief isSandboxed + * @return Returns true if we are running from in a known sandbox. + */ +inline bool isSandboxed() +{ + return isFlatpak() || isSnap(); +} + } // namespace deskflow::platform