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

hear works on Terminal, but not on Alacritty: NSSpeechRecognitionUsageDescription key missing. #23

Open
rflcrz opened this issue Apr 24, 2023 · 4 comments

Comments

@rflcrz
Copy link

rflcrz commented Apr 24, 2023

When I run 'hear' from Alacritty it does not ask access to speech recognition and return 'zsh: abort'.

Console.app:

ERROR: This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSSpeechRecognitionUsageDescription key with a string value explaining to the user how the app uses this data.

On the other hand, when I tried to run 'hear' using Terminal.app, it worked perfectly. Terminal asked for access to speech recognition and started outputting the transcribed text.

Apple documentation says that "You must include the NSSpeechRecognitionUsageDescription key in your app’s Info.plist file. If this key is not present, your app will crash when it attempts to request authorization or use the APIs of the Speech framework."(1) Because "This key is required if your app uses APIs that send user data to Apple’s speech recognition servers."(2)

I added to /Applications/Alacritty.app/Contents/Info.plist:

<key>NSSpeechRecognitionUsageDescription</key>
<string>An application in Alacritty would like to access speech recognition.</string>

Now 'hear' exit with:

Error: Speech recognition authorization not determined

hear/src/Hear.m

Line 114 in e324756

[self die:@"Speech recognition authorization not determined"];

Does anyone know how to solve this issue? Or have any suggestion?

Thanks!

@rflcrz rflcrz changed the title hear works on Terminal, but not on Alacritty. hear works on Terminal, but not on Alacritty: NSSpeechRecognitionUsageDescription key missing. Apr 25, 2023
@sveinbjornt
Copy link
Owner

Strange issue. The hear binary does contain an embedded Info.plist: https://github.com/sveinbjornt/hear/blob/master/Info.plist

Screenshot 2023-04-25 at 13 15 57

This must be something specific to Alacritty, since everything runs just fine in iTerm and Terminal.app.

@sveinbjornt
Copy link
Owner

sveinbjornt commented Apr 25, 2023

I tried adding NSSpeechRecognitionUsageDescription to Alacritty's Info.plist, and was able to reproduce your result.
However, launching Alacritty from the command line in iTerm or Terminal.app works. It looks like subprocesses inherit the permissions of the parent process:

$ /Applications/Alacritty.app/Contents/MacOS/alacritty

At no point does Alacritty appear in this permissions list in Settings despite the changed Info.plist:

Screenshot 2023-04-25 at 13 42 25

@hamidzr
Copy link

hamidzr commented May 23, 2023

I haven't figured out why but this lets me use hear directly Alacritty
what I did is I launched skhd through alacritty and had it run a script that uses hear. that that point i was asked by the os (13.x) if I wanted to let Alacritty use the speech recognition and I did. Now I can directly call hear in Alacritty and it works fine.

@AlienKevin
Copy link

I encountered the same zsh abort issue when running hear in the vscode terminal. Similar to Alacritty, speech recognition permission doesn't list vscode but I don't have a way to request that permission.

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