Skip to content

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

Open
jonstodle wants to merge 8 commits into
spectresystems:developfrom
jonstodle:focus-process
Open

Move focus to main window of process if it's already running#49
jonstodle wants to merge 8 commits into
spectresystems:developfrom
jonstodle:focus-process

Conversation

@jonstodle
Copy link
Copy Markdown

@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

Move focus to main window of process if it's already running
Copy link
Copy Markdown
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.

Comment thread src/Jarvis.Addin.Files/FileProvider.cs Outdated
if (result.Path.Scheme == "shell")
{
Process.Start(path);
var descriptionPath = result.Description.Replace("/", "\\");
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread src/Jarvis.Core/Interop/Kernel32.cs Outdated

namespace Jarvis.Core.Interop
{
public static class Kernel32
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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