7

On Windows, I'm really used to using dead keys (Dutch keyboards all use US International with dead keys), however, on Windows, typing '+s will produce 's, where as on Ubuntu, it creates ś, which is not a character I'm remotely familiar with. Other letters, that do not accept a quote or accent on the character, such as t, simply won't print until I either manually press space after typing the quote, or press the t button twice

Is there any way to get the Windows-like behavior on Ubuntu?

Ruben
  • 171

2 Answers2

1

There are two keysyms for grave, grave and dead_grave, by default dead_grave is set to the ` key. xmodmap can be used to change it, and should be in Ubuntu by default (with arch install xorg-xmodmap).

To change it from the default dead_grave to grave, run:

xmodmap -e "keycode  49 = grave notsign grave notsign brokenbar notsign brokenbar notsign"

The rest of the values are various modifiers, e.g. the second one is shift.

If you want this to be permanent, create ~/.Xmodmap, and then add just:

keycode  49 = grave notsign grave notsign brokenbar notsign brokenbar notsign

If there are any other dead keys you're having trouble with, run:

xmodmap -pke | grep dead

And it should give you a list of dead keys. Alternatively you could run:

xmodmap -pke >> ~/.Xmodmap

You will then have a full list of keyboard keys and their sym values in .Xmodmap, which makes it easy to change your dead keys and any other keys to whatever custom layout you like.

Levi H
  • 151
0

Yes, I have a programmed solution. The answer is in the Compose file under /usr/share/X11/locale/iso8859-1/ and /usr/share/X11/locale/en_US.UTF-8/

That's where all the definitions of the dead keys are. Put in a series of lines like this:

<dead_acute> <S> : "'S" # APOSTROPHE then LATIN CAPITAL LETTER S

instead of the entry in en_US.UTF-8/Compose, which is:

<dead_acute> <S> : "Ś" U015A # LATIN CAPITAL LETTER S WITH ACUTE

Also create lines for every other letter, cap and small, for the ones that by default aren't defined at all, and will therefore do nothing:

<dead_acute> <b> : "'b" # APOSTROPHE then LATIN SMALL LETTER b

Put all these changes into a file named .XCompose, dot ex compose, note the caps, in your home dir. If you copy the whole file and only edit in these lines, taking the old ones out, you don't need to include the mother file, but if you only put your changes into your .XCompose, you will need to put an include line at the top of the file, referencing the system file your lines of code will replace lines from. The way the syntax works is each line supercedes the previous line with the same code before the colon, and redefines that string to your new one, and all after the hash # is ignored as a comment. Here's your chance to make it whatever you want. As a testing thing, I set <dead_acute> <1> to "XCompose 1.0", just so I could immediately see if my code was being called at all in my .XCompose file.

That should give you the MS-Win international US keyboard behaviour you want, so you can type in " 'Best wishes,' he didn't say. ", only having to hit the space bar once extra after the close-single-quote after the comma, because you've mapped "'B" to "'B" and "'t" to "'t", not to something unexpected that only a linguist would use.

Also, you might have to change your keyboard handler to "xim" instead of the default for your installation of Linux. There's an article on how to do that. "xim" uses the Compose/.XCompose files.

Now if only I knew how to turn off the smart quotes, which are driving me batty.