window: changing screen now recreates the window on the new screen

This commit is contained in:
outfoxxed 2024-03-09 04:47:40 -08:00
parent 31365dd179
commit 5f9bb9b46c
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
3 changed files with 10 additions and 2 deletions

@ -1 +1 @@
Subproject commit 9c83cc248c968b18a827b4fa4c616a8d362176e1 Subproject commit f76b43db25fb06a016ccf64ec2b28079c325c346

View file

@ -139,7 +139,12 @@ void ProxyWindowBase::setScreen(QuickshellScreenInfo* screen) {
if (this->window == nullptr) { if (this->window == nullptr) {
this->mScreen = qscreen; this->mScreen = qscreen;
emit this->screenChanged(); emit this->screenChanged();
} else this->window->setScreen(qscreen); } else {
auto reshow = this->window->isVisible();
if (reshow) this->window->setVisible(false);
this->window->setScreen(qscreen);
if (reshow) this->window->setVisible(true);
}
} }
void ProxyWindowBase::onScreenDestroyed() { this->mScreen = nullptr; } void ProxyWindowBase::onScreenDestroyed() { this->mScreen = nullptr; }

View file

@ -28,6 +28,9 @@ public:
/// See [Quickshell.screens] for an example of using `Variants` to create copies of a window per /// See [Quickshell.screens] for an example of using `Variants` to create copies of a window per
/// screen. /// screen.
/// ///
/// > [!WARNING] BUG: Variants currently fails to reload children if the variant set is changed as
/// > it is instantiated. (usually due to a mutation during variant creation)
///
/// [Quickshell.screens]: ../quickshell#prop.screens /// [Quickshell.screens]: ../quickshell#prop.screens
class Variants: public Reloadable { class Variants: public Reloadable {
Q_OBJECT; Q_OBJECT;