-
Notifications
You must be signed in to change notification settings - Fork 53
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
Focus application if open, instead of launching new instance #38
Comments
After googling a bit it looks like there's a few ways to activate a window of an external process: ShowWindow/SetForegroundWindowThis requires importing user32.dll to use the Win32 API. According to this SO answer it might be necessary to call both functions to ensure the window is activated if it's been minimised. SwitchToThisWindowThis also requires user32.dll, but seems to activate minimised windows too (according to this SO answer, but as a comment mentions, it's "not intended for general use. It may be altered or unavailable in subsequent versions of Windows" according to the MSDN docs AppActivateThis function is located in the VisualBasic.dll and I'm not sure that would even work from C#. |
@jonstodle I would prefer the You want to take a stab at this? |
Sure 🙂 |
Doing some cleanup in my open issues. I'm closing |
If there's already an instance open of an application it would be preferable to have that application receive focus instead of launching a new instance. That way Jarvis could be used to quickly to switch between applications in addition to launching them.
A key combination could force a launch of a new instance. Shift+Enter would be in keeping with the Windows default of launching new instances when shift-clicking an application on the taskbar and when using Win+Shift+ to switch application on the taskbar.
The text was updated successfully, but these errors were encountered: