How to decrease the padding of dock icons in ubuntu 20.04

You can do this following these two steps described below -

  1. Change dashToDock extension setting -

    a. open dconf editor

    b. go to org/gnome/shell/extensions/dash-to-dock/

    c. turn on custom-theme-shrink

  2. Now you have to change theme css file -

    a. now go to /usr/share/themes/Yaru-dark/gnome-shell/

    (I'm assuming that you are using Yaru-dark shell theme)

    b. open gnome-shell.css file in a text editor

    c. search these lines of code -

    #dashtodockContainer.shrink .dash-item-container > StButton, #dashtodockContainer.dashtodock .dash-item-container > StButton {
    padding: 2px 4px !important; }
    

    d. change padding to -

    padding: 0px 0px !important;
    

Now restart your gnome-shell by pressing Alt+f2 and then running r command


If you're using a theme go to /home/{user}/.themes/{theme name}/gnome-shell/gnome-shell.css

or for system theme go to /usr/share/gnome-shell/theme

find this line of code

  #dashtodockContainer .show-apps .overview-icon {
  padding: 4px;
  background-size: contain;
}

and change padding to whichever value suits you. Log out and log back in.