[Wayland] Anchor top edge of menu to center #290
Draft
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.
Anchor only the top edge of the menu to the center when --center mode is used instead of centering the entire menu. This
prevents the menu from bouncing around as the list is shortened. The issue this fixes is described in this comment: #194 (comment)
For this to work we only anchor to the top instead of the top and the bottom and set a top margin equal to half of the display width.
The max height of the menu also needs to be halved to prevent drawing a menu that overflows the bottom edge of the screen.
Also fixes #289.
This is what it looks like on the main branch when you combine the
--center
and--list 100
options:It's not really centered anymore because the list was so tall it pushed it to the top of the screen.
When the list is filtered bemenu moves down the screen because it gets shorter, causing the absolute center to move:
With this patch the top edge of the list is centered, and not the entire list:
\
Open questions:
--list
mode it still works fine, but the 'center' is going to be just slightly further down own the page. We could only apply this fix for list mode to avoid that but it will make things a bit more complex. Any preference there?margin_top
property on the window when it's first created but that didn't work since the alignment isn't set yet and we need to know that to determine the margin.