df_displmgr
Cross-platform display configuration manager. Wraps the OS-specific configuration APIs (Windows CCD on Windows, Wayland/wlroots + DRM on Linux) behind a single async trait model.
Concepts
NativeTopology— handle to the current display topology. Resolved to the platform backend at compile time.trait UniversalTopology— lifecycle:acquire()— load topology (sync, FFI-bound)get_outputs()— read currentVec<OutputState>edit_output(&DisplayId) -> Box<dyn OutputEditable>— open an editorvalidate().await— async sanity checkcommit().await— async apply to the OS
trait OutputEditable—set_resolution,set_position,set_rotation,set_enabled.ActivationPlan— save topology → force activate → restore topology → place target display.
Backends
| OS | Backend | Notes |
|---|---|---|
| Windows | backends::windows (CCD + SetDisplayConfig) |
Also exports force_activate_by_monitor_name, force_all, ccd_wake_display, activate_display, WinDisplayManager, query_all_display_targets, find_display_target |
| Linux (Wayland) | backends::linux via wayland-client + wayland-protocols-wlr |
Compositor must implement wlr-output-management unstable |
| Linux (DRM) | drm for hotplug and property I/O |
Used alongside the Wayland path |
Example
use NativeTopology;
use UniversalTopology;
use ;
async
Types (types.rs)
| Type | Purpose |
|---|---|
DisplayId(String) |
Stable OS-side ID (device path or output name) |
ConnectorId(String) |
Physical connector identifier |
AdapterId(String) |
GPU/adapter identifier |
DisplayIdentity |
Aggregate of ID + name + vendor |
Point2D, Extent2D, Rect |
Geometry |
VideoMode |
Resolution and refresh rate |
OutputState |
Snapshot of an output, with is_landscape() and refresh_rate_hz() |
ActivationPlan |
Default plan for safe re-activation |
DisplayRotation |
Rotate0, Rotate90, Rotate180, Rotate270 |
Errors
DisplayErrorenum andDisplayResult<T>alias.- Conversions from
windowsHRESULTs and Wayland/DRM errors are inerror.rs.
Build notes
target_os = "windows"—windows = "0.52"with GDI andWin32_UI_WindowsAndMessagingfeatures.target_os = "linux"—wayland-client,wayland-protocols,wayland-protocols-wlr(withclientfeature),drm.
Tests and benchmarks
benches/display_benchmark.rs uses criterion.
License
MIT