From de725337d628d037e8597c02ef51be466bec3680 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Wed, 8 Nov 2023 20:07:13 +0530 Subject: [PATCH] fix: window drag taking precedence on windows --- .../hoppscotch-selfhost-desktop/src/main.ts | 105 +++++++++--------- 1 file changed, 54 insertions(+), 51 deletions(-) diff --git a/packages/hoppscotch-selfhost-desktop/src/main.ts b/packages/hoppscotch-selfhost-desktop/src/main.ts index 1c2f0a3729..1205e59cce 100644 --- a/packages/hoppscotch-selfhost-desktop/src/main.ts +++ b/packages/hoppscotch-selfhost-desktop/src/main.ts @@ -20,63 +20,66 @@ import { ioDef } from "./platform/io" const headerPaddingLeft = ref("0px") const headerPaddingTop = ref("0px") -createHoppApp("#app", { - ui: { - additionalFooterMenuItems: stdFooterItems, - additionalSupportOptionsMenuItems: stdSupportOptionItems, - appHeader: { - paddingLeft: headerPaddingLeft, - paddingTop: headerPaddingTop, - onHeaderAreaClick() { - // Drag thw window when the user drags the header area - // TODO: Ignore click on headers and fields - appWindow.startDragging() +;(async () => { + const platform = await type() + + createHoppApp("#app", { + ui: { + additionalFooterMenuItems: stdFooterItems, + additionalSupportOptionsMenuItems: stdSupportOptionItems, + appHeader: { + paddingLeft: headerPaddingLeft, + paddingTop: headerPaddingTop, + onHeaderAreaClick() { + if (platform === "Darwin") { + // Drag thw window when the user drags the header area + // TODO: Ignore click on headers and fields + appWindow.startDragging() + } + }, }, }, - }, - io: ioDef, - auth: authDef, - sync: { - environments: environmentsDef, - collections: collectionsDef, - settings: settingsDef, - history: historyDef, - tabState: tabStateDef, - }, - interceptors: { - default: "native", - interceptors: [ - { type: "service", service: NativeInterceptorService }, - { type: "standalone", interceptor: proxyInterceptor }, + io: ioDef, + auth: authDef, + sync: { + environments: environmentsDef, + collections: collectionsDef, + settings: settingsDef, + history: historyDef, + tabState: tabStateDef, + }, + interceptors: { + default: "native", + interceptors: [ + { type: "service", service: NativeInterceptorService }, + { type: "standalone", interceptor: proxyInterceptor }, + ], + }, + additionalInspectors: [ + { type: "service", service: ExtensionInspectorService }, ], - }, - additionalInspectors: [ - { type: "service", service: ExtensionInspectorService }, - ], - platformFeatureFlags: { - exportAsGIST: false, - hasTelemetry: false, - cookiesEnabled: true, - promptAsUsingCookies: false, - }, -}) + platformFeatureFlags: { + exportAsGIST: false, + hasTelemetry: false, + cookiesEnabled: true, + promptAsUsingCookies: false, + }, + }) -watch( - useSettingStatic("BG_COLOR")[0], - async () => { - await nextTick() + watch( + useSettingStatic("BG_COLOR")[0], + async () => { + await nextTick() - await emit( - "hopp-bg-changed", - getComputedStyle(document.documentElement).getPropertyValue( - "--primary-color" + await emit( + "hopp-bg-changed", + getComputedStyle(document.documentElement).getPropertyValue( + "--primary-color" + ) ) - ) - }, - { immediate: true } -) -;(async () => { - const platform = await type() + }, + { immediate: true } + ) if (platform === "Darwin") { listen("will-enter-fullscreen", () => {