How to Change Desktop Icon Size & Spacing in Ubuntu

Change the size of desktop icons, custom sizes supported, in Ubuntu 24.04, Ubuntu 22.04, and/or Ubuntu 20.04.

Too many application shortcuts, files, and folder icons on your desktop, and no more spaces to have more? Well, you can change the icon sizes as well as icon spacing (Horizontal and Vertical) to save your desktop spaces.

In all current Ubuntu with the default GNOME Desktop, the desktop icons are handled by extensions. They are Desktop Icons extension for Ubuntu 22.04, and DING (Desktop Icons NG) for Ubuntu 22.04 and Ubuntu 24.04. To change the icon size, they include option to switch between built-in sizes, though user can edit the code for custom sizes.

Change Desktop Icon Size in Ubuntu 20.04

The desktop in Ubuntu 20.04 Gnome is handled via an extension called ‘Desktop Icons‘. User can install either “Gnome Tweaks” or “Gnome Extensions” tool to open up the preferences dialog for that extension. And, it offers option to change icon size between Small, Standard, and Large

What if the three icon sizes do not meet your requirement? Let’s hack the extension.

1. Edit the extension file:

Press Ctrl+Alt+T on keyboard to open terminal, then run command to edit the file via Gedit text editor:

sudo -H gedit /usr/share/gnome-shell/extensions/desktop-icons@csoriano/prefs.js

When the file opens, scroll down and find out the lines for ‘ICON_SIZE’, ‘ICON_WIDTH’, and ‘ICON_HEIGHT’. And change the value of which you want.

While changing ‘ICON_SIZE’ impacts on real icon sizes, editing ‘ICON_WIDTH’ and ‘ICON_HEIGHT’ will change the icon selection area width and height, which impact on horizontal and vertical spacing.

2. Restart Gnome Shell:

After made your changes, save the file and press Alt+F2, type r in ‘Run a Command’ box, and hit Enter to restart Gnome Shell to apply changes.

Known Issue:

There’s a known issue that a regular system extension update will override what you did in previous steps.

As a workaround, you may disable system ‘Desktop Icon’ extension and create your own one with following steps:

  1. Open terminal (Ctrl+Alt+T) and run command to disable system desktop icons extension:
    gnome-extensions disable desktop-icons@csoriano
  2. Create the local extensions directory (skip this step if you’ve installed an extension from extensions.gnome.org) via command:
    install -d $HOME/.local/share/gnome-shell/extensions
  3. Copy the system ‘Desktop Icons’ extension to local directory and rename it via command:
    cp -r /usr/share/gnome-shell/extensions/desktop-icons@csoriano $HOME/.local/share/gnome-shell/extensions/desktop-icons@csoriano-local
  4. Edit the metadata.json file, and change the uuid value to match the new name by running command:
    gedit ~/.local/share/gnome-shell/extensions/desktop-icons@csoriano-local/metadata.json

    When the file opens, write the new uuid name so it will look like:

  5. Finally hack this local extension to change the icons size and spacing:
    gedit ~/.local/share/gnome-shell/extensions/desktop-icons@csoriano-local/prefs.js
  6. And enable the local extension via command:
    gnome-extensions enable desktop-icons@csoriano-local
  7. Finally restart Gnome Shell and enjoy!

via:askubuntu

Change Desktop Icon Size in Ubuntu 22.04/24.04

Since Ubuntu 22.04, it switches to DING (Desktop Icons NG) extension to handle desktop icons. Normally, you can change the icon size via “Appearance” settings page.

NOTE: for Ubuntu 24.04, the setting option is now under ‘Ubuntu Desktop‘ tab.

Change Desktop Icon Size the normal way

To set custom icon sizes, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run command to edit the config file:

sudo gedit /usr/share/gnome-shell/extensions/ding@rastersoft.com/enums.js

For Ubuntu 24.04, run this command instead:

sudo gnome-text-editor /usr/share/gnome-shell/extensions/ding@rastersoft.com/app/enums.js

When the file opens, change the number value of ‘ICON_SIZE’, ‘ICON_WIDTH’, ‘ICON_HEIGHT’, and save file.

Next, press Super (Windows logo) key to open overview screen, search for and open “Gnome Extensions” app.

Run sudo apt install gnome-shell-extension-prefs command to install the app if you don't have it

And, finally turn off “Desktop Icons NG” extension and re-enable it to apply changes.

Now, re-open “Settings > Appearance (or Ubuntu Desktop)” page and select a desktop icon size to see the magic!

Exit mobile version