Skip to content

Empty wm_class (Regression) #51375

Closed
Closed

Description

@Damglador

Preflight Checklist

Electron Version

41.3.0

What operating system(s) are you using?

Other Linux

Operating System Version

Linux DamgladorPC 7.0.2-1-cachyos-bore #1 SMP PREEMPT Mon, 27 Apr 2026 23:06:10 +0000 x86_64 GNU/Linux

What arch are you using?

x64

Last Known Working Electron version

40

Does the issue also appear in Chromium / Google Chrome?

I don't know how to test

Expected Behavior

WM Class should use app name

Actual Behavior

WM Class is empty

Testcase Gist URL

https://gist.github.com/Damglador/62df313ae7bf10ef8f1ff9e8e1c6376b

Additional Information

Seems to be exclusive to Wayland

Activity

  1. added theissue type on Apr 28, 2026
  2. moved this to 👀 Unsorted Items in 41-x-yon Apr 28, 2026
  3. nikwen commented on Apr 28, 2026

    @nikwen
    Member

    Thanks for reporting!

    1. Would you be able to download Electron Fiddle, use it to create a small sample app that allows maintainers to reproduce this issue, and upload it as a GitHub gist from Fiddle?
    2. Do you use Wayland?
  4. added
    blocked/need-repro
    on Apr 28, 2026
  5. electron-issue-triage commented on Apr 28, 2026

    @electron-issue-triage

    Hello @Damglador. Thanks for reporting this and helping to make Electron better!

    Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use.

    Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.

    Now adding the blocked/need-repro Needs a test case to reproduce the bug label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.

  6. ckerr commented on Apr 29, 2026

    @ckerr
    Member

    @Damglador what method are you using to inspect the app's WM_CLASS and app_id ?

  7. Damglador commented on Apr 29, 2026

    @Damglador
    ContributorAuthor

    @ckerr on KDE Plasma, window menu pops up if I either press Alt+F3 or roght click on the titlebar, in the more options there's 2 bottom options that are usually used to create window rules, but they also show WM Class. Normally it shows two strings, one is identical to the program executable and the right one is WM Class, but on Electron 41 it's always just «electron».

    There's also Kwin debugging window that can be shown from Krunner by searching for «Kwin», resourceClass in window properties there seem to refer to WM Class and for Electron 41 is always just «electron», while it should match app name.

    Video_2026-04-29_07-42-34.mp4
  8. removed
    blocked/need-repro
    on Apr 29, 2026
  9. Damglador commented on Apr 29, 2026

    @Damglador
    ContributorAuthor

    I am on Wayland, and it seems like if I force Electron to use Xwayland (with XDG_SESSION_TYPE=x11), the issue doesn't occur.

    Attached a gist.

  10. added
    has-repro-gist
    on Apr 29, 2026
  11. nikwen commented on Apr 29, 2026

    @nikwen
    Member

    Thanks for the video and for the gist!

    Would you be able to check which v41 alpha/beta/nightly version introduced the issue? You can switch Electron versions easily in Electron Fiddle. You can also bisect in Fiddle: View > Toggle Bisect Helper. (You might need to enable nightly versions in the Electron Fiddle settings.)

  12. Damglador commented on Apr 29, 2026

    @Damglador
    ContributorAuthor

    Last working - v41.0.0-beta.7
    Broken in - v41.0.0-beta.8

  13. mitchchn commented on Apr 29, 2026

    @mitchchn
    Member

    WM_CLASS is not empty, but it is not derived the same way as before. It now uses the app's executable name by default, not the product name, which is better suited as a default ID especially on Wayland: #49988.

    When WM_CLASS matches the XDG App ID, Wayland tends to hide it because WM_CLASS is a legacy X11 concept.

    If you want to override the XDG App ID and WM_CLASS you can set desktopName explicitly as before.

  14. moved this from 👀 Unsorted Items to 👍 Does Not Block Stable in 41-x-yon Apr 29, 2026
  15. Damglador commented on Apr 29, 2026

    @Damglador
    ContributorAuthor

    @mitchchn using executable isn't a great default as then apps that share executable (using system Electron) get all assigned to «electron» wm_class. If the only way to change the WM_CLASS is through the application code it isn't a great solution either as nobody is going to do that for Obsidian for example, which is currently packaged using system Electron on Arch Linux.

  16. ckerr commented on Apr 29, 2026

    @ckerr
    Member

    Yep, @mitchchn has it right: 49988 got backported into the 41-x-y branch with #50051, which landed between v41.0.0-beta.7 and v41.0.0-beta.8, matching up with @Damglador's bisect.

  17. mitchchn commented on Apr 29, 2026

    @mitchchn
    Member

    @Damglador Thanks for the example. Admittedly I did not consider the "system Electron" approach used for some packages on Arch. But even for this edge case:

    1. Electron should not use the raw productName/name to derive WM_CLASS, since these values are not usually compatible with XDG App IDs on Wayland, which breaks icons and keyboard shortcuts.
    2. Regardless of how the default ID is determined, it should still however be possible (and encouraged) for the developers and/or package maintainers to set the metadata and not rely on accidental defaults.

    I am not actually familiar with how Arch packages Electron apps and it would help if someone who is can weigh in.

    Another option for the default ID would be to take the productName/name as before but sanitize the value: remove spaces and special chars, lowercase, etc.

  18. Damglador commented on Apr 29, 2026

    @Damglador
    ContributorAuthor

    Most packages that use system electron just use a script that does

    exec electron<ver> /usr/lib/<app>/app.asar "$@"

    For example Obsidian's launch script is

    #!/bin/bash
    
    OBSIDIAN_USER_FLAGS_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/obsidian/user-flags.conf"
    
    # Allow users to override command-line options
    if [[ -f "${OBSIDIAN_USER_FLAGS_FILE}" ]]; then
       OBSIDIAN_USER_FLAGS=$(grep -v '^#' "$OBSIDIAN_USER_FLAGS_FILE")
    fi
    
    # Launch
    exec electron39 /usr/lib/obsidian/app.asar $OBSIDIAN_USER_FLAGS "$@"

    https://wiki.archlinux.org/title/Electron_package_guidelines

    As the package uses pre-built app.asar, it's not feasible for the packager to change package.json used by electron to add desktop name.

  19. mitchchn commented on Apr 30, 2026

    @mitchchn
    Member

    @Damglador please take a look at #51424.

  20. nikwen commented on Apr 30, 2026

    @nikwen
    Member

    @mitchchn Could we document the need to set the desktopName?

    I see it documented neither in Electron nor in Electron Forge.

  21. mitchchn commented on May 1, 2026

    @mitchchn
    Member

    Docs: #51426.

    In addition to the default value, Obsidian and others can use this (existing!) API even if they are unable to rely on package.json.

  22. Damglador commented on May 1, 2026

    @Damglador
    ContributorAuthor

    Can confirm that #51424 fixes the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

41-x-ybug 🪲has-repro-gistplatform/linuxwayland

Type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions