You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(native-access): enhance screen capture example with coroutine support
- Refactor `ScreenCapture` API to use `suspend` for proper coroutine interoperability.
- Add `ScreenshotViewer` Compose example for capturing and displaying the screenshot asynchronously.
- Update `native-access.md` with new usage patterns and Compose example to illustrate integration.
Copy file name to clipboardExpand all lines: docs/native-access.md
+81-61Lines changed: 81 additions & 61 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,81 +67,101 @@ That's the entire configuration. The plugin handles compilation, bundling, and l
67
67
68
68
Here's a real-world example: capturing the screen using macOS's CoreGraphics API. This is a platform API with no JVM equivalent — the kind of thing that would normally require JNI C glue.
**No C. No JNI headers. No build scripts. No `System.loadLibrary` call.** The `.dylib` is compiled by the plugin, bundled in the JAR, and extracted automatically at runtime.
161
+
**No C. No JNI headers. No build scripts. No `System.loadLibrary` call.** The `.dylib` is compiled by the plugin, bundled in the JAR, and extracted automatically at runtime. The `suspend` on the native side maps transparently to a coroutine on the JVM — the UI stays responsive while CoreGraphics does the work.
162
+
163
+
!!! tip "Full working example"
164
+
The [systeminfo example](https://github.com/kdroidFilter/NucleusNativeAccess/tree/main/examples/systeminfo) in the NucleusNativeAccess repo implements this pattern for all three platforms (CoreGraphics on macOS, XDG ScreenCast + PipeWire on Linux, GDI on Windows), plus native notifications, a system tray menu, and real-time memory updates via `Flow`.
145
165
146
166
The same pattern works for any other platform API:
0 commit comments