[BACK]Return to termbar CVS log [TXT][DIR] Up to [x61] / dotfiles / termbar

Diff for /dotfiles/termbar/termbar between version 1.2 and 1.3

version 1.2, 2020/06/01 16:24:12 version 1.3, 2020/06/04 17:37:01
Line 1 
Line 1 
 #!/bin/sh  #!/bin/sh
   
 yel='\033[33m'  ## Debug
 pur='\033[35m'  #set -x
 gre='\033[32m'  
 rst='\033[0m'  
   
 pipe="${pur}|${rst}"  esc="\033"
   reset="${esc}[0m"
   redf="${esc}[31m"
   cyanf="${esc}[36m";
   purplef="${esc}[35m"
   pipe="${purplef}|${reset}"
   
 while true; do  today()
   {
           DATE=$(date +"%B %d - %H:%M")
   }
   
   cpu()
   {
         CPU_SPEED=$(sysctl hw.cpuspeed | cut -d "=" -f 2 | cut -d "." -f 1)          CPU_SPEED=$(sysctl hw.cpuspeed | cut -d "=" -f 2 | cut -d "." -f 1)
         CPU_TEMP=$(sysctl hw.sensors.cpu0.temp0 | cut -d "=" -f 2 | cut -d "." -f 1)          CPU_TEMP=$(sysctl hw.sensors.cpu0.temp0 | cut -d "=" -f 2 | cut -d "." -f 1)
         RAM=$(top | grep Memory | awk {'print $6'})  }
         BAT_STATUS=$(sysctl hw.sensors.acpiac0.indicator0 | cut -d "=" -f 2 | cut -d "." -f 1)  
   bat()
   {
         BAT=$(apm -l)          BAT=$(apm -l)
         DATE=$(date +"%B %d - %H:%M")  }
         SSID=$(ifconfig | grep ieee | awk -F'"' '$0=$2')  
 #       SSID=$(ifconfig | grep ieee | awk '/join/ {print $3}')  bat_status()
         INTIP=$(ifconfig trunk0 | grep inet | awk '{print $2}')  {
         IP=$(dig +short myip.opendns.com @resolver1.opendns.com | awk {'printf $1'})          STATUS=$(sysctl hw.sensors.acpiac0.indicator0 | grep -c On)
         printf "  $DATE ${pipe} ${gre}CPU:${rst} $CPU_SPEED ($CPU_TEMP┬░) ${pipe} ${gre}Free Ram:${rst} $RAM "  
         printf "${pipe} ${gre}Bat:${rst} $BAT - $BAT_STATUS ${pipe} ${gre}SSID:${rst} $SSID ${pipe}"          if [ ${STATUS} -eq "1" ]; then
         printf " ${gre}Pub. IP:${rst} $IP - ${gre}Int. IP:${rst} $INTIP \r"                  BAT_STATUS=$(echo Connected)
         sleep 15          else
                   BAT_STATUS=$(echo ${redf}Disconnected${reset})
           fi
   }
   
   mem()
   {
           MEM=$(top -n | grep Memory | awk {'print $6'})
   }
   
   wifi()
   {
           SSID=$(ifconfig | grep join | sed -e 's/.*join\(.*\)chan.*/\1/')
   }
   
   network()
   {
           IIP=$(ifconfig trunk0 | grep inet | awk '{print $2}')
           PIP=$(dig +short myip.opendns.com @resolver1.opendns.com | awk {'printf $1'})
   }
   
   while true; do
           today
           cpu
           mem
           bat
           bat_status
           wifi
           network
           printf "  ${DATE} ${pipe} ${cyanf}CPU:${reset} ${CPU_SPEED} MHz (${CPU_TEMP}┬░) ${pipe} ${cyanf}Mem:${reset} ${MEM} "
           printf "${pipe} ${cyanf}Bat:${reset} $BAT - ${BAT_STATUS} ${pipe} ${cyanf}SSID:${reset}${SSID}${pipe}"
           printf " ${cyanf}IPs:${reset} ${PIP} / ${IIP} \v"
           sleep 15
 done  done

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

CVSweb
CodeBerg
SourceHut