#!/bin/bash [[ "$BLOCK_INSTANCE" =~ "long" || "$BLOCK_BUTTON" == 1 ]] && LONG=true [[ "$BLOCK_BUTTON" == 2 ]] && i3-sensible-terminal -e htop sensors *-isa-* | awk -v LONG="$LONG" ' match($0, /^Package[^\+]*\+([0-9]{1,3})[^\+]*\+([0-9]{1,3})/, matches) { temp = matches[1] high = matches[2] step = high / 8 tresholdc = 40 stepc = ( high - tresholdc ) / 6 } END { if (LONG == "true") { printf("%d°C\n", temp) printf("%d°C\n", temp) } else { if (temp < step) { printf("▁\n▁\n") } else if (temp < step * 2 ) { printf("▂\n▂\n") } else if (temp < step * 3 ) { printf("▃\n▃\n") } else if (temp < step * 4 ) { printf("▄\n▄\n") } else if (temp < step * 5 ) { printf("▅\n▅\n") } else if (temp < step * 6 ) { printf("▆\n▆\n") } else if (temp < step * 7 ) { printf("▇\n▇\n") } else { printf("█\n█\n") } } if (temp < stepc + tresholdc) { print("#04B431\n") } else if (temp < stepc * 2 + tresholdc) { print("#A8FF00\n") } else if (temp < stepc * 3 + tresholdc) { print("#FFF600\n") } else if (temp < stepc * 4 + tresholdc) { print("#FFAE00\n") } else if (temp < stepc * 5 + tresholdc) { print("#FF0000\n") } else { exit 33 } } '