Skip to content

Commit

Permalink
FEAT(client): Add possibility to check for Wayland
Browse files Browse the repository at this point in the history
This new function allows to check whether Wayland is being used as the
display manager.
  • Loading branch information
Krzmbrzl committed Nov 10, 2021
1 parent 2dd0c8b commit 5cb3e60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/EnvUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions src/EnvUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ QString getenv(QString name);

bool setenv(QString name, QString value);

bool waylandIsUsed();

}; // namespace EnvUtils

#endif

0 comments on commit 5cb3e60

Please sign in to comment.