fix: restore desktop window dragging on remote instances

- Fixes header drag behavior in Desktop when connected to remote hosts
- Routes all window-drag entry points through a shared safe desktop helper
- Keeps local desktop drag behavior unchanged while avoiding remote IPC failures
This commit is contained in:
Bohdan Triapitsyn
2026-04-14 19:33:09 +03:00
parent c7f1501ad2
commit 16270e4b03
6 changed files with 26 additions and 41 deletions
+2 -8
View File
@@ -62,7 +62,7 @@ import type { SessionContextUsage } from '@/stores/types/sessionTypes';
import { DesktopHostSwitcherDialog } from '@/components/desktop/DesktopHostSwitcher';
import { OpenInAppButton } from '@/components/desktop/OpenInAppButton';
import { ProjectActionsButton } from '@/components/layout/ProjectActionsButton';
import { isDesktopShell, isVSCodeRuntime } from '@/lib/desktop';
import { isDesktopShell, isVSCodeRuntime, startDesktopWindowDrag } from '@/lib/desktop';
import { desktopHostsGet, locationMatchesHost, redactSensitiveUrl } from '@/lib/desktopHosts';
import { resolveSessionDiffStats } from '@/components/session/sidebar/utils';
import type { Session } from '@opencode-ai/sdk/v2/client';
@@ -1405,13 +1405,7 @@ export const Header: React.FC<HeaderProps> = ({
return;
}
if (isDesktopApp) {
try {
const { getCurrentWindow } = await import('@tauri-apps/api/window');
const window = getCurrentWindow();
await window.startDragging();
} catch (error) {
console.error('Failed to start window dragging:', error);
}
await startDesktopWindowDrag();
}
}, [isDesktopApp]);
@@ -1,7 +1,7 @@
import React from 'react';
import { cn } from '@/lib/utils';
import { useUIStore } from '@/stores/useUIStore';
import { isDesktopShell } from '@/lib/desktop';
import { isDesktopShell, startDesktopWindowDrag } from '@/lib/desktop';
export const RIGHT_SIDEBAR_CONTENT_WIDTH = 420;
const RIGHT_SIDEBAR_MIN_WIDTH = 400;
@@ -123,13 +123,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = ({ isOpen, children, cl
return;
}
try {
const { getCurrentWindow } = await import('@tauri-apps/api/window');
const appWindow = getCurrentWindow();
await appWindow.startDragging();
} catch (error) {
console.error('Failed to start window dragging:', error);
}
await startDesktopWindowDrag();
}, [isDesktopApp]);
return (