1

This is a followup to the question Make US International keyboard not put accents in all characters which I believe has partially been adressed in Ubuntu 22.04, but not quite.

I am going to assume that you have read that question and perhaps also Does Linux have a US international keyboard layout exactly like the windows version?, as well.

Given that, you might have noticed that Ubuntu 22.04 presents an advance towards the solution of this problem in the sense that the us+intl keyboard no longer attempts to put accents over all characters (the primary concern of the OP for the first question linked above). For example, pressing '+t gives you 't, which is the desired outcome since no languages AFAIK use the accented letter t. Moreover, again on the upside, '+a gives you the accented letter á and a similar behavior applies to all of the letters usually accentuated in Latin languages. However, '+r gives you ŕ which is not good, again because the letter r is never accentuated (at least not in most latin languages).

My specific question is thus:

Question. How to achieve a keyboard behavior in which a key press <accent>+<letter> gives you the accentuated letter if that combination is usual in latin languages, while giving <accent> followed by <letter>, otherwise?

I suppose Ubuntu 22.04 contains a table somewhere, listing the behavior of <accent>+<letter> and, should I be able to locate and edit it, the problem would likely be solved.

Observe that the problem discussed here has been solved long ago by Windows, so it is only natural that Ubuntu catch up with it!

Finally, let me say that Stack Exchange contains numerous questions related to this issue with partially satisfactory answers, such as using AltGr, or alternating between two keyboard layouts, all of which I am well aware of so, especially if you are not a user of languages employing accented characters (and hence have not suffered an inferiority complex in regards to Windows for ages) please make sure your answer addresses the precise formulation of the question!

Ruy
  • 113
  • The condition "if that combination is usual in latin languages" is not very clear. What exactly means "usual"? Which languages do you expect to be considered as "latin languages"? An accented r seems to exist, see https://en.wikipedia.org/wiki/%C5%94 – Bodo May 10 '23 at 14:32
  • Two points: (1) perhaps the user should determine whether or not an accented letter is "usual", allowing them to configure it somewhere. (2) Achieving the Windows hehavior would already be a great advance! – Ruy May 10 '23 at 14:39
  • One more point: the only Latin language in the Wikipedia page you refer to is Basque and it seems that ŕ is no longer used in that language. – Ruy May 10 '23 at 14:42
  • You should add your improved specification or requirements to your question. To me it is still no clear what exactly you understand as "latin languages". Do you mean Romance languages? (Basque is a very specific language anyway, it doesn't seem to belong to any European language family.) The Windows behavior might be a result of an arbitrary choice of "relevant" languages at some point in time. – Bodo May 10 '23 at 14:53
  • Welcome to AskUbuntu. I can only do your way by pressing a Compose key. Since typewriter generation, some keyboard has dead-keys but for many years no standard US keyboard with dead keys. Mac, Windows and Linux, each one looks very different. Additionally, the US keyboard layout coder hates MS International layout see: /usr/share/X11/xkb/symbols/us line 942-960. So that we need first 1) define a good US international keyboard 2) AltGr must work in Wayland and Xorg without troubles. Unitl the day, I use Compose key. – Sadaharu Wakisaka May 11 '23 at 02:22

1 Answers1

2

The dead key behavior is not tied to a particular keyboard layout. For instance, the dead_acute symbol is present on multiple layouts, not only English (US, intl., with dead keys).

One way to fine tune the dead key behavior for yourself is to create an ~/.XCompose file. As an example you can add these lines to ~/.XCompose:

<dead_acute> <R> : "'R"
<dead_acute> <r> : "'r" 

which (after next login) will result in '+r -> 'r instead of ŕ

(Tested in gedit and gnome-terminal, but may not work in all applications.)

Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94
  • Worked! Excellent answer. I also believe that there are a few questions, like the ones I linked above, which might greatly benefit from your answer! Thanks very much!!! – Ruy May 11 '23 at 13:10
  • Would you know the location of the systemwide .Xcompose, or whatever file defining the default behavior? That would avoid the trouble of creating a new one from scratch. – Ruy May 11 '23 at 13:16
  • @Ruy: No. I don't know exactly which files/libraries/packages affect this. Well, there is the /usr/share/X11/locale/en_US.UTF-8/Compose file, but I don't think it makes a difference by default (and it may not work on Wayland anyway). So overriding the default via ~/.XCompose is the best I can come up with. – Gunnar Hjalmarsson May 11 '23 at 13:26