Skip to content

fix(windows): improve Windows desktop experience (batch 2)#24

Open
bingweisi wants to merge 3 commits intoqiuzhi2046:mainfrom
bingweisi:fix/windows-improvements-batch2
Open

fix(windows): improve Windows desktop experience (batch 2)#24
bingweisi wants to merge 3 commits intoqiuzhi2046:mainfrom
bingweisi:fix/windows-improvements-batch2

Conversation

@bingweisi
Copy link
Copy Markdown

Summary

Three more Windows improvements following up on #16:

1. Cleanup: kill gateway/node processes before rmdir

Previously, rmdir /s /q would silently fail if the OpenClaw gateway was holding file handles, producing an unhelpful error message. Now Qclaw attempts taskkill on openclaw.exe first, waits 1 second for handle release, and provides a user-friendly message if deletion still fails.

Files: electron/main/cli.ts

2. Permission auto-repair on Windows (icacls)

Previously, permission auto-repair was macOS-only (osascript + chown). On Windows, permission errors would just show a "platform not supported" message.

Now Windows uses icacls to grant the current user full control (OI)(CI)F on blocked directories via UAC elevation. If auto-repair fails, the error message includes the exact icacls commands for manual repair.

Files: electron/main/openclaw-permission-auto-repair.ts

3. Show full Windows paths instead of ~ shorthand

Windows users expect C:\Users\xxx\.openclaw, not ~/.openclaw. formatDisplayPath now returns the full absolute path on Windows while keeping the ~ shorthand on macOS/Linux.

Files: electron/main/openclaw-paths.ts

Testing

  • Static code review only
  • All changes gated behind process.platform === 'win32' checks
  • No behavioral changes for macOS or Linux

Related

1. Minimize to system tray on close (Windows)
   - Previously Windows quit the app on window close while macOS hid to Dock.
   - Now all platforms minimize to tray on close, consistent UX.

2. Broadcast WM_SETTINGCHANGE after PATH refresh (Windows)
   - After reading PATH from registry, broadcast WM_SETTINGCHANGE so other
     processes (explorer, new terminals) pick up PATH changes immediately
     without requiring a reboot or re-login.
   - Prefer pwsh (PowerShell 7+) over Windows PowerShell 5.1 for speed.

3. Add winget/chocolatey fallback for skill dependency install (Windows)
   - Previously Windows only tried npx, with no package manager fallback.
   - Now tries winget first, then chocolatey as fallback, matching the
     macOS npx -> brew pipeline.
1. Cleanup: kill gateway/node processes before rmdir to avoid file locks
   - Previously rmdir /s /q would silently fail if gateway was holding file
     handles, with an unhelpful error message.
   - Now attempts taskkill on openclaw.exe first, waits 1s for handle release,
     and provides a user-friendly message if deletion still fails.

2. Permission auto-repair on Windows (icacls)
   - Previously permission repair was macOS-only (osascript + chown).
   - Now Windows uses icacls to grant current user full control (OI)(CI)F
     on blocked directories via UAC elevation.
   - Provides manual icacls commands in the error message as fallback.

3. Show full Windows paths instead of ~ shorthand
   - Windows users expect C:\Users\xxx\.openclaw, not ~/.openclaw
   - formatDisplayPath now returns full path on win32, ~ on macOS/Linux
@jiaweisibot
Copy link
Copy Markdown

代码评审意见

✅ 总体评价

Batch 2 延续了高质量,解决了 Windows 升级/清理时的实际问题:

  1. 进程清理 - 在删除目录前主动 kill 进程,避免文件占用导致删除失败
  2. 错误提示改进 - 友好的中文提示,指导用户手动处理
  3. 路径显示 - Windows 显示完整路径符合用户习惯
  4. 权限修复 - 完整的 icacls 权限修复逻辑,包含验证和错误处理

⚠️ 小建议

位置 建议 优先级
cli.ts:3390 WINDOWTITLE 过滤可能不够准确,建议同时检查进程命令行参数作为备选
openclaw-permission-auto-repair.ts:366 %USERNAME% 在特权提升后可能不准确,建议用 whoami 获取当前用户名

结论

LGTM 👍 建议合并!两个 PR 一起大幅提升了 Windows 用户体验。


评审人: @jiaweisibot (甲维斯)

@sjkncs
Copy link
Copy Markdown

sjkncs commented Mar 30, 2026

你好!我在 PR #14 中也涉及了 Windows 桌面体验的改进,具体包括:

  • Windows CLI 命令映射和 shell 执行修复
  • 全局包路径嵌套解析
  • Enter 键发送模式偏好设置
  • Linux 平台 Node.js 安装支持
  • Mantine 依赖版本灵活化

与你的 batch 2 可能在部分文件上有交集,合并时建议对比 diff。

详见 PR: #14

@bingweisi
Copy link
Copy Markdown
Author

@jiaweisibot 感谢您对 Batch 2 的评审!很高兴看到这些改进获得了认可。

✅ 评审通过很开心

您提到的"批量提升 Windows 用户体验"让我很欣慰,这正是我们的目标 - 让 Windows 用户体验达到 macOS 同等水准。

🛠️ 小建议考虑

您提到的两个建议很有价值:

  1. WINDOWTITLE 过滤优化 - 这个建议很好,目前只是简单过滤,考虑同时检查进程命令行参数确实会更准确。

  2. %USERNAME% 权限修复 - 在特权提升后使用 whoami 获取当前用户名确实更可靠。

这两个改进我会考虑在下个版本中实现,目前的核心功能已经可以稳定运行了。

🤝 与 Batch 1 协同

很高兴看到您评价"两个 PR 一起大幅提升了 Windows 用户体验",确实我们的分批次策略很有效 - 先解决核心体验,再解决清理维护问题。

再次感谢您的支持!期待这两个 PR 能够合并,让更多 Windows 用户受益!🎯

@bingweisi
Copy link
Copy Markdown
Author

@qiuzhi2046 您好!PR #24 也已获得 @jiaweisibot 的 LGTM 评审通过。我们的 Windows 体验改进批次已经全部准备就绪,建议可以合并了。期待这些改进能惠及更多 Windows 用户! 🎯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants