Skip to content

Commit b73eff0

Browse files
committed
core/screen: add model and serial number properties
1 parent 6a017d6 commit b73eff0

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/core/qmlscreen.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,24 @@ QString QuickshellScreenInfo::name() const {
4242
return this->screen->name();
4343
}
4444

45+
QString QuickshellScreenInfo::model() const {
46+
if (this->screen == nullptr) {
47+
this->warnDangling();
48+
return "{ NULL SCREEN }";
49+
}
50+
51+
return this->screen->model();
52+
}
53+
54+
QString QuickshellScreenInfo::serialNumber() const {
55+
if (this->screen == nullptr) {
56+
this->warnDangling();
57+
return "{ NULL SCREEN }";
58+
}
59+
60+
return this->screen->serialNumber();
61+
}
62+
4563
qint32 QuickshellScreenInfo::x() const {
4664
if (this->screen == nullptr) {
4765
this->warnDangling();

src/core/qmlscreen.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ class QuickshellScreenInfo: public QObject {
2929
///
3030
/// Usually something like `DP-1`, `HDMI-1`, `eDP-1`.
3131
Q_PROPERTY(QString name READ name CONSTANT);
32+
/// The model of the screen as seen by the operating system.
33+
Q_PROPERTY(QString model READ model CONSTANT);
34+
/// The serial number of the screen as seen by the operating system.
35+
Q_PROPERTY(QString serialNumber READ serialNumber CONSTANT);
3236
Q_PROPERTY(qint32 x READ x NOTIFY geometryChanged);
3337
Q_PROPERTY(qint32 y READ y NOTIFY geometryChanged);
3438
Q_PROPERTY(qint32 width READ width NOTIFY geometryChanged);
@@ -49,6 +53,8 @@ class QuickshellScreenInfo: public QObject {
4953
bool operator==(QuickshellScreenInfo& other) const;
5054

5155
[[nodiscard]] QString name() const;
56+
[[nodiscard]] QString model() const;
57+
[[nodiscard]] QString serialNumber() const;
5258
[[nodiscard]] qint32 x() const;
5359
[[nodiscard]] qint32 y() const;
5460
[[nodiscard]] qint32 width() const;

0 commit comments

Comments
 (0)