How do I enable 'minimize on click' on Ubuntu dock in 17.10 and later?

It seems as Ubuntu Dock is a fork of the popular and highly customisable Dash to Dock, Ubuntu Dock obeys (some) preferences set by Dash to Dock.

See Solution 2 (CLI method) for the simplest fix.


Solution 1 (GUI method)

Follow the steps below.

  1. Go to Dash to Dock's homepage at extensions.gnome.org.
  2. Turn the extension on by clicking on the toggle button.
  3. Reload the page. It should look like this:
    enter image description here
  4. Click on the "settings" symbol next to the toggle button which now says "ON". A window should pop up.
  5. Navigate to the "Behaviour" tab and select "Minimise" in "Click action".
    enter image description here
  6. Close this window and come back to Dash to Dock's homepage.
  7. Click on the toggle button to deactivate Dash to Dock.
    enter image description here

Now clicking on the icons of running applications in Ubuntu Dock should minimise/restore the focussed application window.


Solution 2 (CLI method)

Open Terminal and run

gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'

To revert to the default option, simply run

gsettings reset org.gnome.shell.extensions.dash-to-dock click-action

Alternative options: (may work only on newer Ubuntu Dock or Ubuntu versions)

  • To minimise when there is a single window of the application and show thumbnail previews if there more than one, run:

    gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize-or-previews'
    
  • To minimise when there is a single window of the application and show the Activities overview if there more than one, follow the answer by V T.

In general, run the following to see all possible permitted values

gsettings range org.gnome.shell.extensions.dash-to-dock click-action

use this command. it will show preview if multiple windows are opened and minimize if single window open.

gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize-or-overview'

Most of the answers are valid but I found out that enabling click to minimize will result in no preview of the open instances of the app.

Alternatively you can use Shift+Mouse middle click to minimize a window.

Tested this on ubuntu 18.04.1