{"id":19903594,"url":"https://github.com/noraworld/bluetoothctl-autoconnector","last_synced_at":"2025-05-03T00:31:16.213Z","repository":{"id":45692386,"uuid":"326325039","full_name":"noraworld/bluetoothctl-autoconnector","owner":"noraworld","description":"Connects all paired Bluetooth devices automatically on Linux","archived":false,"fork":false,"pushed_at":"2024-01-08T06:57:56.000Z","size":57,"stargazers_count":13,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-02T05:54:11.610Z","etag":null,"topics":["bluetooth","bluetoothconnector","bluetoothcontrol","bluetoothctl","linux","raspberry-pi","raspberrypi"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/noraworld.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"noraworld"}},"created_at":"2021-01-03T04:13:30.000Z","updated_at":"2024-03-20T12:43:44.000Z","dependencies_parsed_at":"2022-09-22T18:50:20.862Z","dependency_job_id":"81c771ab-05d0-4331-868b-e8b73cd5e3af","html_url":"https://github.com/noraworld/bluetoothctl-autoconnector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noraworld%2Fbluetoothctl-autoconnector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noraworld%2Fbluetoothctl-autoconnector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noraworld%2Fbluetoothctl-autoconnector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noraworld%2Fbluetoothctl-autoconnector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noraworld","download_url":"https://codeload.github.com/noraworld/bluetoothctl-autoconnector/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224343445,"owners_count":17295646,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bluetooth","bluetoothconnector","bluetoothcontrol","bluetoothctl","linux","raspberry-pi","raspberrypi"],"created_at":"2024-11-12T20:24:31.411Z","updated_at":"2024-11-12T20:24:32.874Z","avatar_url":"https://github.com/noraworld.png","language":"Shell","funding_links":["https://github.com/sponsors/noraworld"],"categories":[],"sub_categories":[],"readme":"# bluetoothctl-autoconnector\nA tool for bluetoothctl to connect all/any devices automatically.\n\n## Standalone\nbluetoothctl attempts to connect all paired Bluetooth devices only once.\n```shell\n$ ./autoconnector.sh\n```\n\nIt can also attempt to connect only specific devices.\n```shell\n$ ./autoconnector.sh -f \u003cMAPPING_LIST_FILE\u003e\n```\nFor details on how to write a mapping list file, see `list.sample`.\n\nUse `./autoconnector.sh -h` for more information.\n\n## Register crontab\n```shell\n$ ./setup.sh\n```\ncrontab will execute `autoconnector.sh` every minute. This will reconnect paired Bluetooth devices automatically even if they disconnect from a computer, and keep connecting them.\n\n## Motivation for making this tool\nI’m using this tool on Ubuntu on Raspberry Pi, and I’m using my Raspberry Pi as Bluetooth audio receiver and mixer.\n\nI always put in my Bluetooth headphone even though I don’t listen anything. Sometimes I’m listening something on iPhone and at other times I’m listening something on MacBook or TV.\n\nI strongly think it’s hassle to switch Bluetooth connections every time I change the devices playing sounds. Then I came up with a good idea.\n\nI connect all devices that play sounds with Raspberry Pi as audio profile (A2DP) instead of my Bluetooth headphone, mix up the sounds on Raspberry Pi, and transmit them to my Bluetooth headphone. And then, yay! Congratulations! I can now listen to sounds played on iPhone, MacBook and TV at the same time without switching Bluetooth connections.\n\nThis system is awesome for me, but the devices that play sounds are not always connecting with Raspberry Pi. I take my iPhone outside, then it disconnects from Raspberry Pi. MacBook sleeps or shutdowns, then it disconnects from Raspberry Pi in the same way. So I wanted to reconnect them with Raspberry Pi automatically when they is connectable even if they disconnect from it, and keep connecting. That’s why I made this tool.\n\n## Troubleshooting\n### Failed to create secure directory\n#### Problem\nAn error occurs like this.\n```\nFailed to create secure directory (/run/user/1000/pulse/): No such file or directory\n```\n\n#### Solution\nRestart PulseAudio daemon and system.\n```shell\nsystemctl --user restart pulseaudio\nsudo reboot\n```\n\n\n\n\n\n\n\n\n\n\n\u003cdetails\u003e\n\u003csummary\u003eCaution! The following is a pre-written version (Click to expand)\u003c/summary\u003e\n\n## Installation\nTBA\n\n## Usage\n### Create an alias file\nAt first, you need to create an alias file called `~/.marlin_aliases`, and add your Bluetooth device address and device alias paired like this:\n\n```shell\n# ~/.marlin_aliases\n\nXX:XX:XX:XX:XX:XX iPhone\nYY:YY:YY:YY:YY:YY MacBook\nZZ:ZZ:ZZ:ZZ:ZZ:ZZ Oculus Quest\n```\n\nA portion of alias can be set whatever you like so that you can be easy to understand what device is later.\n\n### Register\nThis subcommand pairs your Bluetooth device to your Linux device.\n\n```shell\nmarlin register iPhone\n```\n\nYour iPhone should be paired to your Linux device like Raspberry Pi after performing the command above.\n\n### Connect\nThis subcommand connects your Bluetooth device with your Linux device.\n\n```shell\nmarlin connect iPhone\n```\n\nYour iPhone should be connected to your Linux device.\n\nThe `connect` subcommand is not a marlin's one, but in that case, it is passed to `bluetoothctl` command as is. For the same reason, you can also use `disconnect`, `remove`, etc.\n\nFor details on the command list of `bluetoothctl`, refer to [here (for English readers)](https://www.makeuseof.com/manage-bluetooth-linux-with-bluetoothctl/) or [here (for Japanese readers)](https://zenn.dev/noraworld/articles/bluetoothctl-commands).\n\n### List\nThis subcommand shows all the devices you paired.\n\n```shell\nmarlin list\n```\n\n### Alias\nThis subcommand shows all the aliases you set in `~/.marlin_aliases`.\n\n```shell\nmarlin alias\n```\n\n### Info\nThis subcommand shows a specific device's information.\n\n```shell\nmarlin info iPhone\n```\n\n### Others\nThere are more it can do for you. To see all the usages, use the `--help` option.\n\n```shell\nmarlin --help\n```\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoraworld%2Fbluetoothctl-autoconnector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoraworld%2Fbluetoothctl-autoconnector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoraworld%2Fbluetoothctl-autoconnector/lists"}