Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

gportay/i3blocks-status

Repository files navigation

i3blocks-status

This project provides scripts for i3blocks to copycat the status line generated by i3status.

Caution
Any block or option not available in i3status is out of scope.

The default configuration file is a direct translation of the default i3status configuration file. With i3blocks set up, you can fetch these scripts and run them with:

git clone https://github.com/vivien/i3blocks-status.git ~/.config/i3blocks
make -C !$ ipv6
i3blocks # or from another location with -c i3block-status/config

General options are described below.

general

TODO

Blocks (i3status "modules") are described below.

battery

Gets the status (charging, discharging, unknown, full), percentage and remaining time of the given battery and when it’s estimated to be empty.

If you want to use the last full capacity instead of the design capacity (when using the design capacity, it may happen that your battery is at 23% when fully charged because it’s old. In general, I want to see it this way, because it tells me how worn off my battery is.), just specify last_full_capacity=true.

You can hide seconds in the remaining time and empty time estimations by setting hide_seconds=true.

If you want the battery percentage to be shown without decimals, add integer_battery_capacity=true.

If your battery is represented in a non-standard path in /sys, be sure to modify the "path" property accordingly, i.e. pointing to the uevent file on your system. The first occurrence of %d gets replaced with the battery number, but you can just hard-code a path as well.

It is possible to define a low_threshold that causes the battery text to be colored red. The low_threshold type can be of threshold_type "time" or "percentage". So, if you configure low_threshold to 10 and threshold_type to "time", and your battery lasts another 9 minutes, it will be colored red.

To show an aggregate of all batteries in the system, use "all" as the number. In this case, the /sys path must contain the "%d" sequence. Otherwise, the number indicates the battery index as reported in /sys.

Optionally custom strings including any UTF-8 symbols can be used for different battery states. This makes it possible to display individual symbols for each state (charging, discharging, unknown, full). Of course it will also work with special iconic fonts, such as FontAwesome. If any of these special status strings are omitted, the default (CHR, BAT, UNK, FULL) is used.

Options
instance

The battery number

format

The format string (defaults to %status %percentage %remaining)
Placeholders can be: %status, %percentage, %remaining, %emptytime.

format_down

The format string when battery is not present (defaults to No battery)

status_chr

The string for the charging state (defaults to CHR)

status_bat

The string for the battery state (defaults to BAT)

status_unk

The string for the unknown state (defaults to UNK)

status_full

The string for the full state (defaults to FULL)

path

The path to the uevent file (defaults to /sys/class/power_supply/BAT%d/uevent)
The integer placeholder is replaced by the battery number (i.e. instance).

threshold_type

The threshold type (defaults to time)
Values can be: time (in minutes), percentage.

low_threshold

The low threshold level (defaults to 30)

hide_seconds

To hide remaining seconds (defaults to true)

Example
[battery]
instance=0

# Default values
#format=%status %percentage %remaining
#format_down=No battery
#status_chr=CHR
#status_bat=BAT
#status_unk=UNK
#status_full=FULL
#path=/sys/class/power_supply/BAT%d/uevent
#low_threshold=30
#threshold_type=time
#last_full_capacity=false
#integer_battery_capacity=false
#hide_seconds=true

cpu_temperature

Gets the temperature of the given thermal zone. It is possible to define a max_threshold that will color the temperature red in case the specified thermal zone is getting too hot. Defaults to 75 degrees C. The output format when above max_threshold can be customized with format_above_threshold.

Options
instance

The thermal zone number

format

The format string (defaults to %degrees C)
Placeholder is degrees.

format_above_threshold

The format string when threshold is reached (defaults to format)

path

The path to the thermal zone file (defaults to /sys/class/thermal/thermal_zone%d/temp)
The integer placeholder is replaced by the thermal zone number (i.e. instance).

max_threshold

The high threshold level (defaults to 75)

Example
[cpu_temperature]
instance=0

# Default values
#format=%degrees C
# format_above_threshold is not set and fallback to format
# path is not set and fallback to /sys/class/thermal/thermal_zone%d/temp
#max_threshold=75

cpu_usage

Gets the percentual CPU usage from /proc/stat.

