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/i3cpu |
Moved from github
Diffstat (limited to '.local/bin/statusbar/i3cpu')
-rwxr-xr-x | .local/bin/statusbar/i3cpu | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/.local/bin/statusbar/i3cpu b/.local/bin/statusbar/i3cpu new file mode 100755 index 0000000..c5eeb68 --- /dev/null +++ b/.local/bin/statusbar/i3cpu @@ -0,0 +1,34 @@ +#!/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; + +cpu_usage="$(cpu_usage)" +cpu="${cpu_usage%.*}" +printf "%s" "$cpu_usage" +# printf " " +# sb-cpubars + +echo +echo +# Print color, if needed +if [ "$cpu" -ge 90 ]; then + echo "$BLOCK_COLOR_LEVEL5"; + exit 33; +elif [ "$cpu" -ge 70 ]; then + echo "$BLOCK_COLOR_LEVEL4" +elif [ "$cpu" -ge 50 ]; then + echo "$BLOCK_COLOR_LEVEL3" +elif [ "$cpu" -ge 20 ]; then + echo "$BLOCK_COLOR_LEVEL2" +else + echo "$BLOCK_COLOR_LEVEL1" +fi + + |