Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBus input method to quickly find equivalent locale character for a given ASCII character #2461

Closed
fSidel opened this issue Nov 27, 2022 · 10 comments

Comments

@fSidel
Copy link

fSidel commented Nov 27, 2022

I have a laptop keyboard with an ANSI layout, however since I live in Europe I often need to write text with non ASCII characters for languages like italian, german and french.
This feature request has been inspired by two different pieces of software:

  • the Android/iOS virtual keyboard, (1)
  • the Ubuntu Budgie Quickchar app, (2)

As you probably know (1) offers long presses on ASCII characters to write related locale characters, such an implementation is not possible on a desktop environment for obvious reasons, however it may be a good reference for mapping ASCII characters to their non-ASCII siblings.

A more practical approach for desktops and laptops is (2), the Quickchar app is really similar to the IBus service integration offered in GNOME for input of japanese, chinese and korean characters on an ANSI keyboard. See this screenshot for reference:
quickchar
In the Budgie Desktop Environment the app is triggered by a keyboard shortcut which calls a UI on screen that allows a user to write an ASCII character and returns a list of related locale characters that can be written in the text input field by pressing a number or by tabbing to navigate the list of characters and pressing enter on the chosen character.

As you can see this feature is almost identical to the one offered by IBus on GNOME, however as far as I can tell IBus only offers these capabilities for non european characters. As an example, in the following screenshot:
InputCJK example
The ideal output for the "e" character could be: "ê è é ë ė ę ē"

I thank you for your time and for all the work you have put to build ibus! I am a junior developer myself so I'd be glad to contribute in any way to implement this feature request, even though I am not really familiar with the architecture of ibus.

@mike-fabian
Copy link

As you probably know (1) offers long presses on ASCII characters to write related locale characters, such an implementation is not possible on a desktop environment for obvious reasons, however it may be a good reference for mapping ASCII characters to their non-ASCII siblings.

Actually implementing this idea is not impossible on desktops, for example MacOS has this, see:

https://macpaw.com/how-to/type-accents-on-mac

I have this idea on my todo list for ibus-typing-booster.

But it is quite difficult on Xorg or Wayland to detect whether a long press has happened and I had no time yet to investigate how that might be possible.

@mike-fabian
Copy link

I have a laptop keyboard with an ANSI layout, however since I live in Europe I often need to write text with non ASCII characters for languages like italian, german and french.

Even though ibus-typing-booster cannot do the longpress thing yet, it might still be very useful for you to write non ASCII characterss in Italian, German, and French.

I am using an US keyboard layout as well, my native language is German and I am learning Italian and French.

I am typing the accented letters usually with ibus-typing-booster.

For ibus-typing-booster, see:

https://mike-fabian.github.io/ibus-typing-booster/

User documentation:

https://mike-fabian.github.io/ibus-typing-booster/docs/user/

@mike-fabian
Copy link

This screenshots shows one way how one can input accented characters using ibus-typing-booster:

Screenshot

In this screenshot, one can see that I have added English, French, and Italian dictioaries in the ibus-typing-booster setup.

Also, I have added the t-latn-post input method in the ibus-typing-booster setup.

Then I clicked the Input Method Help button which displays the help window shown on the left.
It shows a help like this:

 "Latin script input method using postfix modifiers.
   | mark       | postfix | examples
   |------------+---------+----------
   | acute      |    '    | a' -> á
   | grave      |    `    | a` -> à
   | circumflex |    ^    | a^ -> â
   | diaeresis  |    \"    | a\" -> ä
   | tilde      |    ~    | a~ -> ã
   | cedilla    |    ,    | c, -> ç
   | ogonek     |    ,    | a, -> ą
   | breve      |    ~    | g~ -> ğ
   | caron      |    ~    | c~ -> č
   | dbl. acute |    :    | o: -> ő
   | ring       |    .    | u. -> ů
   | dot        |    .    | z. -> ż
   | stroke     |    /    | l/ -> ł
   | others     | /, etc. | d/ -> ð   t/ -> þ   a/ -> å   o/ -> ø
   |            |         | ae/ -> æ  ij -> ij   oe/ -> œ  s/ -> ß
   |            |         | ?/ -> ¿   !/ -> ¡   // -> °
   |            |         | << -> «   >> -> »   o_ -> º   a_ -> ª
 
Repeating the postfix changes ambiguous combining marks:
  Ex: A~ -> Ã, A~~ -> Ă, A~~~ -> A~

For example, if I want type the French word déjà I can type an U+0027 APOSTROPHE after the e to get é and a U+0060 GRAVE ACCENT after the a to get à.

You can also see in the screenshot that I didn’t actually type déjà but dejà, i.e. I “forgot” the accent on the e. But ibus-typing-booster shows me a candidate list where the correct spelling déjà is the first candidate. This is because I added the French dictionary in the setup and words are looked up accent insensitively in dictionaries.

