[Wayland] Anchor top edge of menu to center#290
[Wayland] Anchor top edge of menu to center#290matt-allan wants to merge 1 commit intoCloudef:masterfrom
Conversation
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. 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.
|
Yes, please let us specify Y position as percentage, that would be awesome! :-) |
|
@Hilgenberg it fixes #289 for me because it prevents the top of the prompt from moving down the screen in the first place. If the top of the prompt doesn't move then it's repainted in the same place every time which avoids the duplicate prompt issue. I don't think it's a real fix for the underlying problem (which appears to be a race condition), but it prevents that bug from being 'activated' if that makes sense. |
|
I'm not using bemenu at the moment and won't be able to work on this any time soon. If someone wants to work off of this PR feel free! |
|
@Cloudef any updates on this? |
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
--centerand--list 100options: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:
--listmode 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_topproperty 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.