Closed Fifis closed 2 years ago
Hi, is this possibly related the problem described here: https://github.com/sezanzeb/key-mapper/blob/main/readme/usage.md#key-names-and-macros?
For example, mapping a key to an exclamation mark is not possible if the keyboard layout is set to german. However, it is possible to mimic the combination that would be required to write it, by writing Shift_L + 1
This might also be interesting, there is an example on how to inject ヤ: https://github.com/sezanzeb/key-mapper/blob/main/readme/examples.md#emitting-unavailable-symbols
Thank you for your prompt reply! I am completely new to this, so, in fact, the key names on my keyboard are slightly different (although the system locale being en_GB.UTF-8 and the layouts being en_US and ru_RU, and this is what I got with en_US active):
fifis@GF72-8RD:~$ key-mapper-control --symbol-names
Escape
1
<...>
Tab
Cyrillic_shorti
Cyrillic_tse
Cyrillic_u
Cyrillic_ka
Cyrillic_ie
Cyrillic_en
Cyrillic_ghe
Cyrillic_sha
Cyrillic_shcha
Cyrillic_ze
Cyrillic_ha
Cyrillic_hardsign
Return
Control_L
Cyrillic_ef
Cyrillic_yeru
Cyrillic_ve
Cyrillic_a
Cyrillic_pe
Cyrillic_er
Cyrillic_o
Cyrillic_el
Cyrillic_de
Cyrillic_zhe
Cyrillic_e
Cyrillic_io
Shift_L
backslash
Cyrillic_ya
Cyrillic_che
Cyrillic_es
Cyrillic_em
Cyrillic_i
Cyrillic_te
Cyrillic_softsign
Cyrillic_be
Cyrillic_yu
period
Shift_R
KP_Multiply
Alt_L
space
Caps_Lock
F1
<...>
I cannot process the tip ‘Map Shift_L + 1
’ for German. Could you please provide a quick example? Do I need to edit JSON? Here is what I am trying to achieve:
The key in question is y
(in US English) / н
(in Russian). First level, no modifiers. The corresponding name of the symbol in the list above is Cyrillic_en
. My 3rd-level key is AltGr. I want AltGr + that key
(y / н / Cyrillic_en) to produce the symbol ѣ
. What should I edit?
Try
about Shift_L + 1
: This is a special syntax that can be used. See https://github.com/sezanzeb/key-mapper/blob/main/readme/usage.md#writing-combinations
I did it, but there are two issues.
1, When I press AltGr + ShiftL + z
, the ‘Key’ column says ISO Level3 Shift + Shift L + Cyrillic ya
. It happens in both en_US and ru_RU layouts, so no matter what I press, I cannot achieve ISO Level3 Shift + Shift L + z
. The mapping is Cyrillic_en.
AltGr + ShiftL + z
produces Y
, and it ru_RU is seleted, it produced H
(the capital Cyrillic en—don’t be confused by the appearance, it truly is U+041D, although I was expecting its lowercase equivalent, U+043D).Cyrillic_en
for ѣ
, the status bar says that it is not recognised (see below). The name for the symbol ѣ
(U+0463) is Cyrillic Small Letter Yat
, but when I start typing Cyrillic...
into the Mapping column, it won’t auto-suggest the name of this Unicode symbol that I want to use.Also, I tried the k()
from the examples, making it "1,100,1+1,21,1": "k(\u0463)"
, but it won’t work either.
When I press AltGr + ShiftL + z, the ‘Key’ column says ISO Level3 Shift + Shift L + Cyrillic ya
I don't think this matters. Key-mapper tries to visualize your pressed input keys in a human readable format based on xmodmap, but it actually remembers the keycodes.
The problem is, if the en_US layout is selected, AltGr + ShiftL + z produces Y, and it ru_RU is seleted, it produced H
What?
When I try to change the mapping Cyrillic_en for ѣ, the status bar says that it is not recognised (see below)
expected, key-mapper only knows the fully written name for the symbol (like Cyrillic_en) and not the actual symbol
Okay, I have tried adding the full written name for tilde (~), but it is not in the list... Here is a video showing that the name of the tilde symbol is not in the full list. Maybe I am stupid, but how can I bind the insertion of the simplest ASCII tilde to AltGr ~
(the latter key being named Cyrillic_io)?
If tilde is not in your key-mapper-control --symbol-names
output, please go over https://github.com/sezanzeb/key-mapper/issues/210#issuecomment-974907749 one more time
xmodmap
turned out to be a buggy mess because instead of the documented 6 levels, it had 7 or more, and the assignment would screw up the en_US layout. It also took a lot of time to reload all the mappings (40 seconds to restore the old mapping after some changes—it was much quicker to kill X and start from scratch).
I managed to solve this issue via xkbcomp
. E.g. this is what I had had (two groups, ru_RU and en_US), after xkbcomp -xkb $DISPLAY
:
xkb_symbols "pc+ru+us:2+inet(evdev)+group(alt_shift_toggle)+level3(ralt_switch)+compose(102)+nbsp(level3n)+termi" {
name[group1]="Russian";
name[group2]="English (US)";
<...>
key <AD06> {
type= "FOUR_LEVEL_SEMIALPHABETIC",
symbols[Group1]= [ Cyrillic_en, Cyrillic_EN, yen, NoSymbol ],
symbols[Group2]= [ y, Y, yen, NoSymbol ]
};
<...>
}
And this is what added the necessary keys to the map:
key <AD06> {
type= "FOUR_LEVEL_SEMIALPHABETIC",
symbols[Group1]= [ Cyrillic_en, Cyrillic_EN, U0463, U0462 ],
symbols[Group2]= [ y, Y, yen, NoSymbol ]
};
In cases where there was no third level defined, changing ALPHABETIC
to FOUR_LEVEL_SEMIALPHABETIC
would do the trick, i.e. changing
key <AD09> {
type= "ALPHABETIC",
symbols[Group1]= [ Cyrillic_shcha, Cyrillic_SHCHA ],
symbols[Group2]= [ o, O ]
};
to
key <AD09> {
type= "FOUR_LEVEL_SEMIALPHABETIC",
symbols[Group1]= [ Cyrillic_shcha, Cyrillic_SHCHA, U0473, U0472 ],
symbols[Group2]= [ o, O, NoSymbol, NoSymbol ]
};
would add ѳ
to the third level of щ
.
xinput list
would reveal AT Translated Set 2 keyboard id=11 [slave keyboard (3)]
, so after making the changes, saving the modified file as great.xkb
and doing xkbcomp -i 11 great.xkb $DISPLAY
, I got the desired extra keys in the 3rd and 4th levels.
So, the full solution to the original question (adding four old Cyrillic letters in lower- and uppercase plus mapping the tilde) comes in the form of an XKB file that modifies the existing layout:
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compatibility { include "complete" };
xkb_symbols {
include "pc+ru+us:2+inet(evdev)+group(alt_shift_toggle)+level3(ralt_switch)+compose(102)+nbsp(level3n)"
include "terminate(ctrl_alt_bksp)+typo(base):1+typo(base):2"
name[group1]="Russian";
name[group2]="English (US)";
key <AD06> {
type= "FOUR_LEVEL_SEMIALPHABETIC",
symbols[Group1]= [ Cyrillic_en, Cyrillic_EN, U0463, U0462 ],
symbols[Group2]= [ y, Y, yen, NoSymbol ]
};
key <AD07> {
type= "FOUR_LEVEL_SEMIALPHABETIC",
symbols[Group1]= [ Cyrillic_ghe, Cyrillic_GHE, U0475, U0474 ],
symbols[Group2]= [ u, U, U20B4, NoSymbol ]
};
key <AD08> {
type= "FOUR_LEVEL_SEMIALPHABETIC",
symbols[Group1]= [ Cyrillic_sha, Cyrillic_SHA, U0456, U0406 ],
symbols[Group2]= [ i, I, NoSymbol, NoSymbol ]
};
key <AD09> {
type= "FOUR_LEVEL_SEMIALPHABETIC",
symbols[Group1]= [ Cyrillic_shcha, Cyrillic_SHCHA, U0473, U0472 ],
symbols[Group2]= [ o, O, NoSymbol, NoSymbol ]
};
key <TLDE> {
type[group1]= "FOUR_LEVEL_SEMIALPHABETIC",
type[group2]= "FOUR_LEVEL",
symbols[Group1]= [ Cyrillic_io, Cyrillic_IO, asciitilde, approxeq ],
symbols[Group2]= [ grave, asciitilde, NoSymbol, approxeq ]
};
};
xkb_geometry { include "pc(pc105)" };
};
The issue can be closed, and the solution I found, in fact, achieves the desired Cyrillic mapping without the use of key-mapper
at all, purely with xkb
, but maybe this solution will be insightful and give the contributors an idea about what could be done to circumvent this issue.
Again, thank you very much for your time and suggestions!
but maybe this solution will be insightful and give the contributors an idea about what could be done to circumvent this issue.
Thanks, but key-mapper only uses xmodmap to gather information for human-readable convenience. It is designed to work with any environment that has, or doesn't has xmodmap available by acting like a keyboard that sends numeric scancodes to the environment.
Again, thank you very much for your time and suggestions!
You're welcome
Using Linux Mint 20.2 (based on Ubuntu 20.04) DE: Cinnamon 5.0.7 Model: MSI GF72-8RD Layouts in use: English (US) + Russian, extra typographic characters enabled, 3rd level = AltGr, switch layour = Alt+Shift
I tried adding some Cyrillic symbols and a tilde to the third level (AltGr + something), and it would not work even after reboot or service restart. Here is the full diagnostic information:
JSON preset:
Service status had some interesting error lines (these are the letters that I wanted to map):
Debug log: