@@ -22,6 +22,9 @@ class DesktopEntry: public QObject {
22
22
Q_PROPERTY (QString name MEMBER mName CONSTANT);
23
23
// / Short description of the application, such as "Web Browser". May be empty.
24
24
Q_PROPERTY (QString genericName MEMBER mGenericName CONSTANT);
25
+ // / Initial class or app id the app intends to use. May be useful for matching running apps
26
+ // / to desktop entries.
27
+ Q_PROPERTY (QString startupClass MEMBER mStartupClass CONSTANT);
25
28
// / If true, this application should not be displayed in menus and launchers.
26
29
Q_PROPERTY (bool noDisplay MEMBER mNoDisplay CONSTANT);
27
30
// / Long description of the application, such as "View websites on the internet". May be empty.
@@ -81,6 +84,7 @@ class DesktopEntry: public QObject {
81
84
QString mId ;
82
85
QString mName ;
83
86
QString mGenericName ;
87
+ QString mStartupClass ;
84
88
bool mNoDisplay = false ;
85
89
QString mComment ;
86
90
QString mIcon ;
@@ -151,6 +155,7 @@ class DesktopEntryManager: public QObject {
151
155
void scanDesktopEntries ();
152
156
153
157
[[nodiscard]] DesktopEntry* byId (const QString& id);
158
+ [[nodiscard]] DesktopEntry* heuristicLookup (const QString& name);
154
159
155
160
[[nodiscard]] ObjectModel<DesktopEntry>* applications ();
156
161
@@ -186,7 +191,14 @@ class DesktopEntries: public QObject {
186
191
explicit DesktopEntries ();
187
192
188
193
// / Look up a desktop entry by name. Includes NoDisplay entries. May return null.
194
+ // /
195
+ // / While this function requires an exact match, @@heuristicLookup() will correctly
196
+ // / find an entry more often and is generally more useful.
189
197
Q_INVOKABLE [[nodiscard]] static DesktopEntry* byId (const QString& id);
198
+ // / Look up a desktop entry by name using heuristics. Unline @@byId(),
199
+ // / if no exact matches are found this function will try to guess - potentially incorrectly.
200
+ // / May return null.
201
+ Q_INVOKABLE [[nodiscard]] static DesktopEntry* heuristicLookup (const QString& name);
190
202
191
203
[[nodiscard]] static ObjectModel<DesktopEntry>* applications ();
192
204
};
0 commit comments