diff --git a/misc/service/dde-application-manager.service b/misc/service/dde-application-manager.service index f97c8bc..cd02394 100644 --- a/misc/service/dde-application-manager.service +++ b/misc/service/dde-application-manager.service @@ -8,6 +8,12 @@ CollectMode=inactive-or-failed StartLimitIntervalSec=10s StartLimitBurst=30 +Requisite=dde-session-manager.target +After=dde-session-manager.target + +Requisite=dde-display.target +After=dde-display.target + BindsTo=dde-session-daemon.service Before=dde-session-daemon.service diff --git a/src/lib/desktopinfo.cpp b/src/lib/desktopinfo.cpp index cd473db..ea60181 100644 --- a/src/lib/desktopinfo.cpp +++ b/src/lib/desktopinfo.cpp @@ -26,6 +26,8 @@ #include "dfile.h" #include "basedir.h" +#include + #include #include #include @@ -96,10 +98,16 @@ bool DesktopInfo::isValidDesktop() return m_isValid; } +/** if return true, item is shown + * @brief DesktopInfo::shouldShow + * @return + */ bool DesktopInfo::shouldShow() { - if (getNoDisplay() || getIsHidden()) + if (getNoDisplay() || getIsHidden()) { + qDebug() << "hidden desktop file path: " << QString::fromStdString(m_fileName); return false; + } std::vector desktopEnvs; return getShowIn(desktopEnvs); @@ -117,6 +125,10 @@ bool DesktopInfo::getIsHidden() bool DesktopInfo::getShowIn(std::vector desktopEnvs) { +#ifdef QT_DEBUG + qDebug() << "desktop file path: " << QString::fromStdString(m_fileName); +#endif + if (desktopEnvs.size() == 0) { const char *env = getenv(envDesktopEnv.c_str()); const auto &desktop = DString::splitChars(env, ':'); @@ -127,14 +139,34 @@ bool DesktopInfo::getShowIn(std::vector desktopEnvs) std::vector onlyShowIn = m_keyFile.getStrList(MainSection, KeyOnlyShowIn); std::vector notShowIn = m_keyFile.getStrList(MainSection, KeyNotShowIn); +#ifdef QT_DEBUG + auto strVector2qstrVector = [](const std::vector &vector) { + QVector vectorString; + for (const std::string &str : vector) + vectorString.append(QString::fromStdString(str)); + + return vectorString; + }; + + qDebug() << "onlyShowIn:" << strVector2qstrVector(onlyShowIn) << + ", notShowIn:" << strVector2qstrVector(notShowIn) << + ", desktopEnvs:" << strVector2qstrVector(desktopEnvs); +#endif + for (const auto &desktop : desktopEnvs) { bool ret = std::any_of(onlyShowIn.begin(), onlyShowIn.end(), [&desktop](const auto &d) {return d == desktop;}); +#ifdef QT_DEBUG + qInfo() << Q_FUNC_INFO << "onlyShowIn, result:" << ret; +#endif if (ret) return true; ret = std::any_of(notShowIn.begin(), notShowIn.end(), [&desktop](const auto &d) {return d == desktop;}); +#ifdef QT_DEBUG + qInfo() << Q_FUNC_INFO << "notShowIn, result:" << ret; +#endif if (ret) return false; } @@ -383,8 +415,10 @@ std::vector AppsDir::getAllDesktopInfos() std::string filePath = dir + iter.first; DesktopInfo desktopInfo(filePath); - if (!DFile::isExisted(filePath) || !desktopInfo.isValidDesktop() || !desktopInfo.shouldShow()) + if (!DFile::isExisted(filePath) || !desktopInfo.isValidDesktop() || !desktopInfo.shouldShow()) { + qDebug() << QString("app item %1 doesn't show in the list..").arg(QString::fromStdString(filePath)); continue; + } desktopInfos.push_back(desktopInfo); }