You are not logged in.

#1 2022-03-20 16:11:48

donaastor
Member
Registered: 2022-03-14
Posts: 73

[SOLVED] nano shortcuts don't work with Russian layout in X

When I turn on the Russian keyboard layout in X, shortcuts in nano that include letters don't work anymore.

My /etc/locale.conf is

LANG=en_US.UTF-8
LC_COLLATE=C

When I set

setxkbmap ru

and open nano in Alacritty I can type Russian normally, but shortcuts such as Ctrl+S don't work.

Even if I edit my /etc/locale.conf to

LANG=ru_RU.UTF-8
LC_COLLATE=C

and generate with locale-gen, I still can't use shortcuts in nano. The only difference is that my nano is in Russian now.

How do I set keyboard shortcuts to work in nano while I type in Russian?

EDIT: for solution go to: https://bbs.archlinux.org/viewtopic.php?id=275021

Last edited by donaastor (2022-03-24 23:30:14)

Offline

#2 2022-03-20 16:56:13

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,705

Re: [SOLVED] nano shortcuts don't work with Russian layout in X

The locale settings aren't relevant to the input layout and afaik there's no "s" in the cyrillic alphabet.

Don't switch w/ setxkbmap, use a multi-layout config (eg. "us,ru" - https://wiki.archlinux.org/title/Xorg/K … ard_layout ) and a toggle.
If you want to use a latin shortcut straight from a cyrillic layout, you'll have to make that latin glyph available "somehow" (3rd level shift/altgr?) - either via xmodmap or a derived xkb layout.

Offline

#3 2022-03-20 17:08:26

donaastor
Member
Registered: 2022-03-14
Posts: 73

Re: [SOLVED] nano shortcuts don't work with Russian layout in X

@seth I used a toggle before, but I found this way more practical to me. But, is it relevant to my issue?
I wonder if I really need to make "s" available because other programs like chromium for example respond properly to Ctrl+F even if I change my keyboard layout (in any way: mine or with toggle). Is it that apps like nano,vim,zathura and others are not designed to work with non-latin layouts? That would be very unfortunate for Linux community, because I believe there are many people who have to switch keyboards often. I hope I can force keycodes somehow in these apps.

Offline

#4 2022-03-20 17:33:23

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,705

Re: [SOLVED] nano shortcuts don't work with Russian layout in X

This isn't about "not designed to work with non-latin layouts" - the concerned clients have something in common… https://en.wikipedia.org/wiki/VT100_encoding
Leaving aside that Ctrl+S is usually XOFF (pause flow control, a terminal shortcut that should™ not be available to the client anyway) you would have to map the keycode for the terminal input to the proper terminal sequence.
(Eg. I use 'xterm.vt100.translations: #override <Key>KP_Delete:string(.)' to map the "," on the german numpad to the "." on specific xterms)

Alternatively define multiple shortcuts for the desired action, eg. ctrl+s and ctrl+Ы (I guess)

Offline

#5 2022-03-20 18:06:38

donaastor
Member
Registered: 2022-03-14
Posts: 73

Re: [SOLVED] nano shortcuts don't work with Russian layout in X

@seth Ok, I tihnk I understood this, thank you. I can't assign multiple shortcuts because I will also use Serbian keyboard which is also Cyrillic but has permuted letters. So, I would need to use xterm and then edit .Xresources to add these translations. I think I will give up and just admit that keyboard layout switching is a mess and neglected. Sad. But thank you for your responses.

Offline

#6 2022-03-20 21:44:22

donaastor
Member
Registered: 2022-03-14
Posts: 73

Re: [SOLVED] nano shortcuts don't work with Russian layout in X

I found a "solution" for nano:

