website/src/icons.md
Broot supports showing icons in terminal if a supported font is installed.
Currently, two fonts are supported, nerdfonts and vscode.
Here is a screenshot, with nerdfont to the left and vscode at right:
First add the appropriate lines to your broot config.
icon_theme: vscode
icon_theme = "vscode"
or
icon_theme: nerdfont
icon_theme = "nerdfont"
If the appropriate fonts are already installed correctly on your system then new instances of broot will show icons correctly.
echo -e "file_type_rust looks like \U001002D2"
echo "Rust is `u{1002D2}"
If you see a rust gear icon, your terminal is displaying the correct font.
echo -e "file_type_rust looks like \ue7a8"
This should display a rust icon
Unless you're really unlucky (there is some font that has the rust gear icon at the exact unicode point as the query but doesn't have other glyphs), you probably have the font installed correctly. If not, move to the installation section.
If the font isn't installed, you may
/resources/icons/vscode/vscode.ttf if you have broot sourcesCopy the vscode.ttf file to ~/.local/share/fonts.
Double click the vscode.ttf file icon and click on "Install font".
icon_theme: "nerdfont" line in broot's config fileQ: Why does broot show a generic icon for this very common file type?
A: The icon mappings aren't complete. You can help out very easily without any coding knowledge. Go to the github repository. Enter the directory corresponding to your theme. Inside data, edit extension_to_icon_name_map.rs and add a line corresponding to your extension. The first field would be the extensions you would like, and the second field should be referred from icon_name_to_icon_code_point_map.rs. Submit a PR.
Q: Can I set up a totally different set of icons or mappings ?
A: Broot can be configured for a different mapping or a different font, but this needs some coding and a new compilation. To get started, have a look at look at the resources/icons/nerdfont directory and, if necessary, come and chat on miaou.
Q: Why isn't the icon mapping configurable?
A: For performance reasons, icon mapping is hardcoded. If this looks like a problem, please come and chat with us on miaou.
Q: How do I remap in nerdfont?
A: If you want to map or remap icons, please go to <a href="https://www.nerdfonts.com/cheat-sheet" target="_blank">nerdfont-cheat-sheet</a> and search for an icon you would like to set in its place. In order to correctly fix the icon mapping you need a FILE_EXTENSION and a NERDFONT_ICON_CODE. For this example we are remapping the json file extension.
The first thing you need to do is find the "json" icon you want to map to in the cheatsheet and copy its iconCode ("the code inside the red box in the screenshot below"). Once done, find the corresponding file mapping in resources/icons/nerdfont by searching for your filetype in icon_name_to_icon_code_point_map: In this case its this line:
( "file_type_json", 0xe60b ),
As you can see: the icon is mapped by "0x" followed by your iconCode. After changing this you should be able to recompile broot and see your new icon. If this is a new file mapping or a missing icon. Please consider contributing!