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
Do not save or restore window geometry when `restore_window_geometry=false`
in `~/.config/nvim-qt/window-geometry.conf`. Defaults to `true`.

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

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

0 comments on commit 307ab43

Please sign in to comment.