Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Desktop: switch the theme without a view transition on Linux (#16040)

oobabooga87d1add91c52
diff --git a/studio/frontend/src/components/ui/animated-theme-toggler.tsx b/studio/frontend/src/components/ui/animated-theme-toggler.tsx
index a76b94236cb..b5bb0f6ddf6 100644
--- a/studio/frontend/src/components/ui/animated-theme-toggler.tsx
+++ b/studio/frontend/src/components/ui/animated-theme-toggler.tsx
@@ -8,6 +8,7 @@ import { flushSync } from "react-dom"
import { cn } from "@/lib/utils"
import { prefersReducedMotion, setTheme } from "@/features/settings"
+import { isWebKitGTK } from "./theme-view-transition"
interface AnimatedThemeTogglerProps extends React.ComponentPropsWithoutRef<"button"> {
duration?: number
@@ -46,7 +47,12 @@ export function useAnimatedThemeToggle(duration = 400) {
}
// Reduced motion cannot reach the view transition's Web Animations clip-path, so skip it.
- if (!document.startViewTransition || prefersReducedMotion()) {
+ // WebKitGTK skips it too: the call itself can crash the page.
+ if (
+ !document.startViewTransition ||
+ prefersReducedMotion() ||
+ isWebKitGTK(navigator.platform, navigator.userAgent)
+ ) {
applyTheme()
return
}
diff --git a/studio/frontend/src/components/ui/theme-view-transition.ts b/studio/frontend/src/components/ui/theme-view-transition.ts
new file mode 100644
index 00000000000..01af76ff3bd
--- /dev/null
+++ b/studio/frontend/src/components/ui/theme-view-transition.ts
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+// startViewTransition crashes WebKitGTK 2.50 to 2.54 in any embedder, not just the desktop app (#16028).
+export function isWebKitGTK(platform: string, userAgent: string): boolean {
+ return (
+ /linux/i.test(`${platform} ${userAgent}`) &&
+ /AppleWebKit/.test(userAgent) &&
+ !/android|chrom|edg/i.test(userAgent)
+ );
+}
diff --git a/studio/frontend/tests/theme-view-transition.test.ts b/studio/frontend/tests/theme-view-transition.test.ts
new file mode 100644
index 00000000000..ca7933d0f72
--- /dev/null
+++ b/studio/frontend/tests/theme-view-transition.test.ts
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import { isWebKitGTK } from "../src/components/ui/theme-view-transition.ts";
+
+// Read from WebKitGTK 2.50.4 (Ubuntu 24.04), the engine under the Linux desktop app.
+const WEBKITGTK =
+ "Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/60.5 Safari/605.1.15";
+const MAC_WEBKIT =
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)";
+const WINDOWS_EDGE =
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0 Safari/537.36 Edg/130.0";
+const LINUX_CHROME =
+ "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0 Safari/537.36";
+const LINUX_HEADLESS_CHROME =
+ "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/130.0 Safari/537.36";
+const LINUX_FIREFOX = "Mozilla/5.0 (X11; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0";
+const ANDROID_CHROME =
+ "Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0 Mobile Safari/537.36";
+
+test("only WebKitGTK skips the theme view transition", () => {
+ assert.equal(isWebKitGTK("Linux x86_64", WEBKITGTK), true);
+ assert.equal(isWebKitGTK("", WEBKITGTK), true);
+ assert.equal(isWebKitGTK("MacIntel", MAC_WEBKIT), false);
+ assert.equal(isWebKitGTK("Win32", WINDOWS_EDGE), false);
+ assert.equal(isWebKitGTK("Linux x86_64", LINUX_CHROME), false);
+ assert.equal(isWebKitGTK("Linux x86_64", LINUX_HEADLESS_CHROME), false);
+ assert.equal(isWebKitGTK("Linux x86_64", LINUX_FIREFOX), false);
+ assert.equal(isWebKitGTK("Linux armv8l", ANDROID_CHROME), false);
+});