Score:0

How to add shortcut for enter key in Ubuntu?

gs flag

I am using Ubuntu 20.04! Unfortunately, the enter key of my keyboard is damaged. Now, I am using a Screen keyboard. However, it is sometimes not working with WPS Office. I want to make Ctrl+E in place of the damaged key. Is it possible?

vanadium avatar
cn flag
Clarify: you mention Ubuntu, but you tag "kubuntu". Use "Edit" to correct.
gs flag
Ubuntu that is right!
Allexj avatar
in flag
If you want to remap your keyboard keys or mouse buttons to certain keys, use "Input Remapper" by sezanzeb. It's VERY simple, it has a GUI, and it just WORKS. I just have set a certain shortcut to simulate a keyboard key, works well.
Score:1
cn flag

You could use xdotool to hack simulating the enter key as follows:

xdotool keyup control+e key return

The keyup statement releases your shortcut key before sending a return to avoid interference from holding Ctrl.

Bind that command to Ctrl+e using "Settings" - "Keyboard" so it gets executed when you press that key combination.

Note this works on Xorg only, not on wayland (default in later Ubuntu versions).

gs flag
Do I have to run it in terminal, or there is another way? If yes, it looks like kidumaybe@kidumaybe-HP-348-G4:~$ sudo xdotool keyup control+e key return (symbol) No such key name 'return'. Ignoring it. (symbol) No such key name 'return'. Ignoring it. kidumaybe@kidumaybe-HP-348-G4:~$ sudo xdotool keyup control+e key enter (symbol) No such key name 'enter'. Ignoring it. (symbol) No such key name 'enter'. Ignoring it.
vanadium avatar
cn flag
I wonder why you decide to use `sudo` which I did not mention? The idea is that you bind that command to your shortcut, so it gets executed when you hit Ctrl+e. Added this to the question.
gs flag
kidumaybe@kidumaybe-HP-348-G4:~$ xdotool keyup control+e key return (symbol) No such key name 'return'. Ignoring it. (symbol) No such key name 'return'. Ignoring it. kidumaybe@kidumaybe-HP-348-G4:~$
Allexj avatar
in flag
If you want to remap your keyboard keys or mouse buttons to certain keys, use "Input Remapper" by sezanzeb. It's VERY simple, it has a GUI, and it just WORKS. I just have set a certain shortcut to simulate a keyboard key, works well.
Score:0
gs flag

Run the command below in your terminal to get the key-code of your keyboard xmodmap -pk I exchanged my Shift_R to KP_Enter. Because my Enter key was damaged! The command I used to exchange key code is xmodmap -e "keycode 104=Shift_R" xmodmap -e "keycode 62=KP_Enter" I added this line of codes in my startup program preferences. Now, Shift-R is functioning as Enter key! Awesome! How to do that? 4. Determine your keyboard key-codes by using the first command. 5. Prefer the key-codes you want to exchange! 6. Use the second and third commands based on your key code 7. Test the commands by using your terminal and if the key works, well done! 8. Then select Startup Applications Preferences icon from your apps! and Add the commands separately!

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.