Skip to content

Commit

Permalink
Save window geometry even when maximized, undo restoring window geome…
Browse files Browse the repository at this point in the history
…try from last screen to fix bug on Hyprland
  • Loading branch information
KrisVos130 committed Aug 27, 2023
1 parent 477ddc5 commit a4b6ce0
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/ui/KonvergoWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,12 @@ void KonvergoWindow::saveGeometry()

qDebug() << "Saving window geometry:" << rc;

if (visibility() == QWindow::Maximized)
{
SettingsComponent::Get().setValue(SETTINGS_SECTION_STATE, "maximized", true);
}
else if (visibility() != QWindow::Hidden)
if (visibility() != QWindow::Hidden)
{
QVariantMap map = {{"x", rc.x()}, {"y", rc.y()},
{"width", rc.width()}, {"height", rc.height()}};
SettingsComponent::Get().setValue(SETTINGS_SECTION_STATE, "geometry", map);
SettingsComponent::Get().setValue(SETTINGS_SECTION_STATE, "maximized", false);
SettingsComponent::Get().setValue(SETTINGS_SECTION_STATE, "maximized", visibility() == QWindow::Maximized);
}
QScreen *curScreen = screen();
SettingsComponent::Get().setValue(SETTINGS_SECTION_STATE, "lastUsedScreen", curScreen ? curScreen->name() : "");
Expand Down Expand Up @@ -226,9 +222,6 @@ QRect KonvergoWindow::loadGeometry()
}
else
{
if (myScreen)
nsize = myScreen->geometry();

setGeometry(nsize);
if (SettingsComponent::Get().value(SETTINGS_SECTION_STATE, "maximized").toBool())
setVisibility(QWindow::Maximized);
Expand Down

0 comments on commit a4b6ce0

Please sign in to comment.