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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
studio: keep the linux desktop window resizable (#12723)
Maheswar Kumar6f268e6cc59b
diff --git a/studio/frontend/tests/window-permissions.test.ts b/studio/frontend/tests/window-permissions.test.tsnew file mode 100644index 00000000000..d7cf7e274dc--- /dev/null+++ b/studio/frontend/tests/window-permissions.test.ts@@ -0,0 +1,35 @@+// 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 { readFile, readdir } from "node:fs/promises";+import test from "node:test";++const SRC = new URL("../src/", import.meta.url);+const CAPABILITIES = new URL(+ "../../src-tauri/capabilities/default.json",+ import.meta.url,+);+const WINDOW_SETTER =+ /\b(?:win|appWindow|getCurrentWindow\(\))\.(set\w+|maximize|unmaximize|minimize|unminimize|toggleMaximize|show|hide|center|close|start\w+)\(/g;+const SOURCE_FILE = /\.tsx?$/;+const toPermission = (method: string) =>+ `core:window:allow-${method.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)}`;++// a denied call rejects at runtime, which once sent setup through its resizable fallback+test("every window setter the frontend calls is granted", async () => {+ const granted = JSON.parse(await readFile(CAPABILITIES, "utf8")).permissions;+ const files = await readdir(SRC, { recursive: true });+ const used = new Set<string>();+ for (const file of files.filter((f) => SOURCE_FILE.test(f))) {+ const source = await readFile(new URL(file, SRC), "utf8");+ for (const match of source.matchAll(WINDOW_SETTER)) {+ used.add(match[1]);+ }+ }+ assert.ok(used.has("unmaximize"));+ const missing = [...used]+ .map(toPermission)+ .filter((p) => !granted.includes(p));+ assert.deepEqual(missing, []);+});diff --git a/studio/src-tauri/capabilities/default.json b/studio/src-tauri/capabilities/default.jsonindex ba00ea0e18e..132b1d9ae90 100644--- a/studio/src-tauri/capabilities/default.json+++ b/studio/src-tauri/capabilities/default.json@@ -20,6 +20,7 @@"core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-toggle-maximize",+ "core:window:allow-unmaximize","core:window:allow-close","core:window:allow-set-theme","core:webview:allow-set-webview-zoom",diff --git a/studio/src-tauri/src/main.rs b/studio/src-tauri/src/main.rsindex aa022cd0e71..26d4e05213e 100644--- a/studio/src-tauri/src/main.rs+++ b/studio/src-tauri/src/main.rs@@ -845,6 +845,44 @@ fn setup_custom_titlebar(app: &tauri::App) -> Result<(), Box<dyn std::error::ErrOk(())}+// tao reapplies the config's `resizable: false` on the first configure, wiping setResizable calls made while hidden+#[cfg(target_os = "linux")]+fn keep_resizable_across_first_configure(+ app: &tauri::App,+) -> Result<(), Box<dyn std::error::Error>> {+ use gtk::prelude::*;+ use std::cell::{Cell, RefCell};+ use std::rc::Rc;++ let window = app.get_webview_window("main").ok_or_else(|| {+ std::io::Error::new(std::io::ErrorKind::NotFound, "main window not found")+ })?;+ let gtk_window = window.gtk_window()?;+ let requested: Rc<Cell<Option<bool>>> = Rc::default();+ let handlers: Rc<RefCell<Vec<glib::SignalHandlerId>>> = Rc::default();++ let seen = requested.clone();+ // "event" fires before tao's configure-event handler; unrealized configures skip that handler, so refresh each time+ let before = gtk_window.connect_event(move |window, event| {+ if event.event_type() == gdk::EventType::Configure {+ seen.set(Some(window.is_resizable()));+ }+ glib::Propagation::Proceed+ });+ let owned = handlers.clone();+ let after = gtk_window.connect_configure_event(move |window, _| {+ if let Some(resizable) = requested.take() {+ window.set_resizable(resizable);+ for id in owned.borrow_mut().drain(..) {+ window.disconnect(id);+ }+ }+ false+ });+ handlers.borrow_mut().extend([before, after]);+ Ok(())+}+// WebKitGTK ships two defaults that together break voice dictation on Linux:// `enable-media-stream` is off, and the stock `permission-request` handler// denies every request it never saw a listener override, including@@ -2313,6 +2351,8 @@ fn main() {setup_custom_titlebar(app)?;#[cfg(target_os = "linux")]setup_linux_media_permissions(app)?;+ #[cfg(target_os = "linux")]+ keep_resizable_across_first_configure(app)?;#[cfg(all(windows, not(debug_assertions)))]setup_windows_browser_guards(app)?;#[cfg(target_os = "macos")]