-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set a default size on first launch #1100
Conversation
7ec3ee4
to
4e638d7
Compare
This looks closely related to #1096. Let's apply these changes in a single PR over there. Also the hard-coded size concerns me, it might not be the best size for all platforms. A few comments:
If we really do need this feature think this feature is necessary, it should likely be an optional setting in |
Sounds good. I'll revisit this after working through #1096 since it's touching the same part of the code.
When I first wrote this patch I was in a temp branch where I had the 1096 changes in effect and it didn't make a difference. I'm going to re-test just to be sure.
I can understand that. There's also a part of me that thinks that it's 2024 and the vast majority of users will be just fine with that value, but I agree that we can do better. This will typically only come into effect on the very first run (e.g. if you Here's an idea.. we could query the screen size using QScreen https://doc.qt.io/qt-5/qscreen.html (I would suggest QDesktopWidget but it's deprecated and removed in Qt6) and then clamp the initial size to the screen size. Alternatively, instead of clamping, we could just set the size to be the same as the screen size (effectively making the UI take the full screen) or some portion of it (e.g. half width of the screen). Let me know what you think. I'll get back to #1096 now and get that into shape for merging. |
Here's what I landed on.
I'm testing on Gnome/Wayland. I suspect that the "tiny initial screen size" issue is seen on other platforms as well, so this should be sensible behavior on all platforms. Most users will not change defaults. What they'll get is the initial size that we're setting here and then whatever size and position they set manually will be preserved, so there's probably few users who won't want the default size. If users don't like the default size they can always use the (enabled-by-default) behavior where we restore window geometry. I hope we don't need another QSettings entry because the Let me know what you think. Hopefully this is a nice approach. |
This PR extends #1096 so I'll rebase this after that topic is resolved. Only a single commit will remain in this branch post-rebase. |
d7cd261
to
bf2cce2
Compare
Everything looks good! A few small comments added. Sorry to be nit-picky :) I like the high-level approach and this looks Qt6 compatible (if I'm reading the Qt docs correctly). However, I think we should make one behavior change regarding this:
I suspect the users who want the geometry restore off, will also NOT want us poking the window size. Let's make it so when Some window managers provide a reasonable default size or do their own size restoration. Also, tiling window managers force a window size. Here is an example Issue: #679 |
Thanks for the explanation and review ~ not nitpicky at all. I've consted this up and re-pushed. While we can't make |
f602849
to
1476b87
Compare
@davvid Sorry for the long delay -- I was away from my computer. Two small comments -- The approach looks great to me, let's get this merged! |
When `~/.config/nvim-qt/window-geometry.conf` does not exist then restoreGeometry() will initialize a window that is tiny and must be resized in order to be usable in some environments. Resize the window to half the screen when launched for the first time. Do not restore window state when it is invalid or missing.
Good stuff, thanks for the re-review. This should be good to go now. |
When
~/.config/nvim-qt/window-geometry.conf
does not exist thenrestoreGeometry() will initialize a window that is tiny and must be
resized in order to be usable in some environments.
Resize the window to half the screen when launched for the first time.
Do not restore window state when it is invalid or missing.