Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Siji symbols not displaying in bar #20

Closed
argunot opened this issue Sep 9, 2022 · 8 comments
Closed

Siji symbols not displaying in bar #20

argunot opened this issue Sep 9, 2022 · 8 comments

Comments

@argunot
Copy link

argunot commented Sep 9, 2022

I cannot get siji symbols to display properly in the bar. All I get are small squares of color where the symbols should be:
2022-09-08-221404_414x13_scrot

The font appears to be installed correctly when I check fc-list and xlsfonts. And I am using the example gruvbox_config.py from the share folder. These are, essentially, the only lines of the code that I've changed so far:

# Widget configuration:
# font = '-*-fixed-medium-*-*-*-15-*-*-*-*-*-iso10646-1'
font = '-*-fixed-medium-*-*-*-13-*-*-*-*-*-iso8859-1'
symbol_font = '-wuncon-siji-medium-r-normal-*-10-100-75-75-c-80-iso10646-1'
bar = lemonbar.Lemonbar(
    geometry=(x, y, width, height),
    font=font,
    symbol_font=symbol_font,
)

Any ideas would be appreciated, thanks!

@t-wissmann
Copy link
Owner

Did you select the right characters via /usr/share/siji/view.sh?
Just to double check: are you using the non-xft version of lemonbar? (Because the siji fonts don't work properly here with lemonbar-xft)

@argunot
Copy link
Author

argunot commented Sep 9, 2022

(Because the siji fonts don't work properly here with lemonbar-xft)

Oh, that is good to know about the xft version of lemonbar. I was using regular lemonbar at first then switched to the xft version when the symbols weren't appearing. I kept it because I didn't think there would be a difference while troubleshooting.

To clarify, I have switched back to the standard lemonbar (installed via the AUR) and still have the same problem.

Did you select the right characters via /usr/share/siji/view.sh?

I believe they are the correct codes. I haven't changed them from the original example. I checked some, though.

mail_symb = '\ue1a8' and view.sh shows character 0x00e1a8
vol_off_symb = col_fmt(FG) + '\ue202' and view.sh shows character 0x00e202
etc.

@t-wissmann
Copy link
Owner

Do you see the mail icon if you run the following from your terminal?

 { echo -e '\ue1a8' ; cat ; } | lemonbar -B '#FF000000' -d -f '-wuncon-siji-medium-r-normal--10-100-75-75-c-80-iso10646-1' 

The expected bar (in the top left corner) is:
image

@argunot
Copy link
Author

argunot commented Sep 9, 2022

Oh, wow, yeah I do! What does that mean? The information isn't properly being sent to lemonbar in config.py or lemonbar.py?

@t-wissmann
Copy link
Owner

how do you use mail_symb? you need to tell lemonbar to switch to the symbol font. This is done automatically by using painter.symbol(mail_symb) and cg.symbol(mail_symb) (where cg is a ConkyGenerator)

@argunot
Copy link
Author

argunot commented Sep 9, 2022

Ah, okay that seems to be the problem then.
mail_symb is used like this currently:

mail_symb = '\ue1a8'
inbox = os.path.expanduser('~/.mail/INBOX')
mail = col_fmt(AQUA_LIGHT) + mail_symb + col_fmt(FG) + ' ${new_mails %s}/${mails %s}' % (inbox, inbox)

Then mail and the other elements are put in a list then string:

conky_elements = [
    custom,
    mail,
    # wifi,
    volume,
    disk_usage,
    cpu,
    ram,
    # net_down_speed,
    # net_up_speed,
    # battery,
    uptime,
]

Then the string is used in a ConkeyWidget:

bar.widget = W.ListLayout([
...
conky.ConkyWidget(
        text=conky_text,
        config={'update_interval': update_interval},
    ),
...

So I should make a ConkyGenerator for the symbols? Excuse my ignorance but what would the textpainter be in

class ConkyGenerator:

    def __init__(self, textpainter):

when making the object

@t-wissmann
Copy link
Owner

You're right, that it is tricky and not very well documented. Here, the textpainter is the painter of lemonbar:

from barpyrus import lemonbar

# ....

cg = conky.ConkyGenerator(lemonbar.textpainter())
with cg.clickable([1], spawn_htop):
    with cg.temp_fg('#B7CE42'):
        cg.symbol(0xe026);
    cg += ' '; cg.var('cpu'); cg += '% '
    with cg.temp_fg('#6F99B4'):
        cg.symbol(0xe021);
    cg += ' '; cg.var('memperc'); cg += '% '

for net in network_devices:
    wireless_icons = [ 0xe218, 0xe219, 0xe21a ]
    wireless_delta = 100 / len(wireless_icons)
    with cg.if_('up %s' % net):
        cg.fg('#FEA63C')
        if net[0] == 'w':
            with cg.cases():
                for i,wicon in enumerate(wireless_icons[:-1]):
                    cg.case('match ${wireless_link_qual_perc %s} < %d' % (net,(i+1)*wireless_delta))
                    cg.symbol(wicon)
                cg.else_()
                cg.symbol(wireless_icons[-1]) # icon for 100 percent
        else:
            cg.symbol(0xe197) # normal wired icon
        cg.fg('#D81860') ; cg.symbol(0xe13c) ; cg.fg('#CDCDCD') ; cg.var('downspeed %s' % net)
        cg.fg('#D81860') ; cg.symbol(0xe13b) ; cg.fg('#CDCDCD') ; cg.var('upspeed %s' % net)
cg.drawRaw('%{F-}%{B-}')

The code above is from my personal barpyrus config

@argunot
Copy link
Author

argunot commented Sep 10, 2022

Thanks! With that example I can get symbols in the bar. Now I just need to configure it for my setup a bit.

Thank you for all the help, I appreciate it. I will close the issue now as my problem is resolved. Although would you possibly consider including your config (or maybe a similar, but simpler one) in the share folder of the repo as an example. The current examples seem outdated and none of them utilize a ConkyGenerator. I assume having a config similar to yours to base their own off of would likely make it easier for others as well.

Of course, This might just be a "me problem" though, and if that is the case feel free to ignore. Either way thanks for the help and the great software.

@argunot argunot closed this as completed Sep 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants