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.
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 desktop-i[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!