aboutsummaryrefslogtreecommitdiff
path: root/Scripts/.local/scripts/status/memory
blob: 2d1c328f7113357def9dbe9a1ae0c32e295bda6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash

line=$(free -m | sed -n 2p);
used=$(echo $line | awk '{print $3}');
available=$(echo $line | awk '{print $2}');
value=$(echo "100 * $used / $available" | bc -l | xargs printf "%.2f" $1)

emacs=$(systemctl --user status emacs | grep "Memory: " | sed "s/[ ]*//;s/Memory: //")
if [[ $emacs -eq "" ]];
then
    emacs="N/A"
fi

echo "⾝ $(printf "%dMB" $used) $value% -> $emacs"