Problem with macro for french layout in PHPStorm

Hello,

following my previous post I managed to replace the keycaps with an AZERTY layout which fits way better my needs

and then my computer is configured to use french layer, and everything works like a charm unless the key “<>” which seem to not have its scancode equivalent in QWERTY

So I wanted to create a macro to use it, seems pretty straightforward: “<” unicode is U+003C and “>” is U+003E

So I created a macro which I affected to a specific key:

set macroEngine.extendedCommands 1
ifNotAnyMod suppressMods tapKeySeq CS-u 0 0 3 c space
ifShift suppressMods tapKeySeq  CS-u 0 0 3 e space

It works like a charm in all applications except in PHPStorm where it displays àà"e
So, it seems that PHPStorm receives the scancode from the french layer and not the qwerty one (or at least, that how I understands it… in french layer 0=>à, 3=>")

So the only way I found to correctly display the characters in PHPStorm is this macro, which seems pretty hacky, and which does not work in any other application

set macroEngine.extendedCommands 1
ifNotAnyMod suppressMods tapKeySeq CS-u LS-0 LS-0 LS-3 c space
ifShift suppressMods tapKeySeq CS-u LS-0 LS-0 LS-3 e space

any help would be apprciated, thank you !!

So CS-u 0 0 3 c space works but CS-u 0 0 3 e space does not? That’s suspicious. Please test that. I.e., place the two tapKeySeq commands into separate macros without ifShift / suppressMods.

Also please test whether Ctrl+Shift+U method to insert unicode chars works in phpstorm when you tap the keys manually. (Some software doesn’t like too fast input, in which case slowing down the input by setting set keystrokeDelay 10 (or more) should help.)

Hi, thanks for your concern for my problem :pray:

So CS-u 0 0 3 c space works but CS-u 0 0 3 e space does not? That’s suspicious.

sorry, I edited my post, none of CS-u 0 0 3 e space nor CS-u 0 0 3 c space work in phpstorm

Also please test whether Ctrl+Shift+U method to insert unicode chars works in phpstorm when you tap the keys manually.

Yes I tested it, and it works perfectly!

Some software doesn’t like too fast input, in which case slowing down the input by setting set keystrokeDelay 10

it does not work event with a value of 100

I am confused.

You seem to be using the linux ctrl+shift+u notation, so I tried to reproduce the problem on my linux machine. First with english layout and php storm - that worked just fine.

Then I switched to french layout and a regular text editor. Turns out that in order to type numbers, shift has to be pressed (that is the property of the french layout). With Ctrl+shift+u notation, numbers have to be typed as regular french-layout numbers, that is, with shift. This is how it apparently works in any software.

What am I missing?

hmm you may be right, and so, the problem would be in the other side: PHPStorm is the only one to understrand correctly the macro. For some unknown reason, other applications understand CS-u 0 0 3 e space as if it would have been in QWERTY… so strange

And then, the problem is: the following macro in other apps don’t understand correctly tapKeySeq CS-u LS-0 LS-0 LS-3 c space
it writes the first characters, then the computer makes a “bip” (sound alert, as if an error happened), and first characters are removed and it writes down the last characters

here is a small video of what happens with the macro tapKeySeq CS-u LS-0 LS-0 LS-3 c space
Peek 05-10-2023 13-42

I mean, how do you normally write numbers? (with shift, or without?)

Do you have any unusual mappings in your UHK? Like numbers mapped so that you don’t have to press shift in order to produce numbers?

What os and window manager are you actually using?

Is it possible that you have your input method or something else in the OS configured in a non-standard way? (I mean, any french-specific preset may be non-standard. Like a configuration which allows CS-u codes to be entered without shift on numbers.)

how do you normally write numbers? (with shift, or without?)

with shift, this is the normal usage of AZERTY layer

Do you have any unusual mappings in your UHK? Like numbers mapped so that you don’t have to press shift in order to produce numbers?

not anything like that

Is it possible that you have your input method or something else in the OS configured in a non-standard way?

I really don’t think, using the regular stuff from ubuntu, configured with regular french layout

Strange.

Anyway, do I understand correctly that if you input the CS-u code manually in phpstorm, it works without shifts, but if you enter it using a macro, it requires shifts?

If so, you can set keystrokeDelay to a high value (200 ms?) and try see what is going on using https://keyboardchecker.com/ . There should be no difference between when you enter the CS-u code manually and between when use the macro.

ok I think the problem is not related to UHK, but I don’t understand at all why have the problem:

the fact is: when I try to inpu manually the CS-u code eslewhere than in phpstorm, it does not require to use the shift key, and where I use the shift key, the first time I release it, I have an error because the symbol does not exist! But if i maintain pressed the shift key as long as I write the code, everything is OK.

ex:

  • CTRL+U
  • press shift
  • press 0
  • release shit
    => :boom:

but:

  • CTRL+U
  • press shift
  • press 0
  • press 0
  • press 3
  • press e
  • release shit
    => prints >

I think that this sequence: tapKeySeq CS-u LS-0 LS-0 LS-3 c would release shift between each keystroke. I’m wondering if I can genrate a macro where shift is pressed all along?

I see. Fix is easy then.

Either

tapKeySeq LC-u pLS 0 0 3 c rLS

for Ctrl+u, then press shift, and enter the code

Or

tapKeySeq  pLS LC-u 0 0 3 c rLS

for Ctrl+Shift+u, …

not so simple :sob:

tapKeySeq LC-u pLS 0 0 3 c rLS works outisde of phpstorm but not in phpstorm
tapKeySeq LC-u pLS LS-0 LS-0 LS-3 c rLS works the opposite

I even tried to play around with LS and RS (something like that: tapKeySeq LC-u pLS RS-0 RS-0 RS-3 c rLS) but it does not work neither.

this so frustrating… for now I’ve created specific macros for phpstorm.

I think I have to find why when I manually press CTRL+SHIFT+U in any app, I’m not required to press shift to access to the numbers, and why it stops the combination when I release shift

Well, what about trying different approach?

<> are still fairly common characters, so inserting them via unicode codes is a bit of an antipattern which a normal user would almost never do. Most language layouts have such less common (but still common) characters available via right alt. In czech for instance @ is available via rightAlt+v, linux maps also allow rightAlt+2.

Quick search tells me that canadian french layout allows you to insert <> via rightAlt + , / .

Could perhaps this could be a solution?

I agree that it is one way to solve the problem.

Quick search tells me that canadian french layout allows you to insert <> via rightAlt + , / .

french-france here :sweat_smile:
I think french canadian is slightly different from the France’s one

I think with french keyboard you can’t do something like rightAlt + , / .
I tried all rightAlt + [all the keys on my keyboard] as well as rightAlt + shift + [all the keys on my keyboard] and discovered plenty of cool character I can produce, but none of them were the ones I’m looking for. And I can’t find anywhere on the net an “alt code” producing < or >

I think I have to find why when I manually press CTRL+SHIFT+U in any app, I’m not required to press shift to access to the numbers, and why it stops the combination when I release shift

I can’t find anything useful on the web :pensive:

Well, what is it that french programmers do when needing to insert <>? Do they all use en-US layout?

haha no, everyone here use french layout, we have a dedicated key near left shift

KB_-AZERTY-FR-Windows-_FR-Liegeois

Well, that key definitely has a scancode and you can map that scancode via Agent.

My guess is it is the iso key:

1 Like

:exploding_head:
Maybe I should have started with this !!

I cannot test it now because I don’t have the UHK here. Sorry for all that noise if the solution is THAT simple, and thank you for your time, that’s very apprciated :slightly_smiling_face:

1 Like

ok then, everything works perfectly using “ISO” scancodes

thanks for your help again

1 Like

You are welcome!