123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- #!/bin/bash
- div="%{F#0092ff}<>%{F-}%{B-}"
- Clock() {
- DATETIME=$(date "+%a %b %d, %T")
- echo -n "$DATETIME"
- }
- cpuTemp() {
- CPUTEMP=$(sensors k10temp-pci-00c3 | grep Tdie | awk '{print $2}' | grep -o [0-9][0-9]||[0-9][0-9][0-9])
- GPUTEMP=$(sensors amdgpu-pci-1d00 | grep temp1 | awk '{print $2}' | grep -o [0-9][0-9]||[0-9][0-9][0-9])
- GPUFAN=$(sensors amdgpu-pci-1d00 | grep fan1 | awk '{print $2}')
- if [[ $CPUTEMP -gt 70 ]]; then
- CPUTEMP="%{F#ff5b00}$CPUTEMP%{F-}%{B-}"
- else
- CPUTEMP="%{F#ff9966}$CPUTEMP%{F-}%{B-}"
- fi
- if [[ $GPUTEMP -gt 70 ]]; then
- GPUTEMP="%{F#ff5b00}$GPUTEMP%{F-}%{B-}"
- else
- GPUTEMP="%{F#ff9966}$GPUTEMP%{F-}%{B-}"
- fi
- CPUFREQ=$(lscpu | grep MHz | head -n1 | awk '{print $3}')
- echo -n "CPU Temp: $CPUTEMP° CPU Freq: $CPUFREQ $div GPU Temp: $GPUTEMP° $div GPU FAN: $GPUFAN RPM"
- }
- 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=$(nmcli -f GENERAL,WIFI-PROPERTIES dev show wlp26s0 | grep GENERAL.CONNECTION: | awk '{print $2}')
- connectionStrength=$(nmcli dev wifi | tail -n1 | awk '{print $7}')
- echo -n "Wifi: $connectionName $connectionStrength%"
- }
- ethPort() {
- linkDetected=$(cat /sys/class/net/enp24s0/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/ubuntu--vg-root | awk '{print $4}' | tail -n1)
- freeHDD=$(df -h /dev/mapper/hddVolume | awk '{print $4}' | tail -n1)
- echo -n "NVMe Free: $freeNVME $div HDD Free: $freeHDD"
- }
- 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
- }
- expressVpn() {
- expressValue=$(expressvpn status | grep Connected 2>&1 > /dev/null; echo $?)
- if [[ "$expressValue" -ne 0 ]]; then
- echo -n "%{F#ff5b00}EVPN Down%{F-}%{B-}"
- elif [[ "$expressValue" -eq 0 ]]; then
- echo -n "%{F#ff9966}EVPN Up%{F-}%{B-}"
- else
- echo -n "Could not determine ExpressVPN status"
- fi
- }
- now_playing() {
- artist=$(cmus-remote -Q | grep "tag artist " | sed s/^tag\ artist\ //g)
- title=$(cmus-remote -Q | grep "tag title " | sed s/^tag\ title\ //g)
- album=$(cmus-remote -Q | grep "tag album " | sed s/^tag\ album\ //g)
- echo -n "Now Playing: $artist - $album - %{F#ff9966}$title%{F-}%{B-}"
- }
- while true; do
- sleep 1
- echo "%{l} $(Clock) $div $(cpuTemp) $div $(loadAvg) $div $(wifiInfo) $div $(ethPort) $div $(diskFree) $div $(soundState) $div $(expressVpn) $div $(now_playing)"
- sleep 0.5
- done
|