Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blueutil --connect not working as a shortcut with Automator on Mac Os Sonoma beta #80

Open
steveaugustine opened this issue Jul 28, 2023 · 15 comments

Comments

@steveaugustine
Copy link

Blueutil --connect not working as a shortcut with Automator on Mac Os Sonoma beta

The command works normally on the terminal. It works on the automator app but it says failed to connect when it is run via a keyboard shortcut.

@toy
Copy link
Owner

toy commented Jul 28, 2023

Can you compare permissions granted to the terminal app that you use and to Automator, and if they are different grant same to Automator?

@steveaugustine
Copy link
Author

I think both the terminal and automator have the same permissions as they seem to work fine when used independently.
The problem occurs when the automator service is run via a keyboard shortcut.
CODE

export PATH=/usr/local/bin:/opt/homebrew/bin
bluetoothStatus=$(blueutil -p)
blueutil --connect 2c-be-eb-0b-8e-61

@toy
Copy link
Owner

toy commented Jul 29, 2023

So running shell script from Automator works. How is keyboard shortcut get assigned, built int through system preferences? As far as I know permissions of first app/binary after launchd are defining them for all children

@steveaugustine
Copy link
Author

Ya it runs through the keyboard shortcuts which can be assigned under the keyboard menu in settings. I hope the official version of mac os sonoma fixes this. Do you think u can recreate it on your pc??

@toy
Copy link
Owner

toy commented Aug 2, 2023

Unfortunately I don't currently have access to any mac capable of running Sonoma.
I think that it may be worth trying to understand the process that is responsible for executing the automator task, simplest way that comes to mind is adding a long sleep to the shell script and checking in process tree the ancestors of it.

@taybart
Copy link

taybart commented Oct 3, 2023

I am also having this issue, since Sonoma is GA are you able to replicate it @toy ?

@steveaugustine
Copy link
Author

I am also having this issue, since Sonoma is GA are you able to replicate it @toy ?

what version of sonoma are you on?
Right now third party apps which use blueutil like toothfairy, work inconsistently.
Real shame that apple hasn't fixed this yet.
connecting devices was so easy with blueutil.

@taybart
Copy link

taybart commented Oct 3, 2023

14.0, i'm just calling blueutil directly in a hammerspoon script

@toy
Copy link
Owner

toy commented Oct 3, 2023

@taybart Still don't have access to a modern enough mac to be able to test it

@peterfredericks
Copy link

Found a fix at least on my end. Giving permissions to Alfred 5 in the Privacy & Security → Bluetooth solved it for me.

@taybart
Copy link

taybart commented Oct 11, 2023

I already have the permissions enabled no luck :/

@steveaugustine
Copy link
Author

Same, all the perms are enabled.

@steveaugustine
Copy link
Author

It works flawlessly via the automator interface but bluetooth just turns on and off when I try to run it through a keyboard shortcut. I upgraded to the latest version of blueutil via homebrew

@steveaugustine
Copy link
Author

Found a fix at least on my end. Giving permissions to Alfred 5 in the Privacy & Security → Bluetooth solved it for me.

Does it work as a keyboard shortcut throughj automator?

@toy
Copy link
Owner

toy commented Oct 15, 2023

A bit of testing showed that automator quick action triggered by keyboard shortcut is executed by com.apple.automator.runner.xpc which is in Automator.framework. You can check by installing and running pstree in the shell of workflow (pstree -p $$ > ~/log.txt) or just a long sleep and finding the process in hierarchy.

Can you try giving the same permissions to that process (for me dragging to preferences the Contents/MacOS/com.apple.automator.runner binary which is inside com.apple.automator.runner.xpc worked, but not the xpc bundle)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants