Go to file
2022-08-11 12:04:24 +09:00
pictures Add picture of swaybar using swaybar_info 2022-08-10 14:29:58 +09:00
src Bump version to 0.1.1, fix warnings 2022-08-11 11:51:12 +09:00
.gitignore Init skeleton project 2022-07-09 15:44:04 +09:00
Cargo.lock Fix README.md, bump version to 0.1.2 2022-08-11 12:04:24 +09:00
Cargo.toml Fix README.md, bump version to 0.1.2 2022-08-11 12:04:24 +09:00
Changelog.md Add Changelog.md 2022-08-11 11:55:53 +09:00
LICENSE Add MIT LICENSE 2022-07-09 19:01:23 +09:00
README.md Fix README.md, bump version to 0.1.2 2022-08-11 12:04:24 +09:00

swaybar_info

swaybar\_info badge

swaybar\_info preview image

About

swaybar_info is a program to be utilized by swaybar that is used by the Sway tiling Wayland compositor.

Changes in What Version

See the Changelog.md for details.

Help Text

Usage:
  -h | --help                                      Prints help
  --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
  --time-format=<date format string>               Set the format string for the date

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/

# Alternatively, get it from crates.io/
cargo install swaybar_info
# The `swaybar_info` binary should be placed in $HOME/.cargo/bin/

Put the following in your ~/.config/sway/config (assuming the binary is at $HOME/.config/sway/swaybar_info):

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

    # A "built-in" for "acpi -b" is available, and can be activated with the
    # --acpi-builtin flag:

    #status_command $HOME/.config/sway/swaybar_info --acpi-builtin

    # One can use the "--regex-cmd=<cmd>[SPLIT]<args...>[SPLIT]<regex>" option like so:

    #status_command $HOME/.config/sway/swaybar_info --regex-cmd="acpi[SPLIT]-b[SPLIT][0-9]+%.*"

    # This example gets battery info into the bar.
    # Multiple args should be separated with "[SPLIT]".
    # Note that the <args...> portion is optional.


    # The following uses 24 hour time
    #status_command $HOME/.config/sway/swaybar_info --time-format="%Y-%m-%d %R:%S"
}

Dependencies

Uses serde_json, serde, chrono, and regex.