toy / blueutil

CLI for bluetooth on OSX: power, discoverable state, list, inquire devices, connect, info, …
https://github.com/toy/blueutil
Other
1.01k stars 53 forks source link

Add a "--power toggle" option #8

Closed lhaeger closed 6 years ago

lhaeger commented 6 years ago

In order to utilize blueutil with keyboard tools like Better Touch Tools or similar, a command line option to toggle the power state would be helpful. The toggle option should basically do the same as this applescript (which I have assigned to the "Fn-B" hotkey via BTT), just without the need for a script in the first place:

set blueutil to "/usr/local/bin/blueutil"
set powerStatus to do shell script blueutil & " --power"

if powerStatus is "1" then
    do shell script blueutil & " --power off"
else if powerStatus is "0" then
    do shell script blueutil & " --power on"
end if
toy commented 6 years ago

Please have a look/check how d4b456b9006d16cf72cc472f3afee19e1b8f0777 works for you.

lhaeger commented 6 years ago

Seems to do the trick rather nicely. Thanks a lot, Ivan!

toy commented 6 years ago

v2.1.0 is out