FlorianWoelki / obsidian-iconize

Simply add icons to anything you want in Obsidian.
https://florianwoelki.github.io/obsidian-iconize/
MIT License
852 stars 58 forks source link

Set frontmatter when changing icon #380

Open Jademalo opened 7 months ago

Jademalo commented 7 months ago

Is your feature request related to a problem? Please describe. At present Iconize will load an icon specified in the icon: property of the frontmatter. This is good, however it only takes effect when the file is edited, when loading a new file, or when restarting the client after selecting "Remove Icon". It doesn't work when editing an .md file outside of Obsidian and reloading, nor if an icon is set with "Change Icon".

When using the "Change Icon" option in the right click menu, the icon is only set in data.json. This means that if you want to use the frontmatter for icons, you need to manually type the name of the icon and cannot use the icon picker.

Describe the solution you'd like I would like "Change Icon" to set the icon data in the frontmatter if "Use icon in frontmatter" is selected, or for there to be a separate option to have the addon write to frontmatter. Additionally, it would be an improvement if the icon could be loaded from the frontmatter on file load, instead of only on edit.

Additional context This would also work well with and apply to #358, essentially moving the two pieces of per file configuration into the frontmatter for those who prefer to have file metadata entirely in the files themselves.

JoshKasap commented 6 months ago

I second this request

DylanSpeiser commented 6 months ago

I'd like to see this too

nweii commented 5 months ago

Me too! I prefer for the authoritative icon information to stay in the frontmatter rather than in a separate, hidden config file. In general I think keeping note data within the note is better for future-proofing (the file over app philosophy is a key reason I use Obsidian).

benoitvalery commented 3 months ago

Interesting idea. But, is this compatible with the ability to change a folder icon?

suka97 commented 3 months ago

This reason is the one thing that is keeping me from using the plugin. I'd really prefer the information to be kept on the files themselves!

Interesting idea. But, is this compatible with the ability to change a folder icon?

In this case maybe an additional file could be created under the selected folder like "_folder_icons.md" or put it under the attachments subdirectory.
By using a plugin like Hide Folders this file could be visually hidden.

karaolidis commented 2 months ago

Perhaps an integration with the folder-note plugin's frontmatter could also work? Something like a folderIcon: property.

davidrsim-p commented 4 days ago

Interesting idea. But, is this compatible with the ability to change a folder icon?

An option would be to retain the existing functionality, but ALSO, when working with files, automatically write the icon info to frontmatter. Frontmatter (I think?) takes precedence.

That way we have a readily syncable and file over app approach, without breaking anything else. It would be minimal coding, since it would literally just be adding or updating a page property when an icon is assigned to a file (and a config option to turn this on/off!)