Caps lock not working using groups

In this simple example, if caps lock is on, pressing the “e” key outputs “e” instead of “E”, while all other keys work fine. Is this a bug or is the code wrong?

group(main) using keys

+ 'e' > 'e' use(E)

group(E)

c do nothing

I’ll try to be more explicit. I would like that, if I press the “e” key, when caps lock is on, the “ee” sequence will be extended to, for example, “Europe”, otherwise the “e” character should simply be output. I got it working using positional layout, with the following code:

group(main) using keys

+ [NCAPS K_E] > 'e' use(E)

group(E)

'ee' > 'Europe'

But using the mnemonic layout, the [K_CAPS] key is not recognized. Is there a way to make this work?

Thanks

Hello @anvaolon,

Thank you for the question and the explicit explanation.
In order to set any letter on the Cap keys or layout you can use something like this:

+ [NCAPS 'e'] > 'e' use(lowercase-e)
+ [CAPS 'e'] > 'E' use(capital-e)

We got it working with the changes you provide us and here are the examples:

group(main) using keys

+ [NCAPS K_E] > 'e' use(e)
+ [CAPS K_E] > 'E' use(E)

group(E)

'ee' > 'Europe'
'EE' > 'England'

Please feel free to refer to this link for more Caps Lock key recognition.
Let us know if there is further question.

Hello @mengheng,

thank you for your answer, but your solution only works for positional layouts. Compiling it with mnemonic layout, it raises following errors:

Thanks

Hello again, @anvaolon,

As for mnemonic layout, it does work by using only the code below to produce E with the Caps Lock.

group(main) using keys

+ [CAPS K_E] > 'E'

This is a workaround solution for the example above to produce Europe:

+ [CAPS K_E] > dk(caps_e)
dk(caps_e) + [CAPS K_E] > 'Europe'

The only difference is that the E is not going to output unless it is typed SHIFT + E.

Furthermore, there is a topic about the rules to produce something similar to ‘EE > Europe’ here: (Same key twice)


Going back to the original question:


Please refer to this keyboard for the rules, groups, and more combinations as it is a Mnemonic keyboard.

Let us know how it goes. Thank you.

Hello @mengheng,

this code only works on desktop devices. I wish it worked on any device.

So, I wrote the following code, which only works on desktop devices and does what it’s supposed to, i.e if you type ‘e’ it outpus ‘e’, if you type ‘e’ pressing ‘shift’, it outputs ‘E’, if you type ‘e’ when the ‘caps lock’ key is active, it outputs ‘E’, and if you type double ‘ee’, it outputs ‘Europe’. The first rule is needed, because otherwise, typing ‘e’ when ‘caps lock’ is active, it outputs ‘e’ and not ‘E’. This is what I want the code to do.

store(&MNEMONICLAYOUT) "1"
store(&TARGETS) 'any'

begin Unicode > use(main)

group(main) using keys

$keymanonly: + [CAPS 'e'] > 'E'
+ 'e' > 'e' use(E)

group(E)

'ee' > 'Europe'

Now, since it has to do the same on mobile devices too, I tried to insert the same rule using the $keymanweb statement (equivalent to removing the $keymanonly statement):

$keymanonly: + [CAPS 'e'] > 'E'
$keymanweb:  + [CAPS 'e'] > 'E'

but I received the message “Virtual character keys not currently supported in KeymanWeb”. So I replaced the ‘e’ virtual character key with the virtual key K_E:

$keymanonly: + [CAPS 'e'] > 'E'
$keymanweb:  + [CAPS K_E] > 'E'

but I received the message “Virtual keys are not valid for mnemonic layouts”. So, what to do?

Thanks

Hello @Marc,

@anvaolon is trying to produce the same output as this 'ee' > 'Europe' on the mobile devices (The rules work on Desktop devices). But, using the code mentioned in $keymanonly and $keymanweb result in errors. Is there a solution for this, Marc?

Okay, so there’s a bit of complexity here! The first thing to consider is that mnemonic layouts are only applicable to hardware – they don’t make sense on touch, where the keyboard layout is defined by the touch definition.

So, you’d need to do the following also to ensure that mnemonic layout only applies to desktop devices:

$keymanonly: store(&MNEMONICLAYOUT) "1"

Please note: mnemonic layouts are only fully supported in Windows. While they work with a US-base layout on macOS and Linux, it is not currently possible to select alternate base layouts on those platforms. This is an area of active development for us.

Also, on touch devices, the concept of Caps Lock is somewhat different. Caps is just another layer on the touch layout – you have ‘default’, ‘shift’, and ‘numeric’ layers, and ‘caps’ would just be another layer like that. Using shorthand on mobile devices typically doesn’t work as well as it does on hardware keyboards, and you may find you wish to use a more visual approach by putting the actual output text on to key caps and using T_ keys to allow for additional keys, either with longpress (or other gestures), or additional layers.

1 Like

@Marc Fine, thank you.

This topic was automatically closed after 14 days. New replies are no longer allowed.