qt 判断程序是否走的wayland

auto e = QProcessEnvironment::systemEnvironment();

QString XDG_SESSION_TYPE = e.value(QStringLiteral("XDG_SESSION_TYPE"));

QString WAYLAND_DISPLAY = e.value(QStringLiteral("WAYLAND_DISPLAY"));

if (XDG_SESSION_TYPE == QLatin1String("wayland") || WAYLAND_DISPLAY.contains(QLatin1String("wayland"), Qt::CaseInsensitive)){

  isWayland = true;

}

posted @ 2020-09-28 15:34  angry_gladiator  阅读(880)  评论(0编辑  收藏  举报