It is possible to define a max_threshold that will color the load value red in case the CPU average over the last interval is getting higher than the configured threshold. Defaults to 95. The output format when above max_threshold can be customized with format_above_threshold.

It is possible to define a degraded_threshold that will color the load value yellow in case the CPU average over the last interval is getting higher than the configured threshold. Defaults to 90. The output format when above degraded threshold can be customized with format_above_degraded_threshold.

Options
full_format

The format string (defaults to %usage)
Placeholders can be: usage, cpu0, cpu1, cpu2…​

format_above_threshold

The format string when max threshold is reached (defaults to format)

format_above_degraded_threshold

The format string when degraded threshold is reached (defaults to format)

path

The path to the stat file (defaults to /proc/stat)

max_threshold

The max threshold level (defaults to 95)

degraded_threshold

The degraded threshold level (defaults to 90)

Example
[cpu_usage]
format=json

# Default values
#full_format=%usage
# format_above_threshold is not set and fallback to full_format
# format_above_degraded_threshold is not set and fallback to full_format
#path=/proc/stat
#max_threshold=95
#degraded_threshold=90

ddate

Outputs the current discordian date in user-specified format. See ddate(1) for details on the format string.

Options
format

The ddate format string (defaults to %{%a, %b %d%}, %Y%N - %H)
See ddate(1) for details on the format string.

Example
[ddate]

# Default values
#format=%{%a, %b %d%}, %Y%N - %H

disk

Gets used, free, available and total amount of bytes on the given mounted filesystem.

These values can also be expressed in percentages with the percentage_used, percentage_free, percentage_avail and percentage_used_of_avail formats.

It is possible to define a low_threshold that causes the disk text to be displayed using color_bad. The low_threshold type can be of threshold_type "bytes_free", "bytes_avail", "percentage_free", or "percentage_avail", where the former two can be prepended by a generic prefix (k, m, g, t) having prefix_type. So, if you configure low_threshold to 2, threshold_type to "gbytes_avail", and prefix_type to "binary", and the remaining available disk space is below 2 GiB, it will be colored bad. If not specified, threshold_type is assumed to be "percentage_avail" and low_threshold to be set to 0, which implies no coloring at all. You can customize the output format when below low_threshold with format_below_threshold.

Options
instance

Moint point

format

The format string (defaults to %free)
Placeholders can be: used, free, available, total, percentage_used, percentage_free, percentage_avail, percentage_used_of_avail.

format_below_threshold

The format string when threshold is reached (defaults to format)

format_not_mounted

Format string when the path does not exist or when it is not a mount point (defaults to "")

prefix_type

Byte sizes are presented in a human readable format using a set of prefixes (defaults to binary)
Values can be: binary (Ki, Mi, Gi, Ti), decimal (k, M, G, T), custom (K, M, G, T).

threshold_type

The threshold type (defaults to percentage_avail)
Values can be: percentage_free, percentage_avail, bytes_free, bytes_avail.

low_threshold

The low threshold level (defaults to 0)

Example
[disk]
instance=/

# Default values
#format=%free
# format_below_threshold is not set and fallback to format
# format_not_mounted is not set and fallback to ""
#prefix_type=binary
#threshold_type=percentage_avail
#low_threshold=0

ethernet

Gets the IP address and (if possible) the link speed of the given ethernet interface. The special interface name _first_ will be replaced by the first non-wireless network interface found on the system (excluding devices starting with "lo").

Options
instance

Network interface (defaults to _first_)

format_up

Format string when the interface is up.
Placeholders can be: %ip, %speed, %interface.

format_down

Format string when the interface is down.

Example
[ethernet]
instance=_first_

# Default values
#format_up=E: %ip (%speed)
#format_down=E: down

ipv6

This module gets the IPv6 address used for outgoing connections (that is, the best available public IPv6 address on your computer).

Options
format_up

Format string when an IPv6 is set (defaults to %ip)
Placeholder is %ip.

format_down

Format string when no IPv6 is set (defaults to No IPv6.)

Example
[ipv6]

# Default values
#format_up=%ip
#format_down=No IPv6

load

Gets the system load (number of processes waiting for CPU time in the last 1, 5 and 15 minutes).

