KeyMapper icon indicating copy to clipboard operation
KeyMapper copied to clipboard

Compose key (multi key) on physical keyboard

Open MicaelJarniac opened this issue 3 years ago • 6 comments

Developer TODO (don't remove)

  • [ ] create new branch. put issue number at start of name
  • [ ] update documentation
  • [ ] merge and delete branch (don't squash because want commit history to see why I made changes)

https://en.wikipedia.org/wiki/Compose_key

I've asked if it was possible to use the Compose key on Android and was suggested this app. https://android.stackexchange.com/questions/248064/compose-key-multi-key-on-physical-keyboard/248070#248070

The idea of a Compose key is to easily be able to type special chars by "composing", or "combining", other chars.

For example:

  • Compose + c + , = ç
  • Compose + a + ~ = ã

Usually, Compose is mapped to a key that isn't often used, like Right Alt or Caps.

It's possible to customize the combinations and resulting chars by using special files: https://github.com/kragen/xcompose

MicaelJarniac avatar Aug 19 '22 16:08 MicaelJarniac

Shouldn't you be able to do this already with the "sequence" triggers and "input text" actions? You won't be able to create a trigger where you hold down the compose key but that shouldn't be an issue. You would have to create different key maps for every character though.

sds100 avatar Aug 20 '22 13:08 sds100

Shouldn't you be able to do this already with the "sequence" triggers and "input text" actions? You won't be able to create a trigger where you hold down the compose key but that shouldn't be an issue. You would have to create different key maps for every character though.

I'm testing it out. For very basic things, this might almost do the trick, but I wouldn't say this is a perfect solution.

As far as I know, holding down the Compose key isn't a thing; it's usually just pressed and released quickly before a sequence, so that shouldn't be a problem.

But there are many Compose sequences, and manually recreating each on the app would be quite a task. Many of them also have duplicates to allow for example Composec, and Compose,c to work.

Also, a problem that I'm facing now is that after assigning Right Altc, to input "ç", my c no longer types "c", nor does my , type ",". I suppose it might be something I did wrong, though.

I'll look at how key maps are shared for this app because I might be able to write a simple script to convert a Compose file to a file this app supports.

But it'd be awesome if this app supported Compose files natively.

MicaelJarniac avatar Aug 20 '22 16:08 MicaelJarniac

If I enable "Do not remap" for both c and , on the action I created, then those keys still work individually, but when using the action, I get "c,ç" instead of just "ç".

MicaelJarniac avatar Aug 20 '22 16:08 MicaelJarniac

Also, another issue with the "manual" approach of recreating each Compose sequence individually, is that it then becomes very tricky to later on change the Compose key itself, because it'll be "hard-coded" on every individual action, so there wouldn't be an easy way to say "now my Compose key is Caps instead of Right Alt."

MicaelJarniac avatar Aug 20 '22 16:08 MicaelJarniac

I've been searching around a bit and haven't come across anything else yet; the closest thing to Compose on Android so far has been this app.

Here are the drawbacks I can think of for simply converting a Compose file to a file this app understands:

  • Wouldn't be possible to, later on, change what key is the Compose key; it'd be hard coded to each mapping individually
  • Would pollute the mapping list a lot, making it hard to use your app for anything else since it'd be quite a chore to navigate around the hundreds of automatically created mappings
  • Would be very tricky to manage what Compose sequences are currently available, to remove them all at once, and switch "Compose files"

So what I was thinking was to add a separate section dedicated to configuring the Compose functionality, where one would be able to import Compose files (preferably more than one) and configure a Compose key. It'd all then work from there. It'd also be nice to have a place to "preview" the selected Compose files, a nice way to visualize them and potentially also search for things like if I wanted to know how to input a specific character, I could search for it and see what Compose sequences can make it.

Another benefit of adding this functionality to this app, instead of a separate dedicated app, would be that it could work together with regular mappings from this app. If it were a separate app, because it needs a special keyboard to be selected on Android, both apps wouldn't be able to work at the same time, it'd be either one or the other.

As I mentioned, I haven't been able to replicate a Compose sequence with this app manually. It'd either completely disable the keys used on the Compose sequence, or it'd input them twice on the sequence. For example, if I configure "Right Altc, = ç", I'd either be unable to type "c" or "," normally outside the sequence, or when doing the sequence, I'd get "c,ç" instead of just "ç". I tried searching around on the FAQ and known issues of this app, and couldn't find a solution to this.

If I manage to get that to work, I could then write my own little script to convert a Compose file to a Key Mapper file, and that might do the trick for the time being.

MicaelJarniac avatar Aug 30 '22 16:08 MicaelJarniac

Second this. This is very useful under Linux on desktops and laptops (and probably under other OSes).

Iey4iej3 avatar Dec 10 '22 09:12 Iey4iej3