electron_sys/module/
system_preferences.rs1use crate::interface::AnimationSettings;
2use js_sys::{Function, JsString, Object, Promise};
3use node_sys::EventEmitter;
4use wasm_bindgen::prelude::*;
5
6#[wasm_bindgen(module = "electron")]
7extern {
8 #[wasm_bindgen(extends = EventEmitter)]
9 pub type SystemPreferences;
10
11 #[wasm_bindgen(js_name = "systemPreferences")]
12 pub static system_preferences: SystemPreferences;
13
14 #[must_use]
21 #[wasm_bindgen(method, js_name = "askForMediaAccess")]
22 pub fn ask_for_media_access(this: &SystemPreferences, media_type: &str) -> Promise;
23
24 #[wasm_bindgen(method, js_name = "canPromptTouchID")]
25 pub fn can_prompt_touch_id(this: &SystemPreferences) -> bool;
26
27 #[wasm_bindgen(method, js_name = "getAccentColor")]
28 pub fn get_accent_color(this: &SystemPreferences) -> JsString;
29
30 #[wasm_bindgen(method, js_name = "getAnimationSettings")]
31 pub fn get_animation_settings(this: &SystemPreferences) -> AnimationSettings;
32
33 #[wasm_bindgen(method, js_name = "getAppLevelAppearance")]
34 pub fn get_app_level_appearance(this: &SystemPreferences) -> JsString;
35
36 #[wasm_bindgen(method, js_name = "getColor")]
37 pub fn get_color(this: &SystemPreferences, color: &str) -> JsString;
38
39 #[wasm_bindgen(method, js_name = "getMediaAccessStatus")]
40 pub fn get_media_access_status(this: &SystemPreferences, media_type: &str) -> JsString;
41
42 #[wasm_bindgen(method, js_name = "getSystemColor")]
43 pub fn get_system_color(this: &SystemPreferences, color: &str) -> JsString;
44
45 #[wasm_bindgen(method, js_name = "getUserDefault")]
46 pub fn get_user_default(this: &SystemPreferences, key: &str, kind: &str) -> JsValue;
47
48 #[wasm_bindgen(method, js_name = "isAeroGlassEnabled")]
49 pub fn is_aero_glass_enabled(this: &SystemPreferences) -> bool;
50
51 #[wasm_bindgen(method, js_name = "isSwipeTrackingFromScrollEventsEnabled")]
52 pub fn is_swipe_tracking_from_scroll_events_enabled(this: &SystemPreferences) -> bool;
53
54 #[wasm_bindgen(method, js_name = "isTrustedAccessibilityClient")]
55 pub fn is_trusted_accessibility_client(this: &SystemPreferences, prompt: bool) -> bool;
56
57 #[wasm_bindgen(method, js_name = "postLocalNotification")]
58 pub fn post_local_notification(this: &SystemPreferences, event: &str, user_info: &Object);
59
60 #[wasm_bindgen(method, js_name = "postNotification")]
61 pub fn post_notification(
62 this: &SystemPreferences,
63 event: &str,
64 user_info: &Object,
65 deliver_immediately: Option<bool>,
66 );
67
68 #[wasm_bindgen(method, js_name = "postWorkspaceNotification")]
69 pub fn post_workspace_notification(this: &SystemPreferences, event: &str, user_info: &Object);
70
71 #[must_use]
72 #[wasm_bindgen(method, js_name = "promptTouchID")]
73 pub fn prompt_touch_id(this: &SystemPreferences, reason: &str) -> Promise;
74
75 #[wasm_bindgen(method, js_name = "registerDefaults")]
76 pub fn register_defaults(this: &SystemPreferences, defaults: &Object);
77
78 #[wasm_bindgen(method, js_name = "removeUserDefaults")]
79 pub fn remove_user_defaults(this: &SystemPreferences, key: &str);
80
81 #[wasm_bindgen(method, js_name = "setUserDefaults")]
82 pub fn set_user_defaults(this: &SystemPreferences, key: &str, kind: &str, value: &str);
83
84 #[wasm_bindgen(method, js_name = "subscribeLocalNotification")]
85 pub fn subscribe_local_notification(this: &SystemPreferences, event: &str, callback: &Function) -> u32;
86
87 #[wasm_bindgen(method, js_name = "subscribeNotification")]
88 pub fn subscribe_notification(this: &SystemPreferences, event: &str, callback: &Function) -> u32;
89
90 #[wasm_bindgen(method, js_name = "subscribeWorkspaceNotification")]
91 pub fn subscribe_workspace_notification(this: &SystemPreferences, event: &str, callback: &Function);
92
93 #[wasm_bindgen(method, js_name = "unsubscribeLocalNotification")]
94 pub fn unsubscribe_local_notification(this: &SystemPreferences, id: u32);
95
96 #[wasm_bindgen(method, js_name = "unsubscribeNotification")]
97 pub fn unsubscribe_notification(this: &SystemPreferences, id: u32);
98
99 #[wasm_bindgen(method, js_name = "unsubscribeWorkspaceNotification")]
100 pub fn unsubscribe_workspace_notification(this: &SystemPreferences, id: u32);
101
102 #[wasm_bindgen(method, getter, js_name = "appLevelAppearance")]
107 pub fn app_level_appearance(this: &SystemPreferences) -> JsString;
108
109 #[wasm_bindgen(method, setter, js_name = "appLevelAppearance")]
110 pub fn set_app_level_appearance(this: &SystemPreferences, value: JsString);
111
112 #[wasm_bindgen(method, getter, js_name = "effectiveAppearance")] pub fn effective_appearance(this: &SystemPreferences) -> JsString;
114}