Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

fix: two narrow gaps the review left on today's changes

youxi798fee54aea1ca5
diff --git a/bin/cli.ts b/bin/cli.ts
index 09050a1e..8a92d0dd 100644
--- a/bin/cli.ts
+++ b/bin/cli.ts
@@ -247,8 +247,12 @@ program.parseAsync().catch((error: unknown) => {
// "too many arguments" names neither --name nor quoting, so the shape
// reads as "names with spaces are unsupported" (#1378).
const excessArguments = error.code === 'commander.excessArguments';
+ // Name the operand rather than asserting why it is there. Unquoting is the
+ // usual cause, but two bare URLs produce the same error and the quoting
+ // advice would be wrong for them.
+ const extraOperand = excessArguments ? program.args.slice(1)[0] : undefined;
const hint = excessArguments
- ? 'A value containing spaces must be quoted, for example --name "Google Translate".'
+ ? `Unexpected extra argument${extraOperand ? ` "${extraOperand}"` : ''}. A value containing spaces must be quoted, for example --name "Google Translate".`
: 'Run pake --help for the accepted options.';
if (process.argv.includes('--json')) {
printJsonResult({
diff --git a/dist/cli.js b/dist/cli.js
index 8b24bf85..0a3e8b69 100644
--- a/dist/cli.js
+++ b/dist/cli.js
@@ -4079,8 +4079,12 @@ program.parseAsync().catch((error) => {
// "too many arguments" names neither --name nor quoting, so the shape
// reads as "names with spaces are unsupported" (#1378).
const excessArguments = error.code === 'commander.excessArguments';
+ // Name the operand rather than asserting why it is there. Unquoting is the
+ // usual cause, but two bare URLs produce the same error and the quoting
+ // advice would be wrong for them.
+ const extraOperand = excessArguments ? program.args.slice(1)[0] : undefined;
const hint = excessArguments
- ? 'A value containing spaces must be quoted, for example --name "Google Translate".'
+ ? `Unexpected extra argument${extraOperand ? ` "${extraOperand}"` : ''}. A value containing spaces must be quoted, for example --name "Google Translate".`
: 'Run pake --help for the accepted options.';
if (process.argv.includes('--json')) {
printJsonResult({
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index a00f459b..146ef348 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -132,12 +132,22 @@ fn should_disable_compositing_mode(
safe_mode: Option<&str>,
niri_socket: Option<&str>,
wayland_display: Option<&str>,
+ gdk_backend: Option<&str>,
desktop_values: &[Option<&str>],
) -> bool {
if let Some(value) = safe_mode.filter(|value| !value.trim().is_empty()) {
return !is_disabled_env_value(value);
}
+ // WAYLAND_DISPLAY says a compositor is reachable, not that GTK will use it.
+ // An explicit GDK_BACKEND=x11 renders through XWayland, which is the X11
+ // path this flag crashes, and it is also the workaround recommended in
+ // #1117, so the two would otherwise collide. should_force_wayland_gdk_backend
+ // already treats an explicit backend as authoritative; so does this.
+ if gdk_backend.is_some_and(|value| value.trim().eq_ignore_ascii_case("x11")) {
+ return false;
+ }
+
if !is_non_empty_env_value(wayland_display) {
return false;
}
@@ -208,6 +218,7 @@ fn apply_linux_webkit_runtime_flags() {
safe_mode.as_deref(),
std::env::var("NIRI_SOCKET").ok().as_deref(),
std::env::var("WAYLAND_DISPLAY").ok().as_deref(),
+ std::env::var(GDK_BACKEND).ok().as_deref(),
&desktop_refs,
) && std::env::var(WEBKIT_DISABLE_COMPOSITING_MODE).is_err()
{
@@ -521,7 +532,30 @@ mod tests {
// segfaults playback there.
let desktop = [Some("i3"), None, None];
assert!(should_disable_dmabuf_renderer(None));
- assert!(!should_disable_compositing_mode(None, None, None, &desktop));
+ assert!(!should_disable_compositing_mode(
+ None, None, None, None, &desktop
+ ));
+ }
+
+ #[test]
+ fn explicit_x11_gdk_backend_keeps_compositing_on_wayland() {
+ // XWayland renders through the X11 path this flag crashes, and
+ // GDK_BACKEND=x11 is the workaround recommended in #1117.
+ assert!(!should_disable_compositing_mode(
+ None,
+ None,
+ Some("wayland-0"),
+ Some("x11"),
+ &[None, None, None]
+ ));
+ // An explicit wayland backend is still a Wayland session.
+ assert!(should_disable_compositing_mode(
+ None,
+ None,
+ Some("wayland-0"),
+ Some("wayland"),
+ &[None, None, None]
+ ));
}
#[test]
@@ -530,6 +564,7 @@ mod tests {
None,
None,
Some("wayland-0"),
+ None,
&[None, None, None]
));
}
@@ -540,6 +575,7 @@ mod tests {
Some("1"),
None,
None,
+ None,
&[Some("i3"), None, None]
));
}
@@ -550,6 +586,7 @@ mod tests {
None,
Some("/run/user/501/niri.sock"),
Some("wayland-0"),
+ None,
&[None, None, None]
));
}
@@ -560,6 +597,7 @@ mod tests {
None,
None,
Some("wayland-0"),
+ None,
&[Some("niri"), None, None]
));
}
@@ -570,6 +608,7 @@ mod tests {
Some("1"),
Some("/run/user/501/niri.sock"),
Some("wayland-0"),
+ None,
&[Some("niri"), None, None]
));
}
@@ -582,6 +621,7 @@ mod tests {
Some(value),
None,
Some("wayland-0"),
+ None,
&[None, None, None]
),
"expected {value} to restore compositing"