2022-07-09 10:06:51 +00:00
|
|
|
# swaybar\_info
|
|
|
|
|
2022-08-10 05:35:36 +00:00
|
|
|
[![swaybar\_info badge](https://img.shields.io/crates/v/swaybar_info)](https://crates.io/crates/swaybar_info)
|
|
|
|
|
2022-08-10 05:36:56 +00:00
|
|
|
[![swaybar\_info preview image](https://github.com/Stephen-Seo/swaybar_info/raw/master/pictures/swaybar_screenshot_00.png)](https://github.com/Stephen-Seo/swaybar_info/raw/master/pictures/swaybar_screenshot_00.png)
|
2022-08-10 05:31:42 +00:00
|
|
|
|
2022-07-09 10:14:53 +00:00
|
|
|
## About
|
|
|
|
|
|
|
|
swaybar\_info is a program to be utilized by swaybar that is used by the [Sway
|
2022-07-10 07:53:34 +00:00
|
|
|
tiling Wayland compositor](https://swaywm.org).
|
2022-07-09 10:14:53 +00:00
|
|
|
|
2022-08-11 02:58:37 +00:00
|
|
|
## Changes in What Version
|
|
|
|
|
|
|
|
[See the Changelog.md for details.](https://github.com/Stephen-Seo/swaybar_info/blob/master/Changelog.md)
|
|
|
|
|
2022-08-11 02:49:54 +00:00
|
|
|
## Help Text
|
|
|
|
|
|
|
|
Usage:
|
2022-08-11 03:04:24 +00:00
|
|
|
-h | --help Prints help
|
2022-08-11 02:49:54 +00:00
|
|
|
--netdev=<device_name> Check network traffic on specified device
|
|
|
|
--interval-sec=<seconds> Output at intervals of <seconds> (default 5)
|
|
|
|
--acpi-builtin Use "acpi -b" built-in fetching (battery info, with color)
|
|
|
|
--regex-cmd=<cmd>[SPLIT]<args...>[SPLIT]<regex> Use an output of a command as a metric
|
2022-08-11 03:04:24 +00:00
|
|
|
--time-format=<date format string> Set the format string for the date
|
2022-08-11 02:49:54 +00:00
|
|
|
|
2022-07-09 10:06:51 +00:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
# build the "release" build of the program
|
|
|
|
cargo build --release
|
|
|
|
# put the "release" build somewhere to be used by swaybar
|
|
|
|
cp ./target/release/swaybar_info ~/.config/sway/
|
|
|
|
|
2022-08-10 05:41:17 +00:00
|
|
|
# Alternatively, get it from crates.io/
|
|
|
|
cargo install swaybar_info
|
|
|
|
# The `swaybar_info` binary should be placed in $HOME/.cargo/bin/
|
|
|
|
|
2022-08-11 02:47:49 +00:00
|
|
|
Put the following in your `~/.config/sway/config` (assuming the binary is at
|
|
|
|
`$HOME/.config/sway/swaybar_info`):
|
2022-07-09 10:06:51 +00:00
|
|
|
|
|
|
|
bar {
|
|
|
|
position top
|
|
|
|
# Set --netdev=<device> such that <device> is the network device you
|
|
|
|
# want to monitor. You can omit --netdev=<device>, but that will also
|
|
|
|
# cause the program to omit network traffic stats.
|
|
|
|
status_command $HOME/.config/sway/swaybar_info --netdev=enp7s0
|
2022-07-12 08:30:15 +00:00
|
|
|
|
2022-07-29 04:49:50 +00:00
|
|
|
# A "built-in" for "acpi -b" is available, and can be activated with the
|
|
|
|
# --acpi-builtin flag:
|
2022-08-10 05:25:02 +00:00
|
|
|
|
|
|
|
#status_command $HOME/.config/sway/swaybar_info --acpi-builtin
|
2022-07-29 04:49:50 +00:00
|
|
|
|
2022-07-12 08:51:44 +00:00
|
|
|
# One can use the "--regex-cmd=<cmd>[SPLIT]<args...>[SPLIT]<regex>" option like so:
|
2022-08-10 05:25:02 +00:00
|
|
|
|
|
|
|
#status_command $HOME/.config/sway/swaybar_info --regex-cmd="acpi[SPLIT]-b[SPLIT][0-9]+%.*"
|
|
|
|
|
2022-07-12 08:30:15 +00:00
|
|
|
# This example gets battery info into the bar.
|
2022-07-12 08:55:18 +00:00
|
|
|
# Multiple args should be separated with "[SPLIT]".
|
2022-07-12 08:41:41 +00:00
|
|
|
# Note that the <args...> portion is optional.
|
2022-08-11 02:47:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
# The following uses 24 hour time
|
|
|
|
#status_command $HOME/.config/sway/swaybar_info --time-format="%Y-%m-%d %R:%S"
|
2022-07-09 10:06:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
## Dependencies
|
|
|
|
|
|
|
|
Uses [`serde_json`](https://crates.io/crates/serde_json),
|
|
|
|
[`serde`](https://crates.io/crates/serde),
|
2022-07-12 08:30:15 +00:00
|
|
|
[`chrono`](https://crates.io/crates/chrono),
|
|
|
|
and [`regex`](https://crates.io/crates/regex).
|