giuspen / cherrytree

cherrytree
https://www.giuspen.net/cherrytree/
Other
3.38k stars 461 forks source link

Allow custom icon for nodes #2163

Open Xeno-Idaltu opened 1 year ago

Xeno-Idaltu commented 1 year ago

Currently on Kubuntu-22, CherryTree v-0.99.43 comes with limited icon options.

Please let us have the option to choose our own icons for each node property.

This would be handy because CherryTree's icons are currently not suited for non-coder users. All I see are country flags, OS icons, etc

Another thing is that the Select Node Icon window shows one icon per tab instead of filling the window with icons.

ArenT1981 commented 1 year ago

I second this idea, would really be a small but significant feature enhancement.

ajaxStardust commented 1 year ago

@giuspen and I were discussing custom icons, and he suggested: let him know what you want, and he'll do his best to include it in a forthcoming release.

He shared a resource for SVG format icons, which is what he uses in CherryTree.

He advises that we pick from that repository as it is next to simple for him to use them, and may be able to include your requests in the next release. @Xeno-Idaltu @ArenT1981

ArenT1981 commented 1 year ago

@ajaxStardust @giuspen

So let's think this issue through some more. I apologise for the lengthy post :-) It seems to me there are potentially two aspects to the issue:

  1. The range/selection of icons that are inbuilt into, or automatically accessible within, Cherrytree.
  2. The ability for a user to use their own custom icon sets/selections.

Aspect (1.) is pretty easy to solve with a "naive" approach, where a much greater selection of icons are included/bundled within Cherrytree. The additional "resource consumption" of increasing the included/bundled icons even by, say, a factor of 10 is still likely to be pretty minimal. If this was a concern, then obviously a more elegant solution would be to simply package/bundle large icon set(s) as packages or a tarball cherrytree-extra-icons-[foo] which the user can either install into the main system Cherrytree installation directory under a suitable location (making them accessible system wide for all Cherrytree users), or alternatively via some path in the $HOME folder, e.g. something like ~/.config/cherrytree/icons.

In terms of what bundled icons, then obvious additional candidate sets would be something along the following lines:

At the moment, the icons (understandably) are heavily focused on "programmer typical" icons, which is great, but ideally we would want to extend the range for many other categories of things, for all of the non-programming/software uses that people use Cherrytree for, and indeed to better cater for all of the many other users who are not developers. Meanwhile the national flag icons are not really particularly useful, IMO. Of course they can stay, but their realistic use-cases are quite small for most users.

The less "naive" and more powerful -- and we could argue, additional, optional, since it would necessitate an online connection -- extension/solution to aspect (1.) would be to enable/add support for pulling/searching for icons from a remote/given repository/location/URI (e.g. like SVG Repo (likely via a checkbox to enable the function under the main Preferences). The user could then specify a given repository path (or could be a user's personal Github repo, and the Cherrytree dialogue would scrape the particular remote to find candidate SVG files).

So that deals with aspect (1.), with either a simple solution (namely, just bundle a lot more icons, and optionally package them in a separate downloadable file for users that don't want all of the extra files), or a comparatively complex solution, which would add the facility for Cherrytree to download and add a particular icon from a remote URL.

Aspect (2.) is what I really want though. Rather than necessarily rely on bundled (or remote) icons (though I do think Cherrytree would benefit from a larger bundled selection), instead, it should allow the facility for the user to add whatever SVG icons they wish to their own personal or specified directory, i.e. something like the ~/.config/cherrytree/icons path as mentioned above, or simply have a Preference/checkbox option that allows the user to both enable "Custom Icons" and then provide the path to where they are stored on the file-system.

Now this is what would really take Cherrytree up another notch, and it shouldn't be too difficult to implement. Cherrytree would simply have to scan/recurse the specified directory looking/finding all *.svg files (and perhaps 16x16/32x32 pngs). Users can then really make Cherrytree their own, as they can go off and grab whatever additional icons they wish for their own purposes/notebooks.

For example, suppose somebody is storing various work related notes in a notebook or node tree. Their company may well/probably already has a bundle of corporate icons. The user, if so inclined, could spend a little bit of time gathering up the company icons, resizing/scaling/saving them as suitable SVGs, put them in their own personal icon dir, and they can now use these work icons for their own personal notes. If the person (for whatever reason) likes mingling their work nodes throughout their tree/other nodes, then the icon provides an immediate visual signifier as to the origin/type of the note.

One of Cherrytree's biggest strengths as a note/knowledge management wiki is its attractive/highly visual nature, and the ability to use arbitrary custom icons would be a massive enhancement. Note the emphasis on arbitrary: not application or inbuilt default selection (however good they might be), but the ability for the user to use exactly whatever particular icon they could ever want for any given node. This allows them to make all of their notes truly "their own".

Expanded icon functionality brings up potential enhancements to the icon selection UI. If we consider that a user or setup now has far, far more icons (because the user has added many more custom sets), we really could do with a slightly more elegant way of selecting amongst them, particularly for users who have the benefit of a high-resolution 4K screen etc. So two things:

a. Instead of having the icon selector as just a simple 1xN long list, it should be a MxN grid. If the user resizes the icon selector window, obviously the grid expands to fill the available window real estate. This would make selecting among/viewing all of the available icons far better. b. As a bonus to (a), HiDPi users might want to have their icon selection window preview the icons at a larger size, just to make it easier to select amongst them. I'm not talking about increasing the actual displayed node icon size in the actual tree (though perhaps that might also be a good option to have customisable), but rather just to make the preview/icon selector larger for easier use. This should obviously be a customisable option. 100% would be the default, but a Preference could enable the user to change that to whatever they like. I know some people might point out that you can obviously do entire HiDPi scaling for all applications/UI elements, but it may be (like me) that they're happy with everything at stock 100% even on 4K screen, but just viewing the icon selector larger would be nicer.

Anyway, out of these UI considerations, only point a. is really significant. Being able to select amongst the icons as a grid rather than just a list would make working with a large number of icons much nicer. I can live with them being a little on the small size, visually, on a 4K display.


So, a TL;DR; summary of all of the above:

  1. Cherrytree would definitely benefit from a much expanded selection of core icons, covering many typical "knowledge management" use cases, various emojis, etc.
  2. These additional icons could optionally be bundled in a separate package if some users/people think that it is "bloating" the application.
  3. The ability to use remote URI/repos of icons would be a nice bonus.
  4. The ability for a user to conveniently and easily add their own additional custom icons, via their own specified icon path, would be a HUGE enhancement.
  5. Having (potentially vastly) more icons raises a few UI management issues, so having the icon selector be a grid rather than long list would solve for most of this.
  6. Having the ability to optionally scale the icons (either in the preview, or additionally in the tree itself) would be a nice bonus.

Out of all of these, point (4) is the one I most care about. Give the user the ability to add svg icons into their own custom Cherrytree icon dir, so they can expand the inbuilt selection with one's tailored to whatever they need. That covers 90% of what one could wish for in terms of "upgraded icon handling". The remaining points are "bonus points", that cover the last 10% :-)

giuspen commented 1 year ago

Thanks for your detailed post @ArenT1981 what has delayed the implementation has been also my being undecided on where these icons will live. Since this fleet of icons are part of the configuration, one option would be to use the same mechanism to export/import the config.cfg and put a folder with the same name beside it containing additional needed files (among these the user icons)