#!/usr/bin/bash

while :
do

  CPU_GOV=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)

  case $CPU_GOV in
    performance)
      CPU_GOV_SHORT=󰓅
      ;;
    balanced)
      CPU_GOV_SHORT=󰾅
      ;;
    powersave)
      CPU_GOV_SHORT=󰌪
      ;;
    userspace)
      CPU_GOV_SHORT=uspace
      ;;
    ondemand)
      CPU_GOV_SHORT=ondmnd
      ;;
    conservative)
      CPU_GOV_SHORT=cons
      ;;
    schedutil)
      CPU_GOV_SHORT=sutil
      ;;
    *)
      STATEMENTS
      ;;
  esac

  CPU_GOV_FULL="${CPU_GOV^}"

s="text|alt|tooltip|class
$CPU_GOV_SHORT|$CPU_GOV_FULL|CPU Mode: $CPU_GOV_FULL|cpugov"

jq --unbuffered --compact-output -Rn '
( input  | split("|") ) as $keys |
( inputs | split("|") ) as $vals |
[[$keys, $vals] | transpose[] | {key:.[0],value:.[1]}] | from_entries
' <<<"$s"

  sleep 5
done

#echo '{"text": "$(CPU_GOV)", "alt": "$CPU_GOV", "tooltip": "$CPU_GOV", "class": "$cpugov" }'