How do I set focus follows mouse in Ubuntu 17.10 and later with GNOME 3?

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?


Solution 1:

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.

enter image description here

Alternatively you may run the following command

gsettings set org.gnome.desktop.wm.preferences focus-mode 'sloppy'

etc.