RemoteDesktopPortal

class RemoteDesktopPortal(connection: DBusConnection)(source)

Wrapper around the org.freedesktop.portal.RemoteDesktop D-Bus interface. Provides convenient methods to access remote desktop properties and create sessions.

This portal maintains an active session internally. After calling startSession, all input methods (pointer, keyboard, touch) will use the active session automatically.

Constructors

Link copied to clipboard
constructor(connection: DBusConnection)

Properties

Link copied to clipboard
val activeSession: DBusPath?

The currently active session handle, set automatically by startSession.

Link copied to clipboard

Returns the available device types as a bitmask.

Link copied to clipboard

Returns the interface version.

Functions

Link copied to clipboard

Clears the active session.

Link copied to clipboard
fun connectToEIS(): Result<FileDescriptor>

Connect to an EIS (Event Input Stream) implementation.

Link copied to clipboard

Creates a new remote desktop session.

Link copied to clipboard

Notify about a keyboard keycode event.

Link copied to clipboard

Notify about a keyboard keysym event.

Link copied to clipboard
fun notifyPointerAxis(dx: Double, dy: Double, finish: Boolean = false): Result<Unit>

Notify about a pointer axis event (smooth scrolling, e.g., from touchpad).

Link copied to clipboard

Notify about a discrete pointer axis event (e.g., mouse wheel click).

Link copied to clipboard

Notify about a pointer button event.

Link copied to clipboard

Notify about a relative pointer motion event.

Link copied to clipboard
fun notifyPointerMotionAbsolute(stream: UInt32, x: Double, y: Double): Result<Unit>

Notify about an absolute pointer motion event.

Link copied to clipboard
fun notifyTouchDown(stream: UInt32, slot: UInt32, x: Double, y: Double): Result<Unit>

Notify about a touch-down event.

Link copied to clipboard
fun notifyTouchMotion(stream: UInt32, slot: UInt32, x: Double, y: Double): Result<Unit>

Notify about a touch motion event.

Link copied to clipboard
fun notifyTouchUp(slot: UInt32): Result<Unit>

Notify about a touch-up event.

Link copied to clipboard

Returns a Flow that emits when the active session is closed.

Link copied to clipboard
suspend fun selectDevices(sessionHandle: DBusPath, types: Set<DeviceType>? = null, restoreToken: String? = null, persistMode: PersistMode? = null): Result<Unit>

Select input devices to remote control.

Link copied to clipboard
suspend fun start(sessionHandle: DBusPath, parentWindow: String = ""): Result<StartResponse>

Start the remote desktop session. This will typically result in the portal presenting a dialog letting the user select what to share, including devices and optionally screen content if screencast sources were selected.

Link copied to clipboard
suspend fun startSession(types: Set<DeviceType>? = null, restoreToken: String? = null, persistMode: PersistMode? = null, parentWindow: String = ""): Result<StartResponse>

Convenience function that performs the complete remote desktop session flow: creates a session, selects devices, and starts the session.