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

Keymap key display improvements #17

Open
petejohanson opened this issue Sep 6, 2024 · 7 comments
Open

Keymap key display improvements #17

petejohanson opened this issue Sep 6, 2024 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@petejohanson
Copy link
Collaborator

Currently, ZMK Studio doesn't incorporate the fetched behavior metadata to influence the rendering of each key in the keymap display, and just attempts to map any passed first binding parameter as a HID usage.

Ideally, we should leverage the behavior metadata to make attempts at rendering things differently, e.g. behaviors with no parameters we might be able to report a suggested "icon" from the backend and render that on the keys, bluetooth behavior with multiple parameters could show different icon for each first param (select vs clear) and render the second profile index as a number next to the icon?

Lots to explore how to try to do this both nicely and generically for pluggable behaviors.

@petejohanson petejohanson added enhancement New feature or request help wanted Extra attention is needed labels Sep 6, 2024
@xingrz
Copy link

xingrz commented Sep 14, 2024

I think, instead of providing display_name and icons for built-in behaviors, I would prefer to provide a neutral and unique ID, such as "zmk,behavior-key-press" instead of "Key Press", or "zmk,behavior-bluetooth/select-profile" instead of "Select Profile". The Studio frontend could then decide entirely how to display them, whether as text, icons, or otherwise. This approach would also make it easier to implement i18n in the future.

@petejohanson
Copy link
Collaborator Author

I think, instead of providing display_name and icons for built-in behaviors, I would prefer to provide a neutral and unique ID, such as "zmk,behavior-key-press" instead of "Key Press", or "zmk,behavior-bluetooth/select-profile" instead of "Select Profile". The Studio frontend could then decide entirely how to display them, whether as text, icons, or otherwise. This approach would also make it easier to implement i18n in the future.

This breaks the requirement that the frontend have no specific knowledge of the set of possible behaviors. We need to support folks building with third party/custom behaviors that aren't in ZMK main. That's the main reason we use the behavior metadata approach.

@xingrz
Copy link

xingrz commented Sep 14, 2024

Thanks for the explanation!

@krikun98
Copy link

krikun98 commented Oct 3, 2024

Shifted keypresses should probably display the shifted symbol ($ for LS(4) and etc.).

@petejohanson
Copy link
Collaborator Author

Shifted keypresses should probably display the shifted symbol ($ for LS(4) and etc.).

That is also planned, but will need host layout info to display properly

@mknj
Copy link

mknj commented Nov 11, 2024

I took a look at the code and the storybook integration is really nice.
Then i tried to modify the keyboard and realised that adding features is really hard as keyboard and HidUsageLabel are tightly coupled.

How about moving the text calculation out of the keyboard and have the keyboard Component simply render the given text and headers?

In principle it would replace the children property with a centerLabel property. Later it could be extended by bottom, left and right labels like in KLE.

I think this would make the visual keyboard easier to maintain and experiment with.

btw.
This is my keyboard rendered in kle
image

and this is the 3rd layer in zmk-studio, which totally makes no sense as most of these keys are acutally shifted

image

@mhantsch
Copy link

but will need host layout info to display properly

Why not start with an assumption of US-QWERTY as they are configured today with that mapping anyway. All the scancodes mapped in ZMK config files are based on US-QWERTY.

Support for other locales can come at a later stage. The remapping would then affect not only the display of the keys but also the scancode assignment (e.g. for Keypress behaviour).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants