systemPreferences Type
⚠ Process Availability: Main ✔ | Renderer ❌ | Utility ✔ | Exported ✔
Get system preferences.Process: Main, Utility
Static members
| Static member |
Description
|
|
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ 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.Important: In order to properly leverage this API, you must set the NSMicrophoneUsageDescription and NSCameraUsageDescription strings in your app's Info.plist file. The values for these keys will be used to populate the permission dialogs so that the user will be properly informed as to the purpose of the permission request. See Electron Application Distribution for more information about how to set these in the context of Electron.This user consent was not required until macOS 10.14 Mojave, so this method will always return true if your system is running 10.13 High Sierra.
|
Full Usage:
systemPreferences.canPromptTouchID ()
Returns: bool
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ whether or not this device has the ability to use Touch ID.
|
|
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ A string property that can be dark, light or unknown.Returns the macOS appearance setting that is currently applied to your application, maps to NSApplication.effectiveAppearance
|
Full Usage:
systemPreferences.getAccentColor ()
Returns: string
Modifiers: inline |
The users current system wide accent color preference in RGBA hexadecimal form.This API is only available on macOS 10.14 Mojave or newer.
|
Full Usage:
systemPreferences.getAnimationSettings ()
Returns: GetAnimationSettings
Modifiers: inline |
|
Full Usage:
systemPreferences.getColor color
Parameters:
Color
Returns: string
Modifiers: inline |
⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌ The system color setting in RGBA hexadecimal form (#RRGGBBAA). See the Windows docs and the macOS docs for more details.The following colors are only available on macOS 10.14: find-highlight, selected-content-background, separator, unemphasized-selected-content-background, unemphasized-selected-text-background, and unemphasized-selected-text.
|
Full Usage:
systemPreferences.getEffectiveAppearance ()
Returns: GetEffectiveAppearance
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ Can be dark, light or unknown.Gets the macOS appearance setting that is currently applied to your application, maps to NSApplication.effectiveAppearance
|
Full Usage:
systemPreferences.getMediaAccessStatus mediaType
Parameters:
MediaType
Returns: GetMediaAccessStatus
Modifiers: inline |
⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌ Can be not-determined, granted, denied, restricted or unknown.This user consent was not required on macOS 10.13 High Sierra so this method will always return granted. macOS 10.14 Mojave or higher requires consent for microphone and camera access. macOS 10.15 Catalina or higher requires consent for screen access.Windows 10 has a global setting controlling microphone and camera access for all win32 applications. It will always return granted for screen and for all media types on older versions of Windows.
|
Full Usage:
systemPreferences.getSystemColor color
Parameters:
Color
Returns: string
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ The standard system color formatted as #RRGGBBAA.Returns one of several standard system colors that automatically adapt to vibrancy and changes in accessibility settings like 'Increase contrast' and 'Reduce transparency'. See Apple Documentation for more details.
|
Full Usage:
systemPreferences.getUserDefault (key, type)
Parameters:
string
type : UserType
Returns: string
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ The value of key in NSUserDefaults.Some popular key and types are:* AppleInterfaceStyle: string* AppleAquaColorVariant: integer* AppleHighlightColor: string* AppleShowScrollBars: string* NSNavRecentPlaces: array* NSPreferredWebServices: dictionary* NSUserDictionaryReplacementItems: array
|
Full Usage:
systemPreferences.isSwipeTrackingFromScrollEventsEnabled ()
Returns: bool
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ Whether the Swipe between pages setting is on.
|
Full Usage:
systemPreferences.isTrustedAccessibilityClient prompt
Parameters:
bool
Returns: bool
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ true if the current process is a trusted accessibility client and false if it is not.
|
Full Usage:
systemPreferences.offAccentColorChanged handler
Parameters:
IOnAccentColorChanged -> unit
Modifiers: inline |
⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ✔ | MAS ❌
|
Full Usage:
systemPreferences.offAccentColorChanged handler
Parameters:
Event -> string -> unit
Modifiers: inline |
⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ✔ | MAS ❌
|
Full Usage:
systemPreferences.offColorChanged handler
Parameters:
Event -> unit
Modifiers: inline |
⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌
|
Full Usage:
systemPreferences.onAccentColorChanged handler
Parameters:
IOnAccentColorChanged -> unit
Modifiers: inline |
⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ✔ | MAS ❌
|
Full Usage:
systemPreferences.onAccentColorChanged handler
Parameters:
Event -> string -> unit
Modifiers: inline |
⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ✔ | MAS ❌
|
Full Usage:
systemPreferences.onColorChanged handler
Parameters:
Event -> unit
Modifiers: inline |
⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌
|
Full Usage:
systemPreferences.onceAccentColorChanged handler
Parameters:
IOnAccentColorChanged -> unit
Modifiers: inline |
⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ✔ | MAS ❌
|
Full Usage:
systemPreferences.onceAccentColorChanged handler
Parameters:
Event -> string -> unit
Modifiers: inline |
⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ✔ | MAS ❌
|
Full Usage:
systemPreferences.onceColorChanged handler
Parameters:
Event -> unit
Modifiers: inline |
⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌
|
Full Usage:
systemPreferences.postLocalNotification (event, userInfo)
Parameters:
string
userInfo : Record<string, obj>
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ Posts event as native notifications of macOS. The userInfo is an Object that contains the user information dictionary sent along with the notification.
|
Full Usage:
systemPreferences.postNotification (event, userInfo, ?deliverImmediately)
Parameters:
string
userInfo : Record<string, obj>
?deliverImmediately : bool
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ Posts event as native notifications of macOS. The userInfo is an Object that contains the user information dictionary sent along with the notification.
|
Full Usage:
systemPreferences.postWorkspaceNotification (event, userInfo)
Parameters:
string
userInfo : Record<string, obj>
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ Posts event as native notifications of macOS. The userInfo is an Object that contains the user information dictionary sent along with the notification.
|
Full Usage:
systemPreferences.promptTouchID reason
Parameters:
string
Returns: Promise<unit>
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ resolves if the user has successfully authenticated with Touch ID.This API itself will not protect your user data; rather, it is a mechanism to allow you to do so. Native apps will need to set Access Control Constants like kSecAccessControlUserPresence on their keychain entry so that reading it would auto-prompt for Touch ID biometric consent. This could be done with node-keytar, such that one would store an encryption key with node-keytar and only fetch it if promptTouchID() resolves.
|
|
|
Full Usage:
systemPreferences.removeUserDefault key
Parameters:
string
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ Removes the key in NSUserDefaults. This can be used to restore the default or global value of a key previously set with setUserDefault.
|
Full Usage:
systemPreferences.setUserDefault (key, type, value)
Parameters:
string
type : UserType
value : string
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ Set the value of key in NSUserDefaults.Note that type should match actual type of value. An exception is thrown if they don't.Some popular key and types are:* ApplePressAndHoldEnabled: boolean
|
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ The ID of this subscriptionSame as subscribeNotification, but uses NSNotificationCenter for local defaults. This is necessary for events such as NSUserDefaultsDidChangeNotification.If event is null, the NSNotificationCenter doesn’t use it as criteria for delivery to the observer. See docs for more information.
|
|
|
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ The ID of this subscriptionSubscribes to native notifications of macOS, callback will be called with callback(event, userInfo) when the corresponding event happens. The userInfo is an Object that contains the user information dictionary sent along with the notification. The object is the sender of the notification, and only supports NSString values for now.The id of the subscriber is returned, which can be used to unsubscribe the event.Under the hood this API subscribes to NSDistributedNotificationCenter, example values of event are:* AppleInterfaceThemeChangedNotification* AppleAquaColorVariantChanged* AppleColorPreferencesChangedNotification* AppleShowScrollBarsSettingChangedIf event is null, the NSDistributedNotificationCenter doesn’t use it as criteria for delivery to the observer. See docs for more information.
|
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ The ID of this subscriptionSame as subscribeNotification, but uses NSWorkspace.sharedWorkspace.notificationCenter. This is necessary for events such as NSWorkspaceDidActivateApplicationNotification.If event is null, the NSWorkspaceNotificationCenter doesn’t use it as criteria for delivery to the observer. See docs for more information.
|
|
Full Usage:
systemPreferences.unsubscribeLocalNotification id
Parameters:
int
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ Same as unsubscribeNotification, but removes the subscriber from NSNotificationCenter.
|
Full Usage:
systemPreferences.unsubscribeNotification id
Parameters:
int
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ Removes the subscriber with id.
|
Full Usage:
systemPreferences.unsubscribeWorkspaceNotification id
Parameters:
int
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ Same as unsubscribeNotification, but removes the subscriber from NSWorkspace.sharedWorkspace.notificationCenter.
|
fable-electron-docs-api