DEV Community

Remap keys in the keyboard in Ubuntu

BC on August 18, 2020

We could use xmodmap to remap keys in ubuntu. First, generate the current keycode map: xmodmap -pke > .Xmodmap Then op...
Collapse
 
blackbeerben profile image
blackbeerben • • Edited

$ xkbcomp /home/user/.xkbmap ":0"
Error: Cannot open display ":0"
Exiting

Gave up on terminal. Unsure what the command ":0" is supposed to do. I read this article- linuxuprising.com/2020/12/remap-ke...
Then I installed input-mapper- github.com/sezanzeb/input-remapper

Got this funky UK keyboard on a Starbook laptop with a narrow left hand shift key where there is an extra ">" less than key which I changed to be an additional left shift key. Now I can type at a normal speed again.

Running- Pop!_OS 21.10 x86_64 on a Starbook-mk-v

Thanks for the efforts. Couldn't get it to work for me.

Collapse
 
abidkhairyak profile image
AbidKhairyAK •

Pop OS use display ":1"

Collapse
 
blackbeerben profile image
blackbeerben •

Thanks for this

Collapse
 
thefluxapex profile image
Ian Pride • • Edited

Nice, you can also use the xdotool/AutoKey combo which I've been using for many years and have been planning a tutorial for it.
Actually it'll be for window management as well with wmctrl.
I'll also be doing one on AutoHotkey in Windows.

Collapse
 
mulleresposito profile image
Müller Esposito Nunes •

Hello, I can get to remap colon and semicolon keys to same key?

Collapse
 
velcrine profile image
velcrine •

yes you can

Collapse
 
mulleresposito profile image
Müller Esposito Nunes •

When I done the steps from that tutorial my Ubuntu didn't booting. I had to change the modifications that I made via the safe mode boot.

Thread Thread
 
velcrine profile image
velcrine •

Well i do it this way:
Assigned hyphen, to another key. Only this. Now, normal key press prints hyphen + when I shift press that key, I get underscore too.
Right now _ - I just typed using those keys.
Better to try and test, before making them permanent.

Collapse
 
henriquepgomide profile image
Henrique Gomide •

Just loved your tutorial!

Collapse
 
holidayinnings profile image
HolidayInnings •

The process is simpler now, with input-remapper.
I made a guide for remapping a mac-style layout, if anyone is interested.

Collapse
 
xaander1 profile image
Alexander •

Saved my day. Had keys that had stopped working.

Collapse
 
sefatanam profile image
Sefat Anam •

million dollar's article, man !

Collapse
 
estacientral profile image
estación central •

I'm having trouble setting it as a startup aplication. I am able to succesfully edit .Xmodmap but I cant make xkbcomp /home/user/.xkbmap ":0" work.

Collapse
 
thucdev profile image
thucdev •

Can I change Ctrl + C to Alt? And how can I do that?
Thanks.

Collapse
 
vuducvi1999 profile image
Vuducvi1999 •

I just have only one thing to say: Thank you so much!