feat: add startupwmclass prop export

log: as title
This commit is contained in:
Tsic Liu 2024-09-03 19:10:20 +08:00 committed by Comix
parent 5b99e9e4b9
commit 230636f2e1
3 changed files with 19 additions and 0 deletions

View File

@ -117,6 +117,14 @@
<annotation name="org.qtproject.QtDBus.QtTypeName" value="QStringMap"/>
</property>
<property name="StartupWMClass" type="s" access="read">
<annotation
name="org.freedesktop.DBus.Description"
value="The meaning of this property's type is same as which in StartupWMClass."
/>
<annotation name="org.qtproject.QtDBus.QtTypeName" value="QStringMap"/>
</property>
<method name="Launch">
<arg type="s" name="action" direction="in" />
<arg type="as" name="fields" direction="in" />

View File

@ -559,6 +559,12 @@ bool ApplicationService::terminal() const noexcept
return false;
}
QString ApplicationService::startupWMClass() const noexcept
{
auto value = findEntryValue(DesktopFileEntryKey, "StartupWMClass", EntryValueType::String);
return value.isNull() ? QString{} : value.toString();
}
qint64 ApplicationService::installedTime() const noexcept
{
return m_installedTime;
@ -894,6 +900,7 @@ void ApplicationService::resetEntry(DesktopEntry *newEntry) noexcept
emit terminalChanged();
emit environChanged();
emit launchedTimesChanged();
emit startupWMClassChanged();
}
std::optional<QStringList> ApplicationService::unescapeExecArgs(const QString &str) noexcept

View File

@ -74,6 +74,9 @@ public:
Q_PROPERTY(bool Terminal READ terminal NOTIFY terminalChanged)
[[nodiscard]] bool terminal() const noexcept;
Q_PROPERTY(QString StartupWMClass READ startupWMClass NOTIFY startupWMClassChanged)
[[nodiscard]] QString startupWMClass() const noexcept;
// FIXME:
// This property should implement with fuse guarded
// $XDG_CONFIG_HOME/autostart/. Current implementation has some problems,
@ -163,6 +166,7 @@ Q_SIGNALS:
void terminalChanged();
void environChanged();
void launchedTimesChanged();
void startupWMClassChanged();
private:
friend class ApplicationManager1Service;