Skip to content

Commit

Permalink
core/screen: add model and serial number properties
Browse files Browse the repository at this point in the history
  • Loading branch information
outfoxxed committed Jan 23, 2025
1 parent 6a017d6 commit b73eff0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/core/qmlscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ QString QuickshellScreenInfo::name() const {
return this->screen->name();
}

QString QuickshellScreenInfo::model() const {
if (this->screen == nullptr) {
this->warnDangling();
return "{ NULL SCREEN }";
}

return this->screen->model();
}

QString QuickshellScreenInfo::serialNumber() const {
if (this->screen == nullptr) {
this->warnDangling();
return "{ NULL SCREEN }";
}

return this->screen->serialNumber();
}

qint32 QuickshellScreenInfo::x() const {
if (this->screen == nullptr) {
this->warnDangling();
Expand Down
6 changes: 6 additions & 0 deletions src/core/qmlscreen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class QuickshellScreenInfo: public QObject {
///
/// Usually something like `DP-1`, `HDMI-1`, `eDP-1`.
Q_PROPERTY(QString name READ name CONSTANT);
/// The model of the screen as seen by the operating system.
Q_PROPERTY(QString model READ model CONSTANT);
/// The serial number of the screen as seen by the operating system.
Q_PROPERTY(QString serialNumber READ serialNumber CONSTANT);
Q_PROPERTY(qint32 x READ x NOTIFY geometryChanged);
Q_PROPERTY(qint32 y READ y NOTIFY geometryChanged);
Q_PROPERTY(qint32 width READ width NOTIFY geometryChanged);
Expand All @@ -49,6 +53,8 @@ class QuickshellScreenInfo: public QObject {
bool operator==(QuickshellScreenInfo& other) const;

[[nodiscard]] QString name() const;
[[nodiscard]] QString model() const;
[[nodiscard]] QString serialNumber() const;
[[nodiscard]] qint32 x() const;
[[nodiscard]] qint32 y() const;
[[nodiscard]] qint32 width() const;
Expand Down

0 comments on commit b73eff0

Please sign in to comment.