8000 "BrowserWindow.webPreferences.icon" On ubuntu 24 doesn't show the app icon. Β· Issue #938 Β· electron/minimal-repro Β· GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
"BrowserWindow.webPreferences.icon" On ubuntu 24 doesn't show the app icon.Β #938
Open
@EdgarRSSA

Description

@EdgarRSSA

This doesn't show any icon*.png 😒 , some workaround? Greetings.

Pasted image

Pasted image (2)

node version : v22.7.0

Distributor ID:	Ubuntu
Description:	Ubuntu 24.04.1 LTS
Release:	24.04
Codename:	noble

Files:

.
β”œβ”€β”€ img
β”‚Β Β  β”œβ”€β”€ icon-128.png
β”‚Β Β  β”œβ”€β”€ icon-16.png
β”‚Β Β  β”œβ”€β”€ icon-256.png
β”‚Β Β  β”œβ”€β”€ icon-32.png
β”‚Β Β  β”œβ”€β”€ icon-64.png
β”‚Β Β  └── icon.png
β”œβ”€β”€ index.html
β”œβ”€β”€ LICENSE.md
β”œβ”€β”€ main.js
β”œβ”€β”€ package.json
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ preload.js
β”œβ”€β”€ README.md
β”œβ”€β”€ renderer.js
└── styles.css
![Pasted image](https://github.com/user-attachments/assets/0d240c40-6d31-42bd-8058-a0cb5242070d)

Package.json

{
  "name": "electron-quick-start",
  "version": "1.0.0",
  "description": "A minimal Electron application",
  "main": "main.js",
  "scripts": {
    "start": "electron ."
  },
  "repository": "https://github.com/electron/electron-quick-start",
  "keywords": [
    "Electron",
    "quick",
    "start",
    "tutorial",
    "demo"
  ],
  "author": "GitHub",
  "license": "CC0-1.0",
  "devDependencies": {
    "electron": "^32.1.2"
  },
  "icon": "./img/icon-32.png"
}

Main.js

const fs = require('fs');

const ICON_PATH = path.join(__dirname, "img", "icon-32.png")

function checkIconPath(iconPath) {

  if (fs.existsSync(iconPath)) {
    return;
  } else {
    console.error(`Not exists ${iconPath}`);
    process.exit(1);
  }

}
checkIconPath(ICON_PATH);



function createWindow() {
  // Create the browser window.
  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      preload: path.join(__dirname, 'preload.js'),
      icon: nativeImage.createFromPath(ICON_PATH),
    },
    icon: nativeImage.createFromPath(ICON_PATH),
  })

  // and load the index.html of the app.
  mainWindow.loadFile('index.html')

  // Open the DevTools.
  // mainWindow.webContents.openDevTools()
}

//                                                  ...
//                                                  ...
//                                                  ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0