Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My backtick key (`) produces nothing when first pressed - I have to press it twice to generate a `. If I forget, and type ` e, I get an accented e character.

I am only able to fix this temporarily, for the current session, by running:

xmodmap -e 'keycode 49 = grave asciitilde'

The problem is, I can't figure out how to make this change permanent. I have found many related questions on Ask Ubuntu, but none that solve this specific problem.

I am using KDE.

share|improve this question
1  
Maybe a problem with your keyboard layout. Which keyboard layout are you using? –  Geppettvs D'Constanzo Aug 28 '12 at 12:47
    
I have enabled the keyboard layout taskbar icon in KDE, and it says "gb", which is correct. –  Robin Green Aug 28 '12 at 13:36

2 Answers 2

up vote 5 down vote accepted

In system preferences, keyboard layouts, there's three UK "variants":

Layout          Variants
------          --------
English (UK)    Default
English (UK)    English (UK, extended WinKeys)
English (UK)    English (UK, international with dead keys)

My keyboard has windows keys, so I'd selected the second variant during the install process, as seemed reasonable.

In fact, the difference between "Default" and the "extended WinKeys" variant seems to have nothing to do with the Windows keys at all. The "extended WinKeys" variant actually makes many changes to the AltGr key behaviour, most of them for the better, for example, the AltGr-shifted apostrophe and circumflex keys add the acute and circumflex accent to the next letter that's pressed, rather than the random results that the "Default" variant gives.

However, the "extended Winkeys" variant also corrects the AltGr-shifted backtick, and returns a broken-bar as is printed on the key rather the incorrect solid-bar provided by "Default". That in turn means that the AltGr-backtick can't be used to add the grave accent to the next letter, as would be consistent with the "extended Winkeys" variant, so somebody evidently decided to just replace the backtick with that function.

Since any UK Linux user would use the Compose-key functionality to write accented letters, nobody knows about the differences between these keyboard variants and it just catches people out. In the various forums that mention the backtick-key giving this unexpected behaviour, everybody was mystified about why it happened.

This is the sort of thing that this bug causes. If I wanted to display the content of a shell script that somewhere on the path, I might type:

$ cat `which zegrep`

But instead, I get:

$ cat ẁhich zegrep

...the backtick and "w" combine into w-with-grave

This is the mapping of the backtick key with the UK "extended WinKeys" layout:

$ xmodmap -pke | grep "keycode  49"
keycode  49 = dead_grave notsign grave notsign brokenbar notsign bar bar

And if you change the keyboard layout to UK "Default", the dead_grave key mapping gets shifted to the third position, which is the "mode_shifted" position (enabled by a Mode_shift key if you had one defined on your keyboard) which makes much more sense:

$ xmodmap -pke | grep "keycode  49"
keycode  49 = grave notsign dead_grave notsign bar bar brokenbar notsign

I'm thinking that I should report a bug, since evidently other people run into this, but I'm not sure what to recommend. Maybe rename "UK, extended WinKeys" to "UK, deadkeys via AltGr", so that people generally wouldn't select it unless they knew what "deadkeys" were and specifically wanted that behaviour. Or shift the dead_grave function to the AltGr-shifted position on the backtick key, which would make it consistent with the other deadkeys.

Anyway, just goto the keyboard layouts, add a new layout and select the UK Default keyboard.

share|improve this answer
    
Thanks, that worked! Maybe the extended winkeys variant got mixed up with the international with dead keys variant in a recent Ubuntu release? I'm using 12.04. –  Robin Green Sep 5 '12 at 12:40
    
Thanks for this. I deliberately chose the extended WinKeys variant, for easy access to common accents. I don't like the dead backtick key though, so used the info here to create a custom ~/.Xmodmap file. See here for how to do that... Cheers –  Alex Leach Jul 7 '13 at 8:50

This is called a "dead key". Look for a variant of your keyboard layout that says something like "eliminate dead keys" or a variant which is not "dead keys". For the gb keyboard, the variant is called English (UK) I think. You can also set it with command line:

setxkbmap -layout gb -variant basic

However, this will not be permanent. Fint the basic

If you do not find one like that, it is possible (and quite easy) to create your own layout.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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