fix: 修复录屏应用没有显示在启动器中的问题
systemd拉起deepin-application-manager进程时,系统环境变量XDG_CURRENT_DESKTOP键值为空,而录屏应用只显示在Deepin系统环境中 修复方法:在XDG_CURRENT_DESKTOP赋值后再拉起deepin-application-manager. Log: Influence: 修改AM 启动时序,确保系统环境变量已装载完成再启动 Bug: https://pms.uniontech.com/bug-view-159147.html Change-Id: I39301ff52d54d53131890c847e418799a91b83b8
This commit is contained in:
parent
b66fc78553
commit
dacd8088a4
@ -8,6 +8,12 @@ CollectMode=inactive-or-failed
|
|||||||
StartLimitIntervalSec=10s
|
StartLimitIntervalSec=10s
|
||||||
StartLimitBurst=30
|
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
|
BindsTo=dde-session-daemon.service
|
||||||
Before=dde-session-daemon.service
|
Before=dde-session-daemon.service
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include "dfile.h"
|
#include "dfile.h"
|
||||||
#include "basedir.h"
|
#include "basedir.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -96,10 +98,16 @@ bool DesktopInfo::isValidDesktop()
|
|||||||
return m_isValid;
|
return m_isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** if return true, item is shown
|
||||||
|
* @brief DesktopInfo::shouldShow
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
bool DesktopInfo::shouldShow()
|
bool DesktopInfo::shouldShow()
|
||||||
{
|
{
|
||||||
if (getNoDisplay() || getIsHidden())
|
if (getNoDisplay() || getIsHidden()) {
|
||||||
|
qDebug() << "hidden desktop file path: " << QString::fromStdString(m_fileName);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::string> desktopEnvs;
|
std::vector<std::string> desktopEnvs;
|
||||||
return getShowIn(desktopEnvs);
|
return getShowIn(desktopEnvs);
|
||||||
@ -117,6 +125,10 @@ bool DesktopInfo::getIsHidden()
|
|||||||
|
|
||||||
bool DesktopInfo::getShowIn(std::vector<std::string> desktopEnvs)
|
bool DesktopInfo::getShowIn(std::vector<std::string> desktopEnvs)
|
||||||
{
|
{
|
||||||
|
#ifdef QT_DEBUG
|
||||||
|
qDebug() << "desktop file path: " << QString::fromStdString(m_fileName);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (desktopEnvs.size() == 0) {
|
if (desktopEnvs.size() == 0) {
|
||||||
const char *env = getenv(envDesktopEnv.c_str());
|
const char *env = getenv(envDesktopEnv.c_str());
|
||||||
const auto &desktop = DString::splitChars(env, ':');
|
const auto &desktop = DString::splitChars(env, ':');
|
||||||
@ -127,14 +139,34 @@ bool DesktopInfo::getShowIn(std::vector<std::string> desktopEnvs)
|
|||||||
std::vector<std::string> onlyShowIn = m_keyFile.getStrList(MainSection, KeyOnlyShowIn);
|
std::vector<std::string> onlyShowIn = m_keyFile.getStrList(MainSection, KeyOnlyShowIn);
|
||||||
std::vector<std::string> notShowIn = m_keyFile.getStrList(MainSection, KeyNotShowIn);
|
std::vector<std::string> notShowIn = m_keyFile.getStrList(MainSection, KeyNotShowIn);
|
||||||
|
|
||||||
|
#ifdef QT_DEBUG
|
||||||
|
auto strVector2qstrVector = [](const std::vector<std::string> &vector) {
|
||||||
|
QVector<QString> 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) {
|
for (const auto &desktop : desktopEnvs) {
|
||||||
bool ret = std::any_of(onlyShowIn.begin(), onlyShowIn.end(),
|
bool ret = std::any_of(onlyShowIn.begin(), onlyShowIn.end(),
|
||||||
[&desktop](const auto &d) {return d == desktop;});
|
[&desktop](const auto &d) {return d == desktop;});
|
||||||
|
#ifdef QT_DEBUG
|
||||||
|
qInfo() << Q_FUNC_INFO << "onlyShowIn, result:" << ret;
|
||||||
|
#endif
|
||||||
if (ret)
|
if (ret)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
ret = std::any_of(notShowIn.begin(), notShowIn.end(),
|
ret = std::any_of(notShowIn.begin(), notShowIn.end(),
|
||||||
[&desktop](const auto &d) {return d == desktop;});
|
[&desktop](const auto &d) {return d == desktop;});
|
||||||
|
#ifdef QT_DEBUG
|
||||||
|
qInfo() << Q_FUNC_INFO << "notShowIn, result:" << ret;
|
||||||
|
#endif
|
||||||
if (ret)
|
if (ret)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -383,8 +415,10 @@ std::vector<DesktopInfo> AppsDir::getAllDesktopInfos()
|
|||||||
std::string filePath = dir + iter.first;
|
std::string filePath = dir + iter.first;
|
||||||
|
|
||||||
DesktopInfo desktopInfo(filePath);
|
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;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
desktopInfos.push_back(desktopInfo);
|
desktopInfos.push_back(desktopInfo);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user