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

[Run][New Plugin] Allow to terminate the selected running process #6084

Closed
Just1n opened this issue Aug 21, 2020 · 22 comments
Closed

[Run][New Plugin] Allow to terminate the selected running process #6084

Just1n opened this issue Aug 21, 2020 · 22 comments
Assignees
Labels
Help Wanted We encourage anyone to jump in on these and submit a PR. Idea-Enhancement New feature or request on an existing product Product-PowerToys Run Improved app launch PT Run (Win+R) Window Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. Run-Plugin Things that relate with PowerToys Run's plugin interface
Milestone

Comments

@Just1n
Copy link

Just1n commented Aug 21, 2020

📝 'Ctrl + Enter' to terminate the selected running process

After listing the running processes, and pressing 'Ctrl + Enter' would terminate the selected one.

Originated from #5823

@ghost ghost added the Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams label Aug 21, 2020
@crutkas crutkas changed the title 'Ctrl + Enter' to terminate the selected running process [pt run] - Allow to terminate the selected running process Aug 21, 2020
@crutkas
Copy link
Member

crutkas commented Aug 21, 2020

so ctrl-enter has a lot of implications. it typically means to just 'execute'. Think about outlook and others. It is also very close to run as admin.

Maybe ctrl-delete may be a better key. I would only have this as a context menu item in the window walker section.

@crutkas crutkas added Help Wanted We encourage anyone to jump in on these and submit a PR. Idea-Enhancement New feature or request on an existing product Product-PowerToys Run Improved app launch PT Run (Win+R) Window Run-Plugin Things that relate with PowerToys Run's plugin interface and removed Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Aug 21, 2020
@crutkas crutkas added this to the Suggested Enhancements milestone Aug 21, 2020
@crutkas
Copy link
Member

crutkas commented Aug 21, 2020

xref #322 as well, good spot to share code

@P-Storm
Copy link
Contributor

P-Storm commented Sep 15, 2020

See #6604 (comment). Change of component and don't kill every instance.

@Just1n
Copy link
Author

Just1n commented Oct 30, 2020

Hi @crutkas & @P-Storm , Is the killing 'Force kill' or just 'Send the close message to the window'?
See this link for the difference.

@enricogior enricogior changed the title [pt run] - Allow to terminate the selected running process [Run][New Plugin] Allow to terminate the selected running process Jan 7, 2021
@htcfreek
Copy link
Collaborator

htcfreek commented Dec 26, 2021

Small spec how a Kill process plugin can work:

  • Result layout
    • Title: <name> - <Process-ID> (<user>)
    • Subtitle: <path>
    • Icon: Process icon/plugin icon
  • Tool tip:
    • Line 1: <name> - <Process-ID>
    • Line 2: Main window: <process.MainWindowTitle>
    • Line 3: User context: <user>
    • Line 4: Path: <path>
  • Commands
    • Result command: Kill this process only
    • Context menu: Kill all processes with this name
    • Send close message to process (Prio two feature)
    • "explorer.exe" context menu (addition): Restart explorer of current user
  • Behavior
    • Process list: Only running on this user (See plugin setting!)
      • Should be validated by comparing user sid and session id.
    • Search by Process-ID, name, user context (Prio two feature), Window title (Prio two feature)
    • Hide special processes: lsass, winlogon, rundll32, ... [See this example.]
      • If explorer restart doesn't work we should hide it's processes or show only the on with an explorer window running independent from shell!!
    • Before process is killed check if it's exist/Update results after killing a process [Killing a killed process isn't possible and my lead to unexpected behavior. - See this issue.]
    • Ask for admin permission if the process to kill runs in other user context (See settings.)
    • Block results for "Global results" and show warning that it's blocked (See settings.) [It might be problematic to have this results global.]
    • Restart explorer of current user detached as current user process.
  • Plugin settings
    • Show and kill processes for all users (default off) (Prio two feature)
    • Confirm on closing single process (default off)
    • Confirm on closing multiple processes by name (default on)
    • Ignore "Global results" warning and show results anyway (default off)
    • Switch kill command on enter with close command in context menu (default off)
    • Operate in window mode instead of process mode (default on)

I am not sure if I can implement such a plugin. But like to share my ideas. At the moment I don't have the time to implement it.

@franky920920
Copy link
Contributor

Is this going in to the window walker? Or there may be two result for the same program.

@htcfreek
Copy link
Collaborator

htcfreek commented Dec 26, 2021

