jjsullivan5196 / wvkbd

On-screen keyboard for wlroots
GNU General Public License v3.0
286 stars 55 forks source link

Layouts with different sizes #80

Open magdesign opened 3 months ago

magdesign commented 3 months ago

I love this keyboard and its customisation capabilities!

However, for some vim style terminal apps like "toot tui" i'd like to create a small 50px one row NAV layout.

how would i add this codewhise to the according layout only? since following changes the size on all layouts

 static struct key keys_nav[] = {
KBD_PIXEL_HEIGHT 50
{my keys here}
};
magdesign commented 3 months ago

current workaround is to create a second keyboard which needs to be triggered manually....

2024-07-27-13:40:29

proycon commented 3 months ago

Currently a keyboard has a fixed height that applies to all layouts within it. Or actually, it has two fixed heights: one for portrait mode, one for landscape mode. Both can be set at runtime with -H or -L respectively.

But once in a certain orientation, the window size no longer changes. So regardless if your layout has two or five rows, they will be squished into the same height.

If you want a keyboard optimised for difference situations, like a two-row layout like you created, then creating a new keyboard is indeed the best solution.

proycon commented 3 months ago

I had actually considered this problem before. A possible solution would be to fix the row height instead of the total height and let the total height be computed dynamically based on that. I'm not sure if that would be preferable to having total control over the actual height like now, I guess it depends on the use case. Feel free to weigh in.

magdesign commented 3 months ago

if this extra calculations do not slow down the keyboard, this sounds like a great idea. so we would define once a fixed row height and the rest will be solved by the amount of lines.

magdesign commented 3 months ago

as longer i think about, i want to have this row height feature. how hard is this to integrate in main.c and where else?

proycon commented 3 months ago

On Sun Jul 28, 2024 at 9:26 AM CEST, magdesign wrote:

as longer i think about, i want to have this row height feature. how hard is this to integrate in main.c and where else?

I'm taking a look, the biggest challenge will be to resize the window on each layer switch (if needed). It's not exactly trivial with all the low-level wayland stuff.