mirror of
https://github.com/VallierDev/uu-remote-linux.git
synced 2026-11-16 16:50:41 +01:00
Document Arch and Omarchy setup and exercise native desktop input and clipboard
This commit is contained in:
1 parent
90c33e173c
commit
f123f0ba05
5 files changed
+115
-17
No files matched your search
+21
-16
@@ -4,9 +4,13 @@ pub fn run() -> Result<(),String> {
|
||||
if std::fs::read_to_string("/proc/sys/kernel/hostname").unwrap_or_default().trim()!="uu-hyprland-test" {
|
||||
return Err("Clipboard acceptance is restricted to the isolated VM".into());
|
||||
}
|
||||
let session=Arc::new(crate::portal::PortalSession::open()?);
|
||||
let bridge=crate::clipboard::start_portal(session.clone());
|
||||
if !bridge.ready.blocking_recv().unwrap_or(false) { return Err("Portal clipboard permission not granted".into()); }
|
||||
let screen=crate::capture::ScreenCapture::new()?;
|
||||
let input=Arc::new(crate::input::InputInjector::new());
|
||||
input.bind_portal(screen.portal.clone());
|
||||
let pointer=input.start_pointer_worker();
|
||||
let bridge=if let Some(session)=screen.portal.clone() { crate::clipboard::start_portal(session) }
|
||||
else { crate::clipboard::start(screen.display.clone()) };
|
||||
if !bridge.ready.blocking_recv().unwrap_or(false) { return Err("Desktop clipboard permission not granted".into()); }
|
||||
let mut child=Command::new("python3").arg("/home/uuremote/clipboard-acceptance.py")
|
||||
.env("GDK_BACKEND","wayland").env("GSK_RENDERER","cairo")
|
||||
.stdin(Stdio::piped()).stdout(Stdio::piped()).stderr(Stdio::null()).spawn().map_err(|_|"Start GTK clipboard fixture")?;
|
||||
@@ -29,13 +33,14 @@ pub fn run() -> Result<(),String> {
|
||||
bridge.incoming.send_replace(Some(text.clone()));
|
||||
let deadline=Instant::now()+Duration::from_secs(6);let mut matched=false;
|
||||
while Instant::now()<deadline { if check("read",&text)? {matched=true;break;} std::thread::sleep(Duration::from_millis(100)); }
|
||||
if !matched { return Err(format!("Portal clipboard incoming {name} mismatch")); }
|
||||
if !matched { return Err(format!("Desktop clipboard incoming {name} mismatch")); }
|
||||
std::thread::sleep(Duration::from_millis(300));
|
||||
if outgoing.has_changed().unwrap_or(false) { return Err("Portal clipboard echoed its own selection".into()); }
|
||||
println!("Portal clipboard incoming {name}: passed; no echo");
|
||||
if outgoing.has_changed().unwrap_or(false) { return Err("Desktop clipboard echoed its own selection".into()); }
|
||||
println!("Desktop clipboard incoming {name}: passed; no echo");
|
||||
}
|
||||
session.move_pointer(f64::from(session.width)/2.0,f64::from(session.height)/2.0,false)?;
|
||||
session.button(1,true)?; session.button(1,false)?;
|
||||
input.mouse_absolute_normalized(0.5,0.5,(screen.width,screen.height));
|
||||
std::thread::sleep(Duration::from_millis(100));
|
||||
input.mouse_button(1,true); input.mouse_button(1,false);
|
||||
std::thread::sleep(Duration::from_millis(300));
|
||||
let external="UU outgoing 中文🚀\nsecond line";
|
||||
if !check("set",external)? { return Err("GTK clipboard ownership failed".into()); }
|
||||
@@ -44,25 +49,25 @@ pub fn run() -> Result<(),String> {
|
||||
if outgoing.has_changed().unwrap_or(false) && outgoing.borrow_and_update().as_deref()==Some(external) {matched=true;break;}
|
||||
std::thread::sleep(Duration::from_millis(100));
|
||||
}
|
||||
if !matched { return Err("Portal clipboard outgoing Unicode mismatch".into()); }
|
||||
println!("Portal clipboard outgoing unicode: passed");
|
||||
if !matched { return Err("Desktop clipboard outgoing Unicode mismatch".into()); }
|
||||
println!("Desktop clipboard outgoing unicode: passed");
|
||||
bridge.incoming.send_replace(Some("x".repeat(crate::clipboard::MAX_TEXT+1)));
|
||||
std::thread::sleep(Duration::from_millis(400));
|
||||
if !check("read",external)? { return Err("Oversized text altered native clipboard".into()); }
|
||||
println!("Portal clipboard incoming oversized rejection: passed");
|
||||
println!("Desktop clipboard incoming oversized rejection: passed");
|
||||
if !check("set",&"y".repeat(crate::clipboard::MAX_TEXT+1))? { return Err("GTK oversized fixture setup failed".into()); }
|
||||
std::thread::sleep(Duration::from_secs(3));
|
||||
if outgoing.has_changed().unwrap_or(false) { return Err("Portal clipboard published oversized native text".into()); }
|
||||
println!("Portal clipboard outgoing oversized rejection: passed");
|
||||
if outgoing.has_changed().unwrap_or(false) { return Err("Desktop clipboard published oversized native text".into()); }
|
||||
println!("Desktop clipboard outgoing oversized rejection: passed");
|
||||
if !check("set","")? { return Err("GTK empty fixture setup failed".into()); }
|
||||
let deadline=Instant::now()+Duration::from_secs(6);let mut matched=false;
|
||||
while Instant::now()<deadline {
|
||||
if outgoing.has_changed().unwrap_or(false) && outgoing.borrow_and_update().as_deref()==Some("") {matched=true;break;}
|
||||
std::thread::sleep(Duration::from_millis(100));
|
||||
}
|
||||
if !matched { return Err("Portal clipboard outgoing empty text mismatch".into()); }
|
||||
println!("Portal clipboard outgoing empty: passed");
|
||||
if !matched { return Err("Desktop clipboard outgoing empty text mismatch".into()); }
|
||||
println!("Desktop clipboard outgoing empty: passed");
|
||||
drop(writer); Ok(())
|
||||
})();
|
||||
let _=child.kill();let _=child.wait();result
|
||||
let _=child.kill();let _=child.wait();pointer.abort();input.release_held();result
|
||||
}
|
||||
+25
-1
@@ -56,7 +56,7 @@ use webrtc::WebRtcSession;
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init();
|
||||
// An unknown argument must never fall through to starting a second full host server.
|
||||
const SUBCOMMANDS: [&str; 10] = ["virtual-audio-probe", "login", "unlock-check", "desktop-probe", "desktop-video-probe", "desktop-audio-probe", "wayland-capture",
|
||||
const SUBCOMMANDS: [&str; 11] = ["desktop-input-probe", "virtual-audio-probe", "login", "unlock-check", "desktop-probe", "desktop-video-probe", "desktop-audio-probe", "wayland-capture",
|
||||
"wayland-input-probe", "clipboard-acceptance", "portal-acceptance"];
|
||||
if let Some(arg) = std::env::args().nth(1).filter(|a| !SUBCOMMANDS.contains(&a.as_str())) {
|
||||
let usage = format!("usage: uuremote-server [{}]\n (no argument: run the host)", SUBCOMMANDS.join(" | "));
|
||||
@@ -165,6 +165,30 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let path=std::env::args().nth(2);
|
||||
return video::probe((screen.width,screen.height),screen.display.clone(),screen.portal.clone(),path).await.map_err(|e|e.into());
|
||||
}
|
||||
if std::env::args().nth(1).as_deref() == Some("desktop-input-probe") {
|
||||
if std::fs::read_to_string("/proc/sys/kernel/hostname").unwrap_or_default().trim()!="uu-hyprland-test" {
|
||||
return Err("Input acceptance is restricted to the isolated VM".into());
|
||||
}
|
||||
let screen=ScreenCapture::new()?;
|
||||
let input=Arc::new(InputInjector::new());
|
||||
input.bind_portal(screen.portal.clone());
|
||||
let worker=input.start_pointer_worker();
|
||||
// libinput discovers newly created uinput devices asynchronously.
|
||||
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
|
||||
input.mouse_absolute_normalized(0.25,0.25,(screen.width,screen.height));
|
||||
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
|
||||
input.mouse_absolute_normalized(0.5,0.5,(screen.width,screen.height));
|
||||
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
|
||||
input.mouse_button(1,true); input.mouse_button(1,false);
|
||||
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
|
||||
input.mouse_relative(32,0);
|
||||
tokio::time::sleep(std::time::Duration::from_millis(200)).await;
|
||||
for key in b"UUWAYLAND" { input.windows_key_event(i32::from(*key),true); input.windows_key_event(i32::from(*key),false); }
|
||||
tokio::time::sleep(std::time::Duration::from_millis(300)).await;
|
||||
worker.abort(); input.release_held();
|
||||
println!("Desktop test events sent; verify the GTK acceptance report");
|
||||
return Ok(());
|
||||
}
|
||||
if std::env::args().nth(1).as_deref() == Some("wayland-input-probe") {
|
||||
return wayland::input_probe().map_err(|e|e.into());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user