Giter Site home page Giter Site logo

rsoorajs / bluetooth-autoconnect Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jrouleau/bluetooth-autoconnect

0.0 1.0 0.0 11 KB

A linux command line tool to automatically connect to all paired and trusted bluetooth devices.

License: MIT License

Python 100.00%

bluetooth-autoconnect's Introduction

bluetooth-autoconnect

A linux command line tool to automatically connect to all paired and trusted bluetooth devices.

It can operate as a oneshot script or as a daemon where it waits for adapters to come online.

Requirements

  • Requires python3, python-prctl, python-dbus, and bluez

Installation

If you have packaged this for another disto, please open an issue or PR so the instructions can be added to this list.

Arch Linux

pulseaudio

  • If you are using pulseaudio with a bluetooth headset or speaker, also enable the helper service with systemctl --user enable pulseaudio-bluetooth-autoconnect

Manual

  • Install the bluetooth-autoconnect script to somewhere in your PATH, such as /usr/local/bin/
  • If you are using systemd, consider installing the bluetooth-autoconnect.service file to /etc/systemd/system/ and modifying it to reflect the location of where you installed the script
    • Enable the service with sudo systemctl enable bluetooth-autoconnect

pulseaudio

If you are using a bluetooth headset with pulseaudio running as your user, then the above service will fail to connect to your headset on boot because pulseaudio won't have been started when to bluetooth service comes up.

  • If you are using systemd, consider installing the pulseaudio-bluetooth-autoconnect.service file to /etc/systemd/user/ or ~/.config/systemd/user/ and modifying it to reflect the location of where you installed the script
    • Enable the service with systemctl --user enable pulseaudio-bluetooth-autoconnect

Usage

Usage: bluetooth-autoconnect [OPTIONS]...

Automatically connect to trusted bluetooth devices

OPTIONS:
  -d, --daemon      Monitor bluetooth adapters and automatically connect to
                    trusted devices when an adapter is powered on
  -h, --help        Print this help message
  -v, --verbose     Show more detailed log messages

Simply running the script will scan all powered on adapters and connect to any available devices

$ bluetooth-autoconnect
connecting to device /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX
successfully connected to device /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX

When operating in daemon mode with the -d flag, it will first connect to any available devices and then wait for new adapters to be connected/powered on. Sending the HUP signal to the process will force it to rescan all adapters.

$ bluetooth-autoconnect -d
connecting to device /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX
successfully connected to device /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX
[...]
connecting to device /org/bluez/hci1/dev_XX_XX_XX_XX_XX_XX
successfully connected to device /org/bluez/hci1/dev_XX_XX_XX_XX_XX_XX

License

MIT License

Copyright (c) 2019 Jonathan Rouleau

bluetooth-autoconnect's People

Contributors

jrouleau avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.