sleep 1 second before setting default sink to avoid timing issues

This commit is contained in:
Tilman Kranz 2025-02-25 01:17:51 +01:00
parent 8680811bfd
commit a6218a0d96

View File

@ -1,4 +1,6 @@
#!/bin/sh
#!/bin/bash
# shellcheck disable=SC1090
# shellcheck disable=SC2154
# Setup and run encrypted connection to remote PulseAudio/Pipewire server
# Copyright (C) 2023 Tilman Kranz <t.kranz@tk-sls.de>
#
@ -179,7 +181,7 @@ EOF
# Check if SSH port forwarding is running
check_pa_ssh() {
for pid in $(pidof ssh) ; do
if grep -Fq $USER-pulseaudio /proc/"$pid"/cmdline ; then
if grep -Fq "$USER"-pulseaudio /proc/"$pid"/cmdline ; then
grep -Fq -e -L /proc/"$pid"/cmdline || {
echo "ERROR: No SSH port forwarding to remote server is established." >&2
return 1 ;
@ -307,6 +309,7 @@ do_start() {
if "$outbound" ; then
enable_local_pa_tunnel_sink || return 1
sleep 1
set_local_pa_tunnel_sink_as_default || return 1
fi
@ -382,7 +385,7 @@ disable_remote_pa_tunnel_server() {
# Terminate SSH portforwarding session
terminate_ssh_portforward() {
for pid in $(pidof ssh) ; do
if grep -Fq $USER-pulseaudio /proc/"$pid"/cmdline ; then
if grep -Fq "$USER"-pulseaudio /proc/"$pid"/cmdline ; then
kill -TERM "$pid"
fi
done