while true; do micstat=$(pamixer --default-source --get-mute) [[ $micstat = "false" ]] && micstat="✔️" [[ $micstat = "true" ]] && micstat="🚫" vol="$(pamixer --get-volume)" if [ "$vol" -gt "70" ]; then volicon="% 🔊" elif [ "$vol" -lt "30" ]; then volicon="% 🔈" else volicon="% 🔉" fi [[ "$vol" = 0 || "$vol" = "" || $(pamixer --get-mute) = "true" ]] && volicon="🔇" && vol="" for battery in /sys/class/power_supply/BAT? do # Get its remaining capacity and charge status. capacity=$(cat "$battery"/capacity 2>/dev/null) || break status=$(sed "s/[Dd]ischarging/🔋/;s/[Nn]ot charging/🛑/;s/[Cc]harging/🔌/;s/[Uu]nknown/♻️/;s/[Ff]ull/|⚡/" "$battery"/status) # If it is discharging and 25% or less, we will add a ❗ as a warning. [ "$capacity" -le 25 ] && [ "$status" = "🔋" ] && warn="❗" batmsg=$(printf "%s%s%s%s%%" "$status" "$warn" "$capacity") unset warn done clock=$(date '+%I') case "$clock" in "00") icon="🕛" ;; "01") icon="🕐" ;; "02") icon="🕑" ;; "03") icon="🕒" ;; "04") icon="🕓" ;; "05") icon="🕔" ;; "06") icon="🕕" ;; "07") icon="🕖" ;; "08") icon="🕗" ;; "09") icon="🕘" ;; "10") icon="🕙" ;; "11") icon="🕚" ;; "12") icon="🕛" ;; esac xsetroot -name " 🔆 $(brightnessctl | grep -oP '\(\K[0-9]+(?=%\))') \ $vol$volicon \ $(free --mega | sed -n '2{p;q}' | awk '{printf ("%2.2fGB/%2.2fGB\n", ( $3 / 1000), ($2 / 1000))}') \ $batmsg \ $(date '+%a %d %b %Y') $icon $(date +"%-I:%M %p")" sleep 1 done