Can I make Ubuntu 18.04 switch between multiple windows of the program by just clicking the icon?
You can do
gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'cycle-windows'
If you mean Enabling Click to Minimize (minimize the window when clicking on the icon) as shown in the gif photo:
It is simple, you can do that by running the following command in your terminal:
gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'
If you do not like ‘click to minimize’ behavior, you can set it back to default using the command below:
gsettings reset org.gnome.shell.extensions.dash-to-dock click-action