It is possible to define a max_threshold that will color the load value red in case the load average of the last minute is getting higher than the configured threshold. Defaults to 5. The output format when above max_threshold can be customized with format_above_threshold.

Options
format

The format string (defaults to %1min %5min %15min)
Placeholders can be: %1min, %5min, %15min.

format_above_threshold

The format string when threshold is reached (defaults to format)

max_threshold

The high threshold level (defaults to 5)

Example
[load]

# Default values
#format=%1min %5min %15min
# format_above_threshold is not set and fallback to format
#max_threshold=5

path_exists

Checks if the given path exists in the filesystem. You can use this to check if something is active, like for example a VPN tunnel managed by NetworkManager. There also is an option "format_down". You can hide the output with format_down="".

Options
instance

The title.

path

The path to the file (must be set).

format

The format string (defaults to %title: %status)
Placeholders can be: %title (i.e. instance), %status (i.e. yes or no).

format_down

The format string when the file does not exist at path (defaults to format).

Example
[path_exists]
instance=VPN
# path exists when a VPN tunnel launched by nmcli/nm-applet is active
path=/proc/sys/net/ipv4/conf/tun0

# Default values
# path is not set and must be set
#format=%title: %status
# format_down is not set and fallback to format if path does not exist

run_watch

Expands the given path to a pidfile and checks if the process ID found inside is valid (that is, if the process is running). You can use this to check if a specific application, such as a VPN client or your DHCP client is running. There also is an option "format_down". You can hide the output with format_down="".

Options
instance

The title.

pidfile

The path to the pid file (must be set).

format

The format string (defaults to %title: %status)
Placeholders can be: %title (i.e. instance), %status (i.e. yes or no).

format_down

The format string when the pid does not exist in pidfile (defaults to format).

Example
[run_watch]
instance=DHCP
pidfile=/var/run/dhclient*.pid

# Default values
# pidfile is not set and must be set
#format=%title: %status
# format_down is not set and fallback to format if pid does not exist

time

Outputs the current time.

Options
format

The strftime format string (defaults to %Y-%m-%d %H:%M:%S)
See strftime(3) for details on the format string.

Example
[time]

# Default values
#format=%Y-%m-%d %H:%M:%S

tztime

Outputs the current time in the given timezone. If no timezone is given, local time will be used. The system’s timezone database is usually installed in /usr/share/zoneinfo. Files below that path make for valid timezone strings, e.g. for /usr/share/zoneinfo/Europe/Berlin you can set timezone to Europe/Berlin in the tztime module. To override the locale settings of your environment, set the locale option.

Options
format

The strftime format string if format_time is unset or format string (defaults to %Y-%m-%d %H:%M:%S %Z)
If format_time is unset, placeholders are the one from strftime(3). Otherwise, placeholder is %time (i.e. the strftime(3) format string).

timezone

The timezone (defaults to "")

locale

The locale (defaults to "")

format_time

The strftime format string (defaults to unset).
See strftime(3) for details on the format string.

Example
[tztime]
instance=local
format=%Y-%m-%d %H:%M:%S

# Default values
#format=%Y-%m-%d %H:%M:%S %Z
# timezone is not set
# locale is not set
# format_time is not set

volume

Outputs the volume of the specified mixer on the specified device. Only ALSA is supported.

Options
format

Format string (defaults to ♪: %volume). Placeholder is %volume.

format_muted

Format string when the mixer is muted (defaults to ♪: 0%%).

device

The device (defaults to default)

mixer

The mixer (defaults to Master)

mixer_idx

The mixer id (defaults to 0)

Example
[volume]

# Default values
#format=♪: %volume
#format_muted=♪: 0%%
#device=default
#mixer=Master
#mixer_idx=0

wireless

Get the link quality, frequency, and ESSID of the given wireless network interface.

Options
instance

Network interface (defaults to _first_)

format_up

Format string when the interface is up.
Placeholders can be: %bitrate, %essid, %frequency, %ip, %quality.

format_down

Format string when the interface is down.

format_quality

Format string for quality (defaults to %3d%s).

Example
[wireless]
instance=_first_

# Default values
#format_up=W: (%quality at %essid, %bitrate / %frequency) %ip
#format_down=W: down
#format_quality=%3d%s

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •