fix: 修复 Windows 平台窗口被任务栏遮挡的问题#930
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to fix the “always-on-top” behavior on Windows (Issue #430), where the app window can be covered by the Windows 11 taskbar / fullscreen apps, by introducing a Windows-specific always-on-top implementation and some UI-side handling around context menus.
Changes:
- Add Windows-specific
set_always_on_topimplementation using Win32SetWindowPosand restructure window commands into per-OS modules (macOS/Windows/Linux). - Update main window context-menu handling to temporarily disable always-on-top on Windows while the menu is displayed.
- Add a Windows-only Rust dependency (
windowscrate) to support the Win32 calls.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pages/main/index.vue | Temporarily toggles always-on-top around context menu popup on Windows. |
| src-tauri/src/plugins/window/src/commands/windows.rs | Implements Windows always-on-top via Win32 SetWindowPos and a background loop. |
| src-tauri/src/plugins/window/src/commands/mod.rs | Refactors command dispatch to OS-specific modules (windows/linux/macos). |
| src-tauri/src/plugins/window/src/commands/macos.rs | Inlines previously shared window behaviors and keeps macOS panel logic for main window. |
| src-tauri/src/plugins/window/src/commands/linux.rs | Adds Linux implementation equivalent to the prior shared/common behavior. |
| src-tauri/src/plugins/window/src/commands/common.rs | Removes the prior non-macOS shared implementation. |
| src-tauri/src/plugins/window/Cargo.toml | Adds Windows-only windows crate dependency. |
| Cargo.lock | Updates lockfile to include windows 0.58.0 alongside existing windows 0.61.x. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
287a7b2 to
e2811a7
Compare
There was a problem hiding this comment.
Pull request overview
该 PR 旨在修复 Windows 11 上开启“窗口置顶”后仍会被全屏应用/任务栏遮挡的问题(关联 #430),并对 custom-window Tauri 插件的按平台实现进行拆分与增强。
Changes:
- Windows:通过 Win32
SetWindowPos(HWND_TOPMOST, ...)强制维持窗口 TopMost,以避免被任务栏/全屏窗口覆盖。 - 前端:在 Windows 上弹出右键菜单前临时取消置顶,避免菜单被置顶窗口遮挡,菜单关闭后再恢复置顶。
- 插件结构:将非 macOS 的 common 实现拆分为 windows/linux 平台文件,并新增 Windows 专用依赖。
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pages/main/index.vue | Windows 下右键菜单弹出前临时取消置顶,弹出后恢复置顶 |
| src-tauri/src/plugins/window/src/commands/windows.rs | Windows 置顶实现改为 Win32 SetWindowPos + 轮询维持 TopMost |
| src-tauri/src/plugins/window/src/commands/mod.rs | commands 模块改为按 OS 拆分并简化窗口显示逻辑 |
| src-tauri/src/plugins/window/src/commands/macos.rs | macOS 命令实现内聚(移除 shared/common 依赖),保留主窗口 panel 行为 |
| src-tauri/src/plugins/window/src/commands/linux.rs | 新增 Linux 命令实现(承接原 common 行为) |
| src-tauri/src/plugins/window/src/commands/common.rs | 删除原非 macOS 的 common 实现 |
| src-tauri/src/plugins/window/Cargo.toml | Windows 平台新增 windows crate 依赖 |
| Cargo.lock | 锁文件更新,引入 windows 0.62.2 及其依赖,同时保留 windows 0.61.3 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e2811a7 to
a3d737c
Compare
fixed #430