<commit_before>#!/bin/bash

DEV=$(bluetoothctl devices | cat - <(echo power off)| dmenu -i -p 'choose device' -l 10 | cut -d\  -f2)

if [ "$DEV" = "off" ] ; then
	bluetoothctl power off
else
	bluetoothctl power on
	bluetoothctl connect $DEV
fi
<commit_msg>add notifications and info to bluetooth<commit_after>#!/bin/bash

DEV_MENU=$(bluetoothctl devices | cut -d' ' -f2)
STT_MENU=$(for d in ${DEV_MENU}; do
		bluetoothctl info $d | grep Connected: | awk '{print $2;}'
	done )

SEL=$(bluetoothctl devices | \
	cut -d' ' -f 2- | \
	paste <( echo $STT_MENU | tr ' ' '\n' | sed -e 's/no/(off)/' -e 's/yes/(on)/' ) - | \
	cat - <(echo power off) | \
	cat <(echo "") - | \
	dmenu -i -p 'choose device' -l 10 )

if [ "$SEL" = "power off" ] ; then
	bluetoothctl power off
	notify-send "bluetooth off"
	return 0
elif [ "$SEL" = "" ] ; then
	return 0
else
	DEV=$( echo $SEL | cut -d' ' -f 2 )
	DEV_NAME=$( echo $SEL | cut -d' ' -f 3- )

	PWR_STATUS=$( bluetoothctl show | grep Powered: | awk '{ print $2; }' )

	[ "${PWR_STATUS}" = "no" ] && bluetoothctl power on && notify-send "bluetooth on"

	DEV_CONNECTED=$( bluetoothctl info ${DEV} | grep Connected: | awk '{print $2;}' )

	if [ ${DEV_CONNECTED} = "yes" ]; then
		bluetoothctl disconnect ${DEV} || notify-send "failed to connect to ${DEV_NAME}"
		notify-send "disconnected from ${DEV_NAME}"
	else
		bluetoothctl connect ${DEV}
		notify-send "connected to ${DEV_NAME}"
	fi
	return 0
fi

{'fraction_non_alphanumeric': 0.17819706498951782, 'fraction_numerical': 0.010482180293501049, 'mean_word_length': 3.3658536585365852, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7454238', 'n_tokens_mistral': 579, 'n_tokens_neox': 545, 'n_words': 173}