3

This question already has an answer here:

I am using Ubuntu since August 2010. Now, I am using Ubuntu 14.04 with gnome-shell 3.12.1. I was trying to find shortcut for toggling language but it couldn't work and my grave accent key (`) is also disabled. Now, whenever I am pressing this key on my keyboard, it works as Esc key. Can some-one tell me how can I configure it? Can some-one tell me how can I define a key-board shortcut key for input languages-toggling.

When I am pressing command "xev -event keyboard" then it opens a small window and in that if I press grave key (`) then the output is as:

KeyPress event, serial 28, synthetic NO, window 0x4000001,
    root 0x2bb, subw 0x0, time 2422193, (366,566), root:(368,710),
    state 0x0, keycode 49 (keysym 0xff1b, Escape), same_screen YES,
    XKeysymToKeycode returns keycode: 9
    XLookupString gives 1 bytes: (1b) ""
    XmbLookupString gives 1 bytes: (1b) ""
    XFilterEvent returns: False

KeyRelease event, serial 28, synthetic NO, window 0x4000001,
    root 0x2bb, subw 0x0, time 2422339, (366,566), root:(368,710),
    state 0x0, keycode 49 (keysym 0xff1b, Escape), same_screen YES,
    XKeysymToKeycode returns keycode: 9
    XLookupString gives 1 bytes: (1b) ""
    XFilterEvent returns: False

marked as duplicate by Lucio, Mitch Aug 3 '14 at 9:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

You need to remap the key to Grave.

This is taken from this answer.

  1. xev will output some information about the pressed key. The third line is important. It should look similar to:

    state 0x10, keycode 49 (keysym 0xff55, Escape), same_screen YES,
    

    in this example Escape is the name of the behaviour the key is assigned to at the moment, the number keycode is the internal id to recognize the key.

  2. now when you want to change the keys use xmodmap.

     xmodmap -e "keycode 49 = grave"
    

    This changes the key with keycode 49 on your keyboard to the key grave. It's pretty simple. Unfortunately, this loses the ~ char.

To allow the ~ key, you have to assign it to a modifier. The modifiers are, in order:

(no modifier key used is implied as first)
shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25),  Control_R (0x69)
mod1        Alt_L (0x40),  Alt_R (0x6c),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3      
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

So we want it to be ` when there is no modifier (item 1) and ~ when there is a modifier. The command is:

xmodmap -e "keycode 49 = grave asciitilde"

asciitilde is the ~ key.

You can also set it to change with caps etc, so if I wanted | when caps is on, you use:

xmodmap -e "keycode 49 = grave asciitilde bar"

bar is the `| key.

Note: These change are for the active X session only and will be lost after reboot. When you want to save the changes permanently you have to run the following commands after the ones above:

xmodmap -pke >~/.Xmodmap

(it creates a file named .Xmodmap in your home directory (~))

Then you have to create a file named .xinitrc in your home directory where you put command xmodmap .Xmodmap in.

source: Ubuntu Foruns

  • xmodmap -e "keycode 49 = grave" Corrects the grave key (`) but with shift key it is also giving the same output. I mean after doing all above, I missed tilde (~) – Sanjeev Kumar Aug 2 '14 at 13:00
  • After doing all above. I can't access tilde (~) key. Can you please tell me something about it. – Sanjeev Kumar Aug 2 '14 at 13:47
  • Good :) Don't forget to accept! – Tim Aug 2 '14 at 16:26
-2

I find I can do the correct accents quite simply using the compose key.

enter image description here

The grave à is achieved by pressing (in my case) the Right Windows key RtWinthena then the `¬| key in succesion (top left of keyboard next to the 1! key) and not necessarily together, just one after the other.

The other accents are just as logical. The least obvious is ç which is RtWin key then c then comma ,.

I hope that helps and that I have understood your requirement properly.

  • He's not asking how to insert it with a character, he wants to get it so that it gives the key ` – Tim Aug 2 '14 at 12:07
  • @Tim Then all he needs to do in that case is press the compose key and the character he wants. Simple! – Graham Aug 2 '14 at 12:11
  • 1
    No, when he presses the key, it doesn't display it, it is incorrectly assigned as Esc. – Tim Aug 2 '14 at 12:13
  • Let us continue this discussion in chat. – Tim Aug 2 '14 at 12:52
  • @NoviceUserFrance thanks for answer but my problem is as Tim understood. – Sanjeev Kumar Aug 2 '14 at 13:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.