Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
6.42k stars 696 forks source link

Add seperate font size for icon font #2111

Open fritzrehde opened 1 year ago

fritzrehde commented 1 year ago

I have already added a seperate font used for icons, but now the icons are too small compared to the text. Is it possible to specify a seperate font size for another font (in my case the icon font)?

BoomerangNebula commented 1 year ago

As far as I know, the only way to set a separate font rule is to use Pango Markup in your config file.

If you resize icons this way, you may also find yourself unhappy with their vertical alignment, as it tends to drift out of sync with the rest of the text. In this case you can also set a rise value to adjust the vertical alignment of the resized icons. Note that too large a rise value will begin to push the rest of the text in the opposite direction, so you'll have to test and find what works.

"format": "<span size='x-large' rise='-1500' color='#fff'>墳</span> {volume}%",
ArtemSmaznov commented 1 year ago

@fritzrehde how did you use a separate font for icons?

LukashonakV commented 1 year ago

@ArtemSmaznov, you should use span where you want to separate font for icons See format section in config

    "battery": {
        "bat": "BAT0",
        "states": {
        // "good": 95,
                "warning": 30,
                "critical": 15
                },
        "format": "<span font-family=\"Font Awesome 6 Pro Regular\">{icon}</span> {capacity}%",
        "format-full": "{icon}",
        "format-alt": "{icon} {time}",
        // "format-good": "", // An empty format will hide the module
        "format-icons": {
                        "plugged": "",
                        "full": "",
                        "charging": ["","","","","","",""],
                        "default": ["","","","",""]
                        },
        "tooltip": true
    },
ArtemSmaznov commented 1 year ago

That's what I wanted to avoid. Hoped there was a way to reference icons in css. but guess I just need to add custom classes in the config with span like I was doing in EWW

fritzrehde commented 1 year ago

@ArtemSmaznov I never did get around to fixing this for me, I wasn't happy with any of the solutions. I just accepted that the icons are smaller and use the same font for everything for now.

5p4r74cu5 commented 8 months ago

I used the following, but won't necessarily work depending on scaling.

<span size='large'>{icon}</span>

diegodorado commented 8 months ago

Use the nerdfont variant Propo, i.e.: "JetBrainsMono Nerd Font Propo", which isn't strictly monospaced, and works well in this scenario

ArtemSmaznov commented 8 months ago

Wait, shouldn't this be valid? "format": "<span class='icon'>{icon}</span> {temperatureC}°C", doesn't seem to work for with widget just not displaying anything. Is class specifically that isn't supported?