2021-02-01 00:37:48 +00:00
|
|
|
function pastoggle -d 'Toggle the pulseaudio server between pc.lan and laptop.lan'
|
|
|
|
set -l host 'pc.lan'
|
|
|
|
set -l remote 'laptop.lan'
|
|
|
|
set -l config $HOME/.config/pulse/client.conf
|
|
|
|
|
|
|
|
if test (hostname) = 'm-laptop'
|
|
|
|
set host 'laptop.lan'
|
|
|
|
set remote 'pc.lan'
|
|
|
|
end
|
|
|
|
|
2021-05-02 19:49:38 +00:00
|
|
|
ssh $remote true
|
|
|
|
or return $status
|
|
|
|
|
2021-02-01 00:37:48 +00:00
|
|
|
if test -f "$config"
|
|
|
|
rm $config
|
|
|
|
and systemctl --user restart pulseaudio.service
|
|
|
|
and ssh $remote "echo \"default-server = $host\" >$config; and systemctl --user restart pulseaudio.service"
|
|
|
|
else
|
|
|
|
ssh $remote "rm $config; and systemctl --user restart pulseaudio.service"
|
|
|
|
and echo "default-server = $remote" >$config
|
|
|
|
and systemctl --user restart pulseaudio.service
|
|
|
|
end
|
|
|
|
end
|