Remembers window position after quit#8601
Conversation
|
It's not that simple, this can for example lead to the window being It definitely needs to be behind a default off option and if we are |
|
@kovidgoyal it works for Rectangle for macos but I don't know about Wayland. Perhaps I could make the x and y values offsets of the screen resolution? |
|
@kovidgoyal I just tested it with different resolutions on macos and nothing appears off-screen. I think glfw accounts for off-screen positioning when making windows. Let me know. |
|
You need to store the monitor geometry and the window position. On Cocoa This behavior needs to be made optional, defaulting to off, the default There needs to be a --position CLI flag added to kitty and all this |
|
@kovidgoyal I just pushed a working version of what you described. Thanks! |
|
OK I'll review when I have a moment |
|
You need to store all available monitor geometries not just the primary one (the os window being closed could be on any monitor not necessarily the primary one), and then in the restore code check that the geometries are unchanged and only then restore, otherwise let the window manager decide where to place the window. Use glfwGetMonitors, glfwGetMonitorPos and glfwGetMonitorWorkarea and glfwgetmonitorphysicalsize. Store all that data in the cache and when restoring use it to decide whether to restore or abort or move and restore. |
|
Got it, thanks. |
|
@kovidgoyal It now only restores if the monitor workarea is the exact same. Also, <pyerrors.h> was throwing undefined function errors, so I fixed it by importing <Python.h> in glfw.c. Let me know! |
|
@kovidgoyal It seems my pull request changed some of the formatting of the code. I'll fix that right now |
|
@kovidgoyal Working version is here. Sorry about the confusion. |
|
Please fix the CI failures |
|
I think it was because of including Python.h in kitty/glfw.c |
|
@kovidgoyal should be working now |
Adds a cache partition to remember the window position after quitting. Solves #1119