Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The IconTemplate.png overrides my icons when I package my app #468

Open
cassidoo opened this issue Feb 2, 2024 · 2 comments
Open

The IconTemplate.png overrides my icons when I package my app #468

cassidoo opened this issue Feb 2, 2024 · 2 comments

Comments

@cassidoo
Copy link
Contributor

cassidoo commented Feb 2, 2024

Description

I have the following code for my simple app:

const { menubar } = require("menubar");
const path = require("path");

const mb = menubar({
	browserWindow: {
		width: 420,
		height: 520,
	},
	icon: path.join(__dirname, "extraResources", "icon.png"),
	tooltip: "Tester",
});

This works perfectly in development, but when I package this with Electron Forge, my tray icon only shows the IconTemplate.png.

Steps to Reproduce the Problem

  1. Use any icon for the tray
  2. Package the app
  3. The icon is using the IconTemplate.png file, not mine.

Expected Behaviour

My icon should appear in "production", not the default.

Specifications

  • Menubar version: latest
  • Platform: Mac + Windows
  • Electron version: v28.2.1

Other information

My app is a plain HTML file.

@nickyhajal
Copy link

I'm hitting this issue as well. Haven't figured out a fix yet. In my case I'm using electron-builder.

@nickyhajal
Copy link

@cassidoo I managed to get this worked out by "logging" with a message box like the following to track down where exactly the bundler was putting my files:

dialog.showMessageBox({
  message: JSON.stringify(fs.readdirSync(path.join(__dirname)))
})

Continued adding onto the path then rebuilding until I discovered the icon wasn't at the working directory root at all. I then did the same process starting from process.resourcePath which lead me in the right direction and my final working path to the icon was: path.join(process.resourcesPath, "buildResources", "menuicon.png")

Hope that process helps!

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

No branches or pull requests

2 participants