-
Notifications
You must be signed in to change notification settings - Fork 49
Block specific options
Each block can have its command or script, background, foreground (i.e. font), underline and overline colors, alignment and other options.
- Execution: path to the command/script to be executed or one of Yabar's internal blocks. Yabar consumes the (stdout) output and shows it on the bar.
exec: "date +%F";
When running a command, Yabar sets some environment variables before execution that are defined in the command-button{1-5}
entry. Such env variables can be useful when drawing your window on the corresponding button press.
${YABAR_BLOCK_X} # beginning x axis for the block
${YABAR_BLOCK_Y} # bottom y value of the block for topbar or top y value of the block for bottombar
${YABAR_BLOCK_WIDTH} # block width
- Alignment: accepts
left
,center
orright
alignments. Consecutive blocks will be placed to the right of each other.
align: "right";
- Justify: By default, text is center inside the block. However, you can optionally justify the text to the left or the right.
justify: "left";
- Type: The block type can be
periodic
(execution within a fixed interval of time),persistent
where the command/script runs in a persistent way likextitle
oronce
(single execution on startup) (e.g. where the intended info should not change like inwhoami
). Examples:
type: "periodic";
type: "persist";
type: "once";
- Interval: interval in seconds for periodic blocks.
interval: 3;
- Fixed size: define the fixed width size of the block. Yabar currently only supports fixed widths (this will be improved soon). You can deduce the appropriate width using trial and error. The current default value is 80 but you are encouraged to override it to a more appropriate value. Example:
fixed-size: 90;
- Pango markup: en- or disable Pango Markup. Accepts either
true
orfalse
without quotes (default isfalse
).
pango-markup: true;
- Colors: any block has 4 kinds of colors: background, foreground (i.e. font color), underline and overline. Colors are accepted in hex RRGGBB and AARRGGBB representations. Examples:
foreground-color-rgb : 0xeeeeee;
background-color-argb : 0x1dc93582;
underline-color-rgb : 0x1d1d1d;
overline-color-argb : 0xf0642356;
Note: the values are integers and not double-quoted strings.
- Button commands: This option is used to invoke a command/script upon a mouse button press. You have 5 buttons that usually represent left click, right click, middle click, scroll up and scroll down respectively but this may not be the case for everyone. Examples:
command-button1: "pavucontrol";
command-button4: "pactl set-sink-volume 0 +10%";
command-button5: "pactl set-sink-volume 0 -10%";
- Inheritance: As the config gets larger because you want to add many blocks, you may find yourself adding many identical option values for every added block. This optional entry is added in order to inherit the options from a precedent block into your new block. You can also override the inherited options with new values.
inherit: "bar1.block1";
- Icons and images: Yabar supports drawing icons and images inside blocks using gdk-pixbuf and cairo. The images are drawn before drawing text so they may act as backgrounds if desired. You can control the horizontal and vertical shift and the width and height scale for the image/icon. Example:
image: "/usr/share/icons/Numix/16/apps/google.svg";
image-shift-x: 2; #integer value
image-shift-y: 1; #integer value
image-scale-width: 0.4; #float value
image-scale-height: 0.4; #float value
- Variable width: Use this optional feature in order to fit the block width into the current text width and subsequently save empty space inside the bar. Example:
variable-size: true;
You can change block colors (background, foreground, underline and overline) within runtime. Along with pango markup format, you can fully control how a block looks throughout a session.
If you wish to change one or more of the 4 color types, you must begin your string-to-be-drawn (i.e. the output string to stdout by your shell script) with !Y FORMAT Y!
. The FORMAT
statement should contain the color type (BG
or bg
for background, FG
or fg
for foreground, U
or u
for underline and O
or o
for overline). The color must be in hex AARRGGBB (So if you want to add an rgb color just make it FFxxxxxx
). Examples:
"!Y BG 0xFFFF0000 fg0xFF00ff00 U0xFFFAC739 Y!"
"!Ybg0xff00ff00Y!"
The spaces are skipped automatically. Keep in mind that you can always dynamically change your foreground color using pango markup, too.