From 46557bc4343d5c834f88366094350de8c5346664 Mon Sep 17 00:00:00 2001 From: q3aql Date: Sat, 20 Nov 2021 14:23:01 +0100 Subject: [PATCH] Dotfiles config update (2021-11-20) --- .config/spectrwm/baraction.sh | 41 ++++++++++++++++++++++++++++++----- README-i3.md | 1 + README.md | 1 + 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/.config/spectrwm/baraction.sh b/.config/spectrwm/baraction.sh index 42af01e..ad99d7c 100755 --- a/.config/spectrwm/baraction.sh +++ b/.config/spectrwm/baraction.sh @@ -9,20 +9,51 @@ hdd() { ## RAM mem() { - mem=`free | awk '/Mem/ {printf "%dM/%dM\n", $3 / 1024.0, $2 / 1024.0 }'` - echo -e "$mem" + # Disable show meminfo + #mem=`free | awk '/Mem/ {printf "%dM/%dM\n", $3 / 1024.0, $2 / 1024.0 }'` + #echo -e "$mem" + + # Enable meminfo in GiB + 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) + memTotalG=$(calc ${memTotalM} / 1024 | tr -s " " | cut -c1-5) + memActiveG=$(calc ${memActiveM} / 1024 | tr -s " " | cut -c1-5) + + # Variables to show + if [ "${size}" == "G" ] ; then + showMemTotal="${memTotalG}G" + showMemActive="${memActiveG}G" + elif [ "${size}" == "M" ] ; then + showMemTotal="${memTotalM}M" + showMemActive="${memActiveM}M" + else + showMemTotal="${memTotalG}G" + showMemActive="${memActiveG}G" + fi + + show_mem_bar=$(echo ${showMemActive} /${showMemTotal}) + echo -e ${show_mem_bar} | tr -s " " } ## DATE AND TIME date_today() { day_hour=$(date "+%a,%d %h [%H:%M]") - echo "${day_hour}" + echo -e "${day_hour}" } ## DATE AND TIME (CUT) date_today_cut() { day_hour=$(date "+%H:%M") - echo "${day_hour}" + echo -e "${day_hour}" } # KERNEL @@ -50,7 +81,7 @@ kernel() { kernelVersion=${kernelVersion}${kernelVersionTempDot} # Apply arch kernelVersion=${kernelVersion} - echo "Linux ${kernelVersion}" + echo -e "Linux ${kernelVersion}" } ## CPU diff --git a/README-i3.md b/README-i3.md index c019d82..947d8df 100644 --- a/README-i3.md +++ b/README-i3.md @@ -127,6 +127,7 @@ My list of extra combinations: * [Antonio Sarosi](https://github.com/antoniosarosi/dotfiles/) * [Derek Taylor](https://gitlab.com/dwt1/dotfiles/) +* [TWB0109](https://github.com/TWB0109/PDots) * [i3-style](https://github.com/altdesktop/i3-style) * [addy-dclxvi](https://github.com/addy-dclxvi/i3-starterpack) * [i3-gaps](https://github.com/Airblader/i3) diff --git a/README.md b/README.md index 91afbfb..d444e7b 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,7 @@ My list of extra combinations: * [Antonio Sarosi](https://github.com/antoniosarosi/dotfiles/) * [Derek Taylor](https://gitlab.com/dwt1/dotfiles/) +* [TWB0109](https://github.com/TWB0109/PDots) * [i3-style](https://github.com/altdesktop/i3-style) * [addy-dclxvi](https://github.com/addy-dclxvi/i3-starterpack) * [i3-gaps](https://github.com/Airblader/i3)