---
title: "RecursiveAI.OnePlatform"
url: https://recursiveai.org/oneplatform/docs/overview/
description: "Windows, input, IME, clipboard, DPI, displays, gamepads and the desktop shell for .NET on Windows, macOS, Linux, Android, iOS and the browser, and the support table for each system."
version: "1.0.0"
source: https://github.com/recursive-ai-oss/oneplatform-csharp/blob/37f5a73c449624ea8671f8612d61000e2d57aa5e/README.md
---

# RecursiveAI.OnePlatform

Windows, input, IME, clipboard, DPI, displays, gamepads and the desktop shell for .NET applications on Windows, macOS, Linux (Wayland and X11), Android, iOS and the browser. It depends only on the .NET base class library, and is NativeAOT- and trim-compatible.

- One `PlatformApp` per process owns the windows, the event queue and the input state.
- Each operating system's own API is used directly: Win32, the Objective-C runtime for Cocoa and UIKit, Xlib and the Wayland client protocol on Linux, the NDK on Android, and a small script in the browser.
- Desktop windows are decorated, movable and resizable by default, and can be dialogs, always-on-top overlays or popups.
- Desktop services sit beside the windows: a D-Bus client and the Linux portals, the Windows and macOS equivalents (tray icon, notifications, file dialogs, global hotkeys, menu bar, screenshots, single-instance hand-over), and a window accessibility provider that is bridged to UI Automation on Windows and NSAccessibility on macOS.
- A headless backend and `InputInjector` drive an app with no display, so tests can click, type and resize without a window.
- Game controllers, haptics, input actions with rebinding, and text clipboard access are included.

## Support

| | Windows | macOS | Linux | Android, iOS | Browser |
|---|---|---|---|---|---|
| Windows | Win32: ordinary windows, dialogs, overlays, popups, size limits, fullscreen | Cocoa: ordinary windows, dialogs, overlays, popups, size limits, fullscreen | Wayland (`xdg-decoration`, `wlr-layer-shell`, `xdg_popup`) and X11 (EWMH) | one window per activity or scene | one canvas |
| Input | keyboard, mouse, touch, gamepads (XInput) | keyboard, mouse, trackpad, gamepads | keyboard, mouse, touch, gamepads (evdev) | touch, keyboard, gamepads | keyboard, mouse, touch, Gamepad API |
| IME | `WM_IME_*` | `NSTextInputClient` | `text-input-v3` on Wayland; composed keys on X11 | system soft keyboard | page text input |
| Clipboard (UTF-8 text) | yes | yes | yes (X11 primary selection too) | yes | yes |
| DPI and displays | per-monitor v2 | backing scale | `wp_fractional_scale`, `wp_viewporter`, X11 scale | system scale | `devicePixelRatio` |
| Shell services | `WindowsDesktop`: tray icon, notifications, file dialogs, global hotkeys, menu bar, screenshots; `LocalSingleInstance` | `MacDesktop`: menu bar, status item, file panels, notifications, hotkeys; `LocalSingleInstance` | portals and notification, tray and single-instance services over D-Bus | none | none |
| D-Bus and portals | n/a | n/a | `DBusConnection`, `FileChooserPortal`, `ScreenshotPortal`, `GlobalShortcutsSession`, `NotificationService`, `TrayIcon`, `SingleInstance` | n/a | n/a |
| Accessibility | UI Automation provider | NSAccessibility provider | provider model only | provider model only | provider model only |
| Injection and capture | `InputInjector`; window and region capture | `InputInjector` | `InputInjector`; screenshot portal | `InputInjector` | `InputInjector` |

"Provider model only" means `Window.Accessibility` keeps the provider and nothing reads it on that system (`WindowAccessibility.IsSupported` is false). The headless backend works everywhere and has no operating-system window.

## Getting started

```csharp
using OnePlatform;

using var app = PlatformApp.Create();                       // picks Wayland, X11, Win32, Cocoa... for this system
var window = app.CreateWindow(new WindowOptions { Title = "Hello", Width = 800, Height = 600 });

var running = true;
while (running)
{
    app.PumpEvents(1000);                                    // sleeps until an event arrives or a second passes
    while (app.TryGetEvent(out var e))
    {
        if (e.Kind == PlatformEventKind.QuitRequested || e.Kind == PlatformEventKind.WindowCloseRequested)
        {
            running = false;
        }
    }
}
```

`window.NativeHandle` gives the native window or view for a renderer, `window.Width`/`Height` are physical pixels and `window.Scale` converts to logical units. For tests, create the app with `Backend = PlatformBackendKind.Headless` and drive it with `app.Injector`.

## Browser

On `browser-wasm` the platform's page script, `oneplatform.js`, comes with the package: it is a static web asset, so a .NET WebAssembly app that references `RecursiveAI.OnePlatform` publishes it at `_content/RecursiveAI.OnePlatform/oneplatform.js` with nothing to copy. The app's page imports it and registers it under the module name `oneplatform` before the program starts; the window is the `<canvas>` whose id is `PlatformOptions.DisplayName` (default `oneplatform-canvas`).

```js
import { dotnet } from './_framework/dotnet.js';
import * as platform from './_content/RecursiveAI.OnePlatform/oneplatform.js';

const runtime = await dotnet.create();
runtime.setModuleImports('oneplatform', platform);
await runtime.runMain();
```

See [Browser pages](https://recursiveai.org/oneplatform/docs/browser/) for the canvas, the page functions and development control.

## Documentation

- [Desktop windows](https://recursiveai.org/oneplatform/docs/desktop-windows/): decorations, dialogs, overlays, popups, placement, activation, keep-on-top.
- [Linux desktop services](https://recursiveai.org/oneplatform/docs/linux-shell/): the D-Bus client, portals, notifications, tray, single instance.
- [macOS desktop services](https://recursiveai.org/oneplatform/docs/macos-shell/) and [Windows desktop services](https://recursiveai.org/oneplatform/docs/windows-shell/).
- [Accessibility](https://recursiveai.org/oneplatform/docs/accessibility/): the provider model and the UI Automation and NSAccessibility bridges.
- [Browser pages](https://recursiveai.org/oneplatform/docs/browser/): loading `oneplatform.js` and the canvas.
- [Waking the event loop](https://recursiveai.org/oneplatform/docs/waking-the-loop/): ending a blocking wait from another thread.
- [Changelog](https://recursiveai.org/oneplatform/docs/changelog/)

Licensed under MIT OR Apache-2.0.
