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

[Bug]: There is no way to get a custom WM_CLASS on electron app Windows #33155

Closed
3 tasks done
voxsoftware opened this issue Mar 5, 2022 · 18 comments
Closed
3 tasks done

Comments

@voxsoftware
Copy link

voxsoftware commented Mar 5, 2022

Preflight Checklist

Electron Version

17.1.0

What operating system are you using?

Other Linux

Operating System Version

OpenSuse or any other

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

How can I set a custom WM_CLASS attribute to windows opened with electron? For example, in chromium is possible specifying --class argument. When app get a WM_CLASS, KDE and other desktops can correctly assign a icon based on .desktop files installed.

google-chrome --app=https://example.org --class=crx_application

Is there any way to do this in electron? Maybe with command line or with javascript? Something like this could be good

const window = new BrowserWindow({wmClass: "crx_appplication"})

Actual Behavior

I don't see any option related to this. Is there any way to get this?

Testcase Gist URL

No response

Additional Information

No response

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2022

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Oct 5, 2022
@twobiers
Copy link

twobiers commented Oct 5, 2022

I'm also interested in an answer

@voxsoftware voxsoftware changed the title [Bug]: How to get a custom WM_CLASS on electron apps? [Bug]: There is no way to get a custom WM_CLASS on electron app Windows Oct 5, 2022
@github-actions github-actions bot removed the stale label Oct 6, 2022
@Jagadeesh19
Copy link

I am interested in an answer too

@Jagadeesh19
Copy link

I have found a solution for this from javascript side.

const app = require('electron').app;
app.setName("crx_appplication");

the above code will set the WM_CLASS to crx_appplication

@harmathy
Copy link

It would be nice to have a command line parameter though.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Feb 13, 2023
@harmathy
Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

there you go

@github-actions github-actions bot removed the stale label Feb 15, 2023
@pikim
Copy link

pikim commented Feb 23, 2023

For example, in chromium is possible specifying --class argument.

Some other applications use --name, but --class seems to be more common.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label May 25, 2023
@pikim
Copy link

pikim commented Jun 8, 2023

bump

@github-actions github-actions bot removed the stale label Jun 9, 2023
@electron-issue-triage
Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@voxsoftware
Copy link
Author

voxsoftware commented Sep 8, 2023 via email

@electron-issue-triage
Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@harmathy
Copy link

harmathy commented Dec 8, 2023

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

bump

@threema-danilo
Copy link

threema-danilo commented Dec 12, 2023

I can confirm that the suggestion by @Jagadeesh19 works:

// In electron main script
electron.app.setName("Your App Name / WM_CLASS");

Thus the issue "There is no way to get a custom WM_CLASS on electron app Windows" can be considered resolved (unless someone needs a WM_CLASS that explicitly differs from the app name).

If someone wants to customize the WM_CLASS through command line parameters, then why don't you add/parse a custom command line parameter, which is then used in electron.app.setName(...)?

@ruario
Copy link

ruario commented Jan 4, 2024

Thus the issue "There is no way to get a custom WM_CLASS on electron app Windows" can be considered resolved (unless someone needs a WM_CLASS that explicitly differs from the app name).

Yes to a "WM_CLASS that explicitly differs from the app name" and in any case without the command line parameter (that already exists in Chromium) you cannot change it on the fly.

@electron-issue-triage
Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@electron-issue-triage
Copy link

This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.

@electron-issue-triage electron-issue-triage bot closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants