SystemPreferences

external interface SystemPreferences : EventEmitter(source)

Properties

Link copied to clipboard

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

Functions

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

Link copied to clipboard
abstract fun addListener(event: SystemPreferencesEvent.ACCENT_COLOR_CHANGED, listener: (event: Event<*>, newColor: String) -> Unit)
abstract fun addListener(event: SystemPreferencesEvent.COLOR_CHANGED, listener: (event: Event<*>) -> Unit)
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 fun canPromptTouchID(): Boolean

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

Link copied to clipboard
Link copied to clipboard
abstract fun getAccentColor(): String

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

Link copied to clipboard

Returns an object with system animation settings.

Link copied to clipboard

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
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 fun getUserDefault(key: String, type: String): Any?

The value of key in NSUserDefaults.

Link copied to clipboard
abstract fun isAeroGlassEnabled(): Boolean

true if DWM composition (Aero Glass) is enabled, and false otherwise.

Link copied to clipboard

Whether the Swipe between pages setting is on.

Link copied to clipboard

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

Link copied to clipboard
abstract fun off(event: SystemPreferencesEvent.ACCENT_COLOR_CHANGED, listener: (event: Event<*>, newColor: String) -> Unit)
abstract fun off(event: SystemPreferencesEvent.COLOR_CHANGED, listener: (event: Event<*>) -> Unit)
Link copied to clipboard
abstract fun on(event: SystemPreferencesEvent.ACCENT_COLOR_CHANGED, listener: (event: Event<*>, newColor: String) -> Unit)
abstract fun on(event: SystemPreferencesEvent.COLOR_CHANGED, listener: (event: Event<*>) -> Unit)
Link copied to clipboard
abstract fun once(event: SystemPreferencesEvent.ACCENT_COLOR_CHANGED, listener: (event: Event<*>, newColor: String) -> Unit)
abstract fun once(event: SystemPreferencesEvent.COLOR_CHANGED, listener: (event: Event<*>) -> Unit)
Link copied to clipboard
abstract 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 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 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
abstract fun promptTouchID(reason: String): Promise<Void>

resolves if the user has successfully authenticated with Touch ID.

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

Add the specified defaults to your application's NSUserDefaults.

Link copied to clipboard
abstract fun removeListener(event: SystemPreferencesEvent.ACCENT_COLOR_CHANGED, listener: (event: Event<*>, newColor: String) -> Unit)
abstract fun removeListener(event: SystemPreferencesEvent.COLOR_CHANGED, listener: (event: Event<*>) -> Unit)
Link copied to clipboard
abstract 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
Link copied to clipboard
abstract fun setUserDefault(key: String, type: String, value: Any?)

Set the value of key in NSUserDefaults.

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

The ID of this subscription

Link copied to clipboard

Same as unsubscribeNotification, but removes the subscriber from NSNotificationCenter.

Link copied to clipboard

Removes the subscriber with id.

Link copied to clipboard

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