diff --git a/src/interfaces/window.cpp b/src/interfaces/window.cpp
index 477b74e..eba46db 100644
--- a/src/interfaces/window.cpp
+++ b/src/interfaces/window.cpp
@@ -8,6 +8,7 @@
 #include <layershellqt_logging.h>
 
 #include <QPointer>
+#include <optional>
 
 using namespace LayerShellQt;
 
@@ -26,7 +27,7 @@ public:
     Window::KeyboardInteractivity keyboardInteractivity = Window::KeyboardInteractivityExclusive;
     Window::Layer layer = Window::LayerTop;
     QMargins margins;
-    QPointer<QScreen> desiredOutput;
+    std::optional<QPointer<QScreen>> desiredOutput;
 };
 
 static QMap<QWindow *, Window *> s_map;
@@ -103,7 +104,7 @@ Window::Layer Window::layer() const
 
 QScreen *Window::desiredOutput() const
 {
-    return d->desiredOutput;
+    return d->desiredOutput.value_or(nullptr);
 }
 
 void Window::setDesiredOutput(QScreen *output)
@@ -111,6 +112,11 @@ void Window::setDesiredOutput(QScreen *output)
     d->desiredOutput = output;
 }
 
+bool Window::desiredOutputSet() const
+{
+    return d->desiredOutput.has_value();
+}
+
 Window::Window(QWindow *window)
     : QObject(window)
     , d(new WindowPrivate(window))
diff --git a/src/interfaces/window.h b/src/interfaces/window.h
index 5ebc9b1..81ff603 100644
--- a/src/interfaces/window.h
+++ b/src/interfaces/window.h
@@ -76,6 +76,7 @@ public:
      */
     void setDesiredOutput(QScreen *output);
     QScreen *desiredOutput() const;
+    bool desiredOutputSet() const;
 
     /**
      * Sets a string based identifier for this window.
diff --git a/src/qwaylandlayersurface.cpp b/src/qwaylandlayersurface.cpp
index dd17aa0..a355845 100644
--- a/src/qwaylandlayersurface.cpp
+++ b/src/qwaylandlayersurface.cpp
@@ -24,7 +24,7 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShell *shell, QtWaylandC
     Q_ASSERT(interface);
 
     wl_output *output = nullptr;
-    QScreen *screen = interface->desiredOutput();
+    QScreen *screen = interface->desiredOutputSet() ? interface->desiredOutput() : window->window()->screen();
     if (screen) {
         auto waylandScreen = dynamic_cast<QtWaylandClient::QWaylandScreen *>(screen->handle());
         // Qt will always assign a screen to a window, but if the compositor has no screens available a dummy QScreen object is created