3

Starting with Ubuntu 20.10, and continuing in Ubuntu 21.04, the icon for RStudio project files and RData files was no longer showing up. It had been my experience in prior Ubuntu versions that these icons were correctly associated with the proper mimetype after installing RStudio.

enter image description here

So first I made sure that RStudio still added a mimetype entry for these on installation, finding in usr/share/mime/packages/rstudio.xml

  <mime-type type="application/x-r-data">
    <comment>R Data File</comment>
    <glob pattern="*.RData"/>
    <glob pattern="*.Rdata"/>
    <glob pattern="*.rdata"/>
    <glob pattern="*.rda"/>
  </mime-type>

  <mime-type type="application/x-r-project">
    <comment>R Project</comment>
    <glob pattern="*.Rproj"/>
    <glob pattern="*.RProj"/>
    <glob pattern="*.rproj"/>
  </mime-type>

If, that wasn't the issue, I was a little stumped, so I checked to see if others had this problem. I sure enough found an issue filed at Yaru's GitHub repository, but so far it seems like there hasn't been any movement on fixing this issue.1 How can I get these icons back while we wait on the Yaru devs?


1. There has been some movement on the issue as filed, which affects several icon sets, but none of it on the RStudio icons.

1 Answer 1

5

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.

1
  • 1
    Also works on Ubuntu 22.04. Thanks!
    – Gorka
    Aug 18, 2022 at 12:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .