distribution/packages/sysutils/system-utils/sources/devices/RG353P/headphone_sense
fewtarius 7d07eff763
* Add user profile directory /storage/.config/profile.d.
* Apply workaround for no sound / no headphone jack switching (RG353V).
* Update ArtBook Next theme.
* Ensure the device tree is not swapped after an update.
> Note: Exiting RG353V users will need to disable and re-enable the RG353V switch, or run `device-switch RG353V` over ssh.
2022-10-02 12:46:51 -04:00

33 lines
797 B
Bash

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2020-present Shanti Gilbert (https://github.com/shantigilbert)
# Copyright (C) 2021-present Fewtarius
# Source predefined functions and variables
. /etc/profile
HP_ON='*headset status is in*'
HP_OFF='*headset status is out*'
# Switch to headphones if we have them already connected at boot
BOOT_SETTING=$(journalctl | grep "headset status is" | tail -n 1)
case ${BOOT_SETTING} in
(${HP_ON})
amixer cset name='Playback Path' HP
;;
*)
amixer cset name='Playback Path' SPK
;;
esac
journalctl -f | while read line; do
case $line in
(${HP_ON})
amixer cset name='Playback Path' HP
;;
(${HP_OFF})
amixer cset name='Playback Path' SPK
;;
esac
done