Dotfiles config update (2022-10-07)
This commit is contained in:
parent
80d9d065b3
commit
322c188acc
|
@ -1,4 +1,40 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
mem_info=$(free -h | awk '/Mem:/ { printf(" %5s/%s \n", $3, $2) }')
|
# Configuration variables
|
||||||
echo ${mem_info}
|
memfile="/proc/meminfo"
|
||||||
|
size="G" # Change to M for MiB
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
memTotal=$(cat ${memfile} | grep -i "memtotal:" | head -1 | tr -s " " | cut -d " " -f 2)
|
||||||
|
memActive=$(cat ${memfile} | grep -i "memavailable:" | head -1 | tr -s " " | cut -d " " -f 2)
|
||||||
|
memActive=$(expr ${memTotal} - ${memActive})
|
||||||
|
|
||||||
|
# Variables to calculate
|
||||||
|
memTotalM=$(expr ${memTotal} / 1024 )
|
||||||
|
memActiveM=$(expr ${memActive} / 1024)
|
||||||
|
if [ -f /usr/bin/calc ] ; then
|
||||||
|
memPercentage=$(calc ${memActive} / ${memTotal} \* 100)
|
||||||
|
memTotalG=$(calc ${memTotalM} / 1024 | tr -s " " | cut -c1-5)
|
||||||
|
memActiveG=$(calc ${memActiveM} / 1024 | tr -s " " | cut -c1-5)
|
||||||
|
else
|
||||||
|
memPercentage=$(expr ${memActive} / ${memTotal} \* 100)
|
||||||
|
memTotalG=$(expr ${memTotalM} / 1024 | tr -s " " | cut -c1-5)
|
||||||
|
memActiveG=$(expr ${memActiveM} / 1024 | tr -s " " | cut -c1-5)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Variables to show
|
||||||
|
showMemPercentage=$(echo ${memPercentage} | cut -d "~" -f 2 | cut -d "." -f 1)
|
||||||
|
if [ "${size}" == "G" ] ; then
|
||||||
|
showMemTotal="${memTotalG}Gi"
|
||||||
|
showMemActive="${memActiveG}Gi"
|
||||||
|
elif [ "${size}" == "M" ] ; then
|
||||||
|
showMemTotal="${memTotalM}Mi"
|
||||||
|
showMemActive="${memActiveM}Mi"
|
||||||
|
else
|
||||||
|
showMemTotal="${memTotalG}Gi"
|
||||||
|
showMemActive="${memActiveG}Gi"
|
||||||
|
fi
|
||||||
|
|
||||||
|
memshowactive=$(echo ${showMemActive})
|
||||||
|
memshowtotal=$(echo ${showMemTotal})
|
||||||
|
echo ${memshowactive}/${memshowtotal}
|
||||||
|
|
4
.config/conky/scripts/mem_info_old.sh
Executable file
4
.config/conky/scripts/mem_info_old.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
mem_info=$(free -h | awk '/Mem:/ { printf(" %5s/%s \n", $3, $2) }')
|
||||||
|
echo ${mem_info}
|
|
@ -1,6 +1,42 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
mem_info=$(free -h | awk '/Mem:/ { printf(" %5s/%s \n", $3, $2) }')
|
# Configuration variables
|
||||||
|
memfile="/proc/meminfo"
|
||||||
|
size="G" # Change to M for MiB
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
memTotal=$(cat ${memfile} | grep -i "memtotal:" | head -1 | tr -s " " | cut -d " " -f 2)
|
||||||
|
memActive=$(cat ${memfile} | grep -i "memavailable:" | head -1 | tr -s " " | cut -d " " -f 2)
|
||||||
|
memActive=$(expr ${memTotal} - ${memActive})
|
||||||
|
|
||||||
|
# Variables to calculate
|
||||||
|
memTotalM=$(expr ${memTotal} / 1024 )
|
||||||
|
memActiveM=$(expr ${memActive} / 1024)
|
||||||
|
if [ -f /usr/bin/calc ] ; then
|
||||||
|
memPercentage=$(calc ${memActive} / ${memTotal} \* 100)
|
||||||
|
memTotalG=$(calc ${memTotalM} / 1024 | tr -s " " | cut -c1-5)
|
||||||
|
memActiveG=$(calc ${memActiveM} / 1024 | tr -s " " | cut -c1-5)
|
||||||
|
else
|
||||||
|
memPercentage=$(expr ${memActive} / ${memTotal} \* 100)
|
||||||
|
memTotalG=$(expr ${memTotalM} / 1024 | tr -s " " | cut -c1-5)
|
||||||
|
memActiveG=$(expr ${memActiveM} / 1024 | tr -s " " | cut -c1-5)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Variables to show
|
||||||
|
showMemPercentage=$(echo ${memPercentage} | cut -d "~" -f 2 | cut -d "." -f 1)
|
||||||
|
if [ "${size}" == "G" ] ; then
|
||||||
|
showMemTotal="${memTotalG}Gi"
|
||||||
|
showMemActive="${memActiveG}Gi"
|
||||||
|
elif [ "${size}" == "M" ] ; then
|
||||||
|
showMemTotal="${memTotalM}Mi"
|
||||||
|
showMemActive="${memActiveM}Mi"
|
||||||
|
else
|
||||||
|
showMemTotal="${memTotalG}Gi"
|
||||||
|
showMemActive="${memActiveG}Gi"
|
||||||
|
fi
|
||||||
|
|
||||||
echo -n " "
|
echo -n " "
|
||||||
echo -n ${mem_info}
|
memshowactive=$(echo ${showMemActive})
|
||||||
|
memshowtotal=$(echo ${showMemTotal})
|
||||||
|
echo -n ${memshowactive}/${memshowtotal}
|
||||||
echo " "
|
echo " "
|
||||||
|
|
6
.config/dwm/scripts/mem_info_old.sh
Executable file
6
.config/dwm/scripts/mem_info_old.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
mem_info=$(free -h | awk '/Mem:/ { printf(" %5s/%s \n", $3, $2) }')
|
||||||
|
echo -n " "
|
||||||
|
echo -n ${mem_info}
|
||||||
|
echo " "
|
|
@ -1,3 +1,40 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
free -h | awk '/Mem:/ { printf(" %5s / %s \n", $3, $2) }'
|
# Configuration variables
|
||||||
|
memfile="/proc/meminfo"
|
||||||
|
size="G" # Change to M for MiB
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
memTotal=$(cat ${memfile} | grep -i "memtotal:" | head -1 | tr -s " " | cut -d " " -f 2)
|
||||||
|
memActive=$(cat ${memfile} | grep -i "memavailable:" | head -1 | tr -s " " | cut -d " " -f 2)
|
||||||
|
memActive=$(expr ${memTotal} - ${memActive})
|
||||||
|
|
||||||
|
# Variables to calculate
|
||||||
|
memTotalM=$(expr ${memTotal} / 1024 )
|
||||||
|
memActiveM=$(expr ${memActive} / 1024)
|
||||||
|
if [ -f /usr/bin/calc ] ; then
|
||||||
|
memPercentage=$(calc ${memActive} / ${memTotal} \* 100)
|
||||||
|
memTotalG=$(calc ${memTotalM} / 1024 | tr -s " " | cut -c1-5)
|
||||||
|
memActiveG=$(calc ${memActiveM} / 1024 | tr -s " " | cut -c1-5)
|
||||||
|
else
|
||||||
|
memPercentage=$(expr ${memActive} / ${memTotal} \* 100)
|
||||||
|
memTotalG=$(expr ${memTotalM} / 1024 | tr -s " " | cut -c1-5)
|
||||||
|
memActiveG=$(expr ${memActiveM} / 1024 | tr -s " " | cut -c1-5)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Variables to show
|
||||||
|
showMemPercentage=$(echo ${memPercentage} | cut -d "~" -f 2 | cut -d "." -f 1)
|
||||||
|
if [ "${size}" == "G" ] ; then
|
||||||
|
showMemTotal="${memTotalG}Gi"
|
||||||
|
showMemActive="${memActiveG}Gi"
|
||||||
|
elif [ "${size}" == "M" ] ; then
|
||||||
|
showMemTotal="${memTotalM}Mi"
|
||||||
|
showMemActive="${memActiveM}Mi"
|
||||||
|
else
|
||||||
|
showMemTotal="${memTotalG}Gi"
|
||||||
|
showMemActive="${memActiveG}Gi"
|
||||||
|
fi
|
||||||
|
|
||||||
|
memshowactive=$(echo ${showMemActive})
|
||||||
|
memshowtotal=$(echo ${showMemTotal})
|
||||||
|
echo " ${memshowactive} / ${memshowtotal}"
|
||||||
|
|
3
.config/waybar/scripts/mem_info_old.sh
Executable file
3
.config/waybar/scripts/mem_info_old.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
free -h | awk '/Mem:/ { printf(" %5s / %s \n", $3, $2) }'
|
Loading…
Reference in New Issue
Block a user