Overcoming a failed "Right Arrow" key on laptop

My right arrow key has failed ( bluetooth keyboard works fine). Planning on replacing laptop keyboard, but in meantime was thinking there would be a way to remap right control + left arrow to do the right arrow function. Researched xmodmap as one option, and editing /etc/inputrc as another option. In each case I have trouble figuring out how to accomplish what i want to do. Maybe there’s a better way? I’d very much appreciate any help anyone could offer. Thank you.

My laptop has 2 sets of arrow keys. One just below the pause key in the lower right and another as part of the number key. Just use the one that is working until you can fix the other.

Thank you for the reply. My laptop is a Lenovo 720-13IKB (13.3"). It only has the one set of cursor keys. Amazing how much that “right” key is missed when it doesn’t work.

In order to account for regional variations etc the input system is rather complex and what applies to one keyboard may not apply to another.

Is this your keyboard layout? Your arrow keys are also home etc? That’s not normal (at least for me), it may complicate things or it might make it easier. :man_shrugging:

Ctrl + left/right arrow key moves by a word instead of a character. I can map Ctrl + left arrow to Ctrl + right arrow on my keyboard, but of course you lose move by word for the left, and right can only move by word.

This happens because we end up with Ctrl + right arrow, instead of just right arrow, unfortunately I don’t know how to change the Ctrl state. :frowning:

Shift + arrow moves and selects, so that’s probably not great either. Third level shift (usually AltGr) might work better, if we can make it work at all. We could maybe try AltGr + left arrow, and AltGr + /, the latter may be easier and hopefully still convenient assuming you don’t already use that combo.

It would help if we knew exactly which key we’re talking about, and how it’s configured.

sudo pacman -S evtest
sudo evtest
# select your keyboard from the list
# press a key, if you don't get any response then try other keys
# if still no response try another device

Once you know which device it is, Ctrl + C to exit and rerun the command, press only the key we’re interested in, left arrow, then exit. Post the response here. Might as well double check the right arrow key, just in case.

Also dump your current config, it’s a bit large to post here directly so either find the relevant bits (the types up to 4 levels, and the symbol definitions), or use a site like pastebin to post the whole thing.

xkbcomp $DISPLAY ~/.xkbmap

Alternatively, if you have a key you never use (maybe Insert?) then you could rebind it to emit the right arrow key, either using xmodmap, xkbcomp or better yet by mapping scancodes to keycodes. The latter works below both X and the console (tty) so it works for both, the first 2 only work for X so you’d also need to configure the console if you want it to work there.

Yes! That is my keyboard. Ran evtest. Right Arrow in fact does not give me anything. It’s dead. Here’s what I got when I pushed the Left Arrow…

Event: time 1672631663.731409, type 4 (EV_MSC), code 4 (MSC_SCAN), value cb
Event: time 1672631663.731409, type 1 (EV_KEY), code 105 (KEY_LEFT), value 1
Event: time 1672631663.731409, -------------- SYN_REPORT ------------
^[[DEvent: time 1672631663.838941, type 4 (EV_MSC), code 4 (MSC_SCAN), value cb
Event: time 1672631663.838941, type 1 (EV_KEY), code 105 (KEY_LEFT), value 0
Event: time 1672631663.838941, -------------- SYN_REPORT ------------
Event: time 1672631664.374718, type 4 (EV_MSC), code 4 (MSC_SCAN), value b8
Event: time 1672631664.374718, type 1 (EV_KEY), code 100 (KEY_RIGHTALT), value 1
Event: time 1672631664.374718, -------------- SYN_REPORT ------------
Event: time 1672631664.479118, type 4 (EV_MSC), code 4 (MSC_SCAN), value b8
Event: time 1672631664.479118, type 1 (EV_KEY), code 100 (KEY_RIGHTALT), value 0
Event: time 1672631664.479118, -------------- SYN_REPORT ------------
Event: time 1672631664.957377, type 4 (EV_MSC), code 4 (MSC_SCAN), value 35
Event: time 1672631664.957377, type 1 (EV_KEY), code 53 (KEY_SLASH), value 1
Event: time 1672631664.957377, -------------- SYN_REPORT ------------
/Event: time 1672631665.039891, type 4 (EV_MSC), code 4 (MSC_SCAN), value 35
Event: time 1672631665.039891, type 1 (EV_KEY), code 53 (KEY_SLASH), value 0

Having a little trouble figuring how to pick out what i need to from the xkbmap file generated by the ```
xkbcomp $DISPLAY ~/.xkbmap command

I did use the “mapping scancodes to keycodes” technique to program the left control to function as Right Arrow.

I’d still like to pursue the “Right Alt /” maneuver though.

Thank you for your help dmt.

You’re welcome. :slight_smile:

Luckily it should already be a FOUR_LEVEL type, so we should only have to replace the third keysym. Look for the symbol definition with slash and question.

In mine I have:

key <AB10> {
        type= "FOUR_LEVEL",
        symbols[Group1]= [           slash,        question,   dead_belowdot,   dead_abovedot ]
    };

and this

key <RGHT> {         [           Right ] };

so this should do it

key <AB10> {
        type= "FOUR_LEVEL",
        symbols[Group1]= [           slash,        question,   Right,   dead_abovedot ]
    };

However I have noticed it doesn’t work in one program I use, sublime-text, apparently the dev wants AltGr to be equal to Ctrl + Alt to match Windows. IMO it should match whatever OS it’s running on. :frowning:

AltGR issue - Technical Support - Sublime Forum

So it may depend, but it should work in most if not all native software.

EDIT: Forgot to say use xkbcomp ~/.xkbmap $DISPLAY to apply it.

Thanks so much dmt!

Monkeyed around a bit getting familiar with it, eventually decided on using the Alt_R to give me the slash and the non-Alt_R to give me the Right.

So did this…

 changed form this...
    key <AB10> {
        type= "FOUR_LEVEL",
        symbols[Group1]= [           slash,        question,        division,    questiondown ]
    };

to this....    
   key <AB10> {
        type= "FOUR_LEVEL",
        symbols[Group1]= [           Right,        question,        slash,    questiondown ]
    };

Thanks again. You helped me learn some cool tricks.

1 Like

New keyboard (laptop top) received and installed. Disabled the remap scripts. Nice to have it all working again.