Exponent replacement (^2 -> ²)

9

In my freshly installed Debian 7 system, every time I type on the keys ^ then 2, I get ² (ASCII character for "squared"). The same is true with 2 replaced by 3 to 8.

How could I desactivate this to get ^2 instead, as in Mac OSX ?

Floyd

Posted 2013-12-20T22:12:16.603

Reputation: 91

1Does this occur in all text entering (terminal, web browser, text editor, etc.)? – K.A.Monica – 2013-12-26T04:03:45.463

I have the same problem (hence the bounty), and it does occur in all text editing. The problem disappears if I choose a keyboard layout with "dead keys" in the system preferences, but then I cannot typeset accents anymore. – Klaus – 2013-12-26T10:30:22.023

Answers

3

Perhaps a compose key setting? Are you using Gnome, by chance?

Try checking the files listed here; /usr/share/X11/locale/compose.dir and /usr/share/X11/locale/en_US.UTF-8/Compose (the latter may change based on the first; see the link for more details)

Collin Grady

Posted 2013-12-20T22:12:16.603

Reputation: 219

3

You can try to use xmodmap for this, some useful info is at the ArchWiki xmodmap page. Basically, this is a utility to manage your keyboard mapping in X. For your specific question, you could do something like

xmodmap -pke >mycustommodmap

to get the current settings first. On my system, the 'bad' keypress caused something called dead_circumflex, which could be found in that file. After changing this to asciicircum, and loading the new map with

xmodmap mycustummodmap

the key now immediately produces a ^.

To make sure that this is automatically done when you login, you could set the name of the file to .Xmodmap in your home directory. If it doesn't get loaded automatically then or you don't want to name your file that way, you should be able to instruct your desktop to run the specified command at startup somehow.

Edit

Actually, although getting the current map first is a good place to start, you don't need all those lines in your .Xmodmap, just the ones you'd like to change. For example, in my .Xmodmap, to change the behavior for ^ (circumflex) and ~ (tilde), the contents are just

keycode  34 = asciicircum dead_diaeresis dead_circumflex dead_diaeresis bracketleft dead_abovering bracketleft
keycode  61 = equal plus equal plus asciitilde dead_abovedot dead_tilde

brm

Posted 2013-12-20T22:12:16.603

Reputation: 436

2

Try tricking the computer. I have had this issue many times before and it can be tricked by typing '^' pressing space, then adding another space right after ^, then a 2, then erase the space between them and clicking after '^2' it's worked for me before on occasion but is concurrence. Give it a shot.

Crutchcorn

Posted 2013-12-20T22:12:16.603

Reputation: 156

Of course, this works, but requires 3 key presses instead of 2. – Klaus – 2013-12-27T21:04:57.790

If this is not a viable solution, you could also take a look at the source code and run a realtime debugger while typing this and seeing what actually runs when you type this. If you know enough code within linux that is. – Crutchcorn – 2013-12-28T05:54:47.033

2I think it is a viable workaround when you need to use it on someoneelses computer and do nto want to fiddle around with their settings. But it is not a good solution for the OP. – Hennes – 2013-12-29T15:53:05.213

Well, naturally this is not a permanent fix; however it is the most viable answer I have to give. :( – Crutchcorn – 2013-12-30T18:53:32.667

0

I guess it GTK input issue, try different input method with some GTK app:

$ GTK_IM_MODILE=xim gedit

If it will help just export GTK_IM_MODILE variable by adding export GTK_IM_MODILE=xim to your ~/.profile or by other method you prefer.

Dmitry Alexandrov

Posted 2013-12-20T22:12:16.603

Reputation: 984