From 5769511b196dc73d68d31956893b511b575e8914 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sat, 10 Feb 2024 16:26:53 -0800 Subject: [PATCH] mainwindow: add an option to avoid restoring window geometry 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: #997 Related-to: #1094 --- src/gui/mainwindow.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 7892e2b5a..ff7ec257d 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -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()); } @@ -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()); }