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

app.setLoginItemSettings works incorrectly while packaged with the environment variable --win32metadata.requested-execution-level=requireAdministrator #1366

Open
3 tasks done
ch1ny opened this issue May 19, 2022 · 4 comments
Labels

Comments

@ch1ny
Copy link

ch1ny commented May 19, 2022

Preflight Checklist

Issue Details

  • Electron Packager Version:
    • 15.5.1
  • Electron Version:
    • 17.1.0
  • Operating System:
    • Windows 10 (21H2)

Behavior

I'm trying to add a feature to my Electron application to make it automatically run after my computer starting up. And this is my source code:

		ipcMain.on('EXCHANGE_OPEN_AT_LOGIN', (evt, openAtLogin) => {
			if (app.isPackaged) {
				app.setLoginItemSettings({
					openAtLogin,
				});
			}
		});

If I packaged my application with command like this , my application can be successfully self-booted.

electron-packager ./build SduMeeting --platform=win32 --arch=x64 --out ./dist --asar --overwrite

However, to implement certain features, I have to package it with command like this to get administrator privileges.

electron-packager ./build SduMeeting --platform=win32 --arch=x64 --out ./dist --asar --overwrite --win32metadata.requested-execution-level=requireAdministrator

The application packaged in this way cannot be opened automatically.

Additional Information

Excuse me, I'm a college student from a university in China with poor English. I wish my poor presentation wouldn't cause troubles for you.

@ch1ny ch1ny added the bug 🐛 label May 19, 2022
@welcome
Copy link

welcome bot commented May 19, 2022

👋 Thanks for opening your first issue here! If you have a question about using Electron Packager, read the support docs. If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. Development and issue triage is community-driven, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@ch1ny ch1ny changed the title app.setLoginItemSettings works incorrectly while packaged with the environment variable --win32metadata.requested-execution-level=requireAdministrator app.setLoginItemSettings works incorrectly while packaged with the environment variable --win32metadata.requested-execution-level=requireAdministrator May 19, 2022
@toantt2k
Copy link

Hey man, have you fixed this error yet?

@ch1ny
Copy link
Author

ch1ny commented Jan 20, 2024

Hey man, have you fixed this error yet?

Yes, I have solved this problem by modifying the Windows registry, but I am not sure that my method is appropriate.
You can see my code from the link below:
https://github.com/ch1ny/SduMeeting/blob/7ed5a51e2eac5716f16f30639455aa3d762b1260/main.js#L363

There may be other, better ways to work it out.

@s0ckd3
Copy link

s0ckd3 commented Sep 15, 2024

up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants