*: Wrap lines at 80 columns where appropriate
Wrap lines at 80 columns where appropriate and I had the energy to think about how/where to wrap. There are still lines longer than that, which I plan to wrap in the future. But that is enough for now.
This commit is contained in:
@@ -5,14 +5,24 @@ bluetooth_print() {
|
||||
bluetoothctl | while read -r; do
|
||||
if [[ "$(systemctl is-active "bluetooth.service")" = "active" ]]; then
|
||||
|
||||
devices_paired=$(echo paired-devices | bluetoothctl | sed -n '/paired-devices/,$p' | grep Device | cut -d ' ' -f 2)
|
||||
devices_paired=$(
|
||||
echo paired-devices \
|
||||
| bluetoothctl \
|
||||
| sed -n '/paired-devices/,$p' \
|
||||
| grep Device \
|
||||
| cut -d ' ' -f 2
|
||||
)
|
||||
counter=0
|
||||
|
||||
echo "$devices_paired" | while read -r line; do
|
||||
device_info=$(echo "info $line" | bluetoothctl)
|
||||
|
||||
if echo "$device_info" | grep -q "Connected: yes"; then
|
||||
device_alias=$(echo "$device_info" | grep "Alias" | cut -d ' ' -f 2-)
|
||||
device_alias=$(
|
||||
echo "$device_info" \
|
||||
| grep "Alias" \
|
||||
| cut -d ' ' -f 2-
|
||||
)
|
||||
|
||||
if [[ $counter -gt 0 ]]; then
|
||||
printf ", %s" "$device_alias"
|
||||
@@ -39,12 +49,24 @@ bluetooth_toggle() {
|
||||
echo "power on" | bluetoothctl >> /dev/null
|
||||
sleep 1
|
||||
|
||||
devices_paired=$(echo paired-devices | bluetoothctl | sed -n '/paired-devices/,$p' | grep Device | cut -d ' ' -f 2)
|
||||
devices_paired=$(
|
||||
echo paired-devices
|
||||
| bluetoothctl \
|
||||
| sed -n '/paired-devices/,$p' \
|
||||
| grep Device \
|
||||
| cut -d ' ' -f 2
|
||||
)
|
||||
echo "$devices_paired" | while read -r line; do
|
||||
echo "connect $line" | bluetoothctl >> /dev/null
|
||||
done
|
||||
else
|
||||
devices_paired=$(echo paired-devices | bluetoothctl | sed -n '/paired-devices/,$p' | grep Device | cut -d ' ' -f 2)
|
||||
devices_paired=$(
|
||||
echo paired-devices \
|
||||
| bluetoothctl \
|
||||
| sed -n '/paired-devices/,$p' \
|
||||
| grep Device \
|
||||
| cut -d ' ' -f 2
|
||||
)
|
||||
echo "$devices_paired" | while read -r line; do
|
||||
device_info=$(echo "info $line" | bluetoothctl)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user