Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/main/core/detachedWindowManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,25 @@ class DetachedWindowManager {
// Windows 系统配置(与主窗口保持一致)
else if (isWindows) {
windowConfig.backgroundColor = '#00000000' // 完全透明,让 Mica 材质显示
// 设置插件窗口独立图标
if (options.logo) {
try {
windowConfig.icon = options.logo.startsWith('file:')
? fileURLToPath(options.logo)
: options.logo
} catch (error) {
console.warn('[DetachedWindow] 设置窗口图标失败:', error)
}
}
}

const win = new BrowserWindow(windowConfig)

// Windows 11 应用窗口材质(与主窗口保持一致)
if (isWindows) {
this.applyWindowMaterial(win)
// 设置插件窗口ID,避免任务栏窗口合并
win.setAppDetails({
appId: 'ZTools.' + pluginName
})
Comment on lines +192 to +194

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The appId (AppUserModelID) on Windows is used for taskbar grouping and should ideally follow a specific format (e.g., CompanyName.ProductName). It should not contain spaces or special characters other than dots and hyphens. If pluginName contains spaces, it might lead to inconsistent behavior in the Windows taskbar. Sanitizing the string ensures robustness.

Suggested change
win.setAppDetails({
appId: 'ZTools.' + pluginName
})
win.setAppDetails({
appId: 'ZTools.' + pluginName.replace(/[^a-zA-Z0-9.-]/g, '')
})

}

// 窗口直接加载标题栏 HTML
Expand Down
2 changes: 1 addition & 1 deletion ztools-plugin-cli