raycast / raycast/extensions

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

Open
#1,497 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api bug Stale
Dominant language
TypeScript
Stars
7.8k
Forks
6.9k
Avg merge
2d 6h
Merged PRs (30d)
442

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided getSelectedText() example when no desktop window is available, and compare its behavior with getSelectedItem(). Trace the getSelectedText() API path that handles the reported error. Done means the error is still catchable without emitting an NSBeep sound.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.