mirror of
https://github.com/VallierDev/uu-remote-linux.git
synced 2026-11-16 16:50:41 +01:00
1 parent
d9c43897c7
commit
6bf05a6361
3 files changed
+26
-3
No files matched your search
+2
-1
@@ -589,7 +589,8 @@ terminal emulator (`TERMINAL` selects one). From source: `sudo apt install libsd
|
||||
`cargo build --release --locked --features native-viewer,viewer-sdl --bin uuremote-viewer`.
|
||||
|
||||
SDL clipboard access reuses the desktop window to avoid temporary-window Dock churn on GNOME Wayland (#37).
|
||||
Synchronization runs only while that window is focused and keeps the 30 KiB text limit. Selections without a supported
|
||||
On niri, data-control-capable `wl-clipboard` is used instead, so synchronization does not require window focus.
|
||||
Other SDL backends synchronize only while that window is focused. The 30 KiB text limit applies. Selections without a supported
|
||||
text format are skipped; empty-text detection depends on the SDL2 backend. Builds without SDL retain the command backend.
|
||||
SDL2 reads selections synchronously, so a slow selection owner can temporarily block the window; the bridge timeout cannot interrupt it.
|
||||
GNOME-to-official-Mac bidirectional clipboard synchronization is still unverified; this change does not resolve host compatibility.
|
||||
|
||||
@@ -514,7 +514,8 @@ xfce4-session xfce4-panel xfdesktop xfwm4 gnome-terminal`。
|
||||
`ffmpeg` 命令;SDL 桌面窗口直接同步文本剪贴板(Wayland/X11),无需额外剪贴板工具;终端功能需要本机终端程序(可用 `TERMINAL` 指定)。
|
||||
从源码构建:`sudo apt install libsdl2-dev`,然后 `cargo build --release --locked --features native-viewer,viewer-sdl --bin uuremote-viewer`。
|
||||
|
||||
SDL 剪贴板复用桌面窗口,避免 GNOME Wayland 上临时窗口引起的 Dock 跳动(#37)。仅在桌面窗口获得焦点时同步,
|
||||
SDL 剪贴板复用桌面窗口,避免 GNOME Wayland 上临时窗口引起的 Dock 跳动(#37)。niri 改用支持 data-control 的
|
||||
`wl-clipboard`,不需要桌面窗口保持焦点;其他 SDL 后端仅在桌面窗口获得焦点时同步。
|
||||
保留 30 KiB 文本上限;跳过不含支持的文本格式的本地选择,空文本的识别取决于 SDL2 后端。不带 SDL 的构建保留命令后端。
|
||||
SDL2 同步读取选择内容,慢速的剪贴板提供者可能暂时阻塞窗口,桥接超时无法中断该原生调用。
|
||||
GNOME 与官方 Mac 被控端的双向剪贴板尚未验证通过;此修改不解决被控端兼容问题。
|
||||
|
||||
+22
-1
@@ -156,6 +156,16 @@ async fn send(channel:&RTCDataChannel,message:Vec<u8>)->Result<(),()>{
|
||||
tokio::time::timeout(Duration::from_secs(2),channel.send(&bytes::Bytes::from(message))).await.map_err(|_|())?.map_err(|_|())?;Ok(())
|
||||
}
|
||||
pub struct Bridge {backend:Option<Backend>,pub enabled:bool,tx:Option<mpsc::Sender<Vec<u8>>>,task:Option<tokio::task::JoinHandle<()>>,target_mac:Option<bool>}
|
||||
#[cfg(feature="viewer-sdl")]
|
||||
fn sdl_backend(wayland:bool,niri:bool,tx:mpsc::Sender<ClipboardRequest>,find:impl Fn(&str)->Option<PathBuf>)->Option<Backend>{
|
||||
if wayland && niri {
|
||||
// SDL3 only retains a Wayland selection offer associated with its seat;
|
||||
// niri's regular clipboard is not exposed through that seat state.
|
||||
// Unlike GNOME, niri supports data-control, so polling wl-clipboard
|
||||
// neither requires a focused toplevel nor creates transient windows.
|
||||
CommandBackend::select(true,find).map(Backend::Command).or(Some(Backend::Sdl(tx)))
|
||||
}else{Some(Backend::Sdl(tx))}
|
||||
}
|
||||
impl Bridge {
|
||||
pub fn new(desktop:bool)->Self{
|
||||
let backend=if desktop{Backend::detect()}else{None};let enabled=backend.is_some();
|
||||
@@ -163,7 +173,9 @@ impl Bridge {
|
||||
}
|
||||
#[cfg(feature="viewer-sdl")]
|
||||
pub fn sdl(tx:mpsc::Sender<ClipboardRequest>)->Self{
|
||||
let backend=(std::env::var("UU_VIEWER_CLIPBOARD").as_deref()!=Ok("0")).then_some(Backend::Sdl(tx));
|
||||
let wayland=std::env::var_os("WAYLAND_DISPLAY").is_some_and(|v|!v.is_empty());
|
||||
let backend=(std::env::var("UU_VIEWER_CLIPBOARD").as_deref()!=Ok("0"))
|
||||
.then(||sdl_backend(wayland,std::env::var_os("NIRI_SOCKET").is_some(),tx,executable)).flatten();
|
||||
Self{enabled:backend.is_some(),backend,tx:None,task:None,target_mac:None}
|
||||
}
|
||||
pub fn set_target_mac(&mut self,mac:Option<bool>){self.target_mac=mac;}
|
||||
@@ -249,6 +261,15 @@ impl Drop for Bridge{fn drop(&mut self){self.stop();}}
|
||||
assert!(select(true,&[]).is_none());
|
||||
}
|
||||
#[cfg(feature="viewer-sdl")]
|
||||
#[test] fn niri_command_backend_avoids_sdl_seat_selection(){
|
||||
let(tx,_rx)=mpsc::channel(1);
|
||||
let find=|n:&str|n.starts_with("wl-").then(||PathBuf::from(n));
|
||||
assert!(matches!(sdl_backend(true,true,tx.clone(),find),Some(Backend::Command(_))));
|
||||
assert!(matches!(sdl_backend(true,true,tx.clone(),|_|None),Some(Backend::Sdl(_))));
|
||||
assert!(matches!(sdl_backend(true,false,tx.clone(),find),Some(Backend::Sdl(_))));
|
||||
assert!(matches!(sdl_backend(false,true,tx,find),Some(Backend::Sdl(_))));
|
||||
}
|
||||
#[cfg(feature="viewer-sdl")]
|
||||
#[tokio::test] async fn unfocused_write_does_not_mark_remote_text_as_applied(){
|
||||
let(tx,mut rx)=mpsc::channel(8);let backend=Backend::Sdl(tx);
|
||||
let ui=tokio::spawn(async move{
|
||||
|
||||
Reference in new issue
Block a user