How to map a broken key to a replacement?

Zorin Lite 16.2 XFCE:
On both my mum's and my old HP laptops, the Down keys are physically broken (in any OS). Obviously the long term solution is to get them physically repaired but I was wondering if in the meantime I could remap to an alternative or combination, e.g. Shift+Up to get Down.
I've seen a few related posts elsewhere but they all suggest different methods and I'm not sure which, if any, would be right on Zorin Lite (and I don't want to bork anything else: right now every other key works exactly as it should).
And if there's a GUI way to do it, that would be easier for me than CLI.

1 Like

In XFCE's Settings > Keyboard > Application Shortcuts, you can set up key combinations but, as far as I can tell, just to trigger applications. In Layout, you can change the Compose key, and the entire layout. But not just one key of your choice.

1 Like

Probably you can use the Down arrow of the numpad section of your keyboard, on the right of Enter button. In my case, the Down arrow is on 2 button but in can be on 8 for you. The problem is that I tried to use that Down button but I wasn't able to make it do what it should, whatever I pressed (Shift, Fn, Ctrl, Alt) together with that was only writing 2 :face_exhaling:. I hoped that at least the on-screen keyboard had arrows but it doesn't :unamused:. As last, I'd suggest to create a custom keyboard shortcut but I don't know the command to execute Down button action.

Input Remapper, available via a deb file, will let you remap any key. You could make the right Ctrl key do down arrow.

@Luca_Pavan & @337harvey , both machines are laptops without number pads.

@TabNumlock that program looked interesting until I read this:

Note that for the Input Remapper to work correctly, you need to physically press the mapped button. For instance if you mapped key to <Ctrl+C>, the remapping won’t work until you press the key. Any third party program that simulates pressing of key through software solutions may fail to invoke <Ctrl+C> mapping.

And:

If your fingers can't type it on your keyboard, input-remapper can't inject it.

I tried anyway using Onboard to mimic the Down key, but Input Remapper didn't register it.

1 Like

How about plugging in a KB?

No. I think because it will only accept input from the keyboard you're trying to remap (selected in step 1).

That was a reply to TabNumlock: trying his idea was quicker so I tried that first before xmodmap.
Now I've tried xmodmap.
Because I use right ctrl all the time, I decided to try a key combination for another key.
Due to its location on the keyboard I decided to use the End key.
I followed the instructions in the tutorial and found out the existing key mapping.

keycode 88 = KP_Down KP_2 KP_Down KP_2
keycode 87 = KP_End KP_1 KP_End KP_1

I thought of trying Ctrl or Fn or Alt or Alt Gr + End to get down, but after 10 minutes of trying to understand opaque or contradictory online info as to what actual keys on my keyboard equated to Mode_switch and ISO_Level3_Shift, I gave up & said "f#ck itm just use Shift". Which is the second position, supposedly. So I modified the End key entry to:

keycode 87 = KP_End KP_Down KP_End KP_1

Then I saved and carried out the remaining steps in the tutorial.
Tried Shift+End a couple times to go down in the browser. Nothing.
So I logged out and back in again to see if that would make it work. Tried going down in the browser. Again, nothing.
Trying it in the edit window here, instead of going down, it selected everything from the cursor to the end of the line. Doh! Of course. Which is why I wanted a different modifier key in the first place.
In a minute I'll try remapping a key without use of a modifier, one I never use like insert, and post back how that goes.

1 Like

Nope. Mapping to Insert (first position) doesn't work either, even after logging out and back in again.

The info on the xmodmap method says that it doesn't work in certain desktop environments. Does anyone know if it actually works in Zorin Lite XFCE?

Yes it works perfectly well in XFCE (though ~/.xmodmap may need to be added to startup).

How would I do that? In "Session and Startup"? Somewhere else?

I did read the link. I did carry out step 4. (I just wasn't sure if "so it gets executed whenever a new terminal or shell is opened" and "added to startup" meant the same thing.)
But I'll carry it out again, just in case. Still nothing.
Ah, "on boot". So maybe just logging out isn't enough. Will reboot and see what happens.
EDIT: No, rebooting didn't work. Insert key seems completely unaffected.

OK, I opened up /.Xmodmap just to double check. For some reason, the remap I did for Shift+End=Down was there (although it doesn't work) but the remap I did for Insert=Down was not. Even though I will swear to my dying day that I did change it, did Ctrl+S to save and did Ctrl+X to close nano, all as properly as possible.
I reopened in Geany (easier on my eyes and brain than nano), changed the Insert to Down, saved, opened again to double-check that the modification was really saved this time, did step 4 again, rebooted... and now Insert=Down works! :smiley:
Ideally, I'd still like to eventually get a combo like Alt/Fn+End=Down, but Insert=Down is working and perfectly acceptable, and too much CLI etc a day hurts my poor noob brain.

Thanks everyone for helping out!

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.