How to switch the keyboard input language from the terminal?


I already have one way to do this:

function input-switch-darwin() {
    cliclick kd:ctrl kp:space ku:ctrl
}

But this is very slow:

❯ time cliclick kd:ctrl kp:space ku:ctrl
cliclick kd:ctrl kp:space ku:ctrl  0.02s user 0.03s system 13% cpu 0.434 total; max RSS 7088