Not only its slow, but when mouse cursor happens to be in the center of the screen, it selects the wrong language for you!
Install "issw" a small utility for macos to switch input sources from a command line.
git clone https://github.com/norflin321/input-source-switcher.git
cd input-source-switcher
mkdir build && cd build
cmake ..
make
make install
By default executable will be installed as /usr/local/bin/issw
import os
from pynput import keyboard
def on_press(key):
    key_str = '{0}'.format(key)
    if (key_str == '<179>'):
        stream = os.popen('/usr/local/bin/issw')
        output = stream.read().strip() 
        if (output == 'com.apple.keylayout.ABC'):
            os.system('/usr/local/bin/issw com.apple.keylayout.Russian')
        else:
            os.system('/usr/local/bin/issw com.apple.keylayout.ABC')
with keyboard.Listener(on_press=on_press, on_release=None) as listener:
    listener.join()
<179> is key code for fn. Don't forget to run issw -l in terminal to get list of available input sources and modify script above if needed!
- Install 
pynputpython module:/usr/bin/python3 -m pip install pynputor, if you are using your own python installation:/your/python3/executable/path -m pip install pynput - Inside 
fn.plistfile, change paths to the python executable (if you are using custom python installation) and the script file. Mine is/Users/norflin/fn.py. Paths should be full. - Copy the plist file to special directory: 
cp -R fn.plist ~/Library/LaunchAgents/. - Then run this command: 
launchctl load ~/Library/LaunchAgents/fn.plist- it will tell mac to run this file every time you log in. If you want to stop it runlaunchctl unload ~/Library/LaunchAgents/fn.plistand remove the filerm -rf ~/Library/LaunchAgents/fn.plist. - Mac might ask you to grant permission for python to monitor input from your keyboard and 
Accessibility. Generally macOS asking aboutInput Monitoring, add your python3 executable toAccessibilityif no popup with this showed. - Restart. Log in. It should work.
 
P.S. Don't forget to reinstall pynput after upgrades. Also see issue #2.
You can toggle input source with "fn" button, but without showing the pop up!

