This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/dotfiles/scripts/pulse-sink

35 lines
1.3 KiB
Plaintext
Raw Normal View History

2022-02-09 00:41:09 +01:00
#!/usr/bin/env fish
2019-10-17 15:21:35 +02:00
2021-12-11 14:48:51 +01:00
set opts "Fone\nSpeaker\nHDMI\nPhone"
set out (printf $opts | wdmenu -p "Output: ")
set vol (pamixer --get-volume)
2019-10-17 15:21:35 +02:00
2021-12-11 14:48:51 +01:00
switch "$out"
case Fone
pactl set-card-profile 0 output:analog-stereo+input:analog-stereo
2021-12-11 14:48:51 +01:00
pactl set-default-sink (pactl list sinks short | grep alsa | head -n1 | cut -f2)
pactl set-sink-port @DEFAULT_SINK@ analog-output-headphones
2021-12-11 14:48:51 +01:00
case Speaker
pactl set-card-profile 0 output:analog-stereo+input:analog-stereo
2021-12-11 14:48:51 +01:00
pactl set-default-sink (pactl list sinks short | grep alsa | head -n1 | cut -f2:)
pactl set-sink-port @DEFAULT_SINK@ analog-output-speaker
2021-12-11 14:48:51 +01:00
case HDMI
pactl set-card-profile 0 (
env LC_ALL=C pactl list cards |
2021-12-27 14:15:12 +01:00
string replace -raf '^\s*(output:hdmi-stereo.*?input.*?): .*' '$1' |
2021-12-11 14:48:51 +01:00
head -n1 )
pactl set-default-sink (pactl list sinks short | grep hdmi | head -n1 | cut -f2)
case Phone
2021-10-29 05:19:10 +02:00
pactl unload-module module-null-sink
pactl unload-module module-rtp-send
pactl load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=48000
pactl load-module module-rtp-send source=rtp.monitor destination=192.168.0.169 port=4010 mtu=320
pactl set-default-sink rtp
2021-12-11 14:48:51 +01:00
end
2019-10-17 15:21:35 +02:00
2019-12-04 05:18:30 +01:00
pamixer --set-volume "$vol"
2021-12-27 00:31:31 +01:00
# vim: ft=fish