#!/usr/bin/bash

# Quick Bluetooth device scan for Fedora
# Run without sudo — uses your user's bluetoothctl session

set -euo pipefail

if ! systemctl is-active --quiet bluetooth; then
    echo "Bluetooth service is not running. Start it with: sudo systemctl start bluetooth"
    exit 1
fi

DURATION="${1:-10}"

echo "Scanning for $DURATION seconds..."
bluetoothctl --timeout "$DURATION" scan on 2>/dev/null

echo ""
echo "Discovered devices:"
bluetoothctl devices
