diff --git a/screen/outputmodel.cpp b/screen/outputmodel.cpp index a647829..0abae99 100644 --- a/screen/outputmodel.cpp +++ b/screen/outputmodel.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -152,6 +153,15 @@ QVariant DisplayOutputModel::data(const QModelIndex &index, int role) const return e.physical.capabilities; case SupportedScalesRole: return QVariantList {1.0, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 4.0}; + case DrmConnectorRole: { + // Sysfs connector name, e.g. "card0-eDP-1". + const QFileInfo device(e.physical.devicePath); + if (!device.canonicalFilePath().startsWith(QLatin1String("/dev/dri/card")) + || e.physical.connectorName.isEmpty()) + return QString(); + return QFileInfo(device.canonicalFilePath()).fileName() + QLatin1Char('-') + + e.physical.connectorName; + } default: return {}; } @@ -313,7 +323,8 @@ QHash DisplayOutputModel::roleNames() const {ReplicasModelRole, "replicasModel"}, {IdRole, "displayId"}, {CapabilitiesRole, "capabilities"}, - {SupportedScalesRole, "supportedScales"}}; + {SupportedScalesRole, "supportedScales"}, + {DrmConnectorRole, "drmConnector"}}; } void DisplayOutputModel::setState(const DisplayClient::State &state) diff --git a/screen/outputmodel.h b/screen/outputmodel.h index 478e4b6..9025d0a 100644 --- a/screen/outputmodel.h +++ b/screen/outputmodel.h @@ -40,7 +40,8 @@ public: ReplicasModelRole, IdRole, CapabilitiesRole, - SupportedScalesRole + SupportedScalesRole, + DrmConnectorRole }; explicit DisplayOutputModel(QObject *parent = nullptr);