Skip to content

configuring

Ben Klein edited this page Mar 11, 2019 · 2 revisions

Configuring ZINC

ZINC uses an associative array for most generic options. The key is the name of the segment, and the value is a ;-separated list.

Most segments have options, but ZINC specifies 4 global options that always mean the same thing for every segment.

They are, in order:

Foreground Color, Background Color, Display/Render mode, Asynchronous render mode

You set these configuration options in the zinc_opts associative array, like in any of these equivalent examples:

# zinc has been loaded
zinc_opts[some_segment]="fg_color;bg_color;normal;normal"
typeset -gA zinc_opts
zinc_opts=(
  some_segment "fg_color;bg_color;normal;normal"
)
# load zinc
# load zinc
# options that are blank will be filled with their default values automatically
zinc_opts[some_segment]="fg_color;bg_color;;"

Defaults

If at any time you don't know what the default options are, just use echo ${(kvj.\n.)zinc_opts} which will display all the segment names followed by their currently-set options string.

Foreground and Background

Foreground and background colors should be self explanatory, however they can also be CONDITIONAL in which case the segment's _fg/_bg function will be called to determine the color.

Display / Render mode

This option is used most commonly for conditionally-displayed segments. Setting this to CONDITIONAL will call the segment's _display_hidden function to determine whether the segment should be shown or not.

You can set this to normal to ensure the segment is always shown, although some segments may show incorrect content in cases where it expects not to be shown.

Async mode

This option normally is not intended for user configuration, as segments will inform ZINC whether they are async or not using their default options function _default_opts.

This being async means that the segment is asynchronous. This requires some additional functions, so you can't just apply this option to segments which don't support it.

Individual segments

Segments may make use of the arguments contained after the first 4.

For example, the cwd segment uses the 5th argument as the strategy, and arguments after that as additional options and modifiers.

# first 4 options are defaults, the cwd segment will use the additional args
zinc_opts=(
  zincs_cwd ';;;;rtab;-t;-l'
)