diff options
author | Vikas Kushwaha <dev@vikas.rocks> | 2024-11-21 13:30:52 +0530 |
---|---|---|
committer | Vikas Kushwaha <dev@vikas.rocks> | 2024-11-21 13:30:52 +0530 |
commit | 5c916d69d457101326803eb076a746060e3618cf (patch) | |
tree | d6fce3256eede1c1bf78fb6a1be75b9cc4b84cee /.local/bin/statusbar/i3memory |
Moved from github
Diffstat (limited to '.local/bin/statusbar/i3memory')
-rwxr-xr-x | .local/bin/statusbar/i3memory | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/.local/bin/statusbar/i3memory b/.local/bin/statusbar/i3memory new file mode 100755 index 0000000..edf9a73 --- /dev/null +++ b/.local/bin/statusbar/i3memory @@ -0,0 +1,33 @@ +#!/bin/sh + +case "$BLOCK_BUTTON" in + 1) $TERMINAL -e gotop ;; + 2) $TERMINAL -e nvim "$(which i3cpu)" ;; + 3) echo "top,$TERMINAL -e top + htop,$TERMINAL -e htop + gotop,$TERMINAL -e gotop + nvtop,$TERMINAL -e nvtop" | jgmenu --vsimple --at-pointer ;; +esac; + +memory="$(memory_percent)" +printf "%s" "$(memory_usage)" +# printf " " +# sb-cpubars + +echo +echo +# Print color, if needed +if [ "$memory" -ge 90 ]; then + echo "$BLOCK_COLOR_LEVEL5"; + exit 33; +elif [ "$memory" -ge 70 ]; then + echo "$BLOCK_COLOR_LEVEL4" +elif [ "$memory" -ge 50 ]; then + echo "$BLOCK_COLOR_LEVEL3" +elif [ "$memory" -ge 20 ]; then + echo "$BLOCK_COLOR_LEVEL2" +else + echo "$BLOCK_COLOR_LEVEL1" +fi + + |