Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Switch playing streams #3

Open
BloodyAltair opened this issue Mar 29, 2019 · 1 comment
Open

[Feature request] Switch playing streams #3

BloodyAltair opened this issue Mar 29, 2019 · 1 comment

Comments

@BloodyAltair
Copy link

How about to add an function to switch already playing streams? I've wrote something like that on pacmd:

touch audio_state
SPEAKER="0 analog-output-speaker"
SPEAKER_SH="DEVICE_NAME"
HEADPHONES="1 analog-output-headphones"
HEADPHONES_SH="DEVICE_NAME"

if grep -q speaker "audio_state"; then
            pactl set-sink-port $HEADPHONES
            OUTPUT=$HEADPHONES_SH
            echo "headphones" > audio_state
            timeout 2 kdialog --msgbox "Switched to external audio device"
else
            pactl set-sink-port $SPEAKER
            OUTPUT=$SPEAKER_SH
            echo "speaker" > audio_state
            timeout 2 kdialog --msgbox "Switched to headphones"
fi
# Set default
pacmd set-default-sink $OUTPUT >/dev/null 2>&1

# Switch playing streams to default device
for playing in $(pacmd list-sink-inputs | awk '$1 == "index:" {print $2}')
do
         pacmd move-sink-input $playing $OUTPUT >/dev/null 2>&1
done
@denilsonsa
Copy link

Seems like duplicate of #5 , and seems like obsolete with the PipeWire behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants