From 906a39f65d746a8a211a7c15dc2112b7b60029bc Mon Sep 17 00:00:00 2001 From: speedie Date: Wed, 24 Aug 2022 12:36:34 +0200 Subject: [PATCH] add already connected notification --- scripts/speedwm-btctrl | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) 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