#!/bin/sh BATTERY_FULL_THRESHOLD=80 BATTERY_FULL_COLOR="#31f53e" WIFI_ADAPTER="wlan0" readable_kib() { if [ "$1" -lt 1024 ]; then printf "%.1fK\n" "$1" elif [ "$1" -lt 1048576 ]; then printf "%.1fM\n" $(($1 / 1024)) else printf "%.1fG\n" $(($1 / 1048576)) fi } monitor_battery() { read -r capacity %s%% (%s)\n' "$BATTERY_FULL_COLOR" "$capacity" "$status" else printf '%s%% (%s)\n' "$capacity" "$status" fi } monitor_cpu() { while read -r _ user _ system idle _; do initial_user_sys=$((user + system)) initial_total=$((user + system + idle)) break done %s @ %s\n' "$address" "$ssid" } monitor_volume() { volume=$(wpctl get-volume @DEFAULT_AUDIO_SINK@) volume=${volume% \[MUTED\]} volume=${volume#Volume: } volume=${volume%.*}${volume#*.} volume=${volume#0} printf '%s%%\n' "$volume" } monitor_uptime() { up=$(uptime -p) up=${up#up } up=${up//,} up=${up// day/d} up=${up// days/d} up=${up// minutes/m} up=${up// minute/m} up=${up// hours/h} up=${up// hour/h} printf '%s\n' "$up" } if command -v monitor_"$1" >/dev/null 2>&1; then monitor_"$1" fi