#!/usr/bin/env bash # This shell script setups bluetooth to be flawless in gnome shell. # Devices are now instantly connected when they're near the laptop. # (It probably works as a service for random WMs too.) # The issue is essentially that gnome-bluetooth is issuing the wrong # dbus calls to connect the device immediately; org.bluez gets EAGAIN # from the kernel when it processes gnome-bluetooth dbus calls (until # it eventually succeeds, 20-30s later). However, bluetoothctl is # flawless at it. Maybe some day gnome-bluetooth will fix this. In the # meantime, this hack lets me have a seamless bluetooth experience. # PS: I tried to report the bug to gnome-bluetooth but haven't figured # out how. Apparently I need to register to 2 or 3 bug trackers? I may # just be dense. # To be able to run this fix, you need: bluez (which provides the # bluetoothctl binary) and python3-gevent. # Source: https://gist.github.com/ralt/b25095dcc1be680e581a9a53f2edcb43 # License: MIT (is that even needed for such a small amount of code?) set -e # Start with checking the requirements. python3 -c 'import gevent' which bluetoothctl # And now the fun begins. cd ~ # Create a systemd user service for our hack. cat > .config/systemd/user/fix-bluetooth.service < bin/fix-bluetooth <