How can I fix missing icons for RStudio project and RData files in Ubuntu 20.10+?

Solution 1:

I noticed from a discussion on a Fedora forum that the hicolor icon set had the relevant .png files. So, first we need to copy those .png files into the Yaru set, which you can do with these commands:

sudo cp /usr/share/icons/hicolor/16x16/mimetypes/application-x-r-data.png /usr/share/icons/Yaru/16x16/mimetypes/
sudo cp /usr/share/icons/hicolor/16x16/mimetypes/application-x-r-project.png /usr/share/icons/Yaru/16x16/mimetypes/
sudo cp /usr/share/icons/hicolor/32x32/mimetypes/application-x-r-data.png /usr/share/icons/Yaru/32x32/mimetypes/
sudo cp /usr/share/icons/hicolor/32x32/mimetypes/application-x-r-project.png /usr/share/icons/Yaru/32x32/mimetypes/
sudo cp /usr/share/icons/hicolor/48x48/mimetypes/application-x-r-data.png /usr/share/icons/Yaru/48x48/mimetypes/
sudo cp /usr/share/icons/hicolor/48x48/mimetypes/application-x-r-project.png /usr/share/icons/Yaru/48x48/mimetypes/

Next we need to refresh the icon cache, which for some reason for me didn't work without touching the root directory (h/t to this answer):

sudo touch /usr/share/icons/Yaru
sudo gtk-update-icon-cache

Then either re-open or refresh the file explorer, and voila!

enter image description here

Now you can have your precious RStudio Project and RData icons in the meantime until they're properly back in Yaru.