diff options
author | Robert Adam <dev@robert-adam.de> | 2021-11-10 11:16:52 +0300 |
---|---|---|
committer | Robert Adam <dev@robert-adam.de> | 2021-11-10 11:37:47 +0300 |
commit | 5cb3e60f246ea4a6e15c1ae4ee2f8fe2292925af (patch) | |
tree | b1ed312f7fd47b0233abdb2e2f2af29e6be3ce26 | |
parent | 2dd0c8bf5d2d981ca768e76ce6a631659ea102b5 (diff) |
FEAT(client): Add possibility to check for Wayland
This new function allows to check whether Wayland is being used as the
display manager.
-rw-r--r-- | src/EnvUtils.cpp | 5 | ||||
-rw-r--r-- | src/EnvUtils.h | 2 |
2 files changed, 7 insertions, 0 deletions
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 |