[SOLVED] How to mapping any key to another any key?

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
tuxtuxtux
Level 1
Level 1
Posts: 14
Joined: Tue Nov 27, 2018 12:48 am

[SOLVED] How to mapping any key to another any key?

Post by tuxtuxtux » Thu Nov 29, 2018 6:35 am

Hello everyone, my laptop keyboard letter "E" it broke and cannot type letter "E" using that (im using virtual keyboard right now :P )
so what i want to ask. is there any apps that can mapping my letter e to another key (ex: right shift key, i rarely used that one)
and can you provide the tutorial how to do that?
thanks before :D
Last edited by tuxtuxtux on Tue Dec 04, 2018 11:35 am, edited 1 time in total.

User avatar
xenopeek
Level 24
Level 24
Posts: 23862
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: How to mapping any key to another any key?

Post by xenopeek » Thu Nov 29, 2018 1:15 pm

You could use the xdotool command for this. First, install the xdotool package through Software Manager. Then in Keyboard settings in your menu find the place where you can configure Shortcuts and add a custom shortcut. Give it a name and configure the command as this to type letter 'e' (replace e with E to type 'E'):
xdotool type e
After adding the custom shortcut click on the blank shortcut to the right of it in the list and it should let you press a keyboard combination to bind to your custom shortcut. A keyboard combination will consist of one or more modifier keys (ctrl, alt, shift, super) and a letter, digit or function key. Which to bind it to is a bit of conundrum. Check in the applications which you most frequently use (where you use keyboard shortcuts) that you don't bind it to a keyboard combination that you need.
Image

tuxtuxtux
Level 1
Level 1
Posts: 14
Joined: Tue Nov 27, 2018 12:48 am

Re: How to mapping any key to another any key?

Post by tuxtuxtux » Thu Nov 29, 2018 9:36 pm

no it doesnt work, any other ways?

User avatar
xenopeek
Level 24
Level 24
Posts: 23862
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: How to mapping any key to another any key?

Post by xenopeek » Fri Nov 30, 2018 3:07 am

Can you detail abiit what you tried and how you concluded it doesn't work? Because this is pretty standard way of generating a character input.

Which Linux Mint version and edition (e.g., Cinnamon, MATE or Xfce) are you using?
Image

tuxtuxtux
Level 1
Level 1
Posts: 14
Joined: Tue Nov 27, 2018 12:48 am

Re: How to mapping any key to another any key?

Post by tuxtuxtux » Fri Nov 30, 2018 4:37 am

im using linux mint 19 mate right now

User avatar
xenopeek
Level 24
Level 24
Posts: 23862
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: How to mapping any key to another any key?

Post by xenopeek » Fri Nov 30, 2018 4:44 am

It works on Linux Mint 18.3 MATE but indeed I can't get it to work on your version.

Perhaps somebody else has a suggestion that will work on 19 MATE.

Is the key really broken or just dirty? If you haven't tried yet, see if you can remove the keycap and clean underneath.
Image

magnus7
Level 3
Level 3
Posts: 160
Joined: Sat Jan 30, 2016 8:46 pm

Re: How to mapping any key to another any key?

Post by magnus7 » Fri Nov 30, 2018 7:21 am

A key can be remapped in your keyboard layout.
What's your keyboard layout?

tuxtuxtux
Level 1
Level 1
Posts: 14
Joined: Tue Nov 27, 2018 12:48 am

Re: How to mapping any key to another any key?

Post by tuxtuxtux » Fri Nov 30, 2018 12:08 pm

US version layout.
can you provide the tutorial how to do that?

magnus7
Level 3
Level 3
Posts: 160
Joined: Sat Jan 30, 2016 8:46 pm

Re: How to mapping any key to another any key?

Post by magnus7 » Sat Dec 01, 2018 8:41 am

Run this command in terminal and restart the computer:

Code: Select all

sudo sed -i '29s|.*|key<RTSH>{[e,E]};|' \
/usr/share/X11/xkb/symbols/pc \
&& sudo dpkg-reconfigure xkb-data
It will remap E to Right Shift.
To undo remapping, when you fix the key, reinstall xkb-data package. In terminal:

Code: Select all

sudo apt-get install --reinstall xkb-data

User avatar
administrollaattori
Level 15
Level 15
Posts: 5860
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: How to mapping any key to another any key?

Post by administrollaattori » Sat Dec 01, 2018 9:06 am

magnus7 wrote:
Sat Dec 01, 2018 8:41 am
Run this command in terminal and restart the computer:

Code: Select all

sudo sed -i '29s|.*|key<RTSH>{[e,E]};|' \
/usr/share/X11/xkb/symbols/pc \
&& sudo dpkg-reconfigure xkb-data
Intresting ... I have one laptop, which has dead left Ctrl key. What is the code to transfer Ctrl to the left Super key windows flag?

magnus7
Level 3
Level 3
Posts: 160
Joined: Sat Jan 30, 2016 8:46 pm

Re: How to mapping any key to another any key?

Post by magnus7 » Sat Dec 01, 2018 2:00 pm

No need for code, just go to Keyboard > Layouts > Options > Ctrl position > Swap Left Win with Left Ctrl, unless you use Xfce.

User avatar
administrollaattori
Level 15
Level 15
Posts: 5860
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: How to mapping any key to another any key?

Post by administrollaattori » Sat Dec 01, 2018 3:06 pm

magnus7 wrote:
Sat Dec 01, 2018 2:00 pm
No need for code, just go to Keyboard > Layouts > Options > Ctrl position > Swap Left Win with Left Ctrl, unless you use Xfce.
Works perfectly! Thank you. :D
change keys.png

Post Reply

Return to “Software & Applications”