mike-fabian / ibus-typing-booster

ibus-typing-booster is a completion input method for faster typing
https://mike-fabian.github.io/ibus-typing-booster/
Other
233 stars 15 forks source link

[ENHANCEMENT] Configurable Emoji trigger key #279

Closed asbjornenge closed 2 years ago

asbjornenge commented 2 years ago

Hi there!

And thanks for saving my life moving from mac to linux with this :star_struck:

I've been using https://matthewpalmer.net/rocket/ for years on the mac, and moving to linux now I was really frustrated until I found this projects 👌

However, I was wondering, would it be possible to add an option to trigger the searchbox with the suggestion key first?

I would like to start with the suggestion key and then type the emoji I'm searching for 😅 Like so: :heart instead of heart: like I have to type now 😅 thanks!

mike-fabian commented 2 years ago

Are you using this only for emoji or also for completing normal (English?) words?

mike-fabian commented 2 years ago

I ask because if your only interest is emoji, then you probably want to use the option

☑️ Unicode symbols and emoji predictions

Because then emoji are always searched without adding any special key to trigger emoji search.

This is off by default because the search for emoji causes some slowdown which is not so nice if the main purpose is to type text in some language like English.

If this option is off, you can still trigger emoji search by adding an underscore before or after the search term, i,e. when searching for heart you can type _heart or heart_ (it makes no difference whether the underscore is before or after the search term).

If this option is on, you don’t need to add the underscore as it searches for emoji always.

If you don’t care for normal words at all, you might also want to tweak the dictionary settings so you don’t get any normal words suggested but only emoji.

To do that, you can choose dictionaries for the right language which support only emoji but not “Spellchecking”.

For example these two dictionaries support emoji but not spell checking:

fr 🌍 French: Spell checking ❌ Emoji ✔️ en 🌍 English: Spell checking ❌ Emoji ✔️

In contrast to these which support both Spell checking and Emoji:

en_US 🇺🇸 English (United States): Spell checking ✔️ Emoji ✔️ fr_FR 🇫🇷 French (France): Spell checking ✔️ Emoji ✔️

If you only care to search for emoji using American English, you can even remove all dictionaries from the setup, emoji search in American English always works by default.

For emoji you only need to add more dictionaries if you want to be able to search for emoji in other languages.

mike-fabian commented 2 years ago

