Skip to content
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

the center flag doesn't change behaviour at all on wayland via bemenu-wayland backend #223

Closed
ribosomerocker opened this issue Jan 23, 2022 · 9 comments

Comments

@ribosomerocker
Copy link

ribosomerocker commented Jan 23, 2022

I've been trying to see if bemenu could be used in center mode, but it seems like it is anything but easy currently;
ways of invoking it that i have been attempting are simply echo -n "1\n2\n3\n" | bemenu --center or using bemenu -c instead of bemenu --center (or just bemenu-run --center), but it does not make bemenu centered at all.

also, another issue i have seen that isnt fixed yet is that the --center option isn't in the manpage, only in the help response

bemenu version: 0.6.4
my distribution is Artix Linux

@Cloudef
Copy link
Owner

Cloudef commented Jan 24, 2022

The actual placement of the window is done by compositor. Bemenu only sets hints on wayland:

anchor |= ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM;

@ribosomerocker
Copy link
Author

huh, i see. i use the river compositor, so i assume that has something to do with this not functioning?

@Cloudef
Copy link
Owner

Cloudef commented Jan 24, 2022

Maybe, if I understood this code correctly https://github.com/riverwm/river/blob/c1d985ac2985b985aa8848490a0fab4fe8403dba/river/Output.zig#L338-L362 river does not handle the anchors as bitflags, but instead as a single value. So it will only work for single anchor at time.

@ifreund
Copy link

ifreund commented Jan 24, 2022

Hey, author of river here.

I see bemenu --center setting an anchor value of 13 in WAYLAND_DEBUG logs, which is left | top | right. It's not terribly explicit in the layer shell protocol xml how the compositor should handle this. I think placing the bar at the top of the screen and stretching it to the full with of the screen if the client request a 0 width value is reasonable, and what river currently does.

In order to get river to center the layer shell client vertically as I believe is desired here, the anchor should be set to left | right or 12 on the wire.

I just tested this using the wlroots layer shell example client and things seem to work as I intended them.

Let me know if you have any questions!

@Cloudef
Copy link
Owner

Cloudef commented Jan 24, 2022

Hmm, according to code here it should be setting all bits:

anchor |= ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM;

ping @llunacb @stacyharper

@ifreund
Copy link

ifreund commented Jan 25, 2022

@Cloudef my apologies, you're right and bemenu is eventually setting all 4 anchors if --set-anchor is passed, I wrongly assumed it would only make one set_anchor request instead of 3 and overlooked the following two requests. It currently makes two redundant set_anchor requests with a value of 13 before making the final one with all anchors set.

Anyhow, river should behave properly here as of this commit: riverwm/river@745fe82

@Cloudef
Copy link
Owner

Cloudef commented Jan 25, 2022

Not sure where those extraneous set_anchor calls come from, reading the code it seems to protect itself pretty well from setting same align twice. At most it should be doing 2 calls. That might be worth debugging.

@stacyharper
Copy link
Contributor

stacyharper commented Jan 25, 2022

btw: I fixed recently wlroots to ignore concurrent calls as set_anchor if the anchor already is what it got. So multiple calls can be ignored (if the anchors are the same ofc)

https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/8e566f716c464d886f1aed7e57b5bf26c3502426#a2d0a37683b2a7576f61a4c258827aefb459771d_129_136

@ribosomerocker
Copy link
Author

hello! I've tested the new river commit and it works perfectly! Thank you so much and I'm very sorry for submitting this issue to the wrong place!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants