Last active
December 16, 2020 10:28
-
-
Save PoisonousJohn/ca3875914fec6f767b7a951ebf3f9756 to your computer and use it in GitHub Desktop.
Headset switcher service. Detects when Zoom is running and switches headset profile for the call, then switches it back, when the meeting is ended
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Music Player Daemon | |
[Service] | |
ExecStart=/home/jp/.config/systemd/user/headset-switcher.sh | |
[Install] | |
WantedBy=default.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while : | |
do | |
IS_HEADSET_AVAILABLE=`pactl list cards | grep bluez || echo -n ""` | |
IS_ZOOM_RUNNING=`pactl list source-outputs | grep ZOOM || echo -n ""` | |
if [ ! -z "$IS_HEADSET_AVAILABLE" -a "$IS_HEADSET_AVAILABLE" != " " ]; then | |
if [ ! -z "$IS_ZOOM_RUNNING" -a "$IS_ZOOM_RUNNING" != " " ]; then | |
pactl set-card-profile bluez_card.38_18_4C_0E_9E_C2 headset_head_unit | |
else | |
pactl set-card-profile bluez_card.38_18_4C_0E_9E_C2 a2dp_sink | |
fi | |
fi | |
sleep 1 | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment