Home / Alt manpages / byobu-ulevel(1)

  • byobu-ulevel(1)
  • User command
  • linux

Build Readable Byobu Indicators with byobu-ulevel

By the end of this guide, you will be able to turn a number into a compact Byobu indicator, switch between Unicode and ASCII output, choose a theme, and make a script fail safely when its input is outside the expected range. The commands take about 10 minutes to try. You need the byobu package and a shell; none of these examples needs elevated privileges.

Checkpoint: know what is installed

  1. Check the package and executable before relying on defaults.
dpkg-query -W -f='${Package} ${Version}\n' byobu
command -v byobu-ulevel
byobu-ulevel -h

On the system used for this guide, the package is byobu 6.11-0ubuntu1.1 and the program is /usr/bin/byobu-ulevel. The installed help reports defaults of a minimum of 0, a maximum of 100, the vbars_8 theme, a width of 5, and two decimal places for accessibility output. The compressed manpage documents the same interface but leaves some defaults as package variables, so use byobu-ulevel -h when a default matters on a different package build.

Checkpoint: render a number

  1. Pass a value from the default range of 0 to 100.
byobu-ulevel 27

The command writes one Unicode bar glyph followed by a newline. The equivalent explicit form is:

byobu-ulevel -c 27

-c is useful in scripts because it makes the value's role obvious. Both forms accept numbers, including floating-point and negative values, as long as the value fits between the selected minimum and maximum. The program writes the indicator to standard output, which makes it suitable for command substitution or a Byobu status component.

Make output safe for terminals and logs

  1. Use accessibility mode when a consumer cannot display the theme's Unicode glyphs.
byobu-ulevel -a -c 27
# 27.00

In the installed version, accessibility mode prints an ASCII decimal value. Set the number of decimal places with -e; for a whole percentage, use zero:

byobu-ulevel -a -e 0 -m 0 -x 100 -c 27
# 27

The same mode is enabled when BYOBU_A11Y is set. This is an environment switch, not a Boolean parser, so test the environment in the process that runs the command:

BYOBU_A11Y=1 byobu-ulevel -c 27
# 27.00

Use -n when the caller supplies its own separator or prompt. It removes only the final newline, not the indicator itself:

byobu-ulevel -n -a -c 27 | od -An -tc
#   2   7   .   0   0

Set a meaningful range

  1. Declare the real lower and upper bounds for the measurement.
byobu-ulevel -m -22.613 -x 5.00212 -c 0.10203 -a -e 0

Here the number is mapped from the range -22.613 to 5.00212, then displayed as an ASCII rounded value. The mapping is relative to the range, not automatically a percentage supplied by your program. A zero current value is just another point in the range.

Do not silently accept values outside the range unless that is the policy you want. Without permissive mode, an out-of-range value is an error:

byobu-ulevel -c 101
# ERROR: current (101) > maximum (100)

If clamping is explicitly acceptable, add -p:

byobu-ulevel -p -c 101

That maps 101 to the upper bound and exits successfully. In a monitoring script, check the exit status before treating output as valid. Permissive mode prevents a bad sample from breaking the display, but it can also hide a broken producer.

Choose or inspect a theme

  1. List the themes available in this installation before selecting one by name.
byobu-ulevel -l

The local build includes themes such as vbars_8, hbars_8, dice_6, stars_2, and solid_numbers_a_10. The suffix indicates the number of glyph values. To inspect every value in one theme, combine -l with -t:

byobu-ulevel -l -t solid_numbers_a_10

Use a named theme for a deliberate visual choice:

byobu-ulevel -c 83 -t stars_2

The two-value themes are rating themes. They can be displayed in the opposite direction with -r and have their colour scheme inverted with -i. These flags apply to rating themes, so do not assume they change a bar theme:

byobu-ulevel -c 60 -t diamonds_2 -ri

For a zero value, -b displays a space instead of the theme's lowest value. That is useful when zero should look like an empty status field, but remember that a blank is harder to spot in logs.

Use a small custom theme

  1. Supply two or more space-delimited characters with -u.
byobu-ulevel -c 50 -u "a b c d e f g h i j"

This selects the character corresponding to the value's position. For a two-character rating with a ten-character width, use:

byobu-ulevel -c 666.321 -m -273.15 -x 1370 -u "· ☢" -w 10

Quote the theme so the shell passes it as one argument. The characters must be separated by spaces; a string of adjacent characters is not the documented format. Custom themes are not a configuration file and make no persistent change, so there is nothing to undo after the command exits.

Keep scripts predictable

  1. Validate the range and status before embedding the result in a larger command.
if indicator=$(byobu-ulevel -a -e 0 -m 0 -x 100 -c "$CURRENT"); then
    printf 'load=%s%%\n' "$indicator"
else
    printf 'invalid load: %s\n' "$CURRENT" >&2
    exit 1
fi

Replace $CURRENT with the value produced by your own measurement. Keep the command substitution's output separate from diagnostics. -d is useful while investigating a mapping, but it emits debug lines as well as the indicator, so leave it out of machine-readable output:

byobu-ulevel -d -c 27

For an invalid theme, the command exits non-zero even with -q. The quiet option suppresses messages only when used with -t; it does not make a misspelled theme valid. Treat a non-zero status as the failure signal and choose a theme from byobu-ulevel -l.

Done means

  • You can produce a Unicode indicator and an ASCII fallback.
  • Your command states its measurement range with -m and -x.
  • You have chosen whether out-of-range input should fail or be clamped with -p.
  • You have checked theme names locally and quoted custom theme characters.
  • Your script checks the exit status and keeps debug output away from parsed values.