Cloudef / bemenu

Dynamic menu library and client program inspired by dmenu
GNU General Public License v3.0
1.21k stars 94 forks source link

add configurable position and size #65

Open Soundtoxin opened 5 years ago

Soundtoxin commented 5 years ago

Are there any plans to allow for the bar to be less wide (to avoid covering the clock, for example), and/or to move the whole bar to the middle of the screen? A bit like rofi or an i3 scratchpad window. There's a patch[1] that add these things to dmenu. [1] https://tools.suckless.org/dmenu/patches/xyw/

Cloudef commented 4 years ago

It's possible at least on X11, on Wayland this feature depends on the protocol.

Leon-Plickat commented 4 years ago

Wayland

A good solution could be to create a surface covering the entire output. Now the visible menu can be positioned where-ever you want and sized however you like. With wl_surface_set_input_region(), you can configure the surface to only receive input events (mouse, touch, etc) on the visible menu.

A command flag like --dimensions <x> <y> <w> <h> could be used (which should accept both pixel values and percentages).

Additionally, this could also enable such things as darken the rest of the screen while the menu is visible.

The major problem I see with this approach is, that the '-n' option likely would have to be removed, since to guarantee a consistent placement, the surface would need to be anchored to all four edges and remain stationary by having an exclusive zone of -1.

Cloudef commented 4 years ago

Another con with that is increase in memory usage. But sure that's one way to go around this as well.

Leon-Plickat commented 4 years ago

Another con with that is increase in memory usage.

Not necessarily. If I am not mistaken, you could have a large wl_surface that spans the entire output, while the actual memory buffer is smaller. When attaching the buffer to the surface with wl_surface_attach(), an offset in x and y can be provided to position where on the surface the buffer will be drawn by the compositor.