Unexpected-Keyboard icon indicating copy to clipboard operation
Unexpected-Keyboard copied to clipboard

How to add ctrl+b (tmux prefix) in custom layout?

Open qw457812 opened this issue 1 year ago • 3 comments

Hello, Thanks for the great keyboard, how can I add combination keys (modifiers + regular key) in custom layout like <key key0="ctrl+b"/> (and display as "tmux")?

qw457812 avatar Feb 21 '24 08:02 qw457812

That's a reasonable request. The quoted string can include multiple keystrokes (without +) but I don't know of a way to specify modified characters. As for the legend, @Julow has said he wants to keep layout separate from appearance, suggesting that if he provides this feature, it would not be with new syntax in the layout file.

Spike-from-NH avatar Feb 21 '24 12:02 Spike-from-NH

This is a good idea! A key is currently represented as an object with two fields: https://github.com/Julow/Unexpected-Keyboard/blob/master/srcs/juloo.keyboard2/KeyValue.java#L130-L133, which makes a 3 words object. Adding anything to this object will add a word to it. This is not a bad deal but we must make sure not to add too much and it might requires some wider changes.

As for the legend, @Julow has said he wants to keep layout separate from appearance, suggesting that if he provides this feature, it would not be with new syntax in the layout file.

You are mixing appearance of symbols (which is a property of the symbol) and appearance of the keyboard (which is defined in a theme that is separate from layouts).

Julow avatar Feb 21 '24 18:02 Julow

Pleased to be corrected! The KeyValue.java piece seems to be an existing variable that holds the keycap legend; all you need is XML syntax to specify a custom one.

I asked for custom legends in an off-topic comment in #483. (What OP @ghost requested there is already doable; also, now, the Compose feature.)

Spike-from-NH avatar Feb 21 '24 19:02 Spike-from-NH