dotfiles/.local/scripts/bluetoothmenu.fish

20 lines
471 B
Fish
Raw Normal View History

2026-03-19 15:34:08 +01:00
#!/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)