Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

feat(desktop): zoom level control in settings (#6358)

Shreyas5456b47c52e2
diff --git a/packages/hoppscotch-common/locales/en.json b/packages/hoppscotch-common/locales/en.json
index e1a25f424..3a8c2c917 100644
--- a/packages/hoppscotch-common/locales/en.json
+++ b/packages/hoppscotch-common/locales/en.json
@@ -1289,7 +1289,8 @@
"delete_account": "Delete account",
"delete_account_description": "Once you delete your account, all your data will be permanently deleted. This action cannot be undone.",
"desktop": "Desktop",
- "desktop_description": "Update behavior and keyboard handling for the Hoppscotch desktop app.",
+ "desktop_description": "Update behavior, keyboard handling, and display preferences for the Hoppscotch desktop app.",
+ "desktop_display": "Display",
"desktop_keyboard": "Keyboard",
"desktop_keyboard_strategy_label": "Match shortcuts by typed letter or physical position",
"desktop_keyboard_strategy_description": "On non-QWERTY layouts, the same letter can come from different physical keys. The default works for most layouts; switch options if shortcuts don't fire as expected on yours.",
@@ -1303,6 +1304,12 @@
"disable_encode_mode_tooltip": "Never encode the parameters in the request",
"disable_update_checks": "Disable automatic update checks",
"disable_update_checks_description": "Skip the update check at app startup. Use the button above to check on demand.",
+ "zoom_level": "Zoom level",
+ "zoom_level_description": "Scales the entire interface. Higher values make text and controls larger on high-resolution screens.",
+ "zoom_level_100": "100%",
+ "zoom_level_110": "110%",
+ "zoom_level_125": "125%",
+ "zoom_level_150": "150%",
"enable_encode_mode_tooltip": "Always encode the parameters in the request",
"enter_otp": "Enter Agent's code",
"expand_navigation": "Expand navigation",
diff --git a/packages/hoppscotch-common/package.json b/packages/hoppscotch-common/package.json
index 66a1b2f41..66bea4446 100644
--- a/packages/hoppscotch-common/package.json
+++ b/packages/hoppscotch-common/package.json
@@ -40,7 +40,7 @@
"@hoppscotch/httpsnippet": "3.0.9",
"@hoppscotch/js-sandbox": "workspace:^",
"@hoppscotch/kernel": "workspace:^",
- "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#0d58d53be2bc75aeb5916bd0d77794fd209426af",
+ "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#1d13dd1cfe6dde56398ea71dfec9e7bbb4376dbf",
"@hoppscotch/ui": "0.2.5",
"@hoppscotch/vue-toasted": "0.1.0",
"@lezer/highlight": "1.2.1",
diff --git a/packages/hoppscotch-common/src/components/settings/Desktop.vue b/packages/hoppscotch-common/src/components/settings/Desktop.vue
index a7384e0b4..d09a2b505 100644
--- a/packages/hoppscotch-common/src/components/settings/Desktop.vue
+++ b/packages/hoppscotch-common/src/components/settings/Desktop.vue
@@ -110,6 +110,35 @@
</div>
</div>
</section>
+
+ <section>
+ <h4 class="font-semibold text-secondaryDark">
+ {{ t("settings.desktop_display") }}
+ </h4>
+
+ <!-- Fixed-preset zoom control. Four named scale steps starting
+ at 100% follow Apple's pattern across Display preferences
+ and Safari View, which keeps every shipped zoom inside the
+ range cross-platform QA covers. Sub-100% steps stay out of
+ scope because the AppHeader's macOS traffic-light clearance
+ sets a 100% floor (see FE-1261). -->
+ <div class="mt-4">
+ <label class="text-secondaryLight">{{
+ t("settings.zoom_level")
+ }}</label>
+ <div class="mt-3">
+ <HoppSmartRadioGroup
+ :radios="zoomPresets"
+ :model-value="selectedZoomPreset"
+ class="!flex-row"
+ @update:model-value="setZoomPreset"
+ />
+ </div>
+ <p class="mt-3 text-xs text-secondaryLight">
+ {{ t("settings.zoom_level_description") }}
+ </p>
+ </div>
+ </section>
</div>
</div>
</template>
@@ -119,6 +148,7 @@ import { computed, onBeforeUnmount, ref, watch, type Component } from "vue"
import {
HoppButtonSecondary,
HoppSmartRadio,
+ HoppSmartRadioGroup,
HoppSmartToggle,
} from "@hoppscotch/ui"
import { useI18n } from "~/composables/i18n"
@@ -342,6 +372,37 @@ const keyboardStrategyOptions = computed<
async function setKeyboardStrategy(value: KeyboardStrategy): Promise<void> {
await desktopSettings.update("keyboardLayoutStrategy", value)
}
+
+// Zoom presets as `{ value, label }` pairs, in the order the control
+// renders. `value` is the string id the radio group emits, kept distinct
+// from the stored float so the radio's `model-value` comparison never
+// trips on float equality. The float-to-string mapping lives in one
+// place (`zoomPresets`) and gets inverted by `setZoomPreset()` when the
+// user picks an option.
+const zoomPresets = computed(() => [
+ { value: "1.0", label: t("settings.zoom_level_100") },
+ { value: "1.1", label: t("settings.zoom_level_110") },
+ { value: "1.25", label: t("settings.zoom_level_125") },
+ { value: "1.5", label: t("settings.zoom_level_150") },
+])
+
+// Maps the persisted float back to a radio id. Falls through to "1.0"
+// for any value not in the preset set (a future schema migration could
+// introduce values outside the shipped range, and the control reads as
+// 100% rather than as no-selection in that case).
+const selectedZoomPreset = computed(() => {
+ const stored = desktopSettings.settings.zoomLevel
+ const match = zoomPresets.value.find(
+ (preset) => parseFloat(preset.value) === stored
+ )
+ return match?.value ?? "1.0"
+})
+
+async function setZoomPreset(value: string): Promise<void> {
+ const factor = parseFloat(value)
+ if (Number.isNaN(factor)) return
+ await desktopSettings.update("zoomLevel", factor)
+}
</script>
<style scoped>
diff --git a/packages/hoppscotch-common/src/composables/desktop-settings.ts b/packages/hoppscotch-common/src/composables/desktop-settings.ts
index 6baa1db22..c5080a3bc 100644
--- a/packages/hoppscotch-common/src/composables/desktop-settings.ts
+++ b/packages/hoppscotch-common/src/composables/desktop-settings.ts
@@ -8,16 +8,25 @@ import { invoke } from "@tauri-apps/api/core"
// shell reads them through its own `kernel/store.ts` wrapper at the
// same physical path. Going through the org-scoped store would route
// writes to a different file and the shell would never see them.
-import { UnifiedStore as Store } from "~/kernel/store"
+//
+// Relative imports rather than the `~/` alias because this module is
+// consumed by both the selfhost-web entry (where `~` resolves to
+// common's src) and the desktop shell entry (where `~` resolves to the
+// shell's own src). The package-name alias `@hoppscotch/common/...`
+// would work under Vite dev but fails under Rollup build, which treats
+// the rewritten `@hoppscotch/common/src/...` as an unresolved package
+// specifier. Relative paths resolve identically under TS, both Vite
+// configs, and the production build.
+import { UnifiedStore as Store } from "../kernel/store"
import {
DESKTOP_SETTINGS_SCHEMA,
DESKTOP_SETTINGS_STORE_KEY,
DESKTOP_SETTINGS_STORE_NAMESPACE,
parseDesktopSettings,
type DesktopSettings,
-} from "~/platform/desktop-settings"
-import { setKeyboardLayoutStrategy } from "~/helpers/keyboard-strategy"
-import { Log } from "~/kernel/log"
+} from "../platform/desktop-settings"
+import { setKeyboardLayoutStrategy } from "../helpers/keyboard-strategy"
+import { Log } from "../kernel/log"
const LOG_TAG = "useDesktopSettings"
@@ -135,6 +144,15 @@ export function useDesktopSettings(): {
loaded: Readonly<typeof loaded>
/** Updates a single setting and persists immediately, rolling back on failure. */
update: UpdateFn
+ /**
+ * Resolves once the initial store read has completed (success or
+ * failure). Synchronous readers of `settings` that need the persisted
+ * value rather than the schema default await this first. Callers that
+ * already react to `settings` through Vue reactivity do not need it,
+ * since `Object.assign(settings, ...)` inside `loadInitial()` triggers
+ * watchers when the persisted value arrives.
+ */
+ ready: () => Promise<void>
} {
if (!initPromise) {
initPromise = loadInitial().catch((err) => {
@@ -145,6 +163,17 @@ export function useDesktopSettings(): {
})
}
+ const ready: () => Promise<void> = async () => {
+ if (!initPromise) return
+ try {
+ await initPromise
+ } catch {
+ // Load failed. Caller can check `loaded.value` to decide whether
+ // to proceed against the schema defaults or retry. Swallowing
+ // matches the pattern `update()` uses below.
+ }
+ }
+
const update: UpdateFn = async (key, value) => {
// Wait for the initial load before mutating. Without this, a
// user clicking a toggle immediately after mount could interleave
@@ -193,5 +222,6 @@ export function useDesktopSettings(): {
settings: readonly(settings) as Readonly<DesktopSettings>,
loaded: readonly(loaded),
update,
+ ready,
}
}
diff --git a/packages/hoppscotch-common/src/composables/desktop-zoom.ts b/packages/hoppscotch-common/src/composables/desktop-zoom.ts
new file mode 100644
index 000000000..9d26b0e28
--- /dev/null
+++ b/packages/hoppscotch-common/src/composables/desktop-zoom.ts
@@ -0,0 +1,66 @@
+import { watch, type WatchStopHandle } from "vue"
+import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow"
+// Relative imports rather than the `~/` alias because this module is
+// consumed by both the selfhost-web entry (where `~` resolves to
+// common's src) and the desktop shell entry (where `~` resolves to the
+// shell's own src). The package-name alias `@hoppscotch/common/...`
+// would work under Vite dev (which honors pnpm symlinks via esbuild)
+// but fails under Rollup build, which treats the rewritten
+// `@hoppscotch/common/src/...` as an unresolved package specifier.
+// Relative paths resolve identically under TS, both Vite configs, and
+// the production build.
+import { useDesktopSettings } from "./desktop-settings"
+import { Log } from "../kernel/log"
+
+const LOG_TAG = "useDesktopZoomEffect"
+
+/**
+ * Applies the persisted desktop `zoomLevel` to the current Tauri webview
+ * and keeps it in sync with the setting.
+ *
+ * Each desktop entry point calls this once during startup. The launcher
+ * window (`hoppscotch-desktop/src/main.ts`) and the bundled selfhost-web
+ * window (`hoppscotch-selfhost-web/src/main.ts`) each get their own
+ * invocation, and each watcher addresses its own window through
+ * `getCurrentWebviewWindow()`, which is the only window the webview can
+ * see. The settings store is the shared source of truth between the two
+ * windows, so a write in one reaches the other through the unified store
+ * watch that `useDesktopSettings()` already maintains, and each window's
+ * own watcher then re-applies the zoom locally.
+ *
+ * The watcher tracks both `loaded` and `zoomLevel` and skips the apply
+ * until `loaded` flips true. A naive `{ immediate: true }` on `zoomLevel`
+ * alone would fire synchronously with the schema default (1.0) before
+ * `loadInitial()` hydrates from disk, undoing any Rust-side pre-mount
+ * apply on the bundled window. For a user persisted at `1.5`, the
+ * sequence would be Rust paints 1.5, JS immediate apply runs setZoom(1.0)
+ * and overrides it, then `loadInitial()` resolves and the watcher fires
+ * again with 1.5, producing a 1.5 -> 1.0 -> 1.5 flash on every connect.
+ * Gating on `loaded` means the first apply uses the persisted value
+ * directly, leaving the pre-mount apply intact. Subsequent user edits
+ * flow through the same watcher as ordinary reactive changes.
+ */
+export function useDesktopZoomEffect(): WatchStopHandle {
+ const desktopSettings = useDesktopSettings()
+
+ return watch(
+ () =>
+ [
+ desktopSettings.loaded.value,
+ desktopSettings.settings.zoomLevel,
+ ] as const,
+ async ([isLoaded, factor]) => {
+ if (!isLoaded) return
+ try {
+ await getCurrentWebviewWindow().setZoom(factor)
+ } catch (err) {
+ // setZoom can reject on Linux WebKitGTK when called very early
+ // in the window lifecycle, before the webview is fully attached.
+ // The next change re-applies, and a fresh launch retries via the
+ // initial fire of this same watcher after `loaded` flips true.
+ Log.warn(LOG_TAG, `setZoom(${factor}) failed`, err)
+ }
+ },
+ { immediate: true }
+ )
+}
diff --git a/packages/hoppscotch-common/src/platform/desktop-settings.ts b/packages/hoppscotch-common/src/platform/desktop-settings.ts
index a3655fb21..cdde5ab2e 100644
--- a/packages/hoppscotch-common/src/platform/desktop-settings.ts
+++ b/packages/hoppscotch-common/src/platform/desktop-settings.ts
@@ -53,8 +53,12 @@ export const DESKTOP_SETTINGS_SCHEMA = z.object({
disableUpdateChecks: z.boolean().default(false),
disableUpdateDownloads: z.boolean().default(false),
- // Display and UX. User-facing zoom control is future scope.
- zoomLevel: z.number().positive().default(1.0),
+ // Display and UX. The bounds match Tauri v2's `setZoom` accepted
+ // range (0.2 to 10.0). A value outside that range would either be
+ // silently rejected by the WebView or trigger engine-level layout
+ // breakage, so the schema gate makes a corrupted store fall back
+ // to the default rather than reaching the runtime apply.
+ zoomLevel: z.number().min(0.2).max(10.0).default(1.0),
// Keyboard shortcut dispatch strategy. The hybrid strategy prefers
// event.key when it produces a Latin glyph (so AZERTY's "A" key fires
diff --git a/packages/hoppscotch-desktop/package.json b/packages/hoppscotch-desktop/package.json
index 6713fa337..37c9d03bf 100644
--- a/packages/hoppscotch-desktop/package.json
+++ b/packages/hoppscotch-desktop/package.json
@@ -27,7 +27,7 @@
"@fontsource-variable/roboto-mono": "5.2.8",
"@hoppscotch/common": "workspace:^",
"@hoppscotch/kernel": "workspace:^",
- "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#0d58d53be2bc75aeb5916bd0d77794fd209426af",
+ "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#1d13dd1cfe6dde56398ea71dfec9e7bbb4376dbf",
"@hoppscotch/ui": "0.2.5",
"@tauri-apps/api": "2.1.1",
"@tauri-apps/plugin-fs": "2.0.2",
diff --git a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/devenv.nix b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/devenv.nix
index 1e49dd787..a26664899 100644
--- a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/devenv.nix
+++ b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/devenv.nix
@@ -7,12 +7,12 @@ let
else pkgs;
darwinPackages = with pkgs; [
- darwin.apple_sdk.frameworks.Security
- darwin.apple_sdk.frameworks.CoreServices
- darwin.apple_sdk.frameworks.CoreFoundation
- darwin.apple_sdk.frameworks.Foundation
- darwin.apple_sdk.frameworks.AppKit
- darwin.apple_sdk.frameworks.WebKit
+ # Unified apple-sdk replaces the per-framework
+ # darwin.apple_sdk.frameworks.* entries that were removed during the
+ # nixpkgs Darwin SDK migration. The default unversioned SDK bundles
+ # Security, CoreServices, CoreFoundation, Foundation, AppKit, and
+ # WebKit, which is what this shell consumed before.
+ apple-sdk
];
linuxPackages = with pkgs; [
@@ -27,8 +27,8 @@ in {
packages = with pkgs; [
git
nodejs_22
- nodePackages_latest.typescript-language-server
- nodePackages_latest.vue-language-server
+ typescript-language-server
+ vue-language-server
cargo-edit
] ++ lib.optionals pkgs.stdenv.isDarwin darwinPackages
++ lib.optionals pkgs.stdenv.isLinux linuxPackages;
diff --git a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/guest-js/index.ts b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/guest-js/index.ts
index 668513bd0..3caf43636 100644
--- a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/guest-js/index.ts
+++ b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/guest-js/index.ts
@@ -16,6 +16,13 @@ export interface WindowOptions {
width?: number
height?: number
resizable?: boolean
+ /**
+ * Initial WebView zoom factor applied between window creation and first
+ * paint. When omitted, the WebView opens at its native default of 1.0.
+ * Pass a persisted user preference here to avoid the 100% flash that a
+ * post-mount setZoom from the bundle would produce.
+ */
+ zoomLevel?: number
}
export interface LoadOptions {
diff --git a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/commands.rs b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/commands.rs
index 288c56f63..ed75ba244 100644
--- a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/commands.rs
+++ b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/commands.rs
@@ -210,6 +210,19 @@ pub async fn load<R: Runtime>(app: AppHandle<R>, options: LoadOptions) -> Result
}
};
+ // Apply the caller-supplied zoom before the first paint. The WebView is
+ // attached but no content has rendered yet, so a 150% zoom lands without
+ // the user seeing a 100% flash. A post-mount setZoom from the bundle's
+ // own JS would otherwise race the first paint and produce a visible
+ // jump. Failures here are logged and ignored, since the bundle's own
+ // watcher (in `hoppscotch-common`'s `useDesktopZoomEffect`) re-applies
+ // the value after mount and degrades the failure to today's behavior.
+ if let Some(zoom) = options.window.zoom_level {
+ if let Err(e) = window.set_zoom(zoom) {
+ tracing::warn!(?e, zoom, ?label, "set_zoom on new webview failed");
+ }
+ }
+
#[cfg(target_os = "macos")]
{
let window_clone = window.clone();
diff --git a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/models.rs b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/models.rs
index fae0c3da6..644059855 100644
--- a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/models.rs
+++ b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/models.rs
@@ -209,6 +209,14 @@ pub struct WindowOptions {
pub height: f64,
#[serde(default = "default_resizable")]
pub resizable: bool,
+ /// Initial WebView zoom factor applied between window creation and first
+ /// paint. When `None`, the WebView opens at its native default of `1.0`.
+ /// Callers that persist a user-chosen zoom (the Hoppscotch desktop shell
+ /// reads `DesktopSettings.zoomLevel`) pass it here so the bundled app
+ /// renders at the right scale on first paint, avoiding the 100% flash
+ /// that a post-mount JS-side `setZoom` would otherwise produce.
+ #[serde(default)]
+ pub zoom_level: Option<f64>,
}
fn default_window_title() -> String {
@@ -234,6 +242,7 @@ impl Default for WindowOptions {
width: default_window_width(),
height: default_window_height(),
resizable: default_resizable(),
+ zoom_level: None,
}
}
}
diff --git a/packages/hoppscotch-desktop/src-tauri/Cargo.lock b/packages/hoppscotch-desktop/src-tauri/Cargo.lock
index 4225b575b..5f0fd21fa 100644
--- a/packages/hoppscotch-desktop/src-tauri/Cargo.lock
+++ b/packages/hoppscotch-desktop/src-tauri/Cargo.lock
@@ -5566,7 +5566,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-appload"
version = "0.1.0"
-source = "git+https://github.com/CuriousCorrelation/tauri-plugin-appload?rev=0d58d53be2bc75aeb5916bd0d77794fd209426af#0d58d53be2bc75aeb5916bd0d77794fd209426af"
+source = "git+https://github.com/CuriousCorrelation/tauri-plugin-appload?rev=1d13dd1cfe6dde56398ea71dfec9e7bbb4376dbf#1d13dd1cfe6dde56398ea71dfec9e7bbb4376dbf"
dependencies = [
"base64 0.22.1",
"blake3",
diff --git a/packages/hoppscotch-desktop/src-tauri/Cargo.toml b/packages/hoppscotch-desktop/src-tauri/Cargo.toml
index 36010b6a2..178f3a4a1 100644
--- a/packages/hoppscotch-desktop/src-tauri/Cargo.toml
+++ b/packages/hoppscotch-desktop/src-tauri/Cargo.toml
@@ -29,7 +29,7 @@ tauri-plugin-store = "2.2.0"
tauri-plugin-dialog = "2.2.0"
tauri-plugin-fs = "2.2.0"
tauri-plugin-deep-link = "2.2.0"
-tauri-plugin-appload = { git = "https://github.com/CuriousCorrelation/tauri-plugin-appload", rev = "0d58d53be2bc75aeb5916bd0d77794fd209426af" }
+tauri-plugin-appload = { git = "https://github.com/CuriousCorrelation/tauri-plugin-appload", rev = "1d13dd1cfe6dde56398ea71dfec9e7bbb4376dbf" }
tauri-plugin-relay = { git = "https://github.com/CuriousCorrelation/tauri-plugin-relay", rev = "42f449e1c5657679fecf0374b0ce5047ad03c069" }
axum = "0.8.1"
tower-http = { version = "0.6.2", features = ["cors"] }
diff --git a/packages/hoppscotch-desktop/src-tauri/capabilities/default.json b/packages/hoppscotch-desktop/src-tauri/capabilities/default.json
index 10ef8cddf..0e7459767 100644
--- a/packages/hoppscotch-desktop/src-tauri/capabilities/default.json
+++ b/packages/hoppscotch-desktop/src-tauri/capabilities/default.json
@@ -14,6 +14,7 @@
"core:event:default",
"core:path:default",
"core:webview:default",
+ "core:webview:allow-set-webview-zoom",
"shell:allow-open",
"store:default",
"dialog:default",
diff --git a/packages/hoppscotch-desktop/src/composables/useAppInitialization.ts b/packages/hoppscotch-desktop/src/composables/useAppInitialization.ts
index addfa1594..c50edce82 100644
--- a/packages/hoppscotch-desktop/src/composables/useAppInitialization.ts
+++ b/packages/hoppscotch-desktop/src/composables/useAppInitialization.ts
@@ -11,6 +11,7 @@ import type {
ConnectionState,
} from "@hoppscotch/common/platform/instance"
import { VENDORED_INSTANCE_CONFIG } from "@hoppscotch/common/platform/instance"
+import { useDesktopSettings } from "@hoppscotch/common/composables/desktop-settings"
// simple diag logger for the main window (runs before kernel log module is available)
function mainDiag(msg: string) {
@@ -38,6 +39,16 @@ export function useAppInitialization() {
const persistence = DesktopPersistenceService.getInstance()
const migration = InstanceStoreMigrationService.getInstance()
+ // Shared with the launcher's own zoom watcher (`useDesktopZoomEffect`).
+ // Each `load()` call below awaits `desktopSettings.ready()` before
+ // reading `zoomLevel`, so the appload Rust-side pre-mount apply gets
+ // the persisted value rather than the schema default on a fast
+ // cold-start click. Without the gate, a user who clicks Connect
+ // before the store read resolves would forward 1.0 to appload and
+ // see the bundled app paint at 100% even though their setting was
+ // 110, 125, or 150.
+ const desktopSettings = useDesktopSettings()
+
const appState = ref<AppState>(AppState.LOADING)
const error = ref("")
const statusMessage = ref("Initializing...")
@@ -77,9 +88,17 @@ export function useAppInitialization() {
mainDiag("loadVendoredInstance: calling load(bundleName=Hoppscotch)")
console.log("Loading vendored app...")
+ // Wait for the store read before forwarding `zoomLevel`, so the
+ // appload Rust-side pre-mount apply gets the persisted value
+ // rather than the schema default on a fast cold-start click.
+ await desktopSettings.ready()
+
const loadResp = await load({
bundleName: VENDORED_INSTANCE_CONFIG.bundleName!,
- window: { title: "Hoppscotch" },
+ window: {
+ title: "Hoppscotch",
+ zoomLevel: desktopSettings.settings.zoomLevel,
+ },
})
mainDiag(
@@ -140,10 +159,14 @@ export function useAppInitialization() {
mainDiag(
`loadVendoredIfMatches: loading cloud-org instance, bundle=${instance.bundleName}, host=${instance.serverUrl}`
)
+ await desktopSettings.ready()
const loadResp = await load({
bundleName: instance.bundleName!,
host: instance.serverUrl,
- window: { title: "Hoppscotch" },
+ window: {
+ title: "Hoppscotch",
+ zoomLevel: desktopSettings.settings.zoomLevel,
+ },
})
mainDiag(
@@ -196,9 +219,13 @@ export function useAppInitialization() {
mainDiag(
`loadVendoredIfMatches: loading non-vendored instance, bundle=${instance.bundleName}`
)
+ await desktopSettings.ready()
const loadResp = await load({
bundleName: instance.bundleName!,
- window: { title: "Hoppscotch" },
+ window: {
+ title: "Hoppscotch",
+ zoomLevel: desktopSettings.settings.zoomLevel,
+ },
})
mainDiag(
diff --git a/packages/hoppscotch-desktop/src/main.ts b/packages/hoppscotch-desktop/src/main.ts
index 01fa7ea08..0f9f91fef 100644
--- a/packages/hoppscotch-desktop/src/main.ts
+++ b/packages/hoppscotch-desktop/src/main.ts
@@ -10,9 +10,16 @@ import "@fontsource-variable/material-symbols-rounded"
import "@fontsource-variable/roboto-mono"
import { initKernel } from "@hoppscotch/kernel"
+import { useDesktopZoomEffect } from "@hoppscotch/common/composables/desktop-zoom"
const app = createApp(App)
app.use(router)
app.mount("#app")
initKernel("desktop")
+
+// Sync the launcher window's zoom with the user's persisted preference.
+// The same composable is wired into the bundled selfhost-web entry so the
+// post-connect window picks up the same value. Each call owns the
+// watcher for its own window, the store is the shared source of truth.
+useDesktopZoomEffect()
diff --git a/packages/hoppscotch-desktop/src/views/Home.vue b/packages/hoppscotch-desktop/src/views/Home.vue
index a1d825143..a44ac2e93 100644
--- a/packages/hoppscotch-desktop/src/views/Home.vue
+++ b/packages/hoppscotch-desktop/src/views/Home.vue
@@ -133,6 +133,7 @@ import { ref, onMounted, onUnmounted } from "vue"
import { LazyStore } from "@tauri-apps/plugin-store"
import { load, close } from "@hoppscotch/plugin-appload"
import { getVersion } from "@tauri-apps/api/app"
+import { useDesktopSettings } from "@hoppscotch/common/composables/desktop-settings"
import { UpdateStatus, CheckResult, UpdateState } from "~/types"
import { UpdaterService } from "~/utils/updater"
@@ -183,6 +184,13 @@ const appVersion = ref("...")
const updaterService = new UpdaterService(appStore)
+// Shared singleton with the launcher's `useDesktopZoomEffect()` watcher.
+// The `load()` call below awaits `desktopSettings.ready()` before
+// reading `zoomLevel` so the appload Rust-side pre-mount apply gets
+// the persisted value rather than the schema default on a fast
+// cold-start click.
+const desktopSettings = useDesktopSettings()
+
let progressPollingInterval: ReturnType<typeof setInterval> | undefined
const formatBytes = (bytes: number): string => {
@@ -331,9 +339,16 @@ const loadVendored = async () => {
}
console.log("Loading vendored app...")
+ // Wait for the store read before forwarding `zoomLevel`, so the
+ // appload Rust-side pre-mount apply gets the persisted value
+ // rather than the schema default on a fast cold-start click.
+ await desktopSettings.ready()
const loadResp = await load({
bundleName: "Hoppscotch",
- window: { title: "Hoppscotch" },
+ window: {
+ title: "Hoppscotch",
+ zoomLevel: desktopSettings.settings.zoomLevel,
+ },
})
if (!loadResp.success) {
diff --git a/packages/hoppscotch-selfhost-web/package.json b/packages/hoppscotch-selfhost-web/package.json
index 989dca679..3635ece35 100644
--- a/packages/hoppscotch-selfhost-web/package.json
+++ b/packages/hoppscotch-selfhost-web/package.json
@@ -29,7 +29,7 @@
"@hoppscotch/common": "workspace:^",
"@hoppscotch/data": "workspace:^",
"@hoppscotch/kernel": "workspace:^",
- "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#0d58d53be2bc75aeb5916bd0d77794fd209426af",
+ "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#1d13dd1cfe6dde56398ea71dfec9e7bbb4376dbf",
"@hoppscotch/ui": "0.2.5",
"@import-meta-env/unplugin": "0.6.3",
"@tauri-apps/api": "2.1.1",
diff --git a/packages/hoppscotch-selfhost-web/src/main.ts b/packages/hoppscotch-selfhost-web/src/main.ts
index 6a5041043..e52728eb3 100644
--- a/packages/hoppscotch-selfhost-web/src/main.ts
+++ b/packages/hoppscotch-selfhost-web/src/main.ts
@@ -31,6 +31,7 @@ import { kernelIO } from "@hoppscotch/common/platform/std/kernel-io"
import { HeaderDownloadableLinksService } from "@app/services/headerDownloadableLinks.service"
import DesktopSettingsSection from "@hoppscotch/common/components/settings/Desktop.vue"
+import { useDesktopZoomEffect } from "@hoppscotch/common/composables/desktop-zoom"
// Std interceptors
import { NativeKernelInterceptorService } from "@hoppscotch/common/platform/std/kernel-interceptors/native"
@@ -150,6 +151,11 @@ async function initApp() {
if (platform === "desktop") {
setupDesktopUI()
+ // Apply the persisted zoom to this window and keep it in sync with
+ // the store. The launcher window runs its own copy of this watcher
+ // from `hoppscotch-desktop/src/main.ts`, and the store is the shared
+ // source of truth between the two.
+ useDesktopZoomEffect()
}
await createHoppApp("#app", {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index fc724ae7c..3e6b0f987 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -557,8 +557,8 @@ importers:
specifier: workspace:^
version: link:../hoppscotch-kernel
'@hoppscotch/plugin-appload':
- specifier: github:CuriousCorrelation/tauri-plugin-appload#0d58d53be2bc75aeb5916bd0d77794fd209426af
- version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0d58d53be2bc75aeb5916bd0d77794fd209426af'
+ specifier: github:CuriousCorrelation/tauri-plugin-appload#1d13dd1cfe6dde56398ea71dfec9e7bbb4376dbf
+ version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1d13dd1cfe6dde56398ea71dfec9e7bbb4376dbf'
'@hoppscotch/ui':
specifier: 0.2.5
@@ -1054,8 +1054,8 @@ importers:
specifier: workspace:^
version: link:../hoppscotch-kernel
'@hoppscotch/plugin-appload':
- specifier: github:CuriousCorrelation/tauri-plugin-appload#0d58d53be2bc75aeb5916bd0d77794fd209426af
- version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0d58d53be2bc75aeb5916bd0d77794fd209426af'
+ specifier: github:CuriousCorrelation/tauri-plugin-appload#1d13dd1cfe6dde56398ea71dfec9e7bbb4376dbf
+ version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1d13dd1cfe6dde56398ea71dfec9e7bbb4376dbf'
'@hoppscotch/ui':
specifier: 0.2.5
@@ -1396,8 +1396,8 @@ importers:
specifier: workspace:^
version: link:../hoppscotch-kernel
'@hoppscotch/plugin-appload':
- specifier: github:CuriousCorrelation/tauri-plugin-appload#0d58d53be2bc75aeb5916bd0d77794fd209426af
- version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0d58d53be2bc75aeb5916bd0d77794fd209426af'
+ specifier: github:CuriousCorrelation/tauri-plugin-appload#1d13dd1cfe6dde56398ea71dfec9e7bbb4376dbf
+ version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1d13dd1cfe6dde56398ea71dfec9e7bbb4376dbf'
'@hoppscotch/ui':
specifier: 0.2.5
@@ -1771,12 +1771,12 @@ packages:
graphql:
optional: true
- '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0d58d53be2bc75aeb5916bd0d77794fd209426af':
- resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0d58d53be2bc75aeb5916bd0d77794fd209426af}
+ '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1d13dd1cfe6dde56398ea71dfec9e7bbb4376dbf':
+ resolution: {gitHosted: true, tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1d13dd1cfe6dde56398ea71dfec9e7bbb4376dbf}
version: 0.1.0
'@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/42f449e1c5657679fecf0374b0ce5047ad03c069':
- resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/42f449e1c5657679fecf0374b0ce5047ad03c069}
+ resolution: {gitHosted: true, tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/42f449e1c5657679fecf0374b0ce5047ad03c069}
version: 0.1.0
'@acemir/[email protected]':
@@ -5932,6 +5932,12 @@ packages:
peerDependencies:
typescript: '>=4.8.4 <6.1.0'
+ '@typescript-eslint/[email protected]':
+ resolution: {integrity: sha512-/0nEyPbX7gRsk0Uwfe4ALwwgxuA66d/l2mhRDNlAvaj4U3juhUtJNq0DsY8M2AYwwb9rEq2hrC3IcIcEt++iJA==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+ peerDependencies:
+ typescript: '>=4.8.4 <6.1.0'
+
'@typescript-eslint/[email protected]':
resolution: {integrity: sha512-PcIJHjmaREXLgIAIzLnSY9VucEzz8FKXsRgFa1DmdGCK/5tJpW03TKJF01Q6VZd1lLdz2sIKPWaDUZN9dp//dw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
@@ -5980,6 +5986,10 @@ packages:
resolution: {integrity: sha512-nLzdsT1gdOgFxxxwrlNVUBzSNBEEHJ86bblmk4QAS6stfig7rcJzWKqCyxFy3YRRHXDWEkb2NralA1nOYkkm/A==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+ '@typescript-eslint/[email protected]':
+ resolution: {integrity: sha512-ZDCjgccSdYPw5Bxh+my4Z0lJU96ZDN7jbBzvmEn0FZx3RtU1C7VWl6NbDx94bwY3V5YsgwRzJPOgeY2Q/nLG8A==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
'@typescript-eslint/[email protected]':
resolution: {integrity: sha512-ePFoH0g4ludssdRFqqDxQePCxU4WQyRa9+XVwjm7yLn0FKhMeoetC+qBEEI1Eyb1pGSDveTIT09Bvw2WhlGayg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
@@ -6673,7 +6683,6 @@ packages:
resolution: {integrity: sha512-jHXC6y/duZ+zzn756/znpfDeVM0hprt2Yk/4QfiIhzNG4YmJXt7NSCup4DFRCitBZVK85lM6UYRaa36fSWs3JQ==}
engines: {node: '>=18.7.0 <21.0.0'}
- deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
resolution: {integrity: sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==}
@@ -13419,7 +13428,7 @@ snapshots:
optionalDependencies:
graphql: 16.14.0
- '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0d58d53be2bc75aeb5916bd0d77794fd209426af':
+ '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1d13dd1cfe6dde56398ea71dfec9e7bbb4376dbf':
dependencies:
'@tauri-apps/api': 2.9.1
@@ -13640,7 +13649,7 @@ snapshots:
dependencies:
'@babel/core': 7.29.0
'@babel/generator': 7.29.1
- '@babel/parser': 7.29.3
+ '@babel/parser': 7.29.2
'@babel/runtime': 7.29.2
'@babel/traverse': 7.29.0
'@babel/types': 7.29.0
@@ -13664,7 +13673,7 @@ snapshots:
dependencies:
'@babel/core': 7.29.0
'@babel/generator': 7.29.1
- '@babel/parser': 7.29.3
+ '@babel/parser': 7.29.2
'@babel/runtime': 7.29.2
'@babel/traverse': 7.29.0
'@babel/types': 7.29.0
@@ -13742,7 +13751,7 @@ snapshots:
'@babel/helper-compilation-targets': 7.28.6
'@babel/helper-module-transforms': 7.28.6(@babel/[email protected])
'@babel/helpers': 7.29.2
- '@babel/parser': 7.29.3
+ '@babel/parser': 7.29.2
'@babel/template': 7.28.6
'@babel/traverse': 7.29.0
'@babel/types': 7.29.0
@@ -14499,7 +14508,7 @@ snapshots:
'@babel/code-frame': 7.29.0
'@babel/generator': 7.29.1
'@babel/helper-globals': 7.28.0
- '@babel/parser': 7.29.3
+ '@babel/parser': 7.29.2
'@babel/template': 7.28.6
'@babel/types': 7.29.0
debug: 4.4.3([email protected])
@@ -16041,7 +16050,7 @@ snapshots:
dependencies:
'@babel/core': 7.29.0
- '@babel/parser': 7.29.3
+ '@babel/parser': 7.29.2
'@babel/plugin-syntax-import-assertions': 7.28.6(@babel/[email protected])
'@babel/traverse': 7.29.0
'@babel/types': 7.29.0
@@ -16054,7 +16063,7 @@ snapshots:
dependencies:
'@babel/core': 7.29.0
- '@babel/parser': 7.29.3
+ '@babel/parser': 7.29.2
'@babel/plugin-syntax-import-assertions': 7.28.6(@babel/[email protected])
'@babel/traverse': 7.29.0
'@babel/types': 7.29.0
@@ -17801,7 +17810,7 @@ snapshots:
'@prisma/[email protected]':
dependencies:
- ajv: 8.18.0
+ ajv: 8.20.0
better-result: 2.8.2
env-paths: 3.0.0
proper-lockfile: 4.1.2
@@ -18322,7 +18331,7 @@ snapshots:
dependencies:
- '@babel/parser': 7.29.3
+ '@babel/parser': 7.29.2
'@babel/types': 7.29.0
'@types/babel__generator': 7.27.0
'@types/babel__template': 7.4.4
@@ -18334,7 +18343,7 @@ snapshots:
dependencies:
- '@babel/parser': 7.29.3
+ '@babel/parser': 7.29.2
'@babel/types': 7.29.0
@@ -18756,8 +18765,8 @@ snapshots:
'@typescript-eslint/[email protected]([email protected])':
dependencies:
- '@typescript-eslint/tsconfig-utils': 8.57.2([email protected])
- '@typescript-eslint/types': 8.57.2
+ '@typescript-eslint/tsconfig-utils': 8.59.1([email protected])
+ '@typescript-eslint/types': 8.59.1
debug: 4.4.3([email protected])
typescript: 5.9.3
transitivePeerDependencies:
@@ -18766,7 +18775,7 @@ snapshots:
'@typescript-eslint/[email protected]([email protected])':
dependencies:
'@typescript-eslint/tsconfig-utils': 8.59.0([email protected])
- '@typescript-eslint/types': 8.59.0
+ '@typescript-eslint/types': 8.59.1
debug: 4.4.3([email protected])
typescript: 5.9.3
transitivePeerDependencies:
@@ -18774,8 +18783,8 @@ snapshots:
'@typescript-eslint/[email protected]([email protected])':
dependencies:
- '@typescript-eslint/tsconfig-utils': 8.59.4([email protected])
- '@typescript-eslint/types': 8.59.4
+ '@typescript-eslint/tsconfig-utils': 8.59.3([email protected])
+ '@typescript-eslint/types': 8.59.3
debug: 4.4.3([email protected])
typescript: 5.9.3
transitivePeerDependencies:
@@ -18818,6 +18827,10 @@ snapshots:
dependencies:
typescript: 5.9.3
+ '@typescript-eslint/[email protected]([email protected])':
+ dependencies:
+ typescript: 5.9.3
+
'@typescript-eslint/[email protected]([email protected])':
dependencies:
typescript: 5.9.3
@@ -18878,6 +18891,8 @@ snapshots:
'@typescript-eslint/[email protected]': {}
+ '@typescript-eslint/[email protected]': {}
+
'@typescript-eslint/[email protected]': {}
'@typescript-eslint/[email protected]': {}
@@ -19296,7 +19311,7 @@ snapshots:
dependencies:
- '@babel/parser': 7.29.3
+ '@babel/parser': 7.29.2
'@vue/shared': 3.5.31
entities: 7.0.1
estree-walker: 2.0.2
@@ -19399,9 +19414,9 @@ snapshots:
dependencies:
'@volar/language-core': 2.4.28
- '@vue/compiler-dom': 3.5.34
+ '@vue/compiler-dom': 3.5.31
'@vue/compiler-vue2': 2.7.16
- '@vue/shared': 3.5.34
+ '@vue/shared': 3.5.31
computeds: 0.0.1
minimatch: 9.0.9
muggle-string: 0.4.1
@@ -19675,9 +19690,9 @@ snapshots:
optionalDependencies:
ajv: 8.18.0
optionalDependencies:
- ajv: 8.18.0
+ ajv: 8.20.0
optionalDependencies:
@@ -19687,9 +19702,9 @@ snapshots:
dependencies:
ajv: 6.14.0
dependencies:
- ajv: 8.18.0
+ ajv: 8.20.0
fast-deep-equal: 3.1.3
@@ -20496,7 +20511,7 @@ snapshots:
dependencies:
- '@babel/parser': 7.29.3
+ '@babel/parser': 7.29.2
'@babel/types': 7.29.0
optional: true
@@ -21134,7 +21149,7 @@ snapshots:
has-property-descriptors: 1.0.2
has-proto: 1.2.0
has-symbols: 1.1.0
- hasown: 2.0.3
+ hasown: 2.0.2
internal-slot: 1.1.0
is-array-buffer: 3.0.5
is-callable: 1.2.7
@@ -21239,7 +21254,7 @@ snapshots:
es-errors: 1.3.0
get-intrinsic: 1.3.0
has-tostringtag: 1.0.2
- hasown: 2.0.3
+ hasown: 2.0.2
dependencies:
@@ -22012,7 +22027,7 @@ snapshots:
call-bound: 1.0.4
define-properties: 1.2.1
functions-have-names: 1.2.3
- hasown: 2.0.3
+ hasown: 2.0.2
is-callable: 1.2.7
@@ -22039,7 +22054,7 @@ snapshots:
get-proto: 1.0.1
gopd: 1.2.0
has-symbols: 1.1.0
- hasown: 2.0.3
+ hasown: 2.0.2
math-intrinsics: 1.1.0
@@ -22608,7 +22623,7 @@ snapshots:
dependencies:
es-errors: 1.3.0
- hasown: 2.0.3
+ hasown: 2.0.2
side-channel: 1.1.0
@@ -22779,7 +22794,7 @@ snapshots:
call-bound: 1.0.4
gopd: 1.2.0
has-tostringtag: 1.0.2
- hasown: 2.0.3
+ hasown: 2.0.2
@@ -22871,7 +22886,7 @@ snapshots:
dependencies:
'@babel/core': 7.29.0
- '@babel/parser': 7.29.3
+ '@babel/parser': 7.29.2
'@istanbuljs/schema': 0.1.3
istanbul-lib-coverage: 3.2.2
semver: 7.8.0
@@ -25895,9 +25910,9 @@ snapshots:
dependencies:
'@types/json-schema': 7.0.15
- ajv: 8.18.0
- ajv-formats: 2.1.1([email protected])
- ajv-keywords: 5.1.0([email protected])
+ ajv: 8.20.0
+ ajv-formats: 2.1.1([email protected])
+ ajv-keywords: 5.1.0([email protected])
@@ -27834,7 +27849,7 @@ snapshots:
dependencies:
- '@babel/parser': 7.29.3
+ '@babel/parser': 7.29.2
'@babel/types': 7.29.0
assert-never: 1.4.0
babel-walk: 3.0.0-canary-5