NW.js Windows 10 任务栏图标始终显示默认值

问题描述 投票:0回答:3

在 Windows 10 中,任务栏未显示我的自定义图标。我正在使用最新的(在撰写本文时)0.51.1 版本的 nw.js,任务栏图标始终默认,无论我在做什么。即使 .exe 图标在构建中发生变化并且行为符合预期。 有人设法解决这个问题吗?我在 nw.js 官方 Github 页面上阅读了几乎所有有关此主题的问题,但这没有帮助,而且似乎某些用户仍然会遇到此问题。

这是我的 package.json 文件

{
  "name": "com.domain.product",
  "version": "0.1.0",
  "build": {
    "nwVersion": "0.51.1",
    "nwFlavor": "normal",
    "strippedProperties": [ "scripts", "devDependencies", "build", "chromium-args"],
    "mac": {
      "name": "Product Name",
      "icon": "ProductName.icns"
    },
    "win": {
      "name": "ProductName",
      "icon": "icon/ProductName.ico"
    },
    "output": "../build"
  },
  "window": {
    "width": 314,
    "height": 660,
    "frame": false,
    "transparent": true,
    "toolbar": false,
    "resizable": false
  },
  "main": "index.html",
  "node-remote": [ "<all_urls>"]
}
windows icons node-webkit taskbar
3个回答
2
投票

这是一个更复杂的示例,但请了解如何在窗口设置和构建设置中处理图标:


2
投票

您需要将“window.icon”属性添加到 package.json 中。类似于:

"window": {
  "icon": "./build/my-icon.png"
},

有关更多详细信息,请参阅清单格式文档:https://nwjs.readthedocs.io/en/latest/References/Manifest%20Format/#icon


1
投票

v0.74-0.75 中的一个错误导致了这种情况的发生。在 Windows 10/11 中与任务栏图标配合良好的最后一个版本是 0.72。请参阅:https://github.com/nwjs/nw.js/issues/8039

截至今天,该问题尚未修复。

如果您没有使用0.74-0.75中的任何新增功能,您可能需要暂时将NWjs降级到0.72。

© www.soinside.com 2019 - 2024. All rights reserved.