API Docs

Module for checking and requesting system permissions

Properties

This module has no properties.

Methods

hs.permissions.checkAccessibility() -> boolean

Check if the app has Accessibility permission
hs.permissions.checkAccessibility() -> boolean
boolean
true if permission is granted, false otherwise
console.log(hs.permissions.checkAccessibility())

hs.permissions.requestAccessibility() -> None

Request Accessibility permission (shows system dialog if not granted)
hs.permissions.requestAccessibility() -> None
None
hs.permissions.requestAccessibility()

hs.permissions.checkScreenRecording() -> boolean

Check if the app has Screen Recording permission
hs.permissions.checkScreenRecording() -> boolean
boolean
true if permission is granted, false otherwise
console.log(hs.permissions.checkScreenRecording())

hs.permissions.requestScreenRecording() -> None

Request Screen Recording permission
hs.permissions.requestScreenRecording() -> None
None
hs.permissions.requestScreenRecording()

hs.permissions.checkCamera() -> boolean

Check if the app has Camera permission
hs.permissions.checkCamera() -> boolean
boolean
true if permission is granted, false otherwise
console.log(hs.permissions.checkCamera())

hs.permissions.requestCamera() -> Promise<boolean>

Request Camera permission (shows system dialog if not granted)
hs.permissions.requestCamera() -> Promise<boolean>
Promise<boolean>
A Promise that resolves to true if granted, false if denied
hs.permissions.requestCamera().then(granted => console.log(granted))

hs.permissions.checkMicrophone() -> boolean

Check if the app has Microphone permission
hs.permissions.checkMicrophone() -> boolean
boolean
true if permission is granted, false otherwise
console.log(hs.permissions.checkMicrophone())

hs.permissions.requestMicrophone() -> Promise<boolean>

Request Microphone permission (shows system dialog if not granted)
hs.permissions.requestMicrophone() -> Promise<boolean>
Promise<boolean>
A Promise that resolves to true if granted, false if denied
hs.permissions.requestMicrophone().then(granted => console.log(granted))

hs.permissions.checkNotifications() -> boolean

Check if the app has permission to display notifications. The result is cached from the last request or check; the cache is refreshed asynchronously, so the very first call in a session may return `false` before the cached value is populated. Use `requestNotifications()` on first launch to ensure the result is accurate.
hs.permissions.checkNotifications() -> boolean
boolean
true if notification permission is granted
console.log(hs.permissions.checkNotifications())

hs.permissions.requestNotifications() -> Promise<boolean>

Request notification permission (shows the system dialog if the user has not yet decided). It is safe to call this on every launch — the dialog only appears once; subsequent calls resolve immediately with the previously granted or denied state.
hs.permissions.requestNotifications() -> Promise<boolean>
Promise<boolean>
A Promise that resolves to true if granted, false if denied
hs.permissions.requestNotifications().then(granted => console.log(granted))

hs.permissions.checkLocation() -> boolean

Check if the app has Location permission.
hs.permissions.checkLocation() -> boolean
boolean
true if permission is granted, false otherwise
console.log(hs.permissions.checkLocation())

hs.permissions.requestLocation() -> Promise<boolean>

Request Location permission (shows the system dialog if the user has not yet decided).
hs.permissions.requestLocation() -> Promise<boolean>
Promise<boolean>
A Promise that resolves to true if granted, false if denied
hs.permissions.requestLocation().then(granted => {
    if (granted) console.log(hs.location.get())
})