Skip to content

Commit

Permalink
settings: store window geometry in ~/.config/nvim-qt/window_geometry.…
Browse files Browse the repository at this point in the history
…conf

The single-argument QSettings constructor sets the organization name.
nvim-qt is passing "window-geometry" as the organization name, which
results in QSettings using `~/.config/window-geometry.conf`.
This is undesirable because the file is written to the root of
`~/.config` without any indication about which application created
or uses the file.

Set the organization name to "nvim-qt" when writing window geometry
so that `~/.config/nvim-qt/window-geometry.conf` is used instead.
  • Loading branch information
davvid authored and equalsraf committed Feb 6, 2024
1 parent f5c95b1 commit 31ddd19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ Shell* MainWindow::shell()

void MainWindow::saveWindowGeometry()
{
QSettings settings{ "window-geometry" };
QSettings settings("nvim-qt", "window-geometry");
settings.setValue("window_geometry", saveGeometry());
settings.setValue("window_state", saveState());
}
Expand All @@ -324,7 +324,7 @@ void MainWindow::restoreWindowGeometry()
qRegisterMetaTypeStreamOperators<QList<int>>("QList<int>");
#endif

QSettings settings{ "window-geometry" };
QSettings settings("nvim-qt", "window-geometry");
restoreGeometry(settings.value("window_geometry").toByteArray());
restoreState(settings.value("window_state").toByteArray());
}
Expand Down

2 comments on commit 31ddd19

@damanis
Copy link

@damanis damanis commented on 31ddd19 Feb 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@equalsraf @davvid
I know, it does not relate to this commit, but it relates to the window-geometry feature.
Might you consider including the patch from 997 in the neovim-qt?

@davvid
Copy link
Contributor Author

@davvid davvid commented on 31ddd19 Feb 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@damanis I updated your patch so that it only affects the restoration logic and submitted a new PR: #1096

cheers!

Please sign in to comment.