hs.permissions
ModuleModule for checking and requesting system permissions
Properties
This module has no properties.
Methods
hs.permissions.checkAccessibility() -> boolean
Check if the app has Accessibility permission
Declaration
hs.permissions.checkAccessibility() -> boolean
Returns
boolean
true if permission is granted, false otherwise
Example
console.log(hs.permissions.checkAccessibility())
hs.permissions.requestAccessibility() -> None
Request Accessibility permission (shows system dialog if not granted)
Declaration
hs.permissions.requestAccessibility() -> None
Returns
None
Example
hs.permissions.requestAccessibility()
hs.permissions.checkScreenRecording() -> boolean
Check if the app has Screen Recording permission
Declaration
hs.permissions.checkScreenRecording() -> boolean
Returns
boolean
true if permission is granted, false otherwise
Example
console.log(hs.permissions.checkScreenRecording())
hs.permissions.requestScreenRecording() -> None
Request Screen Recording permission
Declaration
hs.permissions.requestScreenRecording() -> None
Returns
None
Example
hs.permissions.requestScreenRecording()
hs.permissions.checkCamera() -> boolean
Check if the app has Camera permission
Declaration
hs.permissions.checkCamera() -> boolean
Returns
boolean
true if permission is granted, false otherwise
Example
console.log(hs.permissions.checkCamera())
hs.permissions.requestCamera() -> Promise<boolean>
Request Camera permission (shows system dialog if not granted)
Declaration
hs.permissions.requestCamera() -> Promise<boolean>
Returns
Promise<boolean>
A Promise that resolves to true if granted, false if denied
Example
hs.permissions.requestCamera().then(granted => console.log(granted))
hs.permissions.checkMicrophone() -> boolean
Check if the app has Microphone permission
Declaration
hs.permissions.checkMicrophone() -> boolean
Returns
boolean
true if permission is granted, false otherwise
Example
console.log(hs.permissions.checkMicrophone())
hs.permissions.requestMicrophone() -> Promise<boolean>
Request Microphone permission (shows system dialog if not granted)
Declaration
hs.permissions.requestMicrophone() -> Promise<boolean>
Returns
Promise<boolean>
A Promise that resolves to true if granted, false if denied
Example
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.
Declaration
hs.permissions.checkNotifications() -> boolean
Returns
boolean
true if notification permission is granted
Example
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.
Declaration
hs.permissions.requestNotifications() -> Promise<boolean>
Returns
Promise<boolean>
A Promise that resolves to true if granted, false if denied
Example
hs.permissions.requestNotifications().then(granted => console.log(granted))
hs.permissions.checkLocation() -> boolean
Check if the app has Location permission.
Declaration
hs.permissions.checkLocation() -> boolean
Returns
boolean
true if permission is granted, false otherwise
Example
console.log(hs.permissions.checkLocation())
hs.permissions.requestLocation() -> Promise<boolean>
Request Location permission (shows the system dialog if the user has not yet decided).
Declaration
hs.permissions.requestLocation() -> Promise<boolean>
Returns
Promise<boolean>
A Promise that resolves to true if granted, false if denied
Example
hs.permissions.requestLocation().then(granted => {
if (granted) console.log(hs.location.get())
})