Skip to content

fix: set window icon explicitly on Linux (GNOME/KDE)#334

Open
algojogacor wants to merge 1 commit into
AgregoreWeb:masterfrom
algojogacor:fix/linux-window-icon
Open

fix: set window icon explicitly on Linux (GNOME/KDE)#334
algojogacor wants to merge 1 commit into
AgregoreWeb:masterfrom
algojogacor:fix/linux-window-icon

Conversation

@algojogacor
Copy link
Copy Markdown

Summary

Fixes #10: Agregore logo not showing as window icon on Linux desktop environments (GNOME/KDE).

Problem

Electron's BrowserWindow icon option only applies to Windows and macOS. On Linux, the window icon must be explicitly set using nativeImage.createFromPath() and BrowserWindow.setIcon(). Additionally, the electron-builder Linux configuration was missing an icon field for proper packaging.

Solution

  • Imported nativeImage from electron
  • Added platform check (process.platform === 'linux') and call this.window.setIcon() after BrowserWindow creation
  • Added "icon": "build/icon.png" to the linux electron-builder configuration for proper .desktop entry icon

Testing

  • The icon was confirmed working on Windows and macOS
  • This change adds explicit Linux icon support
  • Falls back gracefully with a warning if icon loading fails

Type of Change

  • Bug fix

Electron's BrowserWindow 'icon' option only applies to Windows and macOS.
On Linux, the window icon must be set via nativeImage and setIcon() at runtime.

Changes:
- Import nativeImage from electron
- After BrowserWindow creation on Linux, call setIcon() with the logo
- Add 'icon' field to electron-builder linux config for proper packaging

Fixes AgregoreWeb#10
Copy link
Copy Markdown
Member

@RangerMauve RangerMauve left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

One nitpick regarding the nativeImage init.

Also, was AI used to produce this PR?

Comment thread src/window.js
// Electron's BrowserWindow 'icon' option only applies to Windows/macOS
if (process.platform === 'linux') {
try {
const icon = nativeImage.createFromPath(LOGO_FILE)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we init this once at the top and reuse it between instances, or do we need a fresh one each time?

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

Successfully merging this pull request may close these issues.

Agregore logo isn't showing up as window icon

2 participants