diff --git a/scripts/speedwm-btctrl b/scripts/speedwm-btctrl index 020618f..1d4c453 100755 --- a/scripts/speedwm-btctrl +++ b/scripts/speedwm-btctrl @@ -91,26 +91,38 @@ UNTRUST() { # Connect CONNECT() { + if [ -e "$/tmp/isconnected" ]; then + NOTIFY_ALREADY_CONNECTED && exit 0 + fi + bluetoothctl connect $SELDEVICE_MAC + touch /tmp/isconnected } # Disconnect DISCONNECT() { + rm -f /tmp/isconnected bluetoothctl disconnect $SELDEVICE_MAC } # Notification when connecting NOTIFY_CONNECT() { - notify-send " Connected to $USEROPT_1" + notify-send " Connected to ${USEROPT_1}!" } # Notification when disconnecting NOTIFY_DISCONNECT() { - notify-send " Disconnected from $USEROPT_1" + notify-send " Disconnected from ${USEROPT_1}!" } +# Notification when removing NOTIFY_REMOVE() { - notify-send " Removed $USEROPT_1" + notify-send " Removed ${USEROPT_1}!" +} + +# Notification when already connected +NOTIFY_ALREADY_CONNECTED() { + notify-send " Device $USEROPT_1 is already connected!" } # Perform actions as per user choice