Add a simple bluetooth menu

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
master
Stacy Harper 4 years ago committed by Maarten van Gompel
parent 3bb3fb6094
commit 95ac330d0b
  1. 1
      scripts/core/sxmo_appmenu.sh
  2. 25
      scripts/core/sxmo_bluetoothmenu.sh
  3. 2
      scripts/core/sxmo_common.sh

@ -401,6 +401,7 @@ programchoicesinit() {
$icon_phn Dialer ^ 0 ^ sxmo_modemdial.sh $icon_phn Dialer ^ 0 ^ sxmo_modemdial.sh
$icon_msg Texts ^ 0 ^ sxmo_modemtext.sh $icon_msg Texts ^ 0 ^ sxmo_modemtext.sh
$icon_usr Contacts ^ 0 ^ sxmo_contactmenu.sh $icon_usr Contacts ^ 0 ^ sxmo_contactmenu.sh
$(command -v bluetoothctl >/dev/null && echo "$icon_bth Bluetooth ^ 0 ^ sxmo_bluetoothmenu.sh")
$(command -v megapixels >/dev/null && echo "$icon_cam Camera ^ 0 ^ GDK_SCALE=2 megapixels") $(command -v megapixels >/dev/null && echo "$icon_cam Camera ^ 0 ^ GDK_SCALE=2 megapixels")
$icon_net Networks ^ 0 ^ sxmo_networks.sh $icon_net Networks ^ 0 ^ sxmo_networks.sh
$icon_mus Audio ^ 0 ^ sxmo_appmenu.sh audioout $icon_mus Audio ^ 0 ^ sxmo_appmenu.sh audioout

@ -0,0 +1,25 @@
#!/usr/bin/env sh
devicemenu() {
while true; do
DEVICES="$(bluetoothctl devices | awk '{ $1=""; printf $2; $2=""; printf " ^" $0 "\n" }')"
ENTRIES="$(echo "$DEVICES" | sed 's|.* ^ ||' | xargs -0 printf "Close Menu\nDisconnect\n%s")"
PICKED="$(
echo "$ENTRIES" |
sxmo_dmenu_with_kb.sh -i -c -l 10 -p "Devices"
)"
if echo "$PICKED" | grep -q "Close Menu"; then
exit
elif echo "$PICKED" | grep -q "Disconnect"; then
st -e sh -c "bluetoothctl disconnect; sleep 1"
continue
else
devicemac="$(echo "$DEVICES" | grep " \^ $PICKED$" | sed 's| ^ .*||' )"
st -e sh -c "bluetoothctl connect $devicemac; sleep 1"
fi
done
}
devicemenu

@ -226,6 +226,8 @@ icon_chk=""
icon_and="" icon_and=""
# shellcheck disable=SC2034 # shellcheck disable=SC2034
icon_wif="" icon_wif=""
# shellcheck disable=SC2034
icon_bth=""
#allow the user to override icons #allow the user to override icons
if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/icons" ]; then if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/icons" ]; then

Loading…
Cancel
Save