-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
shell.openItem
should activate the opened app
#10477
Comments
Afaik this is because our implementation of https://github.com/electron/electron/blob/master/atom/common/platform_util_mac.mm#L127 If you want to open it with activation I believe you can just pass the file path to |
The first mentioned issue there is fixed in Chromium. They're using
Yes, that's my workaround, but it's ugly as it requires converting the path to a file URL. |
👋 @sindresorhus this fix is now in master, so i'm going to go ahead and close this issue! |
@codebytere Thank you for fixing this 🙌 |
I noticed this bug for long time. And I can confirm it is still buggy for Windows 7 with (latest) Electron 8.2.0 |
Works great on mac, but how about making it optional? :') Use case: dev experience - working on a file exporter and would love to see the file live reload -- without having to cmd-tab back to the editor. I suspect a work-around is possible through shell.openExternal as it has activate bool option. As of now, it's possible just to omit the line (don't do any file opening) but keep the file open -> after saving in the editor, (vue on mounted) is hot reloaded and the file is overwritten, though to see changes you need to cmd-tab to refresh it. |
The issue described in #2968 (comment) doesn't appear to exist any more and the openExternal solution fails when opening paths that ends with a backslash. I'd bet the issue we were seeing was electron/electron#10477 which has been long since resolved.
Expected behavior
For example, if I ask it to open a path to a directory, it should open it in Finder and focus the Finder window.
Actual behavior
It opens the Finder window in the background and my app window is still focused.
How to reproduce
Focusing the opened app is expected behavior on macOS and should at least be an option.
The
shell.openExternal
method has this, so it's clear you agree. We just need the behavior/option added to this method too.The text was updated successfully, but these errors were encountered: