Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
StatusNotifierItem.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <PhosphorServices/phosphorservices_export.h>
7
8#include <QImage>
9#include <QObject>
10#include <QString>
11
12#include <memory>
13
14namespace PhosphorServices {
15
20class PHOSPHORSERVICES_EXPORT StatusNotifierItem : public QObject
21{
22 Q_OBJECT
23 Q_DISABLE_COPY_MOVE(StatusNotifierItem)
24 Q_PROPERTY(QString id READ id NOTIFY idChanged)
25 Q_PROPERTY(QString title READ title NOTIFY titleChanged)
26 Q_PROPERTY(QString category READ category NOTIFY categoryChanged)
27 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
28 Q_PROPERTY(QImage iconImage READ iconImage NOTIFY iconChanged)
29 Q_PROPERTY(QImage overlayIconImage READ overlayIconImage NOTIFY iconChanged)
30 Q_PROPERTY(QImage attentionIconImage READ attentionIconImage NOTIFY iconChanged)
31 Q_PROPERTY(QString toolTipTitle READ toolTipTitle NOTIFY toolTipChanged)
32 Q_PROPERTY(QString toolTipBody READ toolTipBody NOTIFY toolTipChanged)
33 Q_PROPERTY(QString menuPath READ menuPath NOTIFY menuPathChanged)
34 Q_PROPERTY(bool itemIsMenu READ itemIsMenu NOTIFY menuPathChanged)
35 Q_PROPERTY(QString dbusService READ dbusService CONSTANT)
36 Q_PROPERTY(QString dbusPath READ dbusPath CONSTANT)
37 Q_PROPERTY(bool isValid READ isValid NOTIFY validChanged)
38
39public:
40 enum class Status {
41 Passive,
42 Active,
43 NeedsAttention
44 };
45 Q_ENUM(Status)
46
47
50 StatusNotifierItem(const QString& dbusService, const QString& dbusPath, QObject* parent = nullptr);
51 ~StatusNotifierItem() override;
52
53 [[nodiscard]] QString id() const;
54 [[nodiscard]] QString title() const;
55 [[nodiscard]] QString category() const;
56 [[nodiscard]] Status status() const;
57 [[nodiscard]] QImage iconImage() const;
58 [[nodiscard]] QImage overlayIconImage() const;
59 [[nodiscard]] QImage attentionIconImage() const;
60 [[nodiscard]] QString toolTipTitle() const;
61 [[nodiscard]] QString toolTipBody() const;
62 [[nodiscard]] QString menuPath() const;
63 [[nodiscard]] bool itemIsMenu() const;
64 [[nodiscard]] QString dbusService() const;
65 [[nodiscard]] QString dbusPath() const;
66 [[nodiscard]] bool isValid() const;
67
72 void setPreferredIconSize(int size);
73 [[nodiscard]] int preferredIconSize() const;
74
75public Q_SLOTS:
76 void activate(int x, int y);
77 void secondaryActivate(int x, int y);
78 void contextMenu(int x, int y);
79 void scroll(int delta, const QString& orientation);
80
81Q_SIGNALS:
82 void idChanged();
83 void titleChanged();
84 void categoryChanged();
85 void statusChanged();
86 void iconChanged();
87 void toolTipChanged();
88 void menuPathChanged();
89 void validChanged();
90
91private:
92 class Private;
93 std::unique_ptr<Private> d;
94};
95
96} // namespace PhosphorServices
One system-tray item.
Definition StatusNotifierItem.h:21
Status
Definition StatusNotifierItem.h:40
Definition DBusMenuModel.h:15