---
title: listensInForegroundOnly
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nsspeechrecognizer/listensinforegroundonly
---

# listensInForegroundOnly

A Boolean value that indicates whether the speech recognizer object should only enable its commands when its application is the frontmost one.

## Declaration

```swift
var listensInForegroundOnly: Bool { get set }
```

## Discussion

Discussion When the value of this property is true, the speech recognizer’s commands are only recognized when the speech recognizer’s application is the frontmost application—typically the application displaying the menu bar. If the value of the property is false, the commands are recognized regardless of the visibility of the application, including agent applications (agent applications, which have the LSUIElement property set, do not appear in the Dock or Force Quit window). The default value of this property is true.

## See Also

### Configuring Speech Recognizers

- [commands](appkit/nsspeechrecognizer/commands.md)
- [displayedCommandsTitle](appkit/nsspeechrecognizer/displayedcommandstitle.md)
- [blocksOtherRecognizers](appkit/nsspeechrecognizer/blocksotherrecognizers.md)
