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

How to open a folder on windows and focus it? #30

Open
blarfoon opened this issue Apr 8, 2024 · 6 comments
Open

How to open a folder on windows and focus it? #30

blarfoon opened this issue Apr 8, 2024 · 6 comments

Comments

@blarfoon
Copy link

blarfoon commented Apr 8, 2024

Currently when I open a folder through explorer with open, it opens it correctly but it's not focused, the explorer window is minimized. Is there any way to bring it to focus automatically after opening?

@Seeker14491
Copy link
Owner

I can't reproduce this issue; on my Windows 10 PC the opened folder gets focused. What Windows version are you on?

@blarfoon
Copy link
Author

blarfoon commented Apr 8, 2024

Windows 11. I have a decently popular app and I get quite a few complaints about this so it's not just a me issue. Let me know if I can be of any help.

@Seeker14491
Copy link
Owner

I'm assuming the app in question is the new GDLauncher. I installed it, and after installing an instance and right-clicking it and selecting "Open folder", the folder did open, but it wasn't focused. It seems inconsistent though; I tried it several times, and sometimes it focuses, sometimes not. I'm thinking it's probably a kind of race condition between the click on your app focusing your app, and opener focusing the explorer window.

@blarfoon
Copy link
Author

blarfoon commented Apr 9, 2024

It is weird though because switching to electron's native open folder method always works.
Also I would expect the explorer window to pop up but be behind GDL, not be fully minimized

@blarfoon
Copy link
Author

blarfoon commented Apr 9, 2024

Both electron's method and opener go through IPC, but opener has to go through a websocket connection as well so technically it should be even slower than electron's one

@Seeker14491
Copy link
Owner

There's an open issue about Electron's shell.openPath() also having the issue of the window appearing in the background: electron/electron#36765
Therefore I believe this is an Electron issue that I can't fix from my side.

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

No branches or pull requests

2 participants