Closed a-rock-lobster closed 9 months ago
Hi @a-rock-lobster,
I'm also a user of obsidian-icon-folder
and thus I know how it works from UI side, user perspective
I've quickly examined internals of that plugin and it looks it exposes the data necessary to group items in File Explorer by
the custom sort plugin. So far so good.
The potential challenge could be how the user knows the exact name of icon to enter in sortspec YAML. For example, the visually selected icon AlarmLine
of the (Ri)
pack is internally stored (by the obsidian-icon-folder
) under the name RiAlarmLine
.
thanks for your suggestion! It looks like it could be turned into a new feature of the custom sort plugin
BTW I'll become unavailable for about two weeks from now, thus not responding in this thread
Super, thanks for following up so quickly!
I think that if the icon names are atleast consistant that shouldn't be a problem i.e. if the icon pack name, such as Ri, is always at the front as in your example.
Hi @a-rock-lobster,
I did a deep dive research of how the obsidian-icon-folder
works and I found it troublesome to determine if an item display an icon in File Explorer. This is because the icon can be displayed as a result of any of the below conditions:
For me it looks that the integration with obsidian-icon-folder
plugin should be done in a fully-fledged fashion, that is handling of all (A), (B), (C) and (D) cases. Partial integration (e.g. ignoring the (D) case) would result in a behavior confusing to the user: s/he sees an icon on an item in Folder Explorer and at the same time the item is ignored by a seemingly correct custom sorting-spec.
In turn, knowing that the custom sorting plugin should correctly recognize (A), (B), (C) and (D) cases means that the logic of obsidian-icon-folder
plugin should be reproduced, especially for (D). This is definitely not the way to go.
I will inquiry with the author of obsidian-icon-folder
plugin (@FlorianWoelki) if he can expose some simple integration API on his plugin to be consumed by other plugins (like custom sorting). Seeing the long list of open tickets of 'obsidian-icon-folder' doesn't look promising.
Anyways, the next step is to open a new ticket there asking for exposing of the new API for integration.
Hi @a-rock-lobster,
I did a deep dive research of how the
obsidian-icon-folder
works and I found it troublesome to determine if an item display an icon in File Explorer. This is because the icon can be displayed as a result of any of the below conditions:
(A) icon configured directly on the folder or file -> handling is easy peasy lemon squeezy
(B) icon configured on a parent folder as 'inherit icon' -> handling is easy peasy as well
(C) icon configured on some (any) of ancestor folders as 'inherit icon' -> mhm... things are getting not so trivial
(D) icon configured in plugin settings 'Custom Icon Rules' via a regexp or string pattern with an additional designation to match folders, files or both -> here begins the horror
For me it looks that the integration with
obsidian-icon-folder
plugin should be done in a fully-fledged fashion, that is handling of all (A), (B), (C) and (D) cases. Partial integration (e.g. ignoring the (D) case) would result in a behavior confusing to the user: s/he sees an icon on an item in Folder Explorer and at the same time the item is ignored by a seemingly correct custom sorting-spec.In turn, knowing that the custom sorting plugin should correctly recognize (A), (B), (C) and (D) cases means that the logic of
obsidian-icon-folder
plugin should be reproduced, especially for (D). This is definitely not the way to go.I will inquiry with the author of
obsidian-icon-folder
plugin (@FlorianWoelki) if he can expose some simple integration API on his plugin to be consumed by other plugins (like custom sorting). Seeing the long list of open tickets of 'obsidian-icon-folder' doesn't look promising.Anyways, the next step is to open a new ticket there asking for exposing of the new API for integration.
Hey,
I have currently other priorities, that's why the amount of open issues are quite huge :D However, I was also thinking about that and creating an issue in my repository would make sense.
Hi @FlorianWoelki
here you go with the technical feature request: #155: [Technical feature request] Expose synchronous API function - getting icon name by path of folder or file
At the same time, to proceed with the integration I will employ a simple approach here in File Explorer Custom Sorting plugin: read the basic data of the obsidian-icon-folder plugin - icon names configured directly as strings or in the iconName field of FolderIconObject structure. This integration approach would obviously break upon any related internal change of obsidian-icon-folder plugin, yet for the interim it looks like a viable solution
Hi @a-rock-lobster
the integration is completed and available in the 1.7.0 release of the plugin
For now only the icons configured explicitly (in obsidian-icon-folder
) on folders and files are handled, no support for icons visible in result of inheritance or regexp-rules (for details see documentation of the mentioned plugin)
The syntax of sorting spec is based on the new token with-icon:
, with or without parameters.
Basic examples:
---
sorting-spec: |
target-folder: /
with-icon:
---
The above example will push to the top of vault root folder all files and folders with icons configured via the obsidian-icon-folder
plugin, directly on these folders and files. Items with icons will be sorted alphabetically (which is the default for the custom sort plugin)
---
sorting-spec: |
target-folder: /
/:files with-icon:
> modified
---
The above example will push to the top of the vault root folder all files with icons configured via the obsidian-icon-folder
plugin, directly on these folders and files. Notes with icons will be sorted by modification date ('freshness')
---
sorting-spec: |
target-folder: Development
with-icon: RiNumber9
/files:folders
with-icon: RiNumber1
> advanced modified
with-icon:
---
The above example is a bit more complex:
RiNumber9
configured via the obsidian-icon-folder
plugin, directly on these folders and files.
RiNumber9
comes from the remix-icons
icon pack, one of packs available to install in obsidian-icon-folder
. The icon name is visible when you use the UI of that plugin to configure the icon on a file of folder/files:folders
token w/o any parameters has that meaning
/files:folders
RiNumber1
configured via the obsidian-icon-folder
plugin, directly on these folders and files.
> advanced modified
), files and folders treated equally /files:folders
rule listed beforeNote: to refresh the sorting after adding or removing icons on some folders and files you need to toggle the ribbon icon or issue the
sort-on
command in Obsidian commands palette
Please let me know if you have further questions.
BTW I'm also curious if you apply icons in your vault(s) via icon inheritance and regexp, or only via direct assignment on a file or folder.
Hi @SebastianMC,
This is awesome! Thank you for putting in so much work. It's really appreciated 🙏
I do use some regexp but mostly it's direct assignment. I can imagine a use case when regexp working be nice but the implementation already is super helpful.
Thanks again!
(deleted last after posting because I realised I had gotten confused - still working out the more advanced ways of using the sortspec)
Sorry for commenting on a closed issue but I've just installed the Icon Folder plugin as I saw that you added support.
I could be missing something completely obvious, but in the current version of Icon Folder it looks like it's no longer possible to determine the icon name in the format used by Custom Sort. When I assign an icon it displays the name of the descriptive name of the icon (e.g. Ubuntu (Fab)
) instead of the IconPackNumber##
which Custom Sort appears to use.
Any idea how I can find the correct icon name to be able to sort on it?
Hi @danteali,
the name of the icon to use in sorting spec comprises the pack short name concatenated with the icon name. For example:
FabUbuntu
for icon labeled Ubuntu (Fab)
inside the Icon Folder plugin
with-icon: FabUbuntu
FabAndroid
for Android (Fab)
with-icon: FabAndroid
and so on.I'm aware that the documentation is still missing for this particular area :-|
This works with the most recent (1.7.0) release of Icon Folder plugin
Hi, @SebastianMC
I think that the latest update might have broken the with-icon: support? Atleast, it stopped working after I updated and I haven't been able to find any causes myself.
Hi @a-rock-lobster,
thanks for the report, I will take a look as soon as possible
A bug indeed, fixed in the recent 1.9.2 Please give it a try
Looks good to me :) Cheers!
Hullo,
I have no idea how feasible or challenging this would be but I thought it would useful if it were possible to specify a file or folder icon (perhaps via the icons name) in the sortspec.
I have been using these icons to help me scan through my list of files. https://github.com/FlorianWoelki/obsidian-icon-folder
For example, one might use the bookmark icon to indicate certain files are book chapters or sections and maybe it would be helpful for them to cluster together (then I imagine alpha-numeric would kick in to order the cluster).
Just a thought.
Thanks for sharing your work,