mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
Interactive tool scripts for EmulationStation's OPTIONS menu at /opt/system/: system-info, wifi-setup, bluetooth-setup, performance-mode, suspend-mode, usb-mode, factory-reset. Uses shared menu-lib.sh with fbcon rendering. Gamepad configs: default.gptk (RetroArch), tools.gptk (menu navigation with D-pad arrows, A=enter, B=escape). Note: scripts need further testing on hardware — left disabled for now. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
51 lines
1.6 KiB
Bash
51 lines
1.6 KiB
Bash
#!/bin/bash
|
|
# NAME: Bluetooth
|
|
. /usr/lib/archr/menu-lib.sh
|
|
tool_init
|
|
|
|
while true; do
|
|
if systemctl is-active bluetooth &>/dev/null; then
|
|
STATUS="ON"
|
|
PAIRED=$(bluetoothctl devices Paired 2>/dev/null)
|
|
if [ -n "$PAIRED" ]; then
|
|
PAIR_INFO=""
|
|
while read -r _ mac name; do
|
|
[ -z "$mac" ] && continue
|
|
if bluetoothctl info "$mac" 2>/dev/null | grep -q "Connected: yes"; then
|
|
PAIR_INFO+=" * $name [connected]\n"
|
|
else
|
|
PAIR_INFO+=" $name\n"
|
|
fi
|
|
done <<< "$PAIRED"
|
|
fi
|
|
else
|
|
STATUS="OFF"
|
|
fi
|
|
|
|
menu_select "Bluetooth — Status: $STATUS" \
|
|
"Toggle Bluetooth" \
|
|
"Make Discoverable (60s)" || break
|
|
|
|
case "$MENU_RESULT" in
|
|
0) # Toggle
|
|
if systemctl is-active bluetooth &>/dev/null; then
|
|
systemctl stop bluetooth 2>/dev/null
|
|
msg_show "Bluetooth" "Bluetooth stopped."
|
|
else
|
|
systemctl start bluetooth 2>/dev/null
|
|
msg_show "Bluetooth" "Bluetooth started."
|
|
fi
|
|
;;
|
|
1) # Discoverable
|
|
if ! systemctl is-active bluetooth &>/dev/null; then
|
|
systemctl start bluetooth 2>/dev/null
|
|
sleep 1
|
|
fi
|
|
bluetoothctl discoverable on 2>/dev/null
|
|
bluetoothctl pairable on 2>/dev/null
|
|
msg_show "Bluetooth" "Discoverable for 60 seconds.\nPair from your device now."
|
|
bluetoothctl discoverable off 2>/dev/null
|
|
;;
|
|
esac
|
|
done
|