SystemPreferences

external interface SystemPreferences : EventEmitter(source)

Properties

Link copied to clipboard

A boolean property which determines whether the app avoids using semitransparent backgrounds. This maps to NSWorkspace.accessibilityDisplayShouldReduceTransparency

Link copied to clipboard
abstract external val colorChangedEvent: EventInstance<Tuple1<Event<*>>>
Link copied to clipboard

A string property that can be dark, light or unknown.

Functions

Link copied to clipboard
external fun addListener(type: EventType, listener: EventListener)
Link copied to clipboard

A promise that resolves with true if consent was granted and false if it was denied. If an invalid mediaType is passed, the promise will be rejected. If an access request was denied and later is changed through the System Preferences pane, a restart of the app will be required for the new permissions to take effect. If access has already been requested and denied, it must be changed through the preference pane; an alert will not pop up and the promise will resolve with the existing access status.

Link copied to clipboard
abstract external fun canPromptTouchID(): Boolean

whether or not this device has the ability to use Touch ID.

Link copied to clipboard
external fun emit(type: EventType, vararg args: Any?): Boolean
Link copied to clipboard
Link copied to clipboard
abstract external fun getAccentColor(): String

The users current system wide accent color preference in RGBA hexadecimal form.

Link copied to clipboard
abstract external fun getAnimationSettings(): AnimationSettings

Returns an object with system animation settings.

Link copied to clipboard
abstract external fun getColor(color: SystemPreferencesGetColorColor): String

The system color setting in RGBA hexadecimal form (#RRGGBBAA). See the Windows docs and the macOS docs for more details.

Link copied to clipboard

Can be dark, light or unknown.

Link copied to clipboard
external fun getMaxListeners(): Double
Link copied to clipboard

Can be not-determined, granted, denied, restricted or unknown.

Link copied to clipboard

The standard system color formatted as #RRGGBBAA.

Link copied to clipboard
abstract external fun getUserDefault(key: String, type: String): Any?

The value of key in NSUserDefaults.

Link copied to clipboard

Whether the Swipe between pages setting is on.

Link copied to clipboard
abstract external fun isTrustedAccessibilityClient(prompt: Boolean): Boolean

true if the current process is a trusted accessibility client and false if it is not.

Link copied to clipboard
external fun listenerCount(type: EventType, listener: EventListener): Double
Link copied to clipboard
Link copied to clipboard
external fun off(type: EventType, listener: EventListener)
Link copied to clipboard
external fun on(type: EventType, listener: EventListener)
Link copied to clipboard
external fun once(type: EventType, listener: EventListener)
Link copied to clipboard
abstract external fun postLocalNotification(event: String, userInfo: ReadonlyRecord<String, Any?>)

Posts event as native notifications of macOS. The userInfo is an Object that contains the user information dictionary sent along with the notification.

Link copied to clipboard
abstract external fun postNotification(event: String, userInfo: ReadonlyRecord<String, Any?>, deliverImmediately: Boolean = definedExternally)

Posts event as native notifications of macOS. The userInfo is an Object that contains the user information dictionary sent along with the notification.

Link copied to clipboard
abstract external fun postWorkspaceNotification(event: String, userInfo: ReadonlyRecord<String, Any?>)

Posts event as native notifications of macOS. The userInfo is an Object that contains the user information dictionary sent along with the notification.

Link copied to clipboard
external fun prependListener(type: EventType, listener: EventListener)
Link copied to clipboard
external fun prependOnceListener(type: EventType, listener: EventListener)
Link copied to clipboard
abstract external fun promptTouchID(reason: String): Promise<Void>

resolves if the user has successfully authenticated with Touch ID.

Link copied to clipboard
Link copied to clipboard
abstract external fun registerDefaults(defaults: ReadonlyRecord<String, Any>)

Add the specified defaults to your application's NSUserDefaults.

Link copied to clipboard
external fun removeAllListeners(type: EventType)
Link copied to clipboard
external fun removeListener(type: EventType, listener: EventListener)
Link copied to clipboard
abstract external fun removeUserDefault(key: String)

Removes the key in NSUserDefaults. This can be used to restore the default or global value of a key previously set with setUserDefault.

Link copied to clipboard
external fun setMaxListeners(n: Number)
Link copied to clipboard
abstract external fun setUserDefault(key: String, type: String, value: Any?)

Set the value of key in NSUserDefaults.

Link copied to clipboard
abstract external fun subscribeLocalNotification(event: String?, callback: (event: String, userInfo: ReadonlyRecord<String, Any?>, object: String) -> Unit): Double

The ID of this subscription

Link copied to clipboard
abstract external fun subscribeNotification(event: String?, callback: (event: String, userInfo: ReadonlyRecord<String, Any?>, object: String) -> Unit): Double

The ID of this subscription

Link copied to clipboard
abstract external fun subscribeWorkspaceNotification(event: String?, callback: (event: String, userInfo: ReadonlyRecord<String, Any?>, object: String) -> Unit): Double

The ID of this subscription

Link copied to clipboard
abstract external fun unsubscribeLocalNotification(id: Double)

Same as unsubscribeNotification, but removes the subscriber from NSNotificationCenter.

Link copied to clipboard
abstract external fun unsubscribeNotification(id: Double)

Removes the subscriber with id.

Link copied to clipboard
abstract external fun unsubscribeWorkspaceNotification(id: Double)

Same as unsubscribeNotification, but removes the subscriber from NSWorkspace.sharedWorkspace.notificationCenter.