Add community scripts for i3blocks

This commit is contained in:
2020-02-19 15:55:35 +00:00
parent 3233439d88
commit 3236629420
19 changed files with 746 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
#!/usr/bin/env bash
################################
# Shows info about the RAM
#
# Dependencies:
# - [notify-send]
#
# @return {Number(%)}: RAM usage
################################
dir=$(dirname $0)
source $dir/util.sh
full=""
short=""
status=0
exec 6< /proc/meminfo
read a total b <&6
read a free b <&6
read a b c <&6
read a buffer b <&6
read a cached b <&6
MEM=$(calc "100 * ($total - ($free + $buffer + $cached)) / $total")
full="$MEM%"
short=$full
if [ $MEM -ge 80 ]; then
status=33
fi
case $BLOCK_BUTTON in
# right click: show packages
3)
n=16
summary=$(ps -eo pmem,pcpu,pid,comm --sort=-pmem | head -$n)
notify-send "Top $n RAM-eaters" "$summary"
;;
esac
echo $full
echo $short
exit $status