Best practices with .nomedia

Hi everyone!

What are currently considered the best practices in using .nomedia touch files (to avoid media being indexed)?

  • should SailfishOS native applications drop their own files? (I’ve seen a few Android apps doing exactly that)
  • should we leave it to the end user to decide and create the files themselves?

Stellarium comes with a very large amount of pictures (backgrounds, constellations in various cultures, etc.) which “pollute” the Gallery.

  • Should I upgrade the .spec file so the RPM drops a .nomedia inside Stellarium’s datadir ?
1 Like

Only /home is indexed. You should not install anything to /home. If that files are installed by an app running by user it should be an option in app settings that allows to index pictures from datadir or not. Average user knows nothing about .nomedia files but always cares about “polluted” Gallery.

1 Like

In this specific case, /run/media/ is also indexed, and offloading datadir to SD card + symlink in /usr/share is a popular procedure.

So I guess the ‘pollution’ only happens to users who have done that sdcard move? Otherwise data is in /usr/share and thus not indexed?


An alternative could be to make the app configure Tracker via dconf/gsettings to ignore that storage area.

This way it could be made configurable per-user.

org.freedesktop.Tracker3.Miner.Files ignored-directories ['po', 'CVS', 'core-dumps', 'lost+found', '$HOME/android_storage/Android']


I can’t remember the thread, but there was a suggestion of installing to /home/.system/ …

But if a ‘.nomedia’ file works, that’s a simple solution. Why not?

For Stellearium I had simply moved the files to :slight_smile:


and generated symlinks in the application folder:

data → /home/defaultuser/.local/share/me.lduboeuf.stellarium/stellarium/data

Should end user is skilled enough to create symlink then is skilled enough to create .nomedia and take care of “pollution” themselves.


It is?
Seems wrong to me. On a stationary GNU/Linux it used to be relatively common to mount /usr/share from a different partition, but that is not the same as abusing a user-mounted SDCard for that. Expand your root partition instead.

In any case, you are free to drop a .nomedia in /usr/share top level directory (wherever that is on your SDCard).

Until the recent models with significant storage (my current Xperia 10iii and PinePhone Pro both have 128GiB storage), saddly this wasn’t a (good) option: there wasn’t that much storage to expand upon without needing to compromise the home partition.

The usual strategy isn’t straigh mounting /usr/share (that would render the phone unbootable if the card is missing) but just moving a couple of very large directories used by applications to the SD-card and putting symlinks to those back in /usr/share

Yeah, right, overlooked this. Indeed most of the users crazy enough to play with symlinks would know to drop a .nomedia

1 Like