@@ -13,11 +13,11 @@ Q_NAMESPACE;
1313QML_ELEMENT;
1414
1515enum Enum {
16- // A passive item does not convey important information and can be considered idle. You may want to hide these.
16+ // / A passive item does not convey important information and can be considered idle. You may want to hide these.
1717 Passive = 0 ,
18- // An active item may have information more important than a passive one and you probably do not want to hide it.
18+ // / An active item may have information more important than a passive one and you probably do not want to hide it.
1919 Active = 1 ,
20- // An item that needs attention conveys very important information such as low battery.
20+ // / An item that needs attention conveys very important information such as low battery.
2121 NeedsAttention = 2 ,
2222};
2323Q_ENUM_NS (Enum);
@@ -29,12 +29,12 @@ Q_NAMESPACE;
2929QML_ELEMENT;
3030
3131enum Enum {
32- // The fallback category for general applications or anything that does
33- // not fit into a different category.
32+ // / The fallback category for general applications or anything that does
33+ // / not fit into a different category.
3434 ApplicationStatus = 0 ,
35- // System services such as IMEs or disk indexing.
35+ // / System services such as IMEs or disk indexing.
3636 SystemServices = 1 ,
37- // Hardware controls like battery indicators or volume control.
37+ // / Hardware controls like battery indicators or volume control.
3838 Hardware = 2 ,
3939};
4040Q_ENUM_NS (Enum);
@@ -47,33 +47,36 @@ Q_ENUM_NS(Enum);
4747// /
4848// / [kde/freedesktop spec]: https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem/
4949class SystemTrayItem : public QObject {
50+ using DBusMenuItem = qs::dbus::dbusmenu::DBusMenuItem;
51+
5052 Q_OBJECT;
51- // A name unique to the application, such as its name.
53+ // / A name unique to the application, such as its name.
5254 Q_PROPERTY (QString id READ id NOTIFY idChanged);
53- // A name that describes the application
55+ // / Text that describes the application.
5456 Q_PROPERTY (QString title READ title NOTIFY titleChanged);
5557 Q_PROPERTY (SystemTrayStatus::Enum status READ status NOTIFY statusChanged);
5658 Q_PROPERTY (SystemTrayCategory::Enum category READ category NOTIFY categoryChanged);
57- // Icon source string, usable as an Image source.
59+ // / Icon source string, usable as an Image source.
5860 Q_PROPERTY (QString icon READ icon NOTIFY iconChanged);
5961 Q_PROPERTY (QString tooltipTitle READ tooltipTitle NOTIFY tooltipTitleChanged);
6062 Q_PROPERTY (QString tooltipDescription READ tooltipDescription NOTIFY tooltipDescriptionChanged);
61- Q_PROPERTY (qs::dbus::dbusmenu::DBusMenuItem* menu READ menu NOTIFY menuChanged);
62- // If this tray item only offers a menu and no activation action.
63+ // The context menu provided by the application, generally displayed via a right click.
64+ Q_PROPERTY (DBusMenuItem* menu READ menu NOTIFY menuChanged);
65+ // / If this tray item only offers a menu and activation will do nothing.
6366 Q_PROPERTY (bool onlyMenu READ onlyMenu NOTIFY onlyMenuChanged);
6467 QML_ELEMENT;
6568 QML_UNCREATABLE (" SystemTrayItems can only be acquired from SystemTray" );
6669
6770public:
6871 explicit SystemTrayItem (qs::service::sni::StatusNotifierItem* item, QObject* parent = nullptr );
6972
70- // Primary activation action, generally triggered via a left click.
73+ // / Primary activation action, generally triggered via a left click.
7174 Q_INVOKABLE void activate ();
7275
73- // Secondary activation action, generally triggered via a middle click.
76+ // / Secondary activation action, generally triggered via a middle click.
7477 Q_INVOKABLE void secondaryActivate ();
7578
76- // Scroll action, such as changing volume on a mixer.
79+ // / Scroll action, such as changing volume on a mixer.
7780 Q_INVOKABLE void scroll (qint32 delta, bool horizontal);
7881
7982 [[nodiscard]] QString id () const ;
@@ -83,7 +86,7 @@ class SystemTrayItem: public QObject {
8386 [[nodiscard]] QString icon () const ;
8487 [[nodiscard]] QString tooltipTitle () const ;
8588 [[nodiscard]] QString tooltipDescription () const ;
86- [[nodiscard]] qs::dbus::dbusmenu:: DBusMenuItem* menu () const ;
89+ [[nodiscard]] DBusMenuItem* menu () const ;
8790 [[nodiscard]] bool onlyMenu () const ;
8891
8992signals:
@@ -107,8 +110,13 @@ private slots:
107110 friend class SystemTray ;
108111};
109112
113+ // /! System tray
114+ // / Referencing the SystemTray singleton will make quickshell start tracking
115+ // / system tray contents, which are updated as the tray changes, and can be
116+ // / accessed via the `items` property.
110117class SystemTray : public QObject {
111118 Q_OBJECT;
119+ // / List of all system tray icons.
112120 Q_PROPERTY (QQmlListProperty<SystemTrayItem> items READ items NOTIFY itemsChanged);
113121 QML_ELEMENT;
114122 QML_SINGLETON;
0 commit comments