aboutsummaryrefslogtreecommitdiff
path: root/.i3-blocks/blocks/cpu
diff options
context:
space:
mode:
authorNeodarZ <neodarz@neodarz.ovh>2016-09-21 20:06:02 +0200
committerNeodarZ <neodarz@neodarz.ovh>2016-09-21 20:06:02 +0200
commitf0b7ce9877b22014022ff1a3035a2f3be262b337 (patch)
treea37046f05a746886bb336ec42e8997632cd0aaf9 /.i3-blocks/blocks/cpu
parentafb981f0fe8fa0de77f7451d6907f5094c38f1b5 (diff)
parent78db7d43845d3ea276b8028bec6d67b5a5641a1b (diff)
downloaddotfiles-f0b7ce9877b22014022ff1a3035a2f3be262b337.tar.xz
dotfiles-f0b7ce9877b22014022ff1a3035a2f3be262b337.zip
Ajout de la police awesome
Diffstat (limited to '.i3-blocks/blocks/cpu')
-rwxr-xr-x.i3-blocks/blocks/cpu48
1 files changed, 0 insertions, 48 deletions
diff --git a/.i3-blocks/blocks/cpu b/.i3-blocks/blocks/cpu
deleted file mode 100755
index 2cb27ad..0000000
--- a/.i3-blocks/blocks/cpu
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-# Source: http://askubuntu.com/a/450136
-
-URGENT_VALUE=90
-
-PREV_TOTAL=0
-PREV_IDLE=0
-
-cpuFile="/tmp/.cpu"
-
-if [[ -f "${cpuFile}" ]]; then
- fileCont=$(cat "${cpuFile}")
- PREV_TOTAL=$(echo "${fileCont}" | head -n 1)
- PREV_IDLE=$(echo "${fileCont}" | tail -n 1)
-fi
-
-CPU=(`cat /proc/stat | grep '^cpu '`) # Get the total CPU statistics.
-unset CPU[0] # Discard the "cpu" prefix.
-IDLE=${CPU[4]} # Get the idle CPU time.
-
-# Calculate the total CPU time.
-TOTAL=0
-
-for VALUE in "${CPU[@]:0:4}"; do
- let "TOTAL=$TOTAL+$VALUE"
-done
-
-if [[ "${PREV_TOTAL}" != "" ]] && [[ "${PREV_IDLE}" != "" ]]; then
- # Calculate the CPU usage since we last checked.
- let "DIFF_IDLE=$IDLE-$PREV_IDLE"
- let "DIFF_TOTAL=$TOTAL-$PREV_TOTAL"
- let "DIFF_USAGE=(1000*($DIFF_TOTAL-$DIFF_IDLE)/$DIFF_TOTAL+5)/10"
- echo "${DIFF_USAGE}%"
- echo "${DIFF_USAGE}%"
- echo ""
-else
- echo "?"
- echo "?"
- echo ""
-fi
-
-# Remember the total and idle CPU times for the next check.
-echo "${TOTAL}" > "${cpuFile}"
-echo "${IDLE}" >> "${cpuFile}"
-
-if [[ "${DIFF_USAGE}" -gt 0 ]] && [[ "${DIFF_USAGE}" -gt "${URGENT_VALUE}" ]]; then
- exit 33
-fi \ No newline at end of file