diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index de91ad8..7172ecc 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; import { Layout, Button, ConfigProvider, theme, Dropdown, MenuProps, message, Modal, Spin, Slider, Progress } from 'antd'; import zhCN from 'antd/locale/zh_CN'; import { PlusOutlined, BulbOutlined, BulbFilled, ConsoleSqlOutlined, UploadOutlined, DownloadOutlined, CloudDownloadOutlined, BugOutlined, ToolOutlined, InfoCircleOutlined, GithubOutlined, SkinOutlined, CheckOutlined, MinusOutlined, BorderOutlined, CloseOutlined, SettingOutlined } from '@ant-design/icons'; -import { EventsOn } from '../wailsjs/runtime/runtime'; +import { Environment, EventsOn } from '../wailsjs/runtime/runtime'; import Sidebar from './components/Sidebar'; import TabManager from './components/TabManager'; import ConnectionModal from './components/ConnectionModal'; @@ -29,6 +29,7 @@ function App() { const effectiveBlur = normalizeBlurForPlatform(appearance.blur); const blurFilter = blurToFilter(effectiveBlur); const windowCornerRadius = 14; + const [isLinuxRuntime, setIsLinuxRuntime] = useState(false); // 同步 macOS 窗口透明度:opacity=1.0 且 blur=0 时关闭 NSVisualEffectView, // 避免 GPU 持续计算窗口背后的模糊合成 @@ -36,6 +37,23 @@ function App() { SetWindowTranslucency(appearance.opacity, appearance.blur).catch(() => {}); }, [appearance.opacity, appearance.blur]); + useEffect(() => { + let cancelled = false; + Environment() + .then((env) => { + if (cancelled) return; + setIsLinuxRuntime((env?.platform || '').toLowerCase() === 'linux'); + }) + .catch(() => { + if (cancelled) return; + const platform = typeof navigator !== 'undefined' ? navigator.platform : ''; + setIsLinuxRuntime(/linux/i.test(platform)); + }); + return () => { + cancelled = true; + }; + }, []); + // Background Helper const getBg = (darkHex: string, lightHex: string) => { if (!darkMode) return `rgba(255, 255, 255, ${effectiveOpacity})`; // Light mode usually white @@ -550,6 +568,17 @@ function App() { }; }, []); + const linuxResizeHandleStyleBase = { + position: 'fixed', + zIndex: 12000, + background: 'transparent', + WebkitAppRegion: 'drag', + '--wails-draggable': 'drag', + userSelect: 'none' + } as any; + + const showLinuxResizeHandles = isLinuxRuntime; + return ( @@ -891,6 +920,21 @@ function App() { ) : null} + + {showLinuxResizeHandles && ( + <> + {/* Linux Mint 下 frameless 仅局部可缩放:补四边四角命中层 */} +
+
+
+
+ +
+
+
+
+ + )} {/* Ghost Resize Line for Sidebar */}