Is this going in to the window walker? Or there may be two result for the same program.

I think we should have an own plugin. And as I wrote I think kill process results shouldn't be shown as global result per default.

If we add it with all the suggested features it's to complex for adding it into WindowWalker.

@crutkas
Copy link
Member

crutkas commented Dec 26, 2021

I think a good first start is to add it to window walker. I think what is being proposed is far in excess to what was being asked.

@htcfreek
Copy link
Collaborator

@crutkas
In a first step I will implement close window and kill process into ww.

For killing you suggested Ctrl+Del. What should we use for closing window? Additional I will implement a setting to enable/disable confirmation of killing a process. For Explorer.exe we should add the prerequisite that each window has to run in it's own process.

If you are good with this please assign me. I will work on it in the next time.

@crutkas
Copy link
Member

crutkas commented Jan 11, 2022

2nd context menu?!?

@htcfreek
Copy link
Collaborator

htcfreek commented Jan 11, 2022

2nd context menu?!?

  1. Close window like clicking on x in title bar. (Should work on elevated windows too and was indirectly requested in the comment [Run][New Plugin] Allow to terminate the selected running process #6084 (comment).)
  2. Kill process sends a kill command to the process.

@htcfreek
Copy link
Collaborator

htcfreek commented Jan 12, 2022

2nd context menu?!?

  1. Close window like clicking on x in title bar. (Should work on elevated windows too and was indirectly requested in the comment [Run][New Plugin] Allow to terminate the selected running process #6084 (comment).)
  2. Kill process sends a kill command to the process.

I have made a very simple PoC without pid/hwnd validation. But it shows what I think about. The code can be found here.

Close window:

An yes it can close elevated windows without PT Run running elevated. 🤩
pt-wwPoc-01

Kill process:

When killing the process there is a bug in my PoC that PT Run doesn't close.
I have reopened Edge manually after killing the process to show you the "Edge closed unexpectedly" message.
pt-wwPoc-02a

@franky920920
Copy link
Contributor

@htcfreek I would like to suggest a confirm message prompt would be great. ;)

@htcfreek
Copy link
Collaborator

@htcfreek I would like to suggest a confirm message prompt would be great. ;)

You mean confirm to kill? That is planned. But only for killing the process. 👍🏻

@franky920920
Copy link
Contributor

@htcfreek I would like to suggest a confirm message prompt would be great. ;)

You mean confirm to kill? That is planned. But only for killing the process. 👍🏻

That's correct. 😄

@crutkas crutkas added Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Status-In progress This issue or work-item is under development labels Jan 25, 2022
@htcfreek htcfreek added Status-In progress This issue or work-item is under development and removed Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. labels Jan 25, 2022
@htcfreek
Copy link
Collaborator

@crutkas
This isn't fix-committed! We only committed the required code changes and fixes to prepare code for the new features. The new features are going to be a second PR. Please update the project assignment.

@Aaron-Junker
Copy link
Collaborator

I moved it to 0.56. Or do you can get it into 0.55?

@htcfreek
Copy link
Collaborator

I moved it to 0.56. Or do you can get it into 0.55?

No. Let's have it in 0.65. Then we have more time for testing and fixing.

@htcfreek htcfreek added Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Status-In progress This issue or work-item is under development labels Mar 7, 2022
@htcfreek
Copy link
Collaborator

htcfreek commented Mar 7, 2022

project: v0.57.0

@htcfreek
Copy link
Collaborator

htcfreek commented Apr 2, 2022

This is fixed with 0.57.0. Please head over to https://aka.ms/installpowertoys

@htcfreek htcfreek closed this as completed Apr 2, 2022
@TCB13
Copy link

TCB13 commented May 26, 2023

The problem is that this was based on window walker thus it is slow and doesn't allow to actually kill a process. It simply finds out what's the process behind a window and kills those. What about actual processes that don't have associated windows. For examples service-related processes, or stuff you're running on some terminal?

I would be great if this feature could be revised to pick the the actual process list from TaskManager instead of window list.

@github-project-automation github-project-automation bot moved this to ⚠️Needs Walkthrough in 3. Help Wanted Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted We encourage anyone to jump in on these and submit a PR. Idea-Enhancement New feature or request on an existing product Product-PowerToys Run Improved app launch PT Run (Win+R) Window Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. Run-Plugin Things that relate with PowerToys Run's plugin interface
Projects
Status: ⚠️Needs Walkthrough
Development

No branches or pull requests

7 participants