#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)

. /etc/profile

AUDIOTEST=$(ps -ef | grep [p]ipewire)
if [ ! $? = 0 ]
then
  PLAYCMD="aplay -q"
else
  PLAYCMD="paplay"
fi

case $1 in
  -b)
    espeak --stdout "$(battery_percent)%" | ${PLAYCMD}
  ;;
  *)
    espeak --stdout "$*" | ${PLAYCMD}
  ;;
esac
