Dotfiles config update (2021-01-28)

This commit is contained in:
q3aql 2022-01-28 16:28:37 +01:00
parent 1900496dc1
commit 52cf0938f8
7 changed files with 256 additions and 20 deletions

View File

@ -1,5 +1,20 @@
#!/bin/sh
TEMP=$(sensors | grep 'Package id 0:\|Tdie' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o)
#CPU_USAGE=$(mpstat 1 1 | awk '/Average:/ {printf("%s\n", $(NF-9))}')
CPU_USAGE=$(~/.config/i3blocks/cpu/cpu_load.sh -p)
echo "$CPU_USAGE $TEMP" | awk '{ printf(" CPU:%6s @ %s \n"), $1, $2 }'
check_sensor=$(sensors | grep "Tdie:" 2> /dev/null)
if [ -z "${check_sensor}" ] ; then
check_sensor=$(sensors | grep "Tctl:" 2> /dev/null)
if [ -z "${check_sensor}" ] ; then
CPU_USAGE=$(~/.config/i3blocks/cpu/cpu_load.sh -p)
echo "$CPU_USAGE" | awk '{ printf(" CPU:%6s \n"), $1, $2 }'
else
TEMP=$(sensors | grep 'Package id 0:\|Tctl' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o)
#CPU_USAGE=$(mpstat 1 1 | awk '/Average:/ {printf("%s\n", $(NF-9))}')
CPU_USAGE=$(~/.config/i3blocks/cpu/cpu_load.sh -p)
echo "$CPU_USAGE $TEMP" | awk '{ printf(" CPU:%6s @ %s \n"), $1, $2 }'
fi
else
TEMP=$(sensors | grep 'Package id 0:\|Tdie' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o)
#CPU_USAGE=$(mpstat 1 1 | awk '/Average:/ {printf("%s\n", $(NF-9))}')
CPU_USAGE=$(~/.config/i3blocks/cpu/cpu_load.sh -p)
echo "$CPU_USAGE $TEMP" | awk '{ printf(" CPU:%6s @ %s \n"), $1, $2 }'
fi

View File

@ -1,5 +1,20 @@
#!/bin/sh
TEMP=$(sensors | grep 'Package id 0:\|Tdie' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o)
#CPU_USAGE=$(mpstat 1 1 | awk '/Average:/ {printf("%s\n", $(NF-9))}')
CPU_USAGE=$(~/.config/i3blocks/cpu/cpu_load.sh -p)
echo "$CPU_USAGE $TEMP" | awk '{ printf(" CPU:%6s @ %s \n"), $1, $2 }'
check_sensor=$(sensors | grep "Tdie:" 2> /dev/null)
if [ -z "${check_sensor}" ] ; then
check_sensor=$(sensors | grep "Tctl:" 2> /dev/null)
if [ -z "${check_sensor}" ] ; then
CPU_USAGE=$(~/.config/polybar/cpu_load.sh -p)
echo "$CPU_USAGE" | awk '{ printf(" CPU:%6s \n"), $1, $2 }'
else
TEMP=$(sensors | grep 'Package id 0:\|Tctl' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o)
#CPU_USAGE=$(mpstat 1 1 | awk '/Average:/ {printf("%s\n", $(NF-9))}')
CPU_USAGE=$(~/.config/i3blocks/cpu/cpu_load.sh -p)
echo "$CPU_USAGE $TEMP" | awk '{ printf(" CPU:%6s @ %s \n"), $1, $2 }'
fi
else
TEMP=$(sensors | grep 'Package id 0:\|Tdie' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o)
#CPU_USAGE=$(mpstat 1 1 | awk '/Average:/ {printf("%s\n", $(NF-9))}')
CPU_USAGE=$(~/.config/i3blocks/cpu/cpu_load.sh -p)
echo "$CPU_USAGE $TEMP" | awk '{ printf(" CPU:%6s @ %s \n"), $1, $2 }'
fi

83
.config/polybar/cpu_load.sh Executable file
View File

