20.04 - How to change the size and appearance of desktop icons and the way they are handled?
Since some previous versions of Ubuntu..
Desktop Icons are handled by desktop-icons
gnome-shell extension.
you can achieve the sizes and spacing you mentioned in Question by editing the extensions prefs.js
file. Take backup of the file before editing.
the extensions directory is /usr/share/gnome-shell/extensions/desktop-icons@csoriano
Original Content:
const ICON_SIZE = { 'small': 48, 'standard': 64, 'large': 96 };
const ICON_WIDTH = { 'small': 108, 'standard': 116, 'large': 116 };
const ICON_HEIGHT = { 'small': 86, 'standard': 102, 'large': 134 };
Edited Content:
const ICON_SIZE = { 'small': 48, 'standard': 64, 'large': 96 };
const ICON_WIDTH = { 'small': 52, 'standard': 116, 'large': 116 };
const ICON_HEIGHT = { 'small': 60, 'standard': 102, 'large': 134 };
I Have Configured the sizes for 'small', you can achieve with other sizes 'standard' and 'large' also.
Above method requires root privileges.. If you need to make changes locally..
Disable the system extension desktop-icons
.
gnome-extensions disable desktop-icons@csoriano
create the local extensions directory.
install -d $HOME/.local/share/gnome-shell/extensions
Copy the system extension desktop-icons
to local extensions directory and rename it as desktop-icons@csoriano-local
cp -r /usr/share/gnome-shell/extensions/desktop-icons@csoriano $HOME/.local/share/gnome-shell/extensions/desktop-icons@csoriano-local
Edit the metadata.json file of the local extension like below contents. Observe that "local" is the main change
{ we need to edit the metadata.json
file because extensions directory name and the UUID field in the metadata.json
file must match }
gedit $HOME/.local/share/gnome-shell/extensions/desktop-icons@csoriano-local/metadata.json
Already Edited Content:
{
"name": "Desktop Icons-local",
"description": "Add icons to the desktop",
"uuid": "desktop-icons@csoriano-local",
"shell-version": ["3.34.0"]
}
Enable the local extension with below command
gnome-extensions enable desktop-icons@csoriano-local
Refresh the gnome-shell with Alt+F2 'r' Enter method.
Make sure you never turn on both the extensions desktop-icons@csoriano
(System Extension) and desktop-icons@csoriano-local
(Local Extension)
For Ubuntu 21.04 you can change the size of the desktop icons by simply adjusting it via the desktop settings again.
Right click on the desktop->choose settings You can adjust the Icon size in the Dialog