Inspired by bluetooth-autoconnect, but much simplier and actually works. Based on systemd service (daemon) which does the following, repeatedly:
- Check activation condition. In my case, just check if
/dev/something
does not exist. - Try to run
bluetoothctl connect <MAC>
. No checks if bluetooth is on, etc. Dead simple. - Sleep for
delay
seconds (configurable).
// TODO
- How
test
command works: https://www.computerhope.com/unix/test.htm - How to loop with equal invervals: https://unix.stackexchange.com/a/214660