Bash script hotkey only working when system preferences is active

I've made a bash script for swapping audio interfaces.

It works perfectly when fired up from terminal.

Next i used automator to make it into a service so i can assign a hotkey to it.

If i start the service from automator it works.

After i assigned the hotkey it will only work when system preferences is active, otherwise i get an "operation not permitted" error.

What am i doing wrong here?

Windows

Posted on Nov 27, 2023 12:27 PM

Reply
Question marked as Top-ranking reply

Posted on Nov 28, 2023 12:27 AM

You may need to give your script and/or Automator permission to "control your computer" in

System Settings->Privacy & Security->Accessibility.


Also, have a look at what is allowed in System Settings->Privacy & Security->Automation.



2 replies

Nov 28, 2023 4:17 AM in response to Luis Sequeira1

Thanks Luis, i tried that before but it appeared under System Settings->Privacy & Security->Development Tools i couldn't add a service (they were greyed out when trying to add them via the + sign). Dragging the file into System Preferences from Finder did do the trick. Weird but it worked.


EDIT: Now it only works when Finder or System Preferences are active. When the focus is on any other application i get the same error.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Bash script hotkey only working when system preferences is active

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.