Sample Header Ad - 728x90

dwmblocks bluetooth module. how to show connected device name?

1 vote
1 answer
1639 views
im using **DWM** with dwmblocks for the statusbar, i have serveral modules/scritps running for the status including bluetooth script that wrote to show some info and status if a device is connected
#!/bin/bash
  
  case $BLOCK_BUTTON in
          1) setsid -f blueman-manager ;;
          2) notify-send "$icon Device Connected" "$(if [[ "$(bluetoothctl info)" != "Missing device address argument" ]]; then 
                                                  echo= "$(bluetoothctl info | grep "Name" | awk '{print $2}')"
else
                                                  echo= "No Device Connected" )" ;;
          3) notify-send "$icon  Bluetooth" "\- Show Bluetooth Status.
  - Click to open Bluetooth Manager.
  - Middle click to show Connected Devices." ;;
  
  esac
  
    if [[ "$(bluetoothctl info)" != "Missing device address argument" ]]; then
      icon="  "
    else
      icon="  "
    fi
  
  printf "%s%s\\n" "$icon"
the script works fine but the middle click action
2) notify-send "$icon Device Connected" "$(if [[ "$(bluetoothctl info)" != "Missing device address argument" ]]; then 
                                                  echo= "$(bluetoothctl info | grep "Name" | awk '{print $2}')"
else
                                                  echo= "No Device Connected" )" ;;
doesn't show anything, i only want it to shows "Device Connected - (name of the device)" when a device is a connected else it shows "No Device Connected", but click action doesn't seems to work it doesn't even show a blank notification.
Asked by apoorv569 (51 rep)
Jun 12, 2020, 02:17 PM
Last activity: Dec 10, 2020, 02:42 AM