distribution/packages/jelos/autostart/050-audio

42 lines
930 B
Text
Raw Normal View History

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
. /etc/profile
2023-08-07 11:12:57 +00:00
tocon "Configuring Audio..."
STATE=$(systemctl isactive pipewire-pulse)
if [ "${STATE}" = "inactive" ]
then
systemctl start pipewire-pulse
fi
### Auto switch between internal and bluetooth devices
pactl load-module module-switch-on-connect 2>/dev/null
### Set up audio routing (Internal or HDMI)
/usr/bin/hdmi_sense 2>/dev/null
2023-08-08 15:59:42 +00:00
2023-08-07 12:02:33 +00:00
### Set the default audio path, needed for some devices
if [ ! -z "${DEVICE_PLAYBACK_PATH_SPK}" ]
then
if [ -z "${DEVICE_PLAYBACK_PATH}" ]
then
export DEVICE_PLAYBACK_PATH="Playback Path"
fi
amixer -c 0 cset name="${DEVICE_PLAYBACK_PATH}" ${DEVICE_PLAYBACK_PATH_SPK} 2>/dev/null
2023-08-07 12:02:33 +00:00
fi
VOLUME=$(get_setting audio.volume)
2023-09-04 19:08:01 +00:00
if [ -z ${VOLUME} ]
then
VOLUME="60"
2023-09-04 19:08:01 +00:00
elif [ -n "${DEVICE_VOLUME}" ]
then
VOLUME="${DEVICE_VOLUME}"
fi
/usr/bin/volume ${VOLUME}