Skip to content

fix: settings window close button (and programmatic resize) silently failing - #38

Merged
Finesssee merged 1 commit into
nesszer:mainfrom
nov30th:fix/settings-window-close-capability
Apr 24, 2026
Merged

fix: settings window close button (and programmatic resize) silently failing#38
Finesssee merged 1 commit into
nesszer:mainfrom
nov30th:fix/settings-window-close-capability

Conversation

@nov30th

@nov30th nov30th commented Apr 24, 2026

Copy link
Copy Markdown

Summary

The custom close button (✕) in the top-right of the detached Settings window does nothing on Windows. Alt+F4 works.

The same silent failure also affects applySettingsWindowSize — the frontend calls getCurrentWindow().setSize(...) when switching tabs (e.g., widening the window for the Providers tab), and those calls are rejected too.

Root cause

apps/desktop-tauri/src-tauri/capabilities/default.json only scopes its permissions to the main window:

"windows": ["main"],

The detached Settings window is created with label "settings" (see shell/settings_window.rs::SETTINGS_LABEL), so it falls outside the capability's scope. Tauri's IPC permission layer rejects core:window:* calls from it without surfacing an error to JS.

Alt+F4 bypasses this entirely — Windows dispatches WM_CLOSE at the OS level, so the native close path works while the in-app button doesn't. That's the smoking gun for a missing capability scope.

Fix

Add "settings" to the capability's windows array so the existing core:default (which grants close/show/focus/minimize) and core:window:allow-set-size apply to the settings window as well.

- "windows": ["main"],
+ "windows": ["main", "settings"],

No code changes needed — Settings.tsx already calls getCurrentWindow().close() on the ✕ button; it just wasn't permitted.

Test plan

  • Rebuild (npm run tauri:dev or tauri:build) — capability files are compiled into the binary, not runtime-loaded.
  • Open Settings from the tray → click the ✕ in the top-right → window closes.
  • Open Settings on the General tab, switch to Providers → window widens from 496 → 720 logical px (previously silently no-op'd).
  • Alt+F4 still closes the window (unchanged).

The default capability only scopes permissions to the `main` window, so
the settings window's close-button `getCurrentWindow().close()` call and
the `applySettingsWindowSize` resize call are silently rejected by the
IPC permission layer. Alt+F4 works because Windows dispatches WM_CLOSE
at the OS level, bypassing Tauri's permission check — which is the
fingerprint of a missing capability scope.

Add `settings` to the capability's `windows` list so core:default (close,
show, focus, minimize) and core:window:allow-set-size apply to it too.
@Finesssee

Copy link
Copy Markdown
Collaborator

Hey thanks for the PR, I will check on it and Merge

@Finesssee
Finesssee merged commit 11ff3c7 into nesszer:main Apr 24, 2026
@Finesssee

Copy link
Copy Markdown
Collaborator

Thanks for the PR, this was exactly the right fix. The missing settings capability scope explains the close/resize behavior cleanly, and I merged it into main. Appreciate the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants