opener
opener copied to clipboard
How to open a folder on windows and focus it?
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?
I can't reproduce this issue; on my Windows 10 PC the opened folder gets focused. What Windows version are you on?
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.
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.
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
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
There's an open issue about Electron's shell.openPath()
also having the issue of the window appearing in the background: https://github.com/electron/electron/issues/36765
Therefore I believe this is an Electron issue that I can't fix from my side.