Skip to main content
VoiceTypr provides React hooks for checking and requesting macOS system permissions required for recording and text insertion.

Required Permissions

VoiceTypr requires two system permissions:
  1. Microphone - Record audio for transcription
  2. Accessibility - Insert transcribed text at cursor position

usePermissions Hook

Comprehensive hook for managing all permissions.

Import

Usage

Options

Example:

Return Values

permissions

Type: PermissionState
Current status of each permission.

checkPermissions

Type: () => Promise<void> Manually check all permissions. Usage:

requestPermission

Type: (type: 'microphone' | 'accessibility') => Promise<void> Request a specific permission. Parameters:
string
required
Permission type: "microphone" or "accessibility"
Usage:
Behavior:
  1. Invokes backend permission request command
  2. Opens System Settings if permission not granted
  3. Re-checks permissions after 1.5 seconds

isChecking

Type: boolean Whether permissions are currently being checked.

isRequesting

Type: string | null Permission type currently being requested ("microphone", "accessibility", or null).

error

Type: Error | null Last error encountered during check/request.

allGranted

Type: boolean Whether all required permissions are granted. Equivalent to:

useMicrophonePermission Hook

Specialized hook for microphone permission only.

Import

Usage

Options


Return Values

hasPermission

Type: boolean | null
  • true - Permission granted
  • false - Permission denied
  • null - Not yet checked

isChecking

Type: boolean Whether permission check is in progress.

checkPermission

Type: () => Promise<boolean> Manually check microphone permission. Returns: true if granted, false if denied

requestPermission

Type: () => Promise<boolean> Request microphone permission from the user. Returns: true if granted, false if denied

Events

The hook listens to backend events:
  • microphone-granted - Permission granted
  • microphone-denied - Permission denied

useAccessibilityPermission Hook

Specialized hook for accessibility permission only.

Import

Usage

Options


Return Values

Same as useMicrophonePermission:
  • hasPermission: boolean | null
  • isChecking: boolean
  • checkPermission: () => Promise<boolean>
  • requestPermission: () => Promise<boolean>

Events

  • accessibility-granted - Permission granted
  • accessibility-denied - Permission denied

Component Examples

Permission Onboarding Screen


Permission Guard


TypeScript Types


See Also