barista icon indicating copy to clipboard operation
barista copied to clipboard

Can't get icons to show up

Open syvanpera opened this issue 3 years ago • 8 comments

I just found out about this project and quickly tried out the sample bar provided. Seems to work as advertised, but for some reason the icons don't show up for me. I all the steps in the example (although I already had some of the icon fonts), mine are installed in .local/share/fonts instead of .fonts, but that shouldn't matter. But they don't show up. Any ideas what I could do?

syvanpera avatar Dec 19 '20 08:12 syvanpera

The default sample bar assumes that icon fonts have been cloned to ~/Github/. Is that where you cloned the font repositories?

Having the fonts installed is not enough, because sometimes the fonts change which icons are assigned to which codepoints. So it's important to have the matching version of the codepoints file available as well. The simplest way to ensure that is to clone the font repository and install a symlink of the font, so that anytime the repo is updated, the installed font is automatically updated as well.

See https://barista.run/pango/icons#default-installation for more details. Hopefully that works for you.

soumya92 avatar Dec 21 '20 02:12 soumya92

Would be neat to have an example of using Go 1.16's embed feature so the barista executable doesn't need runtime access to the font repository: https://golang.org/pkg/embed/

jokeyrhyme avatar Mar 31 '21 00:03 jokeyrhyme

Technically barista doesn't need the font files, the status bar program does. There's no format for embedding icons in the i3bar protocol, so the best we can do is use pango fonts. But that requires the font to be available at runtime.

While we could embed the codepoint files, that would mean rebuilding the bar anytime the fonts update. Instead, I prefer to read the codepoints file at runtime so that fonts can be updated more frequently without issues. (The codepoint file must correspond to the version of the font being loaded by the status bar program)

soumya92 avatar Mar 31 '21 00:03 soumya92

Ah, thanks for the explanation

At the moment I have the fonts themselves managed by my distribution's package manager, and I'm separately/manually using git to manage the codepoints repository, I'll be sure to make an effort to keep these synchronised in future

jokeyrhyme avatar Mar 31 '21 00:03 jokeyrhyme

I ran into this issue because I was using font-awesome 6. I have a fork where I've updated the fontawesome subpackage to use FA-6. Let me know if you want me to PR it and how. (I just changed the number, realistically we'd probably have to find a way to fallback and support both to avoid breaking changes.)

taigrr avatar Aug 08 '22 06:08 taigrr

@taigrr If you send a PR that uses fa6- prefix, that would be simple to integrate. I probably should have versioned fontawesome anyway when I moved from 3 to 4 (or 4 to 5?, I don't remember), but we can do that going forward.

soumya92 avatar Aug 08 '22 21:08 soumya92

Great, and I'll leave the fa- as-is, but should I also add fa-5 as syntactic sugar to make it easier for people to be explicit?

taigrr avatar Aug 08 '22 21:08 taigrr

Up to you 😉 I think that's a good idea

soumya92 avatar Aug 08 '22 23:08 soumya92