Files
Matt Van Horn 4ae3619f87 fix(linux): retry KDE remote control with a temporary session
## Problem and outcome / 问题与结果

Enabling remote control on KDE Plasma Wayland stops native capture even though screen and system-audio sharing were already working. The capture process exits with status 2, and the remote-control request fails because the capture profile never becomes ready. The remote-desktop open asks for transient persistence and passes a restore token. KDE's portal answers with InvalidArgument because remote desktop sessions cannot persist, and that error is treated as a failed capture open.

When a remote-input create fails with that persistence error and has not already been retried, the error is freed and session creation runs again with persist mode none and a null restore token. The retry flag allows only one attempt, so a second rejection still fails the request.

The Linux native check compiles and runs a headless portal regression that rejects the first remote-desktop create with that error and expects the second create to use persist mode none and no token, and the README lists that regression with the other headless checks.

Refs #549

## Release notes

### English

On KDE Plasma Wayland, enabling remote control now retries with a temporary session when the desktop rejects permission persistence.

### 中文

在 KDE Plasma Wayland 中开启远程控制时,如果桌面环境拒绝记住授权,Piik 会改用临时会话重试。

## Verification / 验证

npx --no-install vitest run tests/release-automation.test.ts finished with 6 passing tests in 1 file.
The tests passed with the Piik change applied; a run with it reverted gave no clear result, so no test is shown to catch this bug.
The new test native/capture/linux/portal.test.c did not run here: no test runner for it was available.

Maintainer verification on Alpine Linux with libportal 0.9.1 and GStreamer 1.28.3 passed the Linux capture build and headless Portal tests.

## Impact / 影响

Scoped to the files listed above; no other caller or consumer changes.
2026-11-21 03:35:16 -04:00

35 lines
1.0 KiB
Bash

#!/bin/sh
set -eu
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ] || { [ "$#" -eq 2 ] && [ "$2" != "--check" ]; }; then
echo "usage: build.sh <output-directory> [--check]" >&2
exit 2
fi
output=$1
source_root=$(dirname "$0")
mkdir -p "$output"
build() {
cc \
-std=c11 -O2 -Wall -Wextra -Werror \
"$source_root/$1" "$source_root/portal.c" "$source_root/input.c" \
$(pkg-config --cflags --libs \
libportal gstreamer-1.0 gstreamer-app-1.0 gstreamer-video-1.0) \
-o "$output/$2"
}
build main.c piik-capture
if [ "${2:-}" = "--check" ]; then
build main.test.c piik-capture-test
"$output/piik-capture-test"
cc -std=c11 -O2 -Wall -Wextra -Werror \
"$source_root/input.test.c" "$source_root/input.c" \
$(pkg-config --cflags --libs libportal) -o "$output/piik-input-test"
"$output/piik-input-test"
cc -std=c11 -O2 -Wall -Wextra -Werror \
"$source_root/portal.test.c" "$source_root/portal.c" "$source_root/input.c" \
$(pkg-config --cflags --libs libportal) -o "$output/piik-portal-test"
"$output/piik-portal-test"
fi