Skip to content

Internal blocks

NBonaparte edited this page Feb 3, 2017 · 1 revision

Yabar has several internal blocks written in plain C. Yabar scans the string value in the exec entry to check whether it is a reserved internal block or a normal command/script.

Internal blocks have 5 additional block-specific options:

internal-prefix  # Inject a string (usually a font icon) before the output string
internal-suffix  # Inject a string (usually a font icon) after the output string
internal-option1 # block-specific
internal-option2 # block-specific
internal-option3 # block-specific
internal-spacing # takes a true or false value, used to add space pads to prevent uncomfortable numerical values from moving (only useful for monospace fonts!)

YABAR_DATE

Date & time: Maybe the most essential block. You can control the output format using the standard C library format. Example:

exec: "YABAR_DATE";
internal-option1: "%a %d %b, %I:%M"; #Format String
internal-prefix: " ";
type: "periodic";
interval: 1;

YABAR_TITLE

Uses EWMH to show the current window title. Example:

exec: "YABAR_TITLE";
fixed-size: 300;

YABAR_WORKSPACE

Uses EWMH to show the current workspace/desktop. Example:

exec: "YABAR_WORKSPACE";
internal-option1: "        ";

internal-option1 represents a series of characters/numbers/names to be used as workspace names (separated by a space) in order.

YABAR_UPTIME

Shows system uptime. Currently it shows using a hours:minutes format.

exec: "YABAR_UPTIME";
type: "periodic";
interval: 60;

YABAR_THERMAL

Reads thermal value in the file /sys/class/thermal/NAME/temp and divides it by 1000. Example:

exec: "YABAR_THERMAL";
internal-option1: "thermal_zone0"; #i.e. Replace `NAME` with your corresponding name
internal-option2: "70; 0xFFFFFFFF; 0xFFED303C"; # Critical Temperature, fg, bg
internal-option3: "58; 0xFFFFFFFF; 0xFFF4A345"; # Warning Temperature, fg, bg
interval: 1;

YABAR_BRIGHTNESS

Checks out the brightness value in the file /sys/class/backlight/NAME/brightness. Example:

exec: "YABAR_BRIGHTNESS";
internal-option1: "intel_backlight"; # Replace `NAME` with your corresponding name
interval: 1;

YABAR_BANDWIDTH

Reads out the total transmitted and received bytes in the files /sys/class/net/NAME/statistics/tx_bytes and /sys/class/net/NAME/statistics/rx_bytes and converts them to rates. Example:

exec: "YABAR_BANDWIDTH";
internal-option1: "enp2s0"; #i.e. Replace NAME with your corresponding name
internal-option2: "; "; # two strings/characters/symbols/icons to be injected before down/up values
interval: 2;

YABAR_MEMORY

Used RAM: Reads the file /proc/meminfo and computes the total used memory. Example:

exec: "YABAR_MEMORY";
interval: 1;

YABAR_CPU

CPU total load: It checks out the file /proc/stat and then computes the total load percentage: Example:

exec: "YABAR_CPU";
interval: 2;
internal-prefix: " ";
internal-suffix: "%";
internal-spacing: true;

YABAR_DISKIO

Reads /sys/class/block/NAME/stat and computes the read and write rates for the specified disk. Example:

exec: "YABAR_DISKIO";
internal-option1: "sda"; #i.e. Replace NAME with your corresponding name
internal-option2: "; "; #Two Strings (usually 2 font icons) to be injected before in/out values
interval: 1;

YABAR_BATTERY

Reads the files /sys/class/power_supply/NAME/capacity and /sys/class/power_supply/NAME/status and extracts the capacity value. Example:

exec: "YABAR_BATTERY";
internal-option1: "BAT0"; #i.e. Replace NAME with your corresponding name
internal-option2: " ;   ;   ;   ;  ";
internal-suffix: "%";
internal-spacing: true;