all repos — dotfiles @ 92867c34bf6f26db6eabc12be0bd3c1b5f7b1d52

linux dotfiles

i3blocks/cpu_load

#!/bin/sh

load="$(cut -d ' ' -f1 /proc/loadavg)"
cpus="$(nproc)"

# full text
echo "$load"

# short text
echo "$load"

# color if load is too high
awk -v cpus=$cpus -v cpuload=$load '
    BEGIN {
        if (cpus <= cpuload) {
            print "#FF0000";
            exit 33;
        }
    }
'