Is there a way to change the recently typed word to the next input language with double click SHIFT button?

I would like to have a keyboard shortcut that changes the last typed word to the next input language.
For example, frequently you start typing with wrong input language and you realize it, you delete the word pressing backspace several times, you switch the input language with the shortcut and then you start typing again.

It would be great if bettertouchtool could do this with a shortcut like double shift press.

  1. delete last typed word
  2. change input language
  3. type the letters that were pressed

would this be just for updating the spell correction?

Maybe you could achieve this by combining some shortcuts.
On macOS shift + option + arrow left will select the current word to its beginning. Then ctrl+space will change the input language for that selected text

So maybe something like this would work:

i just did the same thing!
now i am trying to figure out how to use the transform selection with javascript to make it write the last word again after changing input language

that would be possible - however do you really need to write it again? On my system it seems just selecting it and changing the input language is enough to make macOS recognize the change.

mac os sonoma, the selected word is not getting replaced when pressing ctrl+space

ah I think understand - you are switching to a language with a different alphabet? (I'm usually just switching from english to german, and there the only thing that would change is the macOS spell correction)

I think automatically re-typing with a different character set would not work, but I'll have a look :-/

I think it can't be done by BTT alone. I could imagine using some online service that changes the alphabet of given input, but that might be too slow.

In theory you could use the "Transform & Replace Selection with ChatGPT" action like this, but it probably will be too slow:

Ι am trying something like that

async (clipboardContentString) => {
    var alphabet1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    var alphabet2 = "αβψδεφγηιξκλμνοπ;ρστθωςχυζΑΒΨΔΕΦΓΗΙΞΚΛΜΝΟΠ;ΡΣΤΘΩΧΥΖ";

    var newMessage = "";
    messageArr = clipboardContentString.split('');
    for (i in messageArr) {
        var char = messageArr[i];
        var index = alphabet2.indexOf(char);
        if (index !== -1) {
            newMessage += alphabet1.charAt(index);
        } else {
            index = alphabet1.indexOf(char);
            if (index !== -1) {
                newMessage += alphabet2.charAt(index);
            } else {
                newMessage += char;
            }
        }
    }
    return newMessage;
}

Is there a way to change input language from an action ?
The simulated key press does not work so well on Sonoma due to known bug for delay on switch input languages.

I think it should be easy to add an action that changes the input source, will do that later today!

1 Like

image
something else

I want the shift button to change the input language if pressed alone
I want double shift to do the transformation

with the above configuration double shift is never triggered. Is there a config for that (like priority)?

I think there is currently no way to achieve this. It's on my TODO list to add a "wait for x seconds" option to key sequences, so they will only trigger if no other input comes after a certain amount of time, but it's not yet integrated.

eagerly waiting..
if you implemented please inform

I think a "modifier" can basically be used for two actions.

(1) Down/up in max. 0.2 s

(2) Up only in max. 2 s

However, in the case of shift, this affects normal writing. So this is only recommended if you don't need shift for anything else. :slightly_smiling_face:

Since you probably have two shift keys, the alternative would be to distribute the two actions (always 1) to both keys. This does not interfere with normal writing, because the sequence is interrupted when you type shift + letter ... I hope.

sounds good, but as you say it is not as good for the shift button.
although there are 3rd party apps that can handle this, maybe with the delay @Andreas_Hegenberg said

If you are willing to trigger one action with the left shift key and the other with right shift, there should be no problems.

4.276 alpha contains an action "Change Input Source / Keyboard Layout" (currently uploading)

1 Like

thank you very much for this,
although a toggle input source (between languages not emojis or dictation) would be better
or is there a way to trigger an action from inside javascript that transforms the text?

it should show all keyboard layouts / languages you have configured, doesn't it?

yes it shows
image
but I want to toggle it not to specify it