Bitbar: Is there a way to display a literal pipe symbol ("|") in a plugin?

Created on 5 Mar 2018  ·  13Comments  ·  Source: matryer/bitbar

I can't get it to show w/ escaping, printing ASCII sequences or other... Any other ideas? @

All 13 comments

You're right, I just tested it. echo "\x7c" (zsh) and printf "\x7c\n" (bash) don't work. If possible, I think printing ASCII as literal glyph/symbol should be added as a feature in a BitBar. (In my humble opinion.)

Until then I assume it's better to use alternative symbols; here are some

echo "Test ∥ Test │ Test ┃ Test |"
  1. parallel
  2. box drawing light vertical
  3. box drawing heavy vertical
  4. pipe

I believe no. 2 & no. 3 are preferable, although they are a little longer than the actual pipe symbol (no. 4).

Anyone with a different idea?

The literal pipe seems to be parsed by BitBar:

Your lines might contain | to separate the title from other parameters

You should be able to add escaping for this symbol (e.g. something like "\|") in a PR.

OP and myself have tried escaping pipe like that but it doesn't work @m-cat - bitbar ignores the escaping

I meant that you need to add escaping to BitBar itself (i.e. write some code that parses \|) in a PR. Have you tried this as well?

Ah, I see, I have not tried that yet.

Not sure if that would be successful. Programmatically yes, but it seems that BitBar development has ended, so a PR would be ignored.

@JayBrown I have permission to merge PRs 👍

@gingerbeardman Are you able to make new releases as well? (e.g. to download from getbitbar.com) Glad it's not a dead project, the idea is very cool but there are a few annoying bugs like #105.

If this is to be included I would favor a more general approach, namely including UTF/hex printing, e.g. you have this in your script:

#!/bin/bash
_hxr () {
    echo -n "$1" | xxd -p | sed -e 's/\(..\)/\\x\1/g'
}
pipehex=$(_hxr "|")
echo "test $pipehex test | color=blue"

That way you have a function that can hex any character, e.g. in the above case "|" into \x7c, internally as the value of $pipehex, and BitBar would automatically print the actual character, just as zsh does by default, if you run it directly in the shell.

However, if you use #!/bin/zsh as the shebang in your BitBar plugin script, it doesn't work, so it seems that whatever shell you use in BitBar, there is no support for using echo to print hex as character.

If you include that functionality, you could use it for any and all characters, not just the pipe.

@m-cat yes, I'm looking into a few PRs that would make a difference for a new release. If you can fix that one, I'll happily merge and release

@gingerbeardman and I'll happily try to fix this when I have time :) Thanks!

Hey, any updates on this? Thanks

I no longer have time to work on this project. Hopefully someone else can get to this issue though.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

h0d picture h0d  ·  3Comments

ElRochito picture ElRochito  ·  10Comments

dbuezas picture dbuezas  ·  7Comments

BigPrimeNumbers picture BigPrimeNumbers  ·  4Comments

JayBrown picture JayBrown  ·  8Comments