tw93/Pake · warning

[Pake] Failed to toggle native fullscreen:

Error message

[Pake] Failed to toggle native fullscreen:

What it means

This is a warning logged in the catch handler of toggleNativeFullscreen. When the F11 shortcut fires, the code queries the current fullscreen state via `appWindow.isFullscreen()` (a Tauri IPC call) and then toggles it with `setFullscreen` or `document.exitFullscreen()`. If the IPC promise rejects — the webview/window handle is unavailable, the window was closed mid-flight, or the platform rejects the fullscreen change — the rejection is caught and logged with this message instead of crashing.

Solutions

  1. Grant the required permissions in src-tauri/capabilities: add `window:allow-is-fullscreen` and `window:allow-set-fullscreen` to the capability allowlist.
  2. Check whether the warning is transient (window closing during the call) — it is a console.warn and safe to ignore if fullscreen still works on the next F11 press.
  3. On Linux/Wayland, verify the compositor permits fullscreen; test with `--decorations=false` or under X11 to isolate Wayland-specific rejection.
  4. Guard the call by re-fetching the current window and confirming it is still valid (`window.__TAURI__.window.getCurrentWindow()`) before toggling, and debounce repeated F11 presses (event.repeat is already filtered; add a timestamp-based throttle if needed).

Example fix

// before
const appWindow = window.__TAURI__?.window?.getCurrentWindow?.();
if (!appWindow) return;
toggleNativeFullscreen(appWindow);
// after
const appWindow = window.__TAURI__?.window?.getCurrentWindow?.();
if (!appWindow) return;
try {
  await appWindow.isVisible(); // probe IPC liveness before toggling
  toggleNativeFullscreen(appWindow);
} catch {
  return; // window closed or IPC unavailable
}
Defensive patterns

Strategy: try-catch

Validate before calling

const appWindow = window.__TAURI__?.window?.getCurrentWindow?.();
if (!appWindow || typeof appWindow.isFullscreen !== "function") return; // IPC bridge missing

Type guard

function isValidAppWindow(win) {
  return Boolean(win) && typeof win.isFullscreen === "function" && typeof win.setFullscreen === "function";
}

Try / catch

appWindow
  .isFullscreen()
  .then((fullscreen) => appWindow.setFullscreen(!fullscreen))
  .catch((error) => {
    if (String(error).includes("window not found")) return; // window closed, ignore
    console.warn("[Pake] Failed to toggle native fullscreen:", error);
  });

Prevention

When it happens

Trigger: Pressing F11 on Linux/Windows while `window.__TAURI__.window.getCurrentWindow()` returns a stale or already-closed window handle; the `isFullscreen()` or `setFullscreen()` IPC invoke rejects (window destroyed, permissions/capability missing for the window plugin, webview navigating away mid-call); a DOM exitFullscreen() promise rejection is not caught here (only the IPC chain is), but an IPC failure of isFullscreen/setFullscreen always produces this warning.

Common situations: Rapidly double-pressing F11 so the first call is still pending when the window state changes; closing the window while a fullscreen toggle IPC is in flight; a packaged app whose Tauri capabilities do not grant `window:allow-is-fullscreen` / `window:allow-set-fullscreen`; running on a Wayland compositor where fullscreen requests are rejected by the window manager.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of tw93/Pake@c8fe8a3f1a (2026-09-20). Data as JSON: /api/errors/aa8a613df5446fae. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/src/inject/event.js:111

  const isMac = /mac/i.test(getDesktopPlatform());
  const isMacScrollShortcut =
    event.key === "ArrowUp" || event.key === "ArrowDown";
  if (isMac && event.metaKey && isMacScrollShortcut) {
    handleShortcut(event);
  }
}

function toggleNativeFullscreen(appWindow) {
  appWindow
    .isFullscreen()
    .then((fullscreen) => {
      if (document.fullscreenElement && document.exitFullscreen) {
        return document.exitFullscreen();
      }
      return appWindow.setFullscreen(!fullscreen);
    })
    .catch((error) => {
      console.warn("[Pake] Failed to toggle native fullscreen:", error);
    });
}

function handleWindowFullscreenShortcut(event) {
  if (
    !event.isTrusted ||
    event.repeat ||
    event.key !== "F11" ||
    !isNonMacDesktop()
  ) {
    return;
  }

  const appWindow = window.__TAURI__?.window?.getCurrentWindow?.();
  if (!appWindow) {
    return;
  }

View on GitHub (pinned to c8fe8a3f1a)