From 5cb3e60f246ea4a6e15c1ae4ee2f8fe2292925af Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Wed, 10 Nov 2021 09:16:52 +0100 Subject: FEAT(client): Add possibility to check for Wayland This new function allows to check whether Wayland is being used as the display manager. --- src/EnvUtils.cpp | 5 +++++ src/EnvUtils.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/EnvUtils.cpp b/src/EnvUtils.cpp index 7dce1095d..1c3a6dd63 100644 --- a/src/EnvUtils.cpp +++ b/src/EnvUtils.cpp @@ -56,4 +56,9 @@ bool setenv(QString name, QString value) { #endif } +bool waylandIsUsed() { + // If wayland is used, this environment variable is expected to be set + return getenv(QStringLiteral("WAYLAND_DISPLAY")) != ""; +} + }; // namespace EnvUtils diff --git a/src/EnvUtils.h b/src/EnvUtils.h index 1cd454963..7a245f527 100644 --- a/src/EnvUtils.h +++ b/src/EnvUtils.h @@ -22,6 +22,8 @@ QString getenv(QString name); bool setenv(QString name, QString value); +bool waylandIsUsed(); + }; // namespace EnvUtils #endif -- cgit v1.2.3