That means if you type French words, you don’t have to type the accents directly, you can usually type the words without the accents and then select the correct spelling with accents from the candidates shown.

@mike-fabian
Copy link

Another way to type accents is to use Compose.

For details about what Compose is and how it works see: https://mike-fabian.github.io/ibus-typing-booster/docs/user/#5 Compose support

In this screenshot you can see that I did use the Gnome Control Center Keyboard tab to select Right Ctrl as my compose key.

Then (with ibus-typing-booster active, i.e. selected in the Gnome panel) I typed

compose e Tab

The Tab key opens a candidate list which shows me help how this compose sequence could be completed.

It starts with

1 " ë   U+00EB latin small letter e with diaresis
2 ' é    U+00E9 latin small letter e with acute
…  

i.e. it shows me that I could finish the sequence by typing an " and get ë.

Or I could select the candidates shown by typing the number in front of the candidate, i..e type a 1 to get ë.

Screenshot

@fSidel
Copy link
Author

fSidel commented Nov 29, 2022

Actually implementing this idea is not impossible on desktops, for example MacOS has this, see:

https://macpaw.com/how-to/type-accents-on-mac

I have this idea on my todo list for ibus-typing-booster.

But it is quite difficult on Xorg or Wayland to detect whether a long press has happened and I had no time yet to investigate how that might be possible.

I have read the article and that looks really cool, however I have no idea how someone would go around implementing such a feature. At first I thought that libinput could be able to handle the detection but you would have to implement some sort of timer or timeout and that's too high level for libinput so I guess it could be up to each compositor to implement such a feature. It probably won't happen because using the compose key along with tab to see each suggestion is a simpler approach.

@fSidel
Copy link
Author

fSidel commented Nov 29, 2022

You can also see in the screenshot that I didn’t actually type déjà but dejà, i.e. I “forgot” the accent on the e. But ibus-typing-booster shows me a candidate list where the correct spelling déjà is the first candidate. This is because I added the French dictionary in the setup and words are looked up accent insensitively in dictionaries.

That means if you type French words, you don’t have to type the accents directly, you can usually type the words without the accents and then select the correct spelling with accents from the candidates shown.

Yeah I just tried it and that works pretty well with french and german words, it had some difficulties when dealing with some short italian words (sì, papà, sé, lì, né, tè, là) but after writing a bit it adjusted itself pretty quickly and now typing-booster gives those suggestions without any problems. This probably happens because I am using three dictionaries simultaneously (I always switch the highest priority dictionary to match the language I am using, so maybe this happens only because those words are kind of an edge case).

@fSidel
Copy link
Author

fSidel commented Nov 29, 2022

Another way to type accents is to use Compose.

For details about what Compose is and how it works see: https://mike-fabian.github.io/ibus-typing-booster/docs/user/#5 Compose support

In this screenshot you can see that I did use the Gnome Control Center Keyboard tab to select Right Ctrl as my compose key.

Then (with ibus-typing-booster active, i.e. selected in the Gnome panel) I typed

compose e Tab

The Tab key opens a candidate list which shows me help how this compose sequence could be completed.

This works well, the dictionary suggestions help a lot but using the compose key is useful when those suggestions are not good enough.
Just to let you know, when using the horizontal layout the UI takes too much space as you can see in the following screenshot:
Horizontal Layout
It's legible when using the default vertical layout, however since the horizontal layout is an option I think that this is a problem you would want to address.

Anyway this looks really good and I thank you for your time, you've been incredibly helpful :)
I also filed an issue against gnome-shell here since at the time I didn't know about typing-booster, however I think that the issue could still be useful to discuss improvements on the user experience and user discoverability of this feature.
Not that I have problems with your tool, simply put ibus modules are not easily discoverable in the first place and it's a shame because typing-booster is a really powerful piece of software.

@mike-fabian
Copy link

mike-fabian commented Nov 29, 2022

I improved the display of the compose completions in horizontal lookup tables, see the screenshot and video at

mike-fabian/ibus-typing-booster#407

That improvement is included in:

Included in https://github.com/mike-fabian/ibus-typing-booster/releases/tag/2.19.10

@mike-fabian
Copy link

@fSidel Anything left to do here? Or can we close this?

(Accented characters on long press like on MaOS are an interesting idea for the future, maybe, if I have time I will look into that, it is already on my ToDo listr, but probably not soon)

@fSidel
Copy link
Author

fSidel commented Nov 30, 2022

@mike-fabian Sorry, I have kept you waiting. Yeah we can close this, I just tried the last release and the horizontal layout is fine. Thank you.

@fSidel fSidel closed this as completed Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants