14

When I use a keyboard, I expect the following behaviours (and I rely on these behaviours):

  • Press ", release ": Should remember the key as a dead key
  • Press ", release ", press <space>, release <space>: Should print "
  • Press ", release ", press ", release ": Should print ""

I understand that this behaviour is defined by a keyboard layout, so I did some research.

On keyboard layout "English - US with dead keys", I get the top 2 behaviours that I prefer, but the last behaviour is not fulfilled, and I get the weird character ¨ when I try that.

On keyboard layout "English - US with AltGr dead keys", I only get the last behaviour, but the key doesn't behave dead anymore.

How can I modify the keyboard layout to fulfill the 3 behaviours I expect when I use a keyboard?

  • This question would be a lot better with some motivation. – Joshua Sep 23 '18 at 22:37
  • I believe his motivation is to avoid mismatched double quotes in string literals. Seems a bit overkill to achieve this by modifying the overall keyboard behaviour - this should be handled by the IDE used for whatever purpose it is. – teukkam Sep 24 '18 at 5:13
  • 2
    @Joshua In my country, people grown up with computer lessons on windows, and these dead key behaviors are the default on windows in my country. Its really hard to change a habit you learned 20 years ago when you both use Ubuntu and Windows at the same time. On Windows the keyboard layout with this behavior is called "English - Us - International with dead keys" – Ferrybig Sep 24 '18 at 7:10
12

After trying differend ways for this problem, I eventually found a solution with help in chat for this problem

The root cause of the problem is actually caused by the fact that Linux does not have an dead_apostrophe and a dead_quotedbl by default, so the default "us dead keyboard layout" have either mapped a dead_acute or a non dead key mapped to ".

This meant this problem is not being fixable by making your own custom keyboard layout, as I was suggested in the chat.

After further research and the just is time learning of new keywords to search, I found this solution on Unix & Linux StackExchange, what helped me solve the problem.

I followed the following steps listed in that answer:

  1. sudo apt install uim
  2. echo 'export GTK_IM_MODULE="uim"' >> ~/.profile
  3. echo 'export QT_IM_MODULE="uim"' >> ~/.profile
  4. curl 'https://gist.githubusercontent.com/guiambros/b773ee85746e06454596/raw/0ea6d7f7cf9a6ff38b4cafde24dd43852e46d5e3/.XCompose' > ~/.XCompose
  5. Configure my keyboard layout to "English (US - intl with dead keys)"
  6. Rebooted Ubuntu (according to the comments, logging out and in is enough)

After these steps, I managed to fulfill the following expectations I had about my keyboard:

  • Press ", release ": Should remember the key as a dead key
  • Press ", release ", press <space>, release <space>: Should print "
  • Press ", release ", press ", release ": Should print ""
| improve this answer | |
  • 4
    To log out of the session and log back in should be enough to let changes to the user configuration take effect. No need to reboot. – David Foerster Sep 23 '18 at 16:07

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.