switch keyboard depending on foreground app

by L Schmidt

Version 2 (July 29, 2021)

Download (63 downloads)

One size doesn't always fit all. That's the case with input methods (soft keyboards), as for different apps one keyboard is often favoured over another.
Some keyboards allow switching input methods, but bad luck if you like to use one which doesn't.
As my typing needs are usually either of conversational type, for which I prefer "swiping" type writing, or system related (cursor keys, control chars, Esc, function keys, etc), I can distinguish between two groups of app types. With one group, I want a conversational swiping type keyboard (I'm using Swype for this purpose), for the other group I like to use Hackers' keyboard or Nextapp.
This flow switches and activates the proper keyboard for each app of either group automatically.
There are two things to do for customizing this flow:
1. Create a list with package names, write it to a file.
By default, the name and location {storage()}/Automate/keyboard/apps are used, but you can of course change this to your liking, in the block directly below flow start.
For any app on that list, the alternative keyboard will be used. Apps not on that list use the default keyboard.
2. Package names of default and alternative keyboards are needed.
By default does this flow interactively prompt you with two selector dialogs. First dialog for default keyboard, second dialog for alternative keyboard. You may want to set these statically. Provisions to demonstrate how that's done are included (assign keyboard package names to variables "default" and "alternative")
After that, and running the flow, you can enjoy being presented the correct keyboard with any of your apps.