Files
dotfiles/Scripts/.local/scripts/status/memory
Aryadev Chavali 48084564ae (Scripts)~fixed font and output when emacs service wasn't started
~when Emacs hasn't started, state "N/A" rather than nothing

~Using better symbols for output (font wise as well on DWM)
2023-08-21 01:12:46 +01:00

15 lines
390 B
Bash
Executable File

#!/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 = "" ]];
then
emacs="N/A"
fi
echo "$(printf "%dMB" $used) $value% ->  $emacs"