:heart` instead of heart:

The colon : actually has no special meaning when searching for emoji, it does not matter whether you type :heart, heart: or just heart it always searches for an emoji containing “heart”.

It is similar for the underscore, underscores at the beginning or the end of the typed text are stripped and only the remaining text is used to search for emoji. The underscores have only the function to enable the emoji search even if the option

☐ Unicode symbols and emoji predictions

is off.

And one can use underscores to concatenate several search words for emoji:

cat will find something like 🐱 heart will find something like ❤️ heart_cat or cat_heart (order does not matter) will find something like 😻

mike-fabian commented 2 years ago

The colon is part of some ASCII emoji search terms though. For example:

:-( will find 😞 disappointed face :-) will find 🙂 slightly smiling face

etc....

mike-fabian commented 2 years ago

If you also want to type English text while ibus-typing-booster is active and don't want to change the input method to type English text, then I suggests to switch the option

☐ Unicode symbols and emoji predictions

off for maximum speed when typing English text and enable the emoji search with the underscore _.

If you don’t want completions of English words suggested:

When the option “☐ Off the record mode” is off, completions of English words might still be offered based on words you typed before which have been saved to the user database, even if no dictionary with English words is used.

However, letting your typing be saved to the user database can also help for emoji.

For example, when typing

_cat you get 🐱, 🐈, 😹,... and other cat emoji suggested.

If you select 🐈 most of the time and saving to the user database is enabled, 🐈 will appear as the first choice because in the user database it is remembered what was used most often.

You can clear the user database with the “Delete learned data” button in the setup tool.

asbjornenge commented 2 years ago

Hey 😊 Thanks for a very details and fantastically useful response to my proposal 🙌

I changed the default "enable" trigger to be ":" instead of "Tab" or what it was by default 😅

I am using it only for emoji searches yes. I'll be sure to try out your suggestions tomorrow! Sounds like what I want is Unicode symbols and emoji predictions with and emoji only dictionary and test the _ feature 👍

I'll investigate a bit tomorrow and close the issue if I have no further questions.

Thanks!

mike-fabian commented 2 years ago

I changed the default "enable" trigger to be ":" instead of "Tab" or what it was by default 😅

That is an interesting idea! But as you noticed it doesn’t work at the beginning of a word.

Maybe it would be better to make the emoji trigger key, which is currently hardcoded as underscore _ configurable so one could also choose : for that if one likes?

I didn’t use : by default for that because : is quite common in English text and would thus trigger emoji search often for people who just want to type English and don’t care about emoji. _ is easy to type on most keyboard layouts and very rare in normal text. But if the emoji trigger key could be changed with a new option to be : that would be fine.

asbjornenge commented 2 years ago

Having the emoji trigger key configurable would be :ok_hand:

I'm still going back and forth between my macbook and the linux workstation, so I'm trying to get the typing as similar as possible :sweat_smile:

I'll update the issue description accordingly.

mike-fabian commented 2 years ago

While testing for this issue here I found this small problem

https://github.com/mike-fabian/ibus-typing-booster/issues/280

mike-fabian commented 2 years ago

Are you using Fedora or some other distribution?

asbjornenge commented 2 years ago

I'm on Ubuntu 20.04.4 :raised_hands:

mike-fabian commented 2 years ago

Ah, OK, I was just asking because I build test packages of unreleased versions often for Fedora and openSUSE.

But if you are on Ubuntu you could still easily build from source from git if I have an improvement ready for testing.

mike-fabian commented 2 years ago

New option:

Emoji trigger characters:             [ _:                         ]

Default is only _ but you can change it to : or even add several characters if you like.

Typing one of these trigger characters at the beginning or end of a word enable emoji lookup even if the option “☐ Unicode symbols and emoji predictions” is off:

Screenshot

mike-fabian commented 2 years ago

Test builds of ibus-typing-booster 2.15.23 for Fedora are here:

https://copr.fedorainfracloud.org/coprs/mfabian/ibus-typing-booster/builds/

For openSUSE here:

https://build.opensuse.org/package/show/home:mike-fabian/ibus-typing-booster

mike-fabian commented 2 years ago

If you want to build from source, here is the branch for the release candidate:

https://github.com/mike-fabian/ibus-typing-booster/tree/release-candidate-2.15.23

mike-fabian commented 2 years ago

Instructions on how to build from source are here:

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

asbjornenge commented 2 years ago

Woah, that was fast! Thanks a bunch, I'll see if I can find some time to try this out later today :+1: Will report back!

mike-fabian commented 2 years ago

If : is used as a trigger character, then one needs to type ::-) to match the :-) 🙂 “Slightly smiling face” emoji (The first : is cut off when searching because it is only the trigger character:

Screenshot

mike-fabian commented 2 years ago

Woah, that was fast! Thanks a bunch, I'll see if I can find some time to try this out later today +1 Will report back!

When building on Ubuntu, the following packages should be installed:

autopoint, autoconf, automake, python3, ibus, libibus-1.0-dev, make, gcc

Then download, build, and install like this:

$ git clone git://github.com/mike-fabian/ibus-typing-booster.git
$ git checkout -t origin/release-candidate-2.15.23
$ $ ./configure --prefix=/usr --libexecdir=/usr/lib/ibus
$ make
$ sudo make install
mike-fabian commented 2 years ago

Documentation updated to mention the new emoji trigger keys:

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

asbjornenge commented 2 years ago

Tried to build now 😅 But there is no configure script 🤔 Should I use autogen.sh instead?

mike-fabian commented 2 years ago

Ah, sorry, yes!

$ git clone git://github.com/mike-fabian/ibus-typing-booster.git
$ git checkout -t origin/release-candidate-2.15.23
$ ./autogen.sh --prefix=/usr --libexecdir=/usr/lib/ibus
$ make
$ sudo make install

autogen.sh already runs the configure then.

asbjornenge commented 2 years ago

Make is failing me 🤔


make[1]: Entering directory '/home/asbjorn/srv/asbjornenge/ibus-typing-booster/po'
test ! -f ./ibus-typing-booster.pot || \
  test -z "ar.gmo ca.gmo cs.gmo de.gmo es.gmo fa.gmo fr.gmo he.gmo hu.gmo it.gmo ja.gmo nl.gmo or.gmo pl.gmo pt.gmo pt_BR.gmo si.gmo sv.gmo sw.gmo tr.gmo uk.gmo zh_CN.gmo zh_TW.gmo" || make ar.gmo ca.gmo cs.gmo de.gmo es.gmo fa.gmo fr.gmo he.gmo hu.gmo it.gmo ja.gmo nl.gmo or.gmo pl.gmo pt.gmo pt_BR.gmo si.gmo sv.gmo sw.gmo tr.gmo uk.gmo zh_CN.gmo zh_TW.gmo
make[2]: Entering directory '/home/asbjorn/srv/asbjornenge/ibus-typing-booster/po'
rm -f ar.gmo && : -c --statistics -o ar.gmo ar.po
mv: cannot stat 't-ar.gmo': No such file or directory
make[2]: *** [Makefile:142: ar.gmo] Error 1
make[2]: Leaving directory '/home/asbjorn/srv/asbjornenge/ibus-typing-booster/po'
make[1]: *** [Makefile:172: stamp-po] Error 2
make[1]: Leaving directory '/home/asbjorn/srv/asbjornenge/ibus-typing-booster/po'
make: *** [Makefile:523: all-recursive] Error 1
``
mike-fabian commented 2 years ago

Probably I forgot something in the build requirements, checking ...

mike-fabian commented 2 years ago

Do you have /usr/bin/msgfmt (On Fedora that is in the gettext package).

mike-fabian commented 2 years ago

On Debian/Ubuntu it also seems to be in the gettext package.

mike-fabian commented 2 years ago

Make is failing me thinking

make[1]: Entering directory '/home/asbjorn/srv/asbjornenge/ibus-typing-booster/po'
test ! -f ./ibus-typing-booster.pot || \
  test -z "ar.gmo ca.gmo cs.gmo de.gmo es.gmo fa.gmo fr.gmo he.gmo hu.gmo it.gmo ja.gmo nl.gmo or.gmo pl.gmo pt.gmo pt_BR.gmo si.gmo sv.gmo sw.gmo tr.gmo uk.gmo zh_CN.gmo zh_TW.gmo" || make ar.gmo ca.gmo cs.gmo de.gmo es.gmo fa.gmo fr.gmo he.gmo hu.gmo it.gmo ja.gmo nl.gmo or.gmo pl.gmo pt.gmo pt_BR.gmo si.gmo sv.gmo sw.gmo tr.gmo uk.gmo zh_CN.gmo zh_TW.gmo
make[2]: Entering directory '/home/asbjorn/srv/asbjornenge/ibus-typing-booster/po'
rm -f ar.gmo && : -c --statistics -o ar.gmo ar.po
mv: cannot stat 't-ar.gmo': No such file or directory
make[2]: *** [Makefile:142: ar.gmo] Error 1
make[2]: Leaving directory '/home/asbjorn/srv/asbjornenge/ibus-typing-booster/po'
make[1]: *** [Makefile:172: stamp-po] Error 2
make[1]: Leaving directory '/home/asbjorn/srv/asbjornenge/ibus-typing-booster/po'
make: *** [Makefile:523: all-recursive] Error 1
``

I get exactly that build failure if I remove the “gettext” package on my Fedora 36.

So sudo apt-get install gettext should help on Ubuntu.

mike-fabian commented 2 years ago

After installing gettext, try again with

$ git clean -dxf
$ ./autogen.sh --prefix=/usr --libexecdir=/usr/lib/ibus
$ make
$ sudo make install
asbjornenge commented 2 years ago

Managed to get it built, but could not open the setup stuff after :sweat_smile: Managed to rollback installing the one in ubuntu repo :+1:

I'll just sit tights and wait for an update to that one :wink:

thanks a bunch for adding this! Can't wait to use it :grimacing:

mike-fabian commented 2 years ago

Managed to get it built, but could not open the setup stuff after sweat_smile Managed to rollback installing the one in ubuntu repo +1

Weird.

I'll just sit tights and wait for an update to that one wink

thanks a bunch for adding this! Can't wait to use it grimacing

I'll make a release today then.

I found no serious problems although I found a minor detail which I should improve. But I’ll go on vacation soon and will probably do that after the vacation.

mike-fabian commented 2 years ago

Included in ibus-typing-booster-2.15.25:

https://github.com/mike-fabian/ibus-typing-booster/releases/tag/2.15.25

mike-fabian commented 2 years ago

The remaining “minor detail” problem is this:

https://github.com/mike-fabian/ibus-typing-booster/issues/289

If this bothers you, you could try the mentioned workaround of using “off the record mode” and clearing the user dababase.

This workaround might be OK for you as you are only interested in emoji.

But even if you are only interested in emoji, it would be nice if the user database could be used.

For example typing :dog will match

🐶 dog face 🐕 dog “dog2” 🐕‍🦺 service dog 🐩 poodle [dog] 🌭 hot dog 🦮 guide dog 𑠻 dogra abbreviation sign ⺨cjk radical dog ⽝ kangxi radical dog

It would be nice if the order of that list changed according to what was used most often.

Although it is not terribly bad if the order is fixed as the number of matches isn’t huge in most cases, one usually does not have to scroll through several pages of candidates.

mike-fabian commented 2 years ago

I have fixed https://github.com/mike-fabian/ibus-typing-booster/issues/289 now and the fix is included in https://github.com/mike-fabian/ibus-typing-booster/releases/tag/2.15.27