Skip to content

Commit

Permalink
mainwindow: add an option to avoid restoring window geometry
Browse files Browse the repository at this point in the history
Avoid restoring window geometry when `restore_window_geometry=false`
in `~/.config/nvim-qt/window-geometry.conf`. Defaults to `true`.

Suggested-by: @damanis on github
Related-to: equalsraf#997
Related-to: equalsraf#1094
  • Loading branch information
davvid committed Feb 11, 2024
1 parent efb9619 commit 5769511
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ Shell* MainWindow::shell()
void MainWindow::saveWindowGeometry()
{
QSettings settings("nvim-qt", "window-geometry");
bool restore_window_geometry = settings.value("restore_window_geometry", true).toBool();
settings.setValue("restore_window_geometry", restore_window_geometry);
settings.setValue("window_geometry", saveGeometry());
settings.setValue("window_state", saveState());
}
Expand All @@ -325,7 +327,9 @@ void MainWindow::restoreWindowGeometry()
#endif

QSettings settings("nvim-qt", "window-geometry");
restoreGeometry(settings.value("window_geometry").toByteArray());
if (settings.value("restore_window_geometry", true).toBool()) {
restoreGeometry(settings.value("window_geometry").toByteArray());
}
restoreState(settings.value("window_state").toByteArray());
}

Expand Down

0 comments on commit 5769511

Please sign in to comment.