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

System will emit a NSBeep sound when getSelectedText() report error. #1497

Open
koinzhang opened this issue Apr 25, 2022 · 4 comments
Open
Labels
api Issues related to API bug Something isn't working

Comments

@koinzhang
Copy link
Contributor

When the extension calls Raycast's getSelectedText() Api and uses try-catch to catch the error, the system will emit a NSBeep sound if it cannot get the selected text from the foremost app

Raycast version: 1.33.2

Description

Steps To Reproduce

export const fetchItemInput = async () => {
  try {
    await getSelectedText();
  } catch (e) {
    console.error(String(e));
  }
};
  1. Implement and call the above function in the extension.
  2. When there is no window on the desktop, open the extension and call the above function, the system will emit NSBeep sound.
  3. The actual trigger for this bug is that the selected text cannot be retrieved from the top window.
    That is, when getSelectedText() reports an error, it makes a sound. The following errors were caught:
    Error: Cannot copy selected text from frontmost application.

Another very similar api,getSelectedItem, does not make a sound when an error is reported

The current behavior

System will emit a NSBeep sound when getSelectedText() report error.

The expected behavior

System will not emit a NSBeep sound when getSelectedText() report error.

@koinzhang koinzhang added api Issues related to API bug Something isn't working labels Apr 25, 2022
@koinzhang koinzhang reopened this Jun 21, 2022
@mathieudutour
Copy link
Member

Is this fixed?

@koinzhang
Copy link
Contributor Author

Hi @mathieudutour 👋
I just tested it and found no fix, but I couldn't see Raycast's idea of fixing it for a long time, and the bug didn't affect the actual use, so I chose to close it

@mathieudutour
Copy link
Member

we do want to fix it, we didn't get to it yet. I'll reopen it

@koinzhang
Copy link
Contributor Author

To add, this problem is related to the current application, for example, when the current application is Finder, Calendar, Stickies, etc., the NsBeep sound will appear, and when the current application is Slack, DeepL, Arc, VSCode, Obsidian, Warp, Fork, etc., the NSBeep sound will not appear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issues related to API bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants