mirror of
https://github.com/VallierDev/uu-remote-linux.git
synced 2026-11-16 08:50:40 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6703b19df | ||
|
|
76a225a235 | ||
|
|
da99c1ceb4 |
No files matched your search
@@ -117,6 +117,7 @@ viewer does not reconnect them automatically.
|
||||
| `~/.config/uuremote/host_settings.json` | persisted 安全 settings: auto_lock, keep_mute, mute_permanent |
|
||||
| `UU_DESKTOP_BACKEND` | `auto` (default) / `x11` / `wayland` / `portal` / `kms` (experimental feature) / `none` (headless: no display; desktop offers ignored; tool peers get a nominal 1920x1080 screen + Allow permissions, which the port-mapping viewer requires) |
|
||||
| `UU_DESKTOP_RESIZE=0` | X11: the viewer's 分辨率 choice scales the encoded stream instead of changing the display mode. Default: `src/desktop_mode.rs` switches the primary output via xrandr (adds a CVT-RB mode when missing, re-applies once if mutter resets it), restores the original mode for resolution_type 3 and 2 s after the last desktop stream ends |
|
||||
| `UU_NVENC_RGB=0` / `=1` | NVENC 4:2:0 without scaling takes packed BGRA/BGR0 directly (no CPU swscale). Default: on, except when a connected DRM connector belongs to an nvidia-bound card (desktop composited on the encoding GPU; #16 measured 82.6 vs 98 fps at 4K). `0` forces CPU conversion, `1` forces the direct path |
|
||||
| `UU_INPUT_BACKEND` | `auto` (uinput on Wayland/portal when `/dev/uinput` is accessible, udev `uaccess` rule in README) / `uinput` / `native`. X11 keeps XTest (held-key autorepeat handling) |
|
||||
| Mac viewer Cmd | With 「使用 macOS 快捷键」 off the Mac viewer sends Cmd=VK_LWIN 0x5B, Option=0xA4, Ctrl=0xA2; connect header `controller_platform`=4 is macOS. For Mac controllers Cmd is held back: Cmd+C/V/A/F/X/Z → Ctrl+key (terminal: Cmd+C/V → Ctrl+Shift+C/V), other combos/alone → Super |
|
||||
| `UU_TERMINAL_SHORTCUTS=0` | disable Ctrl+V → Ctrl+Shift+V in focused X11 terminals (Mac Cmd and Ctrl both arrive as VK_LCONTROL) |
|
||||
|
||||
Generated
+1
-1
@@ -2741,7 +2741,7 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "uu-remote-linux"
|
||||
version = "0.2.25"
|
||||
version = "0.2.26"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"base64 0.22.1",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "uu-remote-linux"
|
||||
version = "0.2.25"
|
||||
version = "0.2.26"
|
||||
edition = "2021"
|
||||
default-run = "uuremote-server"
|
||||
authors = ["uu-remote-linux contributors"]
|
||||
|
||||
@@ -331,6 +331,7 @@ Common environment variables:
|
||||
| `UU_CONFIG` | Config file path (default `~/.config/uuremote/config.json`) |
|
||||
| `UU_DESKTOP_BACKEND` | `auto` / `x11` / `wayland` / `portal` / `kms` (experimental feature) / `none` (headless) |
|
||||
| `UU_DESKTOP_RESIZE=0` | on X11, keep the desktop resolution and only scale the encoded stream when the viewer picks a resolution |
|
||||
| `UU_NVENC_RGB=0` / `=1` | NVENC encodes BGRA directly (saves CPU). Off by default when a monitor is connected to the NVIDIA card (slower when the desktop is composited on the same GPU); `0` forces off, `1` forces on |
|
||||
| `UU_WAYLAND_MULTISCREEN=1` | Enable Hyprland physical monitor switching (off by default) |
|
||||
| `UU_WAYLAND_OUTPUT` | Initial native Wayland output name, e.g. `HDMI-A-1` |
|
||||
| `UU_WAYLAND_NO_VIRTUAL_KEYBOARD=1` | Native Wayland skips the virtual keyboard (e.g. Denial reserves it for its input method); keys go through uinput. Without wlr-virtual-pointer the pointer also uses uinput (#72) |
|
||||
|
||||
@@ -300,6 +300,7 @@ systemctl --user restart uuremote-native.service
|
||||
| `UU_CONFIG` | 配置文件路径(默认 `~/.config/uuremote/config.json`) |
|
||||
| `UU_DESKTOP_BACKEND` | `auto` / `x11` / `wayland` / `portal` / `kms`(实验性特性) / `none`(无头模式) |
|
||||
| `UU_DESKTOP_RESIZE=0` | X11 下控制端切换分辨率时不改桌面分辨率,只缩放编码画面 |
|
||||
| `UU_NVENC_RGB=0` / `=1` | NVENC 直接编码 BGRA(省 CPU)。显示器接在 NVIDIA 卡上时默认关闭(同卡合成时直吃反而更慢),`0` 强制关,`1` 强制开 |
|
||||
| `UU_WAYLAND_MULTISCREEN=1` | 启用 Hyprland 物理显示器切换(默认关闭) |
|
||||
| `UU_WAYLAND_OUTPUT` | 原生 Wayland 默认采集输出名称,例如 `HDMI-A-1` |
|
||||
| `UU_WAYLAND_NO_VIRTUAL_KEYBOARD=1` | 原生 Wayland 不创建虚拟键盘(如 Denial 只把它给自己的输入法),键盘改走 uinput。合成器没有 wlr-virtual-pointer 时鼠标也自动改走 uinput(#72) |
|
||||
|
||||
@@ -306,9 +306,11 @@ static void on_status_menu(GtkStatusIcon *i, guint button, guint time, gpointer
|
||||
gtk_menu_popup_at_pointer(GTK_MENU(tray_menu), NULL);
|
||||
}
|
||||
// Monochrome tray icon that follows light/dark panels: GTK and the GNOME AppIndicator extension
|
||||
// recolor "-symbolic" names, KDE recolors the ColorScheme-Text class. Written to the user cache
|
||||
// and offered as an icon theme path, so it needs no package install.
|
||||
static const char TRAY_ICON_NAME[] = "uu-remote-linux-symbolic";
|
||||
// recolor "-symbolic" names, KDE recolors the ColorScheme-Text class. Installed into the user's
|
||||
// hicolor theme (found by every panel's default lookup) and also offered as the icon theme path,
|
||||
// so it needs no package install. KDE tries dash-trimmed names ("uu-remote-linux") in each theme
|
||||
// before the next one, so the name must not trim into the colored app icon (#87).
|
||||
static const char TRAY_ICON_NAME[] = "uuremote-tray-symbolic";
|
||||
static const char TRAY_ICON_SVG[] =
|
||||
"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\">"
|
||||
"<style id=\"current-color-scheme\">.ColorScheme-Text{color:#232629}</style>"
|
||||
@@ -316,15 +318,16 @@ static const char TRAY_ICON_SVG[] =
|
||||
"A1.5 1.5 0 0 1 1 10.5v-7A1.5 1.5 0 0 1 2.5 2zm0 1.5v7h11v-7z\"/>"
|
||||
"<path class=\"ColorScheme-Text\" fill=\"currentColor\" d=\"M7.25 12h1.5v1.5H11a.75.75 0 0 1 0 1.5H5a.75.75 0 0 1 0-1.5h2.25z"
|
||||
"M11.5 4.5v4l-1.35-1.35-3.1 3.1-1.2-1.2 3.1-3.1L7.5 4.5z\"/></svg>\n";
|
||||
// Returns the theme path holding the icon (hicolor layout plus a loose copy), or NULL.
|
||||
// Returns the icon theme root holding the icon ($XDG_DATA_HOME/icons), or NULL.
|
||||
static gchar *write_tray_icon(void) {
|
||||
gchar *root = g_build_filename(g_get_user_cache_dir(), "uu-remote-linux", "icons", NULL);
|
||||
gchar *root = g_build_filename(g_get_user_data_dir(), "icons", NULL);
|
||||
gchar *apps = g_build_filename(root, "hicolor", "scalable", "apps", NULL);
|
||||
gchar *file = g_strconcat(TRAY_ICON_NAME, ".svg", NULL);
|
||||
gchar *themed = g_build_filename(apps, file, NULL), *loose = g_build_filename(root, file, NULL);
|
||||
int ok = g_mkdir_with_parents(apps, 0700) == 0 && g_file_set_contents(themed, TRAY_ICON_SVG, -1, NULL)
|
||||
&& g_file_set_contents(loose, TRAY_ICON_SVG, -1, NULL);
|
||||
g_free(apps); g_free(file); g_free(themed); g_free(loose);
|
||||
gchar *path = g_build_filename(apps, file, NULL), *current = NULL;
|
||||
// Rewriting an unchanged file would only make icon caches rescan.
|
||||
int ok = g_file_get_contents(path, ¤t, NULL, NULL) && strcmp(current, TRAY_ICON_SVG) == 0;
|
||||
if (!ok) ok = g_mkdir_with_parents(apps, 0755) == 0 && g_file_set_contents(path, TRAY_ICON_SVG, -1, NULL);
|
||||
g_free(apps); g_free(file); g_free(path); g_free(current);
|
||||
if (!ok) { g_free(root); return NULL; }
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
修复 KDE 托盘图标显示为未知图标;显示器接在 NVIDIA 卡上时默认不再让 NVENC 直接编码 BGRA。/ Fixes the KDE tray icon; NVENC skips direct BGRA input when NVIDIA drives the display.
|
||||
|
||||
### 修复 / Fixed
|
||||
- **KDE 托盘显示成未知(空白页)图标**(#87,v0.2.25 引入):单色托盘图标改名为 `uuremote-tray-symbolic`,写到 `~/.local/share/icons/hicolor`,
|
||||
各家面板的默认图标查找都能找到,仍会随深色/浅色面板着色。已在 Plasma 6.7 / KF6 上用 KIconLoader 按 Plasma 的查找方式验证,Plasma 6.8 面板待报告者确认。
|
||||
v0.2.25 留下的 `~/.cache/uu-remote-linux/icons` 不再使用,可以删除。
|
||||
- **同一张 NVIDIA 卡负责显示时编码变慢**(#16):显示、采集、编码都在同一张 NVIDIA 卡上时,NVENC 直接编码 BGRA 反而比 CPU 转换慢
|
||||
(RTX 5070 4K:探针 82.6 vs 98 fps)。现在只要有显示器接在 NVIDIA 卡上就改用 CPU 转换;核显接显示器的机器不变。`UU_NVENC_RGB=1` 强制直接编码,`=0` 强制 CPU 转换。
|
||||
- The tray icon is installed as `uuremote-tray-symbolic` in the user hicolor theme, so KDE's default lookup finds it
|
||||
(v0.2.25 showed the unknown icon on Plasma 6.8). NVENC no longer takes packed BGRA when a connected monitor hangs off
|
||||
an NVIDIA card (slower when the desktop is composited on the encoding GPU); `UU_NVENC_RGB=1` forces it.
|
||||
|
||||
### 下载 / Download
|
||||
`uu-remote-linux_0.2.26_<amd64|arm64>.deb`,或 `uu-remote-linux-v0.2.26-<x86_64|aarch64>-linux.tar.gz`,或 `docker pull ghcr.io/vallierdev/uu-remote-linux:v0.2.26`(x86_64)。
|
||||
|
||||
**非官方项目,与网易无关。** / **Unofficial, not affiliated with NetEase.**
|
||||
+44
-3
@@ -262,10 +262,29 @@ fn cpu_hevc_options(settings: &VideoSettings, gop: &str) -> Vec<String> {
|
||||
|
||||
/// NVENC converts packed RGB on the GPU (BT.601 limited range, tagged bt470bg like the swscale default;
|
||||
/// compared on the 3090), so 4:2:0 without scaling skips the CPU BGRA→YUV pass (#16: ~2 cores at 4K).
|
||||
/// `input` is the source pixel format; `UU_NVENC_RGB=0` restores CPU conversion.
|
||||
/// When the desktop is composited on the NVIDIA card itself, the packed-RGB path is slower than CPU
|
||||
/// conversion (#16: RTX 5070 at 4K, 82.6 vs 98 fps), so it stays off unless `UU_NVENC_RGB=1`.
|
||||
/// `input` is the source pixel format; `UU_NVENC_RGB=0` always restores CPU conversion.
|
||||
fn nvenc_rgb_input(settings: &VideoSettings, encoder: Encoder, input: &'static str) -> Option<&'static str> {
|
||||
(encoder == Encoder::Nvenc && settings.chroma != crate::capture_setting::CHROMA_444 && settings.output.is_none()
|
||||
&& std::env::var("UU_NVENC_RGB").as_deref() != Ok("0")).then_some(input)
|
||||
let wanted = match std::env::var("UU_NVENC_RGB").as_deref() {
|
||||
Ok("0") => false,
|
||||
Ok("1") => true,
|
||||
_ => !nvidia_drives_display(std::path::Path::new("/sys/class/drm")),
|
||||
};
|
||||
(encoder == Encoder::Nvenc && settings.chroma != crate::capture_setting::CHROMA_444 && settings.output.is_none() && wanted)
|
||||
.then_some(input)
|
||||
}
|
||||
|
||||
/// A connected DRM connector (`cardN-HDMI-A-1/status`) on a card bound to the nvidia driver.
|
||||
/// Only visible with nvidia-drm modeset, which Wayland compositors require.
|
||||
fn nvidia_drives_display(drm: &std::path::Path) -> bool {
|
||||
std::fs::read_dir(drm).into_iter().flatten().flatten().any(|entry| {
|
||||
let name = entry.file_name().to_string_lossy().into_owned();
|
||||
let Some((card, _)) = name.split_once('-') else { return false; };
|
||||
card.starts_with("card")
|
||||
&& std::fs::read_to_string(entry.path().join("status")).is_ok_and(|s| s.trim() == "connected")
|
||||
&& std::fs::read_link(drm.join(card).join("device/driver")).is_ok_and(|p| p.file_name().is_some_and(|n| n == "nvidia"))
|
||||
})
|
||||
}
|
||||
|
||||
fn encoder_options(settings: &VideoSettings, encoder: Encoder, gop: &str, rgb: Option<&'static str>) -> Vec<String> {
|
||||
@@ -1062,6 +1081,28 @@ pub async fn stream_desktop(pc: Arc<RTCPeerConnection>, track: Arc<crate::video_
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn nvidia_display_is_detected_from_connected_connectors() {
|
||||
use std::os::unix::fs::symlink;
|
||||
let root = std::env::temp_dir().join(format!("uu-drm-test-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&root);
|
||||
let card = |n: &str, driver: &str, connector: &str, status: &str| {
|
||||
std::fs::create_dir_all(root.join(format!("drivers/{driver}"))).unwrap();
|
||||
std::fs::create_dir_all(root.join(format!("drm/{n}/device"))).unwrap();
|
||||
let _ = symlink(root.join(format!("drivers/{driver}")), root.join(format!("drm/{n}/device/driver")));
|
||||
std::fs::create_dir_all(root.join(format!("drm/{n}-{connector}"))).unwrap();
|
||||
std::fs::write(root.join(format!("drm/{n}-{connector}/status")), format!("{status}\n")).unwrap();
|
||||
};
|
||||
let drm = root.join("drm");
|
||||
card("card0", "i915", "HDMI-A-1", "connected");
|
||||
card("card1", "nvidia", "DP-1", "disconnected");
|
||||
assert!(!super::nvidia_drives_display(&drm), "iGPU drives the display");
|
||||
card("card1", "nvidia", "DP-2", "connected");
|
||||
assert!(super::nvidia_drives_display(&drm), "NVIDIA drives a display");
|
||||
assert!(!super::nvidia_drives_display(&root.join("missing")));
|
||||
let _ = std::fs::remove_dir_all(&root);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn native_frame_dimensions_are_padded_to_even() {
|
||||
// A scaled compositor can report an odd logical desktop (e.g. two stacked 150% monitors →
|
||||
|
||||
Reference in new issue
Block a user