Open damanis opened 2 years ago
Seems, --geometry can be used, but still need the option to disable save/restore geometry.
It is not clear to me, what is the ask or feature request here?
Are you asking for a --start-position
argument?
The --geometry
option allows the user to specify the windows size. That can be used to indirectly set the number of lines/columns. Why would you need to set lines/columns explicitly?
Adding a lines/coluns option seems like additional complexity without much benefit.
Currently, there is no way to disable saveGeometry
. That does seem like a good feature to add...
@jgehrig
It is feature request.
I didn't asked --start-position
option, but vise versa, I requested a parameter to make save/load geometry optional.
(I just commented out relevant code and build neovim-qt locally.)
The neovim-qt uses --geometry
parameter to set windows size. But loadGeometry also places the window on saved position - as a result all neovim-qt windows open one on top of the other.
In my opinion, window position should be defined by window manager, not by application itself (or be optionally).
P.S. Vim and neovim provide way to set lines and columns in init file. Classic gvim uses them to calculate window size; --geometry
is not needed. Seems, neovim GUI can get these parameters from neovim during start.
@equalsraf @jgehrig This small patch prevent save and restore main window geometry via nvim-qt.conf. Could you add it to neovim-qt?
[General]
save_window_position=false
diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp
index a9a7178..4618978 100644
--- a/src/gui/mainwindow.cpp
+++ b/src/gui/mainwindow.cpp
@@ -299,7 +299,10 @@ Shell* MainWindow::shell()
void MainWindow::saveWindowGeometry()
{
QSettings settings{ "window-geometry" };
- settings.setValue("window_geometry", saveGeometry());
+ QSettings winpos;
+
+ if (winpos.value("save_window_position").toBool())
+ settings.setValue("window_geometry", saveGeometry());
settings.setValue("window_state", saveState());
}
@@ -310,7 +313,9 @@ void MainWindow::restoreWindowGeometry()
qRegisterMetaTypeStreamOperators<QList<int> >("QList<int>");
QSettings settings{ "window-geometry" };
- restoreGeometry(settings.value("window_geometry").toByteArray());
+ QSettings winpos;
+ if (winpos.value("save_window_position").toBool())
+ restoreGeometry(settings.value("window_geometry").toByteArray());
restoreState(settings.value("window_state").toByteArray());
So if I am getting this correctly, the feature request is to have a way to prevent window geometry from being saved at all? Or (perhaps AND here) to have an option to ignore the saved geometry and skip restoreGeometry()
at startup?.
Is it not enough to use the second chunk of the patch that skips restoreGeometry? or am I missing something.
QSettings winpos;
probably needs adjustment to something like QSettings settings("nvim-qt", "window-geometry");
The requested feature — do not restore saved geometry at startup. I.e., calculate width and height of window by lines, columns and font metrics and let window manager place the created window. Seems, there is no reason save geometry in this case, but it will not take effect. I'm not sure where the option should be configured.
The provided patch I used to compile neovim-qt manually.
is it fixed with these latest commits? https://github.com/equalsraf/neovim-qt/commit/ef1bec676b2f36fdb622ac9cab2544f2706707e9
The QT's saveGeometry() works properly, but it saves both dimensions and position. The result restoreGeomentry() always opens window at same position. The option to calculate dimensions by lines and columns, configured in nvim, and give to Window Manager to set window position should be useful.