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.
For UBUNTU 22.04, please SCROLL DOWN & see the update section!
Change Desktop Icon Size in Ubuntu 20.04
The desktop in Ubuntu 20.04 Gnome is handled via an extension called ‘Desktop Icons‘. It offers options, either via Gnome Tweaks or Extensions tool, to select from Small, Standard, and Large icon sizes.
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/[email protected]/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.
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:
- Open terminal (Ctrl+Alt+T) and run command to disable system desktop icons extension:
gnome-extensions disable [email protected]
- 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
- Copy the system ‘Desktop Icons’ extension to local directory and rename it via command:
cp -r /usr/share/gnome-shell/extensions/[email protected] $HOME/.local/share/gnome-shell/extensions/[email protected]
- Edit the metadata.json file, and change the uuid value to match the new name by running command:
gedit ~/.local/share/gnome-shell/extensions/[email protected]/metadata.json
When the file opens, write the new uuid name so it will look like:
- Finally hack this local extension to change the icons size and spacing:
gedit ~/.local/share/gnome-shell/extensions/[email protected]/prefs.js
- And enable the local extension via command:
gnome-extensions enable [email protected]
- Finally restart Gnome Shell and enjoy!
Change Desktop Icon Size in Ubuntu 22.04
Ubuntu 22.04 switches to DING (Desktop Icons NG) extension to handle desktop icons. Normally, you can change the icon size via “Appearance” settings page.
- 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/[email protected]/enums.js
Then edit the sizes as the picture shows you:
- Next, search for and open “Gnome Extensions” app via Activities overview screen.
sudo apt install gnome-shell-extension-prefscommand 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” page and select a desktop icon size to see the magic!