1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! Native OS features behind one small, safe API: file dialogs, the menu bar, the clipboard,
//! keep-awake, files opened from the file manager, single instance, notifications, dock / taskbar
//! progress, the OS keychain and system preferences.
//!
//! Every feature is behind a cargo feature and degrades cleanly: on a platform where it is not
//! implemented (or on the web) a call returns [`NativeError::Unsupported`]; nothing panics. The
//! crate never depends on a UI toolkit, so apps wire it to their own event loop: activation events
//! arrive on channels, and callbacks take a waker so an idle app wakes only when something
//! happened.
//!
//! | Module | macOS | Windows | Linux | Web |
//! |---|---|---|---|---|
//! | [`dialogs`] | rfd | rfd | rfd (portal) | rfd (bytes only) |
//! | [`menu`] | muda | muda (per window) | spec only | spec only |
//! | [`clipboard`] | arboard + NSPasteboard types | arboard | arboard | – |
//! | [`power`] | NSProcessInfo activity | SetThreadExecutionState | logind inhibit | – |
//! | [`open_files`] | Apple events + argv | argv | argv | – |
//! | [`single_instance`] | Unix socket | loopback + token | Unix socket | – |
//! | [`notify`] | UNUserNotificationCenter (bundled apps) | – | D-Bus notifications | – |
//! | [`progress`] | NSDockTile | ITaskbarList3 | – | – |
//! | [`secrets`] | Keychain | Credential Manager | Secret Service | – |
//! | [`system`] | AppKit | registry / SPI | portal settings | media queries |
//! | [`cli_tool`] | link + admin prompt | – | link (no prompt) | – |
//!
//! [`modal`] (always compiled) is a hook around every blocking dialog, for hang watchdogs.
//! [`terminate`] (always compiled) runs a hook when the process is asked to stop (SIGINT, SIGTERM,
//! SIGHUP).
//!
//! `unsafe` is denied in this crate and allowed only in the FFI modules that need it, each block
//! with a `// SAFETY:` comment (docs/adr/0001-native-ffi.md).
pub use ;
/// Something that wakes the app's event loop (an egui `request_repaint`, a winit proxy event).
/// Called from background threads after a new event was queued.
pub type Waker = Arc;
/// A waker that does nothing, for apps that poll.
/// Run `f`, turning a panic inside a third-party binding into an error instead of unwinding into
/// the app.
pub
/// The OS's own words for a failure, made safe to show: one line, at most 200 characters.
pub