Exit if no device selected in bluetooth_connect.pl

Also use 'printf' instead of 'echo' to interpret avoid extra newlines
This commit is contained in:
2024-07-13 22:33:46 +01:00
parent 7c1b52338e
commit 064b3561a5

View File

@ -20,7 +20,7 @@ foreach my $name (sort(keys %devices)) {
$device_list .= $name . "\n";
}
my $selection = `echo "$device_list" | dmenu`;
my $selection = `printf "$device_list" | dmenu` or die("No selection made");
chomp($selection);
`notify-send "$script_name" "Attempting to connect to $selection"`;
`bluetoothctl connect $devices{$selection}`;