Files
lenovo-gentoo/scripts/bluetooth-setup/README.md
Alexander Hinrichs 8de3f16ee6 chore: initialize gentoo-setup documentation repository
Add comprehensive documentation for Lenovo ThinkPad Gentoo Linux setup
including:
- Complete system configuration guides (power, Bluetooth, WiFi, audio)
- Hardware setup documentation (touchpad, touchscreen, DisplayLink)
- Management scripts with ZSH completions
- Kernel configuration (6.12.41-gentoo-x86_64)
- Lid automation and monitor management
- Battery conservation system
- User guides and troubleshooting

Repository includes .gitignore to exclude logs, temporary files, and
secrets.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 18:22:51 +01:00

3.2 KiB

Bluetooth Setup Tool

Easy Bluetooth device management for Gentoo using bluetoothctl.

Features

  • 🔍 Scan for nearby Bluetooth devices
  • 🔗 Pair and connect to devices
  • 📋 List paired devices with connection status
  • Remove/forget devices
  • 🔌 Enable/disable Bluetooth
  • Color-coded output for better readability
  • ZSH autocompletion support

Installation

# From the scripts folder
cd scripts/bluetooth-setup

# Install the main script
sudo cp bluetooth-setup /usr/local/bin/bluetooth-setup
sudo chmod +x /usr/local/bin/bluetooth-setup

# Install ZSH autocompletion
sudo mkdir -p /usr/local/share/zsh/site-functions
sudo cp _bluetooth-setup /usr/local/share/zsh/site-functions/_bluetooth-setup

# Reload ZSH completions (or restart your shell)
autoload -U compinit && compinit

Requirements

  • bluetoothctl (from bluez package)
  • Bluetooth service running (rc-service bluetooth start)
  • Bluetooth hardware not blocked (rfkill list bluetooth)

Usage

List paired devices

bluetooth-setup
# or
bluetooth-setup list-paired

Scan for nearby devices

bluetooth-setup scan

Pair with a device

bluetooth-setup pair AA:BB:CC:DD:EE:FF

The script will automatically trust the device after pairing and ask if you want to connect.

Connect to a paired device

bluetooth-setup connect AA:BB:CC:DD:EE:FF

Disconnect from device(s)

# Disconnect all devices
bluetooth-setup disconnect

# Disconnect specific device
bluetooth-setup disconnect AA:BB:CC:DD:EE:FF

Remove/forget a device

bluetooth-setup remove AA:BB:CC:DD:EE:FF

Show Bluetooth status

bluetooth-setup status

Enable/disable Bluetooth

bluetooth-setup power on
bluetooth-setup power off

Get help

bluetooth-setup help

ZSH Autocompletion

Once installed, ZSH will provide intelligent completions:

  • Command completion: bluetooth-setup <TAB>
  • Device completion: bluetooth-setup connect <TAB> shows paired devices
  • Power state completion: bluetooth-setup power <TAB> shows on/off

Troubleshooting

Bluetooth service not running

sudo rc-service bluetooth start
sudo rc-update add bluetooth default

Bluetooth is blocked

# Check status
rfkill list bluetooth

# Unblock
sudo rfkill unblock bluetooth

Device won't pair

  1. Make sure the device is in pairing mode
  2. Ensure Bluetooth is powered on: bluetooth-setup power on
  3. Remove the device if previously paired: bluetooth-setup remove MAC
  4. Try pairing again

Can't find bluetoothctl

# Install bluez
sudo emerge -av net-wireless/bluez

Examples

Connect to Bluetooth headphones

# Enable Bluetooth
bluetooth-setup power on

# Scan for devices
bluetooth-setup scan

# Pair and connect (use MAC address from scan)
bluetooth-setup pair AA:BB:CC:DD:EE:FF

# Later, reconnect quickly
bluetooth-setup connect AA:BB:CC:DD:EE:FF

Quick disconnect

# Disconnect all Bluetooth devices
bluetooth-setup disconnect

Integration with Waybar

The Bluetooth status can be displayed in waybar. See the main project documentation for waybar configuration.

  • WiFi Setup: See scripts/wifi-setup/ for WiFi management