README file from
GithubGallery Excluder
Keep media in your Obsidian vault out of Android gallery apps.
Gallery Excluder creates Android .nomedia files in selected vault folders. Your images remain ordinary files, so they still appear in Obsidian, work in embeds, and can be synchronized normally.
[!NOTE] You can configure the plugin on any platform, but it creates and removes
.nomediafiles only in Obsidian for Android.
Features
- Protect the entire vault, the configured attachment folder, or selected custom folders.
- Apply protection when the vault opens on Android and when a configured folder is created later.
- Leave any
.nomediafile that already exists at a target location untouched. - Track the paths it creates so they can be removed when automatic protection is turned off.
- Show a notice whenever protection files are created or a removal is attempted.
How it works
Android media scanners recognize a file named .nomedia as a request not to index media in that folder or its subfolders. Gallery Excluder places an empty .nomedia file at each location covered by the selected protection mode.
This affects compatible Android gallery and media apps only. It does not delete, move, encrypt, or hide files inside Obsidian.
Installation
Manual installation
- Download
main.js,manifest.json, andstyles.cssfrom the latest release. - Create
YourVault/.obsidian/plugins/gallery-excluder/. - Copy the three files into that folder.
- Restart Obsidian or reload the app.
- Open Settings → Community plugins and enable Gallery Excluder.
Build from source
Building from source generates main.js. The other two required plugin files, manifest.json and styles.css, are already included in the repository.
-
Install Node.js, which includes npm.
-
Clone the repository and open its folder:
git clone https://github.com/Calmtea5209/Gallery-Excluder.git cd Gallery-Excluder -
Install the exact dependencies recorded in
package-lock.json, then create a production build:npm ci npm run build -
After the build finishes, find the generated
main.jsin the project root. -
Create
YourVault/.obsidian/plugins/gallery-excluder/. -
Copy
main.js,manifest.json, andstyles.cssinto that folder. -
Restart Obsidian or reload the app.
-
Open Settings → Community plugins and enable Gallery Excluder.
The .obsidian folder and .nomedia files are hidden by many file managers. Enable hidden-file display if you need to inspect them.
Usage
Protection is enabled by default for the entire vault. On Android, Gallery Excluder applies the selected mode after the vault is ready. You can change its behavior under Settings → Gallery Excluder.
| Setting | What it does |
|---|---|
| Automatic protection | Creates and maintains .nomedia files when enabled. Turning it off removes files created by Gallery Excluder. |
| Protection mode | Chooses the folders that Gallery Excluder protects. |
| Apply protection now | Immediately applies the current configuration on Android when protection is enabled. |
Protection modes
| Mode | Protected location |
|---|---|
| Entire vault | The vault root, covering media throughout the vault. |
| Attachment folder only | The attachment folder configured under Obsidian's Files and links settings. |
| Custom folders | One or more vault-relative folders, such as attachments, assets, or images/screenshots. A configured folder can be created later. |
If Obsidian stores attachments relative to the current note, such as ./ or ./assets, there is no single vault-wide attachment folder. In Attachment folder only mode, Gallery Excluder asks for a fixed vault-relative fallback folder.
Old images still appear in your gallery
Creating .nomedia stops compatible media scanners from indexing the protected folders, but a gallery app may keep images that it indexed earlier. On Android:
- Open Settings → Apps, then select your gallery app.
- Tap Force stop.
- Open Storage, then tap Clear cache.
- Do not tap Clear data; that can reset the gallery app's settings.
- Restart the phone, then open the gallery app again.
Menu names may vary between devices and gallery apps. These instructions are also available in a collapsible help card at the bottom of the plugin settings page on Android.
Safety and limitations
- If
.nomediaalready exists when Gallery Excluder checks a target, the plugin does not overwrite or track it. - Turning automatic protection off deletes
.nomediafiles at paths recorded as plugin-created. If a different.nomediafile later replaces one at the same path, Gallery Excluder cannot distinguish it and will remove it too. - Changing protection modes does not remove files from the previous mode. Turn automatic protection off when you want to clean up all tracked files.
- Restarting Obsidian does not recreate managed files while automatic protection is off. Turn it on when you want the files created again.
- Some third-party gallery apps may ignore
.nomedia. - A
.nomediafile may sync to other devices. Windows, macOS, and iOS do not use it for Android media scanning, so it normally has no effect there. - Obsidian does not expose a reliable per-file API that lets this plugin exclude
.nomediafrom Obsidian Sync. - Absolute paths and paths containing
..are rejected. Missing or unwritable folders are reported without modifying other locations.