Auto-connect Bluetooth Gamepad on Bazzite
This guide sets up your system so your Bluetooth gamepad connects automatically when turned on. It uses a udev rule for instant connection and a systemd timer (every 5 seconds) as a fallback.
Step 1: Create the auto-connect script
Create the script folder:
mkdir -p ~/.local/bin
Create the script:
nano ~/.local/bin/bt-autoconnect.sh
Paste the following code (replace 11:22:33:44:55:66 with your gamepad’s MAC address):
#!/usr/bin/env bash
DEVICE=“11:22:33:44:55:66” # replace with your gamepad MAC
Check if already connected
if bluetoothctl info “$DEVICE” | grep -q “Connected: yes”; then
exit 0
fi
logger “bt-autoconnect: trying to connect $DEVICE”
/usr/bin/bluetoothctl connect “$DEVICE”
Make it executable:
chmod +x ~/.local/bin/bt-autoconnect.sh
Step 2: Create the systemd unit
Create the systemd folder:
mkdir -p ~/.config/systemd/user
Create the service unit:
nano ~/.config/systemd/user/bt-autoconnect.service
Paste:
[Unit]
Description=Auto-connect Pro Controller
[Service]
Type=oneshot
ExecStart=%h/.local/bin/bt-autoconnect.sh
Step 3: Create the systemd timer (every 5 seconds)
Create the timer unit:
nano ~/.config/systemd/user/bt-autoconnect.timer
Paste:
[Unit]
Description=Fallback: try to connect gamepad every 5s
[Timer]
OnBootSec=5
OnUnitActiveSec=5s
Unit=bt-autoconnect.service
[Install]
WantedBy=default.target
Enable the timer:
systemctl --user daemon-reload
systemctl --user enable --now bt-autoconnect.timer
Step 4: Create the udev rule for instant connection
Create the udev rule file:
sudo nano /etc/udev/rules.d/99-bt-autoconnect.rules
Paste (replace 11:22:33:44:55:66 with your gamepad MAC):
ACTION==“add”, SUBSYSTEM==“bluetooth”, ATTR{address}==“11:22:33:44:55:66”, TAG+=“systemd”, ENV{SYSTEMD_USER_WANTS}+=“bt-autoconnect.service”
Reload udev rules:
sudo udevadm control --reload-rules
sudo udevadm trigger
How it works
udev: triggers the service immediately when the gamepad is turned on.
systemd timer: checks every 5 seconds and retries connecting if the first attempt failed.
With this setup, your Bluetooth gamepad should connect almost instantly and reliably every time.