#!/bin/bash

interval=10

cpu() {
  cpu_val=$(grep -o "^[^ ]*" /proc/loadavg)
  printf "^c#3b414d^ ^b#7ec7a2^ LOAD"
  printf "^c#abb2bf^ ^b#353b45^ $cpu_val"
}

mem() {
  printf "^c#3b414d^^b#c7957e^  "
  printf "^c#abb2bf^ ^b#353b45^ $(free -h | awk '/^Mem/ { print $3 }' | sed s/i//g)"
}

clock() {
  printf "^c#1e222a^^b#668ee3^ 󱑆 "
  printf "^c#1e222a^^b#7aa2f7^ $(date '+%a, %I:%M %p') "
}

while true; do
  sleep $interval
  xsetroot -name "$(cpu) $(mem) $(clock)"
done
