I'm using Ubuntu 18.04. By default, typing something like ^2 produces ², which I don't want: I want it to be ^2. I found out that to accomplish that, one has to set GTK_IM_MODULE=xim and QT_IM_MODULE=xim to use XIM, and then a custom .XCompose file can be set up in the home directory. In my case, I replaced the old rule

<dead_circumflex> <2> : "²" twosuperior # SUPERSCRIPT TWO


<dead_circumflex> <2> : "^2" twosuperior # SUPERSCRIPT TWO

This seems to work fine with GTK apps (like Firefox or Gedit, or Chrome, which I don't think actually uses GTK) but not with QT (I've tested TeXStudio and Mathematica): typing ^2 just produces ^.

Earlier, QT_IM_MODULE was not set to xim and QT programs were producing the default ², so clearly .XCompose is being read now; is it possible that QT interprets the rule differently somehow?

  • In "(I've tested TeXStudio and Mathematica): typing ^+2 just produces ^." shouldn't that be "... just produces ^2."? – DK Bose Dec 6 '18 at 1:59
  • @DKBose No, producing ^2 would be the intended behavior, but I only get ^. – Javier Dec 6 '18 at 2:03
  • I have Kubuntu 18.04 and typed ^+2 in Kate and got ^2 not ² nor just ^. Hence my query. – DK Bose Dec 6 '18 at 2:11
  • If ^ is a dead key, do you not have to type something like ^^ to get a ^? I am not sure as I don't use dead-keys. I do know that you can't just type that character by pressing the key. – ctrl-alt-delor Dec 16 '18 at 16:29
  • @ctrl-alt-delor Yes, but by "typing ^" I mean pressing the ^ key, not producing the ^ character. – Javier Dec 18 '18 at 14:33

If you don't need the dead key feature of ^ key, you can remap the key to a regular ^ with xmodmap. Check which keycode is assigned to the key using xev and use something like xmodmap -e 'keycode 15 = asciicircum'.

| improve this answer | |
  • This would work, but I would prefer a solution that still lets me use ^ as a dead key. – Javier Dec 16 '18 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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