@ -0,0 +1,83 @@
#!/bin/bash
# Script to show cpu
# Created by q3aql (q3aql@protonmail.ch)
# Licensed by GPL v.2
# Date: 10-01-2020
# --------------------------------------
VERSION="1.0"
# Variables
cpuPercentage=$(top -b -n1 | grep \%Cpu | awk '{print 100-$8}')
showCpuPercentage=$(echo ${cpuPercentage})
showCpuPercentageInteger=$(echo ${showCpuPercentage} | cut -d "." -f 1)
# Show percentage bar
if [ ${showCpuPercentageInteger} -ge 0 ] ; then
showCpuPercentageBar="="
fi
if [ ${showCpuPercentageInteger} -ge 3 ] ; then
showCpuPercentageBar="=="
fi
if [ ${showCpuPercentageInteger} -ge 12 ] ; then
showCpuPercentageBar="==="
fi
if [ ${showCpuPercentageInteger} -ge 18 ] ; then
showCpuPercentageBar="===="
fi
if [ ${showCpuPercentageInteger} -ge 25 ] ; then
showCpuPercentageBar="====="
fi
if [ ${showCpuPercentageInteger} -ge 35 ] ; then
showCpuPercentageBar="======"
fi
if [ ${showCpuPercentageInteger} -ge 40 ] ; then
showCpuPercentageBar="======="
fi
if [ ${showCpuPercentageInteger} -ge 45 ] ; then
showCpuPercentageBar="========"
fi
if [ ${showCpuPercentageInteger} -ge 50 ] ; then
showCpuPercentageBar="=========="
fi
if [ ${showCpuPercentageInteger} -ge 62 ] ; then
showCpuPercentageBar="============="
fi
if [ ${showCpuPercentageInteger} -ge 75 ] ; then
showCpuPercentageBar="==============="
fi
if [ ${showCpuPercentageInteger} -ge 85 ] ; then
showCpuPercentageBar="================="
fi
if [ ${showCpuPercentageInteger} -ge 90 ] ; then
showCpuPercentageBar="=================="
fi
if [ ${showCpuPercentageInteger} -ge 95 ] ; then
showCpuPercentageBar="==================="
fi
if [ ${showCpuPercentageInteger} -ge 100 ] ; then
showCpuPercentageBar="===================="
fi
# Show results
if [ "$1" == "-p" ]; then
echo ${showCpuPercentage}%
elif [ "$1" == "-b" ]; then
echo ${showCpuPercentageBar}
else
echo ""
echo " cpuinfo v$VERSION"
echo " ------------"
echo ""
echo " CpuPercentage Use:"
echo " ${showCpuPercentageBar} ${showCpuPercentage}%"
echo ""
echo " Available commands:"
echo ""
echo " cpuinfo.sh -p | Show CpuPercentage"
echo " cpuinfo.sh -b | Show CpuPercentage Bar"
echo ""
echo " Note: Conky require 'maximum_width = 240'"
echo ""
fi

View File

