I found multiple answers on askUbuntu about this topic. But none of them suites to Ubuntu 17.10. So I need to ask again:
How do I set focus follows mouse in Ubuntu 17.10?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
You may use (GNOME) Tweaks to achieve your goal. If it's not installed, first install it by running
sudo apt install gnome-tweak-tool
Launch Tweaks and go to the Windows section. Select "Sloppy" or "Secondary-Click" under Window Focus.
Alternatively you may run the following command
gsettings set org.gnome.desktop.wm.preferences focus-mode 'sloppy'