[ "$(command -v polybar)" ] || return 0

(
  # export BATTERY_ADAPTER="$(
  #   grep -E -l 'Mains' '/sys/class/power_supply/'*'/type' \
  #   | head -n 1 \
  #   | sed 's|.*/\(.\+\)/type$|\1|'
  # )"
  # export BATTERY_BATTERY="$(
  #   grep -E -l 'Battery' '/sys/class/power_supply/'*'/type' \
  #   | head -n 1 \
  #   | sed 's|.*/\(.\+\)/type$|\1|'
  # )"
  export TEMPERATURE_THERMAL_ZONE="$(
    grep -E -l 'cpu|x86' '/sys/class/thermal/thermal_zone'*'/type' 2> /dev/null \
    | head -n 1 \
    | sed 's|.*\([0-9]\+\)/type$|\1|'
  )"
  export BACKLIGHT_CARD="$(
    grep -E -l 'raw' '/sys/class/backlight/'*'/type' 2> /dev/null \
    | head -n 1 \
    | sed 's|.*/\(.\+\)/type$|\1|'
  )"
  killall --wait polybar 2> '/dev/null' || true
  polybar --quiet --reload fake-top &
  polybar --quiet --reload fake-bottom &
  polybar --quiet --reload border-top &
  polybar --quiet --reload border-bottom &
) &