dotfiles/.config/fish/functions/btre.fish

35 lines
825 B
Fish
Raw Permalink Normal View History

2021-08-31 16:47:41 +00:00
function btre -a device -d 'Reconnect to a known bluetooth device'
set -l devices CC:98:8B:3E:6B:9D 00:1B:66:E3:07:3A
set -l index 1
switch device
case sony
set index 1
return
case senn
set index 2
return
case '*'
test -n "$device"; and set index $device
end
2021-08-31 16:47:41 +00:00
bluetoothctl power on
and bluetoothctl remove $devices[$index]
2021-08-31 16:47:41 +00:00
echo \n"--- Press enter to continue ---"\n
bluetoothctl scan on &
read -P ''
2021-08-31 16:47:41 +00:00
bluetoothctl pair $devices[$index]
or return $status
read -p 'echo \n"--- Press enter to continue ---"\n'
bluetoothctl trust $devices[$index]
and bluetoothctl connect $devices[$index]
or return $status
read -p 'echo \n"--- Press enter to continue ---"\n'
2021-08-31 16:47:41 +00:00
kill %1
2021-08-31 16:47:41 +00:00
end