Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,8 @@ if (config.get('options.disableHardwareAcceleration')) {
}

if (is.linux()) {
// Overrides WM_CLASS for X11 to correspond to icon filename
app.setName(
'com.github.th_ch.\u0079\u006f\u0075\u0074\u0075\u0062\u0065\u005f\u006d\u0075\u0073\u0069\u0063',
);
// Overrides WM_CLASS for X11 and Wayland to correspond to icon filename
app.setName('com.github.th_ch.pear_music');
Comment on lines +129 to +130
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify desktop file and icon existence matching the new identifier

# Check for desktop files
echo "=== Searching for desktop files ==="
fd -e desktop -x echo "Found: {}"

# Check for icon files matching the identifier
echo -e "\n=== Searching for icon files matching identifier ==="
fd -i "pear" --type f -e png -e svg -e ico -e icns | head -20

# Check desktop file content if exists
echo -e "\n=== Checking desktop file content ==="
fd "com.github.th_ch.pear_music.desktop" -x cat {}

# Also check for any youtube-music references
echo -e "\n=== Checking for youtube-music references in desktop files ==="
fd -e desktop -x grep -l "youtube-music" {}

Repository: pear-devs/pear-desktop

Length of output: 259


🌐 Web query:

What is the correct WM_CLASS identifier format for Electron apps on Linux desktop files?

💡 Result:

The correct WM_CLASS identifier format for Electron apps on Linux desktop files is the lowercase, hyphenated version of the application's name (from package.json "name" field or set via app.setName), matching the actual WM_CLASS property set by Electron on the running windows. In the .desktop file, use StartupWMClass= followed by this exact string (case-sensitive match to xprop WM_CLASS(STRING) second value). To determine it: 1. Run the Electron app. 2. Use xprop | grep WM_CLASS and click the window. 3. WM_CLASS(STRING) = "instance", "class" — the "class" value (second one) is the identifier. For packaged apps (e.g., via electron-builder): - Defaults to lowercase of package.json "name" (e.g., "beekeeper-studio"). - Use "desktopName": "appname.desktop" in package.json; builders strip .desktop for StartupWMClass=appname. - Override explicitly in build config: "linux": { "desktop": { "StartupWMClass": "your-wmclass" } }. Electron derives WM_CLASS from app name (lowercase, normalized), while productName is display name. Mismatch causes icon/taskbar issues. Always verify with xprop for exact match.

Citations:


Use hyphens in WM_CLASS identifier to match Electron Linux conventions.

The identifier com.github.th_ch.pear_music uses underscores, which violates the standard Electron/Linux convention for WM_CLASS values. According to Electron builder standards, WM_CLASS should use lowercase, hyphenated format (e.g., com.github.th-ch.pear-music). This should also align with the Windows identifier format at line 663 which uses hyphens (com.github.th-ch.youtube-music).

Additionally, the application name differs between platforms: pear_music (Linux) vs youtube-music (Windows). Clarify whether this is an intentional rebrand or an incomplete migration, and ensure the identifier is consistent across all platforms using the correct format: com.github.th-ch.pear-music.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/index.ts` around lines 129 - 130, Update the WM_CLASS value passed to
app.setName to use lowercase hyphens and match the Windows identifier pattern:
replace app.setName('com.github.th_ch.pear_music') with
app.setName('com.github.th-ch.pear-music'); also verify and align any other
platform identifiers (e.g., the Windows identifier
'com.github.th-ch.youtube-music') so the app name/identifier is consistent
across platforms and reflects the intended product name (change other
occurrences if this is a rename).


// Stops chromium from launching its own MPRIS service
if (await config.plugins.isEnabled('shortcuts')) {
Expand Down