Skip to content

feat: folder notes integration#221

Open
piotrnajda3000 wants to merge 1 commit intogfxholo:mainfrom
piotrnajda3000:folder-notes-integration
Open

feat: folder notes integration#221
piotrnajda3000 wants to merge 1 commit intogfxholo:mainfrom
piotrnajda3000:folder-notes-integration

Conversation

@piotrnajda3000
Copy link

@piotrnajda3000 piotrnajda3000 commented Mar 4, 2026

Addresses #98

Note

This is vibecoded to make it work. Is it efficient? Does it make architectural sense? Not sure. However, it can serve as a starting point for anyone interested, as it's at least an MVP/POC, since it works for my need of adding an icon to a Folder Note.

Tip

If you want to use this now, feel free to go to my fork at https://github.com/piotrnajda3000/iconic/tree/folder-notes-integration, build the project, and copy main.js, manifest and styles.css into .obsidian/plugins/iconic.

image

Example

Rulebook:

image

With setting on for a Folder Note:

image

With setting off:

image

Changes Made (AI Generated)

  1. IconicPlugin.ts - Added a new setting integrateFolderNotes (boolean, default false) to the IconicSettings interface and DEFAULT_SETTINGS.

  2. Strings.ts - Added UI strings for the new setting:
    • integrateFolderNotes.name: "Folder Notes integration"
    • integrateFolderNotes.desc: "Apply file rules to folders when the matched file is that folder's Folder Note."

  3. IconicSettingTab.ts - Added a toggle control in the "Sidebars & tabs" section to enable/disable the Folder Notes integration.

  4. FileIconManager.ts - Implemented the core integration logic:
    • Added a folderNoteCache Map to cache folder → folder-note path mappings
    • Added clearFolderNoteCache() method to reset the cache
    • Added getFolderNotePath() helper method that:
    • Checks for detached folder notes first using Folder Notes plugin's excludeFolders settings
    • Computes attached folder note paths based on Folder Notes' folderNoteName, storageLocation, and folderNoteType settings
    • Falls back to supportedFileTypes if primary type not found
    • Modified refreshIcons() to clear the cache on each refresh
    • Modified refreshChildIcons() to:
    • For folders: check for a folder-note file ruling if no folder rule exists and integration is enabled
    • Apply the color-only folder-note rules by showing a colored default folder icon
    • Proper precedence: Folder rule > Folder-note rule > Manual folder icon

@gfxholo
Copy link
Owner

gfxholo commented Mar 8, 2026

Hi! I won't be using this particular solution in the plugin, since I don't use AI-generated code in my projects for maintenance reasons. I'll leave this PR open in the meantime though, since other people might find it useful. ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants