#!/bin/bash div="%{F#0092ff}<>%{F-}%{B-}" Clock() { DATETIME=$(date "+%a %b %d, %T") echo -n "$DATETIME" } cpuTemp() { CPUTEMP=$(sensors | grep CPU | awk '{print $2}') echo -n "CPU Temp: $CPUTEMP" } batteryInfo() { capacityRemaining=$(cat /sys/class/power_supply/BAT0/capacity) batteryStatus=$(cat /sys/class/power_supply/BAT0/status) if [[ $capacityRemaining -lt 25 ]]; then capacityRemaining="%{F#ff5b00}$capacityRemaining %{F-}%{B-}" fi if [[ "$batteryStatus" == "Charging" ]]; then batteryStatus="%{F#ff9966}$batteryStatus%{F-}%{B-}" fi capacityRemaining=$capacityRemaining% echo -n "Battery: $capacityRemaining $batteryStatus" } wifiInfo() { connectionName=$(wpa_cli status | egrep "^ssid" | sed s/ssid=//g) ipAddr=$(wpa_cli status | egrep "^ip" | sed s/ip_address=//g) echo -n "Wifi: $connectionName $div IP: $ipAddr" } ethPort() { linkDetected=$(cat /sys/class/net/enp0s31f6/carrier) if [[ $linkDetected -eq 0 ]]; then connected="eth0: down" elif [[ $linkDetected -eq 1 ]]; then connected="eth0: up" fi echo -n "$connected" } diskFree() { freeNVME=$(df -h /dev/mapper/decryptedRoot-root | awk '{print $4}' | tail -n1) echo -n "NVMe Free: $freeNVME" } loadAvg() { la=$(uptime | grep -o :\ [0-9].* | sed s/://g | awk '{print $1}' | sed s/,//g) if (( $(echo "$la > 8" |bc -l) )); then la="%{F#ff5b00}$la%{F-}%{B-}" else la="%{F#ff9966}$la%{F-}%{B-}" fi echo -n "Load: $la" } soundState() { muted=$(pactl list sinks | grep Mute: | awk '{print $2}') if [[ "$muted" == yes ]]; then state="Volume: 0%" else level=$(pactl list sinks | grep Volume: | awk '{print $5}' | head -n1) state="Volume: $level" fi echo -n $state } while true; do sleep 1 echo "%{l} $(Clock) $div $(cpuTemp) $div $(loadAvg) $div $(wifiInfo) $div $(ethPort) $div $(diskFree) $div $(soundState) $div $(batteryInfo) $div " sleep 0.5 done