@ -87,14 +87,37 @@ kernel() {
## CPU
cpu() {
TEMP=$(sensors | grep 'Package id 0:\|Tdie' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o)
read cpu a b c previdle rest < /proc/stat
prevtotal=$((a+b+c+previdle))
sleep 0.5
read cpu a b c idle rest < /proc/stat
total=$((a+b+c+idle))
cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
echo -e "CPU: $cpu% @ ${TEMP}"
check_sensor=$(sensors | grep "Tdie:" 2> /dev/null)
if [ -z "${check_sensor}" ] ; then
check_sensor=$(sensors | grep "Tctl:" 2> /dev/null)
if [ -z "${check_sensor}" ] ; then
read cpu a b c previdle rest < /proc/stat
prevtotal=$((a+b+c+previdle))
sleep 0.5
read cpu a b c idle rest < /proc/stat
total=$((a+b+c+idle))
cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
echo -e "CPU: $cpu%"
else
TEMP=$(sensors | grep 'Package id 0:\|Tctl' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o)
read cpu a b c previdle rest < /proc/stat
prevtotal=$((a+b+c+previdle))
sleep 0.5
read cpu a b c idle rest < /proc/stat
total=$((a+b+c+idle))
cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
echo -e "CPU: $cpu% @ ${TEMP}"
fi
else
TEMP=$(sensors | grep 'Package id 0:\|Tdie' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o)
read cpu a b c previdle rest < /proc/stat
prevtotal=$((a+b+c+previdle))
sleep 0.5
read cpu a b c idle rest < /proc/stat
total=$((a+b+c+idle))
cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
echo -e "CPU: $cpu% @ ${TEMP}"
fi
}
## VOLUME

View File

@ -1,5 +1,20 @@
#!/bin/sh
TEMP=$(sensors | grep 'Package id 0:\|Tdie' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o)
#CPU_USAGE=$(mpstat 1 1 | awk '/Average:/ {printf("%s\n", $(NF-9))}')
CPU_USAGE=$(~/.config/i3blocks/cpu/cpu_load.sh -p)
echo "$CPU_USAGE $TEMP" | awk '{ printf(" CPU:%6s @ %s \n"), $1, $2 }'
check_sensor=$(sensors | grep "Tdie:" 2> /dev/null)
if [ -z "${check_sensor}" ] ; then
check_sensor=$(sensors | grep "Tctl:" 2> /dev/null)
if [ -z "${check_sensor}" ] ; then
CPU_USAGE=$(~/.config/waybar/scripts/cpu_load.sh -p)
echo "$CPU_USAGE" | awk '{ printf(" CPU:%6s \n"), $1, $2 }'
else
TEMP=$(sensors | grep 'Package id 0:\|Tctl' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o)
#CPU_USAGE=$(mpstat 1 1 | awk '/Average:/ {printf("%s\n", $(NF-9))}')
CPU_USAGE=$(~/.config/i3blocks/cpu/cpu_load.sh -p)
echo "$CPU_USAGE $TEMP" | awk '{ printf(" CPU:%6s @ %s \n"), $1, $2 }'
fi
else
TEMP=$(sensors | grep 'Package id 0:\|Tdie' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o)
#CPU_USAGE=$(mpstat 1 1 | awk '/Average:/ {printf("%s\n", $(NF-9))}')
CPU_USAGE=$(~/.config/i3blocks/cpu/cpu_load.sh -p)
echo "$CPU_USAGE $TEMP" | awk '{ printf(" CPU:%6s @ %s \n"), $1, $2 }'
fi

View File

@ -0,0 +1,83 @@
#!/bin/bash
# Script to show cpu
# Created by q3aql (q3aql@protonmail.ch)
# Licensed by GPL v.2
# Date: 10-01-2020
# --------------------------------------
VERSION="1.0"
# Variables
cpuPercentage=$(top -b -n1 | grep \%Cpu | awk '{print 100-$8}')
showCpuPercentage=$(echo ${cpuPercentage})
showCpuPercentageInteger=$(echo ${showCpuPercentage} | cut -d "." -f 1)
# Show percentage bar
if [ ${showCpuPercentageInteger} -ge 0 ] ; then
showCpuPercentageBar="="
fi
if [ ${showCpuPercentageInteger} -ge 3 ] ; then
showCpuPercentageBar="=="
fi
if [ ${showCpuPercentageInteger} -ge 12 ] ; then
showCpuPercentageBar="==="
fi
if [ ${showCpuPercentageInteger} -ge 18 ] ; then
showCpuPercentageBar="===="
fi
if [ ${showCpuPercentageInteger} -ge 25 ] ; then
showCpuPercentageBar="====="
fi
if [ ${showCpuPercentageInteger} -ge 35 ] ; then
showCpuPercentageBar="======"
fi
if [ ${showCpuPercentageInteger} -ge 40 ] ; then
showCpuPercentageBar="======="
fi
if [ ${showCpuPercentageInteger} -ge 45 ] ; then
showCpuPercentageBar="========"
fi
if [ ${showCpuPercentageInteger} -ge 50 ] ; then
showCpuPercentageBar="=========="
fi
if [ ${showCpuPercentageInteger} -ge 62 ] ; then
showCpuPercentageBar="============="
fi
if [ ${showCpuPercentageInteger} -ge 75 ] ; then
showCpuPercentageBar="==============="
fi
if [ ${showCpuPercentageInteger} -ge 85 ] ; then
showCpuPercentageBar="================="
fi
if [ ${showCpuPercentageInteger} -ge 90 ] ; then
showCpuPercentageBar="=================="
fi
if [ ${showCpuPercentageInteger} -ge 95 ] ; then
showCpuPercentageBar="==================="
fi
if [ ${showCpuPercentageInteger} -ge 100 ] ; then
showCpuPercentageBar="===================="
fi
# Show results
if [ "$1" == "-p" ]; then
echo ${showCpuPercentage}%
elif [ "$1" == "-b" ]; then
echo ${showCpuPercentageBar}
else
echo ""
echo " cpuinfo v$VERSION"
echo " ------------"
echo ""
echo " CpuPercentage Use:"
echo " ${showCpuPercentageBar} ${showCpuPercentage}%"
echo ""
echo " Available commands:"
echo ""
echo " cpuinfo.sh -p | Show CpuPercentage"
echo " cpuinfo.sh -b | Show CpuPercentage Bar"
echo ""
echo " Note: Conky require 'maximum_width = 240'"
echo ""
fi

2
.vimrc
View File

@ -18,6 +18,8 @@ let $NVIM_TUI_ENABLE_TRUE_COLOR=1
" Hide menu/toolbar of GVIM
":set guioptions -=m
:set guioptions -=T
:set guioptions -=r
:set guioptions -=L
" Helps force plug-ins to load correctly when it is turned back on below.
filetype off