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

Move focus to main window of process if it's already running #49

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

jonstodle
Copy link

@jonstodle jonstodle commented Jan 11, 2018

This is just the initial work, but I want to get your feedback before I might head far off in the wrong direction.

This code will move focus to the first process which has the same file name as the FileResult.Description. If the window is minimized, it will restore it.

I haven't checked if this will work with UWP apps yet. I started by checking if I could get the easy problem to work first.

This will close #38

Copy link
Member

@patriksvensson patriksvensson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonstodle Left some comments.

@@ -55,7 +59,33 @@ protected override Task ExecuteAsync(FileResult result)

if (result.Path.Scheme == "shell")
{
Process.Start(path);
var descriptionPath = result.Description.Replace("/", "\\");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the FileResult.Description only works in some cases. Where a lnk-file has been indexed, this will be the shortcut's description.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's what I feared.


namespace Jarvis.Core.Interop
{
public static class Kernel32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer to put this in public static partial class Win32 and name the file Win32.Process or similar.

@jonstodle
Copy link
Author

Well.. That's not exactly what I intended to do. Sorry about this. I'm not too experienced at PRs on Github 😞

I have made a few changes. I'm most curious what you think about the change in FileResult: am I "breaking a boundry" by referring back to the original IdexedEntry?

@CLAassistant
Copy link

CLAassistant commented Aug 24, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 3 committers have signed the CLA.

✅ patriksvensson
❌ punker76
❌ jonstodle
You have signed the CLA already but the status is still pending? Let us recheck it.

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

Successfully merging this pull request may close these issues.

Focus application if open, instead of launching new instance
4 participants