【问题标题】:Electron Linux: .AppImage is not showing the icon, while .deb isElectron Linux:.AppImage 未显示图标,而 .deb 显示
【发布时间】:2019-12-23 21:39:36
【问题描述】:

我有一个 Electron 应用程序,我想将它分发到所有操作系统。

我对 Linux 发行文件有疑问。我已经测试了.deb 文件和.AppImage 文件。

问题是图标:如果我在 Ubuntu 上使用 .deb 文件运行我的应用程序,它会正确显示图标,但当我使用 .AppImage 时它不会。

此外,当我在开发模式下运行它以及为 Windows 和 macOS 发布时,该图标工作正常。

为什么会这样?

我的应用程序的源代码可用here

【问题讨论】:

    标签: linux electron electron-builder electron-packager appimage


    【解决方案1】:

    AppImage 有图标错误。您需要在主窗口中进行设置。

      const options = {
        backgroundColor: '#fff',
        width: 1200,
        height: 800,
        webPreferences: {
          nativeWindowOpen: true,
          nodeIntegration: true
        }
      }
    
      if (process.platform === "linux") {
        options.icon = path.join(`${__dirname}/icon/icon.png`);
      }
    
      mainWindow = new BrowserWindow(options);
    

    【讨论】:

      猜你喜欢
      • 2021-12-26
      • 1970-01-01
      • 2019-02-25
      • 1970-01-01
      • 2017-08-11
      • 2017-01-18
      • 2019-06-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多