It applies only to nano and breaks all the shortcuts in zathura and geany (and others).
Install packages xbindkeys (community) and xvkbd (AUR). And add this to ~/.xbindkeysrc (make new file if it doesn't exist):

"xvkbd -xsendevent -text "\Ca""
    m:0x04 + c:38
"xvkbd -xsendevent -text "\Cb""
    m:0x04 + c:56
"xvkbd -xsendevent -text "\Cc""
    m:0x04 + c:54
"xvkbd -xsendevent -text "\Cd""
    m:0x04 + c:40
"xvkbd -xsendevent -text "\Ce""
    m:0x04 + c:26
"xvkbd -xsendevent -text "\Cf""
    m:0x04 + c:41
"xvkbd -xsendevent -text "\Cg""
    m:0x04 + c:42
"xvkbd -xsendevent -text "\Ch""
    m:0x04 + c:43
"xvkbd -xsendevent -text "\Ci""
    m:0x04 + c:31
"xvkbd -xsendevent -text "\Cj""
    m:0x04 + c:44
"xvkbd -xsendevent -text "\Ck""
    m:0x04 + c:45
"xvkbd -xsendevent -text "\Cl""
    m:0x04 + c:46
"xvkbd -xsendevent -text "\Cm""
    m:0x04 + c:58
"xvkbd -xsendevent -text "\Cn""
    m:0x04 + c:57
"xvkbd -xsendevent -text "\Co""
    m:0x04 + c:32
"xvkbd -xsendevent -text "\Cp""
    m:0x04 + c:33
"xvkbd -xsendevent -text "\Cq""
    m:0x04 + c:24
"xvkbd -xsendevent -text "\Cr""
    m:0x04 + c:27
"xvkbd -xsendevent -text "\Cs""
    m:0x04 + c:39
"xvkbd -xsendevent -text "\Ct""
    m:0x04 + c:28
"xvkbd -xsendevent -text "\Cu""
    m:0x04 + c:30
"xvkbd -xsendevent -text "\Cv""
    m:0x04 + c:55
"xvkbd -xsendevent -text "\Cw""
    m:0x04 + c:25
"xvkbd -xsendevent -text "\Cx""
    m:0x04 + c:53
"xvkbd -xsendevent -text "\Cy""
    m:0x04 + c:29
"xvkbd -xsendevent -text "\Cz""
    m:0x04 + c:52

"xvkbd -xsendevent -text "\Aa""
    m:0x08 + c:38
"xvkbd -xsendevent -text "\Ab""
    m:0x08 + c:56
"xvkbd -xsendevent -text "\Ac""
    m:0x08 + c:54
"xvkbd -xsendevent -text "\Ad""
    m:0x08 + c:40
"xvkbd -xsendevent -text "\Ae""
    m:0x08 + c:26
"xvkbd -xsendevent -text "\Af""
    m:0x08 + c:41
"xvkbd -xsendevent -text "\Ag""
    m:0x08 + c:42
"xvkbd -xsendevent -text "\Ah""
    m:0x08 + c:43
"xvkbd -xsendevent -text "\Ai""
    m:0x08 + c:31
"xvkbd -xsendevent -text "\Aj""
    m:0x08 + c:44
"xvkbd -xsendevent -text "\Ak""
    m:0x08 + c:45
"xvkbd -xsendevent -text "\Al""
    m:0x08 + c:46
"xvkbd -xsendevent -text "\Am""
    m:0x08 + c:58
"xvkbd -xsendevent -text "\An""
    m:0x08 + c:57
"xvkbd -xsendevent -text "\Ao""
    m:0x08 + c:32
"xvkbd -xsendevent -text "\Ap""
    m:0x08 + c:33
"xvkbd -xsendevent -text "\Aq""
    m:0x08 + c:24
"xvkbd -xsendevent -text "\Ar""
    m:0x08 + c:27
"xvkbd -xsendevent -text "\As""
    m:0x08 + c:39
"xvkbd -xsendevent -text "\At""
    m:0x08 + c:28
"xvkbd -xsendevent -text "\Au""
    m:0x08 + c:30
"xvkbd -xsendevent -text "\Av""
    m:0x08 + c:55
"xvkbd -xsendevent -text "\Aw""
    m:0x08 + c:25
"xvkbd -xsendevent -text "\Ax""
    m:0x08 + c:53
"xvkbd -xsendevent -text "\Ay""
    m:0x08 + c:29
"xvkbd -xsendevent -text "\Az""
    m:0x08 + c:52

Then add a new line with "xbindkeys &" before calling your window manager (I am using i3) in .xinitrc:

...
xbindkeys &
exec i3

Last edited by donaastor (2022-03-21 00:28:50)

Offline

Board footer

Powered by FluxBB