diff --git a/src/video/cameradevice.cpp b/src/video/cameradevice.cpp index e0b8e676f..3d0ea2601 100644 --- a/src/video/cameradevice.cpp +++ b/src/video/cameradevice.cpp @@ -318,7 +318,17 @@ QVector> CameraDevice::getDeviceList() if (idesktopFormat) { if (idesktopFormat->name == QString("x11grab")) - devices.push_back(QPair{"x11grab#:0", QObject::tr("Desktop", "Desktop as a camera input for screen sharing")}); + { + QString dev = "x11grab#"; + QByteArray display = qgetenv("DISPLAY"); + + if (display.isNull()) + dev += ":0"; + else + dev += display.constData(); + + devices.push_back(QPair{dev, QObject::tr("Desktop", "Desktop as a camera input for screen sharing")}); + } if (idesktopFormat->name == QString("gdigrab")) devices.push_back(QPair{"gdigrab#desktop", QObject::tr("Desktop", "Desktop as a camera input for screen sharing")}); }