shstatus - a simple statusline generator for i3bar and swaybar
shstatus [-h | --help] [-v | --version] [path/to/config.sh]
Print a help message.
Print version information.
To use shstatus in your statusbar, add this to your i3 or sway config file:
bar {
status_command shstatus
}
1. $XDG_CONFIG_HOME/shstatus/config.sh
2. $HOME/.config/shstatus/config.sh
3. /etc/shstatus/config.sh
Specifying an alternate config file overrides the default paths.
In the config file, you have to define:
1. A variable 'interval'
2. An array 'blocks'
Every element in the blocks array must be a function name. All of these functions should be defined in your config.sh. Each function must set the full_text variable - this is the text that will be displayed in the status bar. There are a lot more variables available - see swaybar-protocol(7) or https://i3wm.org/docs/i3bar-protocol.html for the full list. shstatus will run all functions in the specified order, and then print all set variables as JSON in order to display the information in the bar. This is done every interval seconds.
Inside the config, you can use some of the functions provided by
shstatus to insert information into full_text
and short_text. These functions replace variables
(denoted %var_name) inside the bash variables
full_text and short_text with some
information. For example, %date will be replaced with
the current date and time if you run 'block_datetime "%c"
"printf"' in your function.
See the next section for a detailed description of every function.
There is an example config file in /etc/shstatus/config.sh. It contains usage examples of every block function. Copy it to your home directory and edit it from there.
Shows the date and time.
<program> can be either 'printf' or 'date'. See strftime(3) for how to use printf, or date(1) for how to use date.
Available variables:
%date - current date
Shows the current volume. This is done using wpctl.
Available variables:
%vol - current volume
%mutestatus - if volume is muted, this variable contains <mute-string>. Otherwise it is empty.
Same as block_pwvol, but for pulseaudio (using pactl(1)).
Shows disk usage. This is done using df(1).
Available variables:
%disk - device
%size - disk size
%used - used disk space
%avail - available disk space
%usepercent - percentage of used disk space
%mountpoint - device mountpoint
Shows memory and swap usage. This is done using free(1).
Available variables:
%memtotal - total memory
%memused - used memory
%memavail - available memory
%swaptotal - total swap
%swapused - used swap
%swapavail - available swap
Shows the uptime. This is done by reading /proc/uptime. If <label_seconds> is set to DISABLE, the number of seconds will not be shown.
Available variables:
%uptime - system uptime in the following format: <number><label><separator><number><label> ...
Shows the CPU usage. This is done by reading /proc/stat.
Available variables:
%usage - CPU usage
Shows the load average. This is done by reading /proc/loadavg.
Available variables:
%load1 - load average during the last 1 minute
%load5 - load average during the last 5 minutes
%load15 - load average during the last 15 minutes
Shows battery information. This is done by reading the files in /sys/class/power_supply.
To list available batteries, run 'ls /sys/class/power_supply'
Available variables:
%percentage - battery percentage
%status - depending on the current battery status, this contains either <charging-label>, <discharging-label> or <full-label>.
Shows information about the screen brightness. This is done by reading the files in /sys/class/backlight.
<brightness_file> can be either 'actual_brightness' or 'brightness'.
To list available cards, run 'ls /sys/class/backlight'Available variables:
%current - contents of /sys/class/backlight/<card>/<brightness-file>
%max - contents of /sys/class/backlight/<card>/max_brightness
%percentage - brightness percentage
swaybar-protocol(7), strftime(3), date(1)
i3bar protocol specification
https://i3wm.org/docs/i3bar-protocol.html
Repository
https://github.com/acuteenvy/shstatus