Giter Site home page Giter Site logo

kbos's Introduction

Kill Bluetooth On Sleep (KBOS)

Tired of your bluetooth headphones pairing with a MacOs computer you thought was asleep ? This fixes that

KBOS uses sleepwatcher and Blueutil to turn off bluetooth when your mac falls asleep, then turns it back on when the computer is woken up.

Prerequisites

KBOS requires Homebrew which is used to install the following packages:

Installation

  1. Install Homebrew manually first.
  2. run bash setup.sh from this directory.

Additional arguments

-h, --help                show brief help menu
-d, --disable             disables KBOS, but doesn't uninstall anything.
-e, --enable              re-enables KBOS from a disabled state
-u, --uninstall           removes the ~/sleepscripts directory and the KBOS Plist but does NOT uninstall brew, Blueutil, or sleepwatcher. I'll let you handle that on your own https://docs.brew.sh/FAQ#how-do-i-uninstall-a-formula.

Future improvements

  • Attempt to connect to last connected device on wake.
  • Improve script output and robustness

Report a bug

If this script doesn't work for you, please let me know so I can improve it or feel free to send a pull request.

kbos's People

Contributors

alb12-la avatar chris-deluca avatar sstucki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

kbos's Issues

KBOS setup is broken for sleepwatcher 2.2.1

Latest brew formula for sleepwatcher 2.2.1 doesn't add it to the path and only exposes a service, not an executable.
Thus, SLEEPWATCHER_PATH=$(which sleepwatcher | sed 's_/_\\/_g') returns nothing, which later produces a broken plist file.

        <key>ProgramArguments</key>
        <array>
                <string></string>
                <string>-V</string>

Incorrect paths in the files.

Thank you for making this script.

blueutil path in enable and disable files don't match where brew installs the blueutil. same issue for sleepwatcher path in plist file.

Both of these can be resolved by sed replacing the paths from setup.sh using output of "which blueutil" and "which sleepwatcher"

Not Working in MacOS 12.1 Monetrey

A Usage in Readme.md would be helpful,
there is installation but no usage, then in issues i found out setup.sh is the script itself, but then i had some error.. shown below

First it told me to goto Root

tazer@TAZERs-MacBook-Air KBOS % ./setup.sh -e
Load failed: 5: Input/output error
Try running `launchctl bootstrap` as root for richer errors.

even with the superuser permissions it gave some error

.git				enable_bluetooth.sh
LICENSE				setup.sh
README.md			sleepwatch_bluetooth.plist
disable_bluetooth.sh
sh-3.2# ./setup -e
sh: ./setup: No such file or directory
sh-3.2# ./setup.sh -e
Warning: Expecting a LaunchDaemons path since the command was ran as root. Got LaunchAgents instead.
`launchctl bootstrap` is a recommended alternative.
/var/root/Library/LaunchAgents/sleepwatch_bluetooth.plist: No such file or directory
Load failed: 2: No such file or directory

at last i tried this command
launchctl unload ~/Library/LaunchAgents/sleepwatch_bluetooth.plist
but it doesn't seem to work

Install into user path

๐Ÿ‘‹ @alb12-la , it'd be nice if it was easy to install this into the user PATH, possibly via Homebrew. This would make #1 and other interactions with the script easier since you wouldn't need to navigate to the setup.sh script to do things. The interface I'm thinking of:

=> brew install kbos
...

=> kbos enable
KBOS has been enabled.

=> kbos disable
KBOS has been disabled

If you're open to an interface like this, I'd be happy to look into the work required.

KBOS toggle on/off

Hi!

Thanks a bunch for building this tool. Works well for me so far and saves a lot of hassle.

I could not make out fully from the documentation if/how this tool allows for toggling the KBOS tool on and off. i.e. how might i return to the original bluetooth behaviour after having installed this script?

best,

Tristan

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.