Available on crate feature
remote_desktop only.Expand description
Start a remote desktop session and interact with it.
§Examples
use ashpd::desktop::{
PersistMode,
remote_desktop::{DeviceType, KeyState, RemoteDesktop, SelectDevicesOptions},
};
async fn run() -> ashpd::Result<()> {
let proxy = RemoteDesktop::new().await?;
let session = proxy.create_session(Default::default()).await?;
proxy
.select_devices(
&session,
SelectDevicesOptions::default()
.set_devices(DeviceType::Keyboard | DeviceType::Pointer),
)
.await?;
let response = proxy
.start(&session, None, Default::default())
.await?
.response()?;
println!("{:#?}", response.devices());
// 13 for Enter key code
proxy
.notify_keyboard_keycode(&session, 13, KeyState::Pressed, Default::default())
.await?;
Ok(())
}You can also use the Remote Desktop portal with the ScreenCast one. In order
to do so, you need to call
Screencast::select_sources()
on the session created with
RemoteDesktop::create_session()
use ashpd::desktop::{
PersistMode,
remote_desktop::{DeviceType, KeyState, RemoteDesktop, SelectDevicesOptions},
screencast::{CursorMode, Screencast, SelectSourcesOptions, SourceType},
};
async fn run() -> ashpd::Result<()> {
let remote_desktop = RemoteDesktop::new().await?;
let screencast = Screencast::new().await?;
let session = remote_desktop.create_session(Default::default()).await?;
remote_desktop
.select_devices(
&session,
SelectDevicesOptions::default()
.set_devices(DeviceType::Keyboard | DeviceType::Pointer),
)
.await?;
screencast
.select_sources(
&session,
SelectSourcesOptions::default()
.set_cursor_mode(CursorMode::Metadata)
.set_sources(SourceType::Monitor | SourceType::Window)
.set_multiple(true)
.set_persist_mode(PersistMode::DoNot),
)
.await?;
let response = remote_desktop
.start(&session, None, Default::default())
.await?
.response()?;
println!("{:#?}", response.devices());
println!("{:#?}", response.streams());
// 13 for Enter key code
remote_desktop
.notify_keyboard_keycode(&session, 13, KeyState::Pressed, Default::default())
.await?;
Ok(())
}Structs§
- Connect
ToEIS Options - Specified options for a
RemoteDesktop::connect_to_eisrequest. - Notify
Keyboard Keycode Options - Specified options for a
RemoteDesktop::notify_keyboard_keycoderequest. - Notify
Keyboard Keysym Options - Specified options for a
RemoteDesktop::notify_keyboard_keysymrequest. - Notify
Pointer Axis Discrete Options - Specified options for a
RemoteDesktop::notify_pointer_axis_discreterequest. - Notify
Pointer Axis Options - Specified options for a
RemoteDesktop::notify_pointer_axisrequest. - Notify
Pointer Button Options - Specified options for a
RemoteDesktop::notify_pointer_buttonrequest. - Notify
Pointer Motion Absolute Options - Specified options for a
RemoteDesktop::notify_pointer_motion_absoluterequest. - Notify
Pointer Motion Options - Specified options for a
RemoteDesktop::notify_pointer_motionrequest. - Notify
Touch Down Options - Specified options for a
RemoteDesktop::notify_touch_downrequest. - Notify
Touch Motion Options - Specified options for a
RemoteDesktop::notify_touch_motionrequest. - Notify
Touch UpOptions - Specified options for a
RemoteDesktop::notify_touch_uprequest. - Remote
Desktop - The interface lets sandboxed applications create remote desktop sessions.
- Select
Devices Options - Specified options for a
RemoteDesktop::select_devicesrequest. - Selected
Devices - A response to a
RemoteDesktop::select_devicesrequest. - Start
Options - Specified options for a
RemoteDesktop::startrequest.
Enums§
- Axis
- The available axis.
- Device
Type - A bit flag for the available devices.
- KeyState
- The keyboard key state.