Fix window restoring on opening with Hyprland #481
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow-up PR for #478.
@zjeffer reported that #478 broke JMP on Hyprland, a Wayland tiling window manager. This PR is an attempt to fix this, and make sure #245 remains fixed.
In the previous PR, #245 was fixed by using the previous screen geometry rather than the previously saved window geometry when restoring the window geometry. The screen geometry would always be the full width/height of that monitor, e.g. 1920x1080.
In this PR, that change is reverted, so it will restore the previously saved geometry again.
In addition, it will now save the window geometry, regardless of whether the window is maximized or not.
Previously, the window geometry would not be saved if the window was maximized. It would just save that the window was maximized or not (not saving what monitor the window was on). This was the reason JMP would show up on a different monitor when exiting fullscreen.
For Hyprland specifically, I was able to see a similar issue as @zjeffer reported. For me, Waybar never appeared on top of JMP though, with the standard config for both Hyprland and Waybar.
I was not able to figure out the exact reason/conditions for problems with JMP on Hyprland, but I had success in reproducing the reported issue if the previous monitor was the most left one, and the window matched the full width/height. When that happened, it appeared as if Hyprland didn't attempt to resize the window. Maybe Hyprland thinks that it's meant to be fullscreen, and then doesn't try to resize? I'm not sure.
But some combination of the height, width, x and y of the window appeared to matter.
@zjeffer would you be able to test if this PR fixes the issue on Hyprland for you?