20 lines
471 B
Fish
20 lines
471 B
Fish
|
|
#!/usr/bin/env fish
|
||
|
|
|
||
|
|
# Select a paired bluetooth connection
|
||
|
|
set dump (bluetoothctl devices | string replace "Device " "" | string split -m 1 " ")
|
||
|
|
|
||
|
|
set ids
|
||
|
|
set names
|
||
|
|
|
||
|
|
for i in (seq (count $dump))
|
||
|
|
if test (math $i % 2) -eq 0
|
||
|
|
set -a names $dump[$i]
|
||
|
|
else
|
||
|
|
set -a ids $dump[$i]
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
set input (math (menu --index $names || exit) + 1)
|
||
|
|
|
||
|
|
notify-send "Connect to bluetooth device $names[$input]" (bluetoothctl connect $ids[$input] | string collect)
|