├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── bug.yml │ └── feature.yml ├── .gitignore ├── LICENSE ├── Localizing.md ├── ProcessKiller.sln ├── ProcessKiller ├── CommandLineQuery.cs ├── Images │ ├── Port.dark.png │ ├── Port.dark.svg │ ├── Port.light.png │ ├── Port.light.svg │ ├── Process.dark.png │ ├── Process.dark.svg │ ├── Process.light.png │ ├── Process.light.svg │ ├── ProcessKiller.dark.png │ ├── ProcessKiller.dark.svg │ ├── ProcessKiller.light.png │ └── ProcessKiller.light.svg ├── Lib │ ├── PowerToys.Common.UI.dll │ ├── PowerToys.ManagedCommon.dll │ ├── PowerToys.Settings.UI.Lib.dll │ ├── Wox.Infrastructure.dll │ └── Wox.Plugin.dll ├── Main.cs ├── PortQuery.cs ├── ProcessHelper.cs ├── ProcessKiller.csproj ├── ProcessQuery.cs ├── ProcessResult.cs ├── Properties │ ├── Resources.Designer.cs │ ├── Resources.de-DE.resx │ ├── Resources.pl-PL.resx │ ├── Resources.resx │ ├── Resources.tr-TR.resx │ ├── Resources.uk-UA.resx │ ├── Resources.zh-CN.resx │ └── Resources.zh-TW.resx ├── copyLib.ps1 ├── debug.ps1 ├── plugin.json └── release.ps1 ├── README.md └── assets ├── kl.png ├── kl_all.png └── port.png /.editorconfig: -------------------------------------------------------------------------------- 1 | # Remove the line below if you want to inherit .editorconfig settings from higher directories 2 | root = true 3 | 4 | # C# files 5 | [*.cs] 6 | 7 | indent_style = tab 8 | indent_size = 4 9 | end_of_line = lf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | 14 | #### .NET Code Actions #### 15 | 16 | # Type members 17 | dotnet_hide_advanced_members = false 18 | dotnet_member_insertion_location = with_other_members_of_the_same_kind 19 | dotnet_property_generation_behavior = prefer_throwing_properties 20 | 21 | # Symbol search 22 | dotnet_search_reference_assemblies = true 23 | 24 | #### .NET Coding Conventions #### 25 | 26 | # Organize usings 27 | dotnet_separate_import_directive_groups = false 28 | dotnet_sort_system_directives_first = false 29 | file_header_template = unset 30 | 31 | # this. and Me. preferences 32 | dotnet_style_qualification_for_event = false:warning 33 | dotnet_style_qualification_for_field = false 34 | dotnet_style_qualification_for_method = false:warning 35 | dotnet_style_qualification_for_property = false:warning 36 | 37 | # Language keywords vs BCL types preferences 38 | dotnet_style_predefined_type_for_locals_parameters_members = true:warning 39 | dotnet_style_predefined_type_for_member_access = true:warning 40 | 41 | # Parentheses preferences 42 | dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:warning 43 | dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:warning 44 | dotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning 45 | dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:warning 46 | 47 | # Modifier preferences 48 | dotnet_style_require_accessibility_modifiers = for_non_interface_members 49 | 50 | # Expression-level preferences 51 | dotnet_prefer_system_hash_code = true 52 | dotnet_style_coalesce_expression = true 53 | dotnet_style_collection_initializer = true 54 | dotnet_style_explicit_tuple_names = true 55 | dotnet_style_namespace_match_folder = true 56 | dotnet_style_null_propagation = true 57 | dotnet_style_object_initializer = true 58 | dotnet_style_operator_placement_when_wrapping = beginning_of_line 59 | dotnet_style_prefer_auto_properties = true:warning 60 | dotnet_style_prefer_collection_expression = when_types_loosely_match 61 | dotnet_style_prefer_compound_assignment = true 62 | dotnet_style_prefer_conditional_expression_over_assignment = true:warning 63 | dotnet_style_prefer_conditional_expression_over_return = true:warning 64 | dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed 65 | dotnet_style_prefer_inferred_anonymous_type_member_names = true 66 | dotnet_style_prefer_inferred_tuple_names = true 67 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true 68 | dotnet_style_prefer_simplified_boolean_expressions = true 69 | dotnet_style_prefer_simplified_interpolation = true 70 | 71 | # Field preferences 72 | dotnet_style_readonly_field = true 73 | 74 | # Parameter preferences 75 | dotnet_code_quality_unused_parameters = all 76 | 77 | # Suppression preferences 78 | dotnet_remove_unnecessary_suppression_exclusions = none 79 | 80 | # New line preferences 81 | dotnet_style_allow_multiple_blank_lines_experimental = false:warning 82 | dotnet_style_allow_statement_immediately_after_block_experimental = false:warning 83 | 84 | #### C# Coding Conventions #### 85 | 86 | # var preferences 87 | csharp_style_var_elsewhere = false:warning 88 | csharp_style_var_for_built_in_types = true:warning 89 | csharp_style_var_when_type_is_apparent = true:warning 90 | 91 | # Expression-bodied members 92 | csharp_style_expression_bodied_accessors = true:warning 93 | csharp_style_expression_bodied_constructors = when_on_single_line:warning 94 | csharp_style_expression_bodied_indexers = true:warning 95 | csharp_style_expression_bodied_lambdas = true:warning 96 | csharp_style_expression_bodied_local_functions = true:warning 97 | csharp_style_expression_bodied_methods = when_on_single_line:warning 98 | csharp_style_expression_bodied_operators = when_on_single_line:warning 99 | csharp_style_expression_bodied_properties = true:warning 100 | 101 | # Pattern matching preferences 102 | csharp_style_pattern_matching_over_as_with_null_check = true 103 | csharp_style_pattern_matching_over_is_with_cast_check = true 104 | csharp_style_prefer_extended_property_pattern = true 105 | csharp_style_prefer_not_pattern = true 106 | csharp_style_prefer_pattern_matching = true:warning 107 | csharp_style_prefer_switch_expression = true 108 | 109 | # Null-checking preferences 110 | csharp_style_conditional_delegate_call = true 111 | 112 | # Modifier preferences 113 | csharp_prefer_static_anonymous_function = true 114 | csharp_prefer_static_local_function = true 115 | csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async 116 | csharp_style_prefer_readonly_struct = true 117 | csharp_style_prefer_readonly_struct_member = true 118 | 119 | # Code-block preferences 120 | csharp_prefer_braces = true:warning 121 | csharp_prefer_simple_using_statement = true 122 | csharp_prefer_system_threading_lock = true 123 | csharp_style_namespace_declarations = file_scoped:warning 124 | csharp_style_prefer_method_group_conversion = true:warning 125 | csharp_style_prefer_primary_constructors = true 126 | csharp_style_prefer_top_level_statements = true:warning 127 | 128 | # Expression-level preferences 129 | csharp_prefer_simple_default_expression = true 130 | csharp_style_deconstructed_variable_declaration = true 131 | csharp_style_implicit_object_creation_when_type_is_apparent = true 132 | csharp_style_inlined_variable_declaration = true 133 | csharp_style_prefer_index_operator = true 134 | csharp_style_prefer_local_over_anonymous_function = true 135 | csharp_style_prefer_null_check_over_type_check = true 136 | csharp_style_prefer_range_operator = true 137 | csharp_style_prefer_tuple_swap = true 138 | csharp_style_prefer_utf8_string_literals = true 139 | csharp_style_throw_expression = true 140 | csharp_style_unused_value_assignment_preference = discard_variable 141 | csharp_style_unused_value_expression_statement_preference = discard_variable:warning 142 | 143 | # 'using' directive preferences 144 | csharp_using_directive_placement = outside_namespace:warning 145 | 146 | # New line preferences 147 | csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:warning 148 | csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:warning 149 | csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:warning 150 | csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:warning 151 | csharp_style_allow_embedded_statements_on_same_line_experimental = true:warning 152 | 153 | #### C# Formatting Rules #### 154 | 155 | # New line preferences 156 | csharp_new_line_before_catch = true 157 | csharp_new_line_before_else = true 158 | csharp_new_line_before_finally = true 159 | csharp_new_line_before_members_in_anonymous_types = true 160 | csharp_new_line_before_members_in_object_initializers = true 161 | csharp_new_line_before_open_brace = all 162 | csharp_new_line_between_query_expression_clauses = true 163 | 164 | # Indentation preferences 165 | csharp_indent_block_contents = true 166 | csharp_indent_braces = false 167 | csharp_indent_case_contents = true 168 | csharp_indent_case_contents_when_block = true 169 | csharp_indent_labels = one_less_than_current 170 | csharp_indent_switch_labels = true 171 | 172 | # Space preferences 173 | csharp_space_after_cast = false 174 | csharp_space_after_colon_in_inheritance_clause = true 175 | csharp_space_after_comma = true 176 | csharp_space_after_dot = false 177 | csharp_space_after_keywords_in_control_flow_statements = true 178 | csharp_space_after_semicolon_in_for_statement = true 179 | csharp_space_around_binary_operators = before_and_after 180 | csharp_space_around_declaration_statements = false 181 | csharp_space_before_colon_in_inheritance_clause = true 182 | csharp_space_before_comma = false 183 | csharp_space_before_dot = false 184 | csharp_space_before_open_square_brackets = false 185 | csharp_space_before_semicolon_in_for_statement = false 186 | csharp_space_between_empty_square_brackets = false 187 | csharp_space_between_method_call_empty_parameter_list_parentheses = false 188 | csharp_space_between_method_call_name_and_opening_parenthesis = false 189 | csharp_space_between_method_call_parameter_list_parentheses = false 190 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false 191 | csharp_space_between_method_declaration_name_and_open_parenthesis = false 192 | csharp_space_between_method_declaration_parameter_list_parentheses = false 193 | csharp_space_between_parentheses = false 194 | csharp_space_between_square_brackets = false 195 | 196 | # Wrapping preferences 197 | csharp_preserve_single_line_blocks = true 198 | csharp_preserve_single_line_statements = true 199 | 200 | #### Naming styles #### 201 | 202 | # Naming rules 203 | 204 | dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion 205 | dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface 206 | dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i 207 | 208 | dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion 209 | dotnet_naming_rule.types_should_be_pascal_case.symbols = types 210 | dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case 211 | 212 | dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion 213 | dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members 214 | dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case 215 | 216 | dotnet_naming_rule.static_field_should_be_pascal_case.severity = suggestion 217 | dotnet_naming_rule.static_field_should_be_pascal_case.symbols = static_field 218 | dotnet_naming_rule.static_field_should_be_pascal_case.style = pascal_case 219 | 220 | # Symbol specifications 221 | 222 | dotnet_naming_symbols.interface.applicable_kinds = interface 223 | dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected 224 | dotnet_naming_symbols.interface.required_modifiers = 225 | 226 | dotnet_naming_symbols.static_field.applicable_kinds = field 227 | dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected 228 | dotnet_naming_symbols.static_field.required_modifiers = static 229 | 230 | dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum 231 | dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected 232 | dotnet_naming_symbols.types.required_modifiers = 233 | 234 | dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method 235 | dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected 236 | dotnet_naming_symbols.non_field_members.required_modifiers = 237 | 238 | # Naming styles 239 | 240 | dotnet_naming_style.pascal_case.required_prefix = 241 | dotnet_naming_style.pascal_case.required_suffix = 242 | dotnet_naming_style.pascal_case.word_separator = 243 | dotnet_naming_style.pascal_case.capitalization = pascal_case 244 | 245 | dotnet_naming_style.begins_with_i.required_prefix = I 246 | dotnet_naming_style.begins_with_i.required_suffix = 247 | dotnet_naming_style.begins_with_i.word_separator = 248 | dotnet_naming_style.begins_with_i.capitalization = pascal_case 249 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: 8LWXpg # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 12 | polar: # Replace with a single Polar username 13 | buy_me_a_coffee: # Replace with a single Buy Me a Coffee username 14 | thanks_dev: # Replace with a single thanks.dev username 15 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 16 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.yml: -------------------------------------------------------------------------------- 1 | name: 🐞 Bug report 2 | description: Report a bug in the application 3 | 4 | labels: 5 | - bug 6 | 7 | body: 8 | - type: textarea 9 | id: description 10 | attributes: 11 | label: Description 12 | description: Please provide a clear and concise description of the bug you are experiencing. 13 | validations: 14 | required: true 15 | - type: textarea 16 | id: reproduction 17 | attributes: 18 | label: Steps to reproduce 19 | description: Provide a clear and concise description of the steps to reproduce the bug. 20 | validations: 21 | required: true 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature.yml: -------------------------------------------------------------------------------- 1 | name: ✨ Feature request 2 | description: Suggest a new feature or enhancement for the extension 3 | 4 | labels: 5 | - enhancement 6 | 7 | body: 8 | - type: textarea 9 | id: description 10 | attributes: 11 | label: Description 12 | description: Provide a clear and concise description of the feature you are requesting. 13 | validations: 14 | required: true 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd 364 | 365 | # Custom 366 | *.zip 367 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 8LWXpg 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Localizing.md: -------------------------------------------------------------------------------- 1 | # Localization 2 | 3 | ## On github.dev 4 | 5 | 1. Fork this repository. 6 | 1. Open github.dev by pressing . on keyboard. \ 7 | ![Open github.dev](https://user-images.githubusercontent.com/856858/130119109-4769f2d7-9027-4bc4-a38c-10f297499e8f.gif) 8 | 1. Install [ResX Viewer/Editor](https://marketplace.visualstudio.com/items?itemName=8LWXpg.code-resx) extension (yes, I made an extension for this). 9 | 1. Copy `./ProcessKiller/Properties/Resources.resx` to `./ProcessKiller/Properties/Resources..resx`. 10 | 1. Change the `Value`s to the translated text. 11 | 1. Add `"$releasePath/"` to the `$items` array in `./ProcessKiller/release.ps1`. 12 | https://github.com/8LWXpg/PowerToysRun-ProcessKiller/blob/bc8a9932df1800b1577ac673ac10795047590b48/ProcessKiller/release.ps1#L19-L24 13 | 1. Commit the change and submit a PR. 14 | -------------------------------------------------------------------------------- /ProcessKiller.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.8.34525.116 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProcessKiller", "ProcessKiller\ProcessKiller.csproj", "{F12C4D9D-41BE-489C-9A49-D243F173D17D}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5EAAFC82-48C4-4ECE-BF15-1C0E485CA57B}" 9 | ProjectSection(SolutionItems) = preProject 10 | .gitignore = .gitignore 11 | README.md = README.md 12 | EndProjectSection 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|ARM64 = Debug|ARM64 17 | Debug|x64 = Debug|x64 18 | Release|ARM64 = Release|ARM64 19 | Release|x64 = Release|x64 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {F12C4D9D-41BE-489C-9A49-D243F173D17D}.Debug|ARM64.ActiveCfg = Debug|ARM64 23 | {F12C4D9D-41BE-489C-9A49-D243F173D17D}.Debug|ARM64.Build.0 = Debug|ARM64 24 | {F12C4D9D-41BE-489C-9A49-D243F173D17D}.Debug|x64.ActiveCfg = Debug|x64 25 | {F12C4D9D-41BE-489C-9A49-D243F173D17D}.Debug|x64.Build.0 = Debug|x64 26 | {F12C4D9D-41BE-489C-9A49-D243F173D17D}.Release|ARM64.ActiveCfg = Release|ARM64 27 | {F12C4D9D-41BE-489C-9A49-D243F173D17D}.Release|ARM64.Build.0 = Release|ARM64 28 | {F12C4D9D-41BE-489C-9A49-D243F173D17D}.Release|x64.ActiveCfg = Release|x64 29 | {F12C4D9D-41BE-489C-9A49-D243F173D17D}.Release|x64.Build.0 = Release|x64 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {A0437608-D325-4D04-B1E9-C93704962229} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /ProcessKiller/CommandLineQuery.cs: -------------------------------------------------------------------------------- 1 | using System.Management; 2 | 3 | namespace Community.PowerToys.Run.Plugin.ProcessKiller; 4 | /// 5 | /// Query all running processes and their command lines using WMI. 6 | /// A lot faster than querying each process individually 7 | /// 8 | public class CommandLineQuery 9 | { 10 | public readonly Dictionary query = []; 11 | 12 | /// 13 | /// This class initialization is slow, share the same instance instead of creating a new one. 14 | /// 15 | public CommandLineQuery() 16 | { 17 | var query = "SELECT ProcessId, CommandLine FROM Win32_Process"; 18 | var searcher = new ManagementObjectSearcher(query); 19 | foreach (ManagementBaseObject? obj in searcher.Get()) 20 | { 21 | var processId = Convert.ToInt32(obj["ProcessId"]); 22 | var commandLine = obj["CommandLine"]?.ToString(); 23 | this.query[processId] = commandLine; 24 | } 25 | } 26 | 27 | public string? GetCommandLine(int processId) => query.GetValueOrDefault(processId); 28 | } 29 | -------------------------------------------------------------------------------- /ProcessKiller/Images/Port.dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-ProcessKiller/9046f5770325f94935f644f05241dcbd70a13612/ProcessKiller/Images/Port.dark.png -------------------------------------------------------------------------------- /ProcessKiller/Images/Port.dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 38 | 43 | 44 | -------------------------------------------------------------------------------- /ProcessKiller/Images/Port.light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-ProcessKiller/9046f5770325f94935f644f05241dcbd70a13612/ProcessKiller/Images/Port.light.png -------------------------------------------------------------------------------- /ProcessKiller/Images/Port.light.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 38 | 43 | 44 | -------------------------------------------------------------------------------- /ProcessKiller/Images/Process.dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-ProcessKiller/9046f5770325f94935f644f05241dcbd70a13612/ProcessKiller/Images/Process.dark.png -------------------------------------------------------------------------------- /ProcessKiller/Images/Process.dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 38 | 43 | 44 | -------------------------------------------------------------------------------- /ProcessKiller/Images/Process.light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-ProcessKiller/9046f5770325f94935f644f05241dcbd70a13612/ProcessKiller/Images/Process.light.png -------------------------------------------------------------------------------- /ProcessKiller/Images/Process.light.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 38 | 43 | 44 | -------------------------------------------------------------------------------- /ProcessKiller/Images/ProcessKiller.dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-ProcessKiller/9046f5770325f94935f644f05241dcbd70a13612/ProcessKiller/Images/ProcessKiller.dark.png -------------------------------------------------------------------------------- /ProcessKiller/Images/ProcessKiller.dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 38 | 44 | 45 | -------------------------------------------------------------------------------- /ProcessKiller/Images/ProcessKiller.light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-ProcessKiller/9046f5770325f94935f644f05241dcbd70a13612/ProcessKiller/Images/ProcessKiller.light.png -------------------------------------------------------------------------------- /ProcessKiller/Images/ProcessKiller.light.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 38 | 44 | 45 | -------------------------------------------------------------------------------- /ProcessKiller/Lib/PowerToys.Common.UI.dll: -------------------------------------------------------------------------------- 1 | C:/Program Files/PowerToys/PowerToys.Common.UI.dll -------------------------------------------------------------------------------- /ProcessKiller/Lib/PowerToys.ManagedCommon.dll: -------------------------------------------------------------------------------- 1 | C:/Program Files/PowerToys/PowerToys.ManagedCommon.dll -------------------------------------------------------------------------------- /ProcessKiller/Lib/PowerToys.Settings.UI.Lib.dll: -------------------------------------------------------------------------------- 1 | C:/Program Files/PowerToys/PowerToys.Settings.UI.Lib.dll -------------------------------------------------------------------------------- /ProcessKiller/Lib/Wox.Infrastructure.dll: -------------------------------------------------------------------------------- 1 | C:/Program Files/PowerToys/Wox.Infrastructure.dll -------------------------------------------------------------------------------- /ProcessKiller/Lib/Wox.Plugin.dll: -------------------------------------------------------------------------------- 1 | C:/Program Files/PowerToys/Wox.Plugin.dll -------------------------------------------------------------------------------- /ProcessKiller/Main.cs: -------------------------------------------------------------------------------- 1 | using Community.PowerToys.Run.Plugin.ProcessKiller.Properties; 2 | using ManagedCommon; 3 | using Microsoft.PowerToys.Settings.UI.Library; 4 | using System.Diagnostics; 5 | using System.Windows.Controls; 6 | using Wox.Plugin; 7 | 8 | namespace Community.PowerToys.Run.Plugin.ProcessKiller; 9 | 10 | public class Main : IPlugin, IPluginI18n, ISettingProvider, IReloadable, IDisposable 11 | { 12 | private PluginInitContext? _context; 13 | private bool _disposed; 14 | public string Name => Resources.plugin_name; 15 | public string Description => Resources.plugin_description; 16 | public static string PluginID => "78844AE082E24C0C8AC9DB222FF67317"; 17 | private const string KillAllCount = nameof(KillAllCount); 18 | private const string ShowCommandLine = nameof(ShowCommandLine); 19 | private const string ShowShellExplorer = nameof(ShowShellExplorer); 20 | private int? _killAllCount; 21 | private bool _showCommandLine; 22 | private bool _showShellExplorer; 23 | private string? _portIcon; 24 | private string? _processIcon; 25 | 26 | public IEnumerable AdditionalOptions => 27 | [ 28 | new() 29 | { 30 | PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Numberbox, 31 | Key = KillAllCount, 32 | DisplayLabel = Resources.plugin_setting_kill_all_count, 33 | NumberValue = 5, 34 | NumberBoxMin = 2, 35 | }, 36 | new() 37 | { 38 | PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Checkbox, 39 | Key = ShowCommandLine, 40 | DisplayLabel = Resources.plugin_setting_show_command_line, 41 | DisplayDescription = Resources.plugin_setting_show_command_line_description, 42 | }, 43 | new () 44 | { 45 | PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Checkbox, 46 | Key = ShowShellExplorer, 47 | DisplayLabel = Resources.plugin_setting_show_shell_explorer, 48 | } 49 | ]; 50 | 51 | public void UpdateSettings(PowerLauncherPluginSettings settings) 52 | { 53 | _killAllCount = (int?)(settings?.AdditionalOptions?.FirstOrDefault(static x => x.Key == KillAllCount)?.NumberValue) ?? 5; 54 | _showCommandLine = settings?.AdditionalOptions?.FirstOrDefault(static x => x.Key == ShowCommandLine)?.Value ?? false; 55 | _showShellExplorer = settings?.AdditionalOptions?.FirstOrDefault(static x => x.Key == ShowShellExplorer)?.Value ?? false; 56 | } 57 | 58 | public List Query(Query query) 59 | { 60 | var search = query.Search; 61 | if (search.StartsWith(':')) 62 | { 63 | return new PortQuery().GetMatchingResults(search[1..], query.RawQuery, _showCommandLine, _portIcon!, _context!); 64 | } 65 | 66 | List results = ProcessQuery.GetMatchingResults(search, query.RawQuery, _showCommandLine, _showShellExplorer, _processIcon!, _context!); 67 | results.Reverse(); 68 | 69 | // When there are multiple results AND all of them are instances of the same executable 70 | // add a quick option to kill them all at the top of the results. 71 | Result? topResult = results.OrderByDescending(e => e.Score).First(); 72 | var killAll = results.Where(r => !string.IsNullOrEmpty(r.SubTitle) && r.SubTitle == topResult?.SubTitle).ToList(); 73 | if (results.Count > 1 && !string.IsNullOrEmpty(search) && killAll.Count >= _killAllCount) 74 | { 75 | var name = ((Process)topResult?.ContextData!)?.ProcessName; 76 | var totalMemory = killAll.Sum(r => ((Process)r.ContextData).WorkingSet64); 77 | results.Insert(1, new Result() 78 | { 79 | IcoPath = topResult?.IcoPath, 80 | Title = string.Format(Resources.plugin_kill_all, name), 81 | SubTitle = string.Format(Resources.plugin_kill_all_count, killAll.Count), 82 | ToolTipData = new ToolTipData(name, $"{Resources.plugin_tool_tip_memory}:\n {ProcessResult.FormatMemorySize(totalMemory)}"), 83 | Score = 200, 84 | Action = c => 85 | { 86 | // Kill all processes asynchronously 87 | List> killTasks = killAll.ConvertAll(async r => 88 | { 89 | var p = (Process)r.ContextData; 90 | return await Task.Run(() => ProcessHelper.TryKill(p)); 91 | }); 92 | _ = Task.WhenAll(killTasks); 93 | 94 | _context!.API.ChangeQuery(query.RawQuery, true); 95 | return true; 96 | } 97 | }); 98 | } 99 | 100 | return results; 101 | } 102 | 103 | public void Init(PluginInitContext context) 104 | { 105 | _context = context ?? throw new ArgumentNullException(nameof(context)); 106 | _context.API.ThemeChanged += OnThemeChanged; 107 | UpdateIconPath(_context.API.GetCurrentTheme()); 108 | } 109 | 110 | private void OnThemeChanged(Theme currentTheme, Theme newTheme) => UpdateIconPath(newTheme); 111 | 112 | private void UpdateIconPath(Theme theme) 113 | { 114 | if (theme is Theme.Light or Theme.HighContrastWhite) 115 | { 116 | _portIcon = "Images/Port.light.png"; 117 | _processIcon = "Images/Process.light.png"; 118 | } 119 | else 120 | { 121 | _portIcon = "Images/Port.dark.png"; 122 | _processIcon = "Images/Process.dark.png"; 123 | } 124 | } 125 | 126 | public string GetTranslatedPluginTitle() => Resources.plugin_name; 127 | 128 | public string GetTranslatedPluginDescription() => Resources.plugin_description; 129 | 130 | public Control CreateSettingPanel() => throw new NotImplementedException(); 131 | 132 | public void ReloadData() 133 | { 134 | if (_context is null) 135 | { 136 | return; 137 | } 138 | } 139 | 140 | public void Dispose() 141 | { 142 | Dispose(true); 143 | GC.SuppressFinalize(this); 144 | } 145 | 146 | protected virtual void Dispose(bool disposing) 147 | { 148 | if (!_disposed && disposing) 149 | { 150 | _disposed = true; 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /ProcessKiller/PortQuery.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Wox.Infrastructure; 3 | using Wox.Plugin; 4 | 5 | namespace Community.PowerToys.Run.Plugin.ProcessKiller; 6 | internal class PortQuery 7 | { 8 | public readonly Dictionary Query; 9 | 10 | /// 11 | /// parse output from netstat.exe 12 | /// 13 | public PortQuery() 14 | { 15 | var process = new Process 16 | { 17 | StartInfo = new() 18 | { 19 | FileName = "netstat.exe", 20 | Arguments = "-a -n -o", 21 | RedirectStandardOutput = true, 22 | WindowStyle = ProcessWindowStyle.Hidden, 23 | } 24 | }; 25 | _ = process.Start(); 26 | 27 | var processes = Process.GetProcesses().Where(p => !ProcessHelper.IsSystemProcess(p)).ToList(); 28 | Query = []; 29 | foreach (var row in process.StandardOutput.ReadToEnd().Split("\r\n", StringSplitOptions.RemoveEmptyEntries).Skip(2)) 30 | { 31 | var elements = row.Split(' ', StringSplitOptions.RemoveEmptyEntries); 32 | var localAddress = elements[1]; 33 | var pid = int.Parse(elements.Length > 4 ? elements[4] : elements[3]); 34 | Process? pr = processes.FirstOrDefault(e => e.Id == pid); 35 | if (pr == null) 36 | { 37 | continue; 38 | } 39 | 40 | // There should be only one process using that address and port 41 | Query[localAddress] = pr; 42 | } 43 | } 44 | 45 | public List GetMatchingResults(string search, string rawQuery, bool showCommandLine, string fallbackIcon, PluginInitContext context) 46 | { 47 | CommandLineQuery? commandLineQuery = showCommandLine ? new() : null; 48 | 49 | List results = [.. Query 50 | .Select(e => 51 | { 52 | MatchResult matchResult = StringMatcher.FuzzySearch(search, e.Key); 53 | Process process = e.Value; 54 | var result = new ProcessResult(process, matchResult, commandLineQuery, rawQuery, showCommandLine, fallbackIcon, context) 55 | { 56 | Title = e.Key, 57 | QueryTextDisplay = $":{search}" 58 | }; 59 | return (Result)result; 60 | })]; 61 | 62 | if (!string.IsNullOrWhiteSpace(search)) 63 | { 64 | _ = results.RemoveAll(r => r.Score <= 0); 65 | } 66 | 67 | return results; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /ProcessKiller/ProcessHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Wox.Infrastructure; 3 | using Wox.Plugin.Common.Win32; 4 | using Wox.Plugin.Logger; 5 | 6 | namespace Community.PowerToys.Run.Plugin.ProcessKiller; 7 | 8 | internal static class ProcessHelper 9 | { 10 | private static readonly HashSet SystemProcessList = 11 | [ 12 | "conhost", 13 | "svchost", 14 | "idle", 15 | "system", 16 | "rundll32", 17 | "csrss", 18 | "lsass", 19 | "lsm", 20 | "smss", 21 | "wininit", 22 | "winlogon", 23 | "services", 24 | "spoolsv", 25 | // Used by this Plugin 26 | "wmiprvse", 27 | ]; 28 | 29 | public static bool IsSystemProcess(Process p) => SystemProcessList.Contains(p.ProcessName.ToLower()); 30 | 31 | public static uint GetProcessIDFromWindowHandle(IntPtr hwnd) 32 | { 33 | _ = NativeMethods.GetWindowThreadProcessId(hwnd, out var processId); 34 | return processId; 35 | } 36 | 37 | public static bool TryKill(Process p) 38 | { 39 | try 40 | { 41 | if (!p.HasExited) 42 | { 43 | p.Kill(); 44 | return p.WaitForExit(50); 45 | } 46 | } 47 | catch (Exception e) 48 | { 49 | Log.Exception($"Failed to kill process {p.ProcessName}", e, typeof(ProcessHelper)); 50 | } 51 | 52 | return false; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ProcessKiller/ProcessKiller.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0-windows 4 | true 5 | enable 6 | enable 7 | true 8 | Community.PowerToys.Run.Plugin.ProcessKiller 9 | Community.PowerToys.Run.Plugin.ProcessKiller 10 | $([System.IO.File]::ReadAllText('$(MSBuildProjectDirectory)/plugin.json')) 11 | $([System.Text.RegularExpressions.Regex]::Match($(PluginJson), '"Version": "(\S+)"').Groups[1].Value) 12 | x64;ARM64 13 | Powertoys Run ProcessKiller 14 | Powertoys Run ProcessKiller Plugin 15 | 8LWXpg 16 | https://github.com/8LWXpg/PowerToysRun-ProcessKiller 17 | 18 | 19 | 20 | true 21 | DEBUG;TRACE 22 | full 23 | false 24 | 25 | 26 | 27 | TRACE 28 | true 29 | pdbonly 30 | 31 | 32 | 33 | 34 | .\Lib\PowerToys.Common.UI.dll 35 | 36 | 37 | .\Lib\PowerToys.ManagedCommon.dll 38 | 39 | 40 | .\Lib\PowerToys.Settings.UI.Lib.dll 41 | 42 | 43 | .\Lib\Wox.Infrastructure.dll 44 | 45 | 46 | .\Lib\Wox.Plugin.dll 47 | 48 | 49 | 50 | 51 | 52 | ResXFileCodeGenerator 53 | Resources.Designer.cs 54 | 55 | 56 | True 57 | True 58 | Resources.resx 59 | 60 | 61 | 62 | 63 | 64 | PreserveNewest 65 | 66 | 67 | 68 | PreserveNewest 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /ProcessKiller/ProcessQuery.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using Wox.Infrastructure; 4 | using Wox.Plugin; 5 | using Wox.Plugin.Common.Win32; 6 | 7 | namespace Community.PowerToys.Run.Plugin.ProcessKiller; 8 | 9 | public static class ProcessQuery 10 | { 11 | public static List GetMatchingResults(string search, string rawQuery, bool showCommandLine, bool showShellExplorer, string fallbackIcon, PluginInitContext context) 12 | { 13 | var shellWindowId = ProcessHelper.GetProcessIDFromWindowHandle(NativeMethods.GetShellWindow()); 14 | var processes = Process.GetProcesses().Where(p => !ProcessHelper.IsSystemProcess(p) && (p.Id != shellWindowId || showShellExplorer)).ToList(); 15 | CommandLineQuery? commandLineQuery = showCommandLine ? new() : null; 16 | 17 | List results = processes 18 | .ConvertAll(p => 19 | { 20 | MatchResult matchResult = StringMatcher.FuzzySearch(search, $"{p.ProcessName} - {p.Id}"); 21 | return (Result)new ProcessResult(p, matchResult, commandLineQuery, rawQuery, showCommandLine, fallbackIcon, context); 22 | }); 23 | 24 | if (!string.IsNullOrWhiteSpace(search)) 25 | { 26 | _ = results.RemoveAll(r => r.Score <= 0); 27 | } 28 | 29 | return results; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ProcessKiller/ProcessResult.cs: -------------------------------------------------------------------------------- 1 | using Community.PowerToys.Run.Plugin.ProcessKiller.Properties; 2 | using System.Diagnostics; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | using Wox.Infrastructure; 6 | using Wox.Plugin; 7 | using Wox.Plugin.Common.Win32; 8 | 9 | namespace Community.PowerToys.Run.Plugin.ProcessKiller; 10 | 11 | public class ProcessResult : Result 12 | { 13 | public ProcessResult(Process process, MatchResult matchResult, CommandLineQuery? commandLineQuery, string rawQuery, bool showCommandLine, string fallbackIcon, PluginInitContext context) 14 | { 15 | (var iconFallback, var path) = TryGetProcessFilename(process); 16 | var commandLine = commandLineQuery is null ? null : commandLineQuery.GetCommandLine(process.Id); 17 | 18 | Title = $"{process.ProcessName} - {process.Id}"; 19 | SubTitle = path; 20 | IcoPath = iconFallback ? fallbackIcon : path; 21 | Score = matchResult.Score; 22 | TitleHighlightData = matchResult.MatchData; 23 | ToolTipData = new ToolTipData($"{process.ProcessName} - {process.Id}", GetToolTipText(process, path, showCommandLine, commandLine)); 24 | ContextData = process; 25 | Action = c => 26 | { 27 | _ = ProcessHelper.TryKill(process); 28 | context.API.ChangeQuery(rawQuery, true); 29 | return true; 30 | }; 31 | } 32 | 33 | private static string GetToolTipText(Process process, string path, bool showCommandLine, string? commandLine) 34 | { 35 | var textBuilder = new StringBuilder(); 36 | 37 | if (!string.IsNullOrWhiteSpace(process.MainWindowTitle)) 38 | { 39 | _ = textBuilder.AppendLine($"{Resources.plugin_tool_tip_main_window}:\n {process.MainWindowTitle}"); 40 | } 41 | 42 | _ = textBuilder.AppendLine($"{Resources.plugin_tool_tip_memory}:\n {FormatMemorySize(process.WorkingSet64)}"); 43 | _ = textBuilder.AppendLine($"{Resources.plugin_tool_tip_path}:\n {path}"); 44 | 45 | if (showCommandLine && !string.IsNullOrWhiteSpace(commandLine)) 46 | { 47 | _ = textBuilder.AppendLine($"{Resources.plugin_tool_tip_command_line}:\n {commandLine}"); 48 | } 49 | 50 | textBuilder.Length -= 2; // Length of "\r\n" 51 | return textBuilder.ToString(); 52 | } 53 | 54 | /// 55 | /// Try to get path of the process. If not, returns process name. 56 | /// 57 | /// 58 | /// 59 | private static (bool, string) TryGetProcessFilename(Process p) 60 | { 61 | try 62 | { 63 | var bufferSize = 2048; 64 | unsafe 65 | { 66 | var buffer = stackalloc char[bufferSize]; 67 | var len = bufferSize; 68 | var ptr = NativeMethods.OpenProcess(ProcessAccessFlags.QueryLimitedInformation, false, p.Id); 69 | return QueryFullProcessImageName(ptr, 0, buffer, ref len) ? 70 | (false, new(buffer)) : 71 | (true, p.ProcessName); 72 | } 73 | } 74 | catch 75 | { 76 | return (true, p.ProcessName); 77 | } 78 | } 79 | 80 | [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] 81 | private static extern unsafe bool QueryFullProcessImageName( 82 | [In] IntPtr hProcess, 83 | [In] int dwFlags, 84 | [Out] char* lpExeName, 85 | ref int lpdwSize); 86 | 87 | private const double KB = 1024; 88 | private const double MB = KB * 1024; 89 | private const double GB = MB * 1024; 90 | public static string FormatMemorySize(long mem) => (double)mem switch 91 | { 92 | < KB => $"{mem:0.##} B", 93 | < MB => $"{mem / KB:0.##} KB", 94 | < GB => $"{mem / MB:0.##} MB", 95 | _ => $"{mem / GB:0.##} GB" 96 | }; 97 | } 98 | -------------------------------------------------------------------------------- /ProcessKiller/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Community.PowerToys.Run.Plugin.ProcessKiller.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Community.PowerToys.Run.Plugin.ProcessKiller.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to Kill a process. 65 | /// 66 | internal static string plugin_description { 67 | get { 68 | return ResourceManager.GetString("plugin_description", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to Kill all instances of "{0}". 74 | /// 75 | internal static string plugin_kill_all { 76 | get { 77 | return ResourceManager.GetString("plugin_kill_all", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to Kill {0} processes. 83 | /// 84 | internal static string plugin_kill_all_count { 85 | get { 86 | return ResourceManager.GetString("plugin_kill_all_count", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// Looks up a localized string similar to Kill all instances. 92 | /// 93 | internal static string plugin_kill_instances { 94 | get { 95 | return ResourceManager.GetString("plugin_kill_instances", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// Looks up a localized string similar to Process Killer. 101 | /// 102 | internal static string plugin_name { 103 | get { 104 | return ResourceManager.GetString("plugin_name", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// Looks up a localized string similar to Minimum matches to show "Kill all instances". 110 | /// 111 | internal static string plugin_setting_kill_all_count { 112 | get { 113 | return ResourceManager.GetString("plugin_setting_kill_all_count", resourceCulture); 114 | } 115 | } 116 | 117 | /// 118 | /// Looks up a localized string similar to Show command line of the process in the tool tip. 119 | /// 120 | internal static string plugin_setting_show_command_line { 121 | get { 122 | return ResourceManager.GetString("plugin_setting_show_command_line", resourceCulture); 123 | } 124 | } 125 | 126 | /// 127 | /// Looks up a localized string similar to This may slow down the plugin. 128 | /// 129 | internal static string plugin_setting_show_command_line_description { 130 | get { 131 | return ResourceManager.GetString("plugin_setting_show_command_line_description", resourceCulture); 132 | } 133 | } 134 | 135 | /// 136 | /// Looks up a localized string similar to Show explorer.exe that hosts Windows Shell. 137 | /// 138 | internal static string plugin_setting_show_shell_explorer { 139 | get { 140 | return ResourceManager.GetString("plugin_setting_show_shell_explorer", resourceCulture); 141 | } 142 | } 143 | 144 | /// 145 | /// Looks up a localized string similar to Command Line. 146 | /// 147 | internal static string plugin_tool_tip_command_line { 148 | get { 149 | return ResourceManager.GetString("plugin_tool_tip_command_line", resourceCulture); 150 | } 151 | } 152 | 153 | /// 154 | /// Looks up a localized string similar to Main Window. 155 | /// 156 | internal static string plugin_tool_tip_main_window { 157 | get { 158 | return ResourceManager.GetString("plugin_tool_tip_main_window", resourceCulture); 159 | } 160 | } 161 | 162 | /// 163 | /// Looks up a localized string similar to Memory Usage. 164 | /// 165 | internal static string plugin_tool_tip_memory { 166 | get { 167 | return ResourceManager.GetString("plugin_tool_tip_memory", resourceCulture); 168 | } 169 | } 170 | 171 | /// 172 | /// Looks up a localized string similar to Path. 173 | /// 174 | internal static string plugin_tool_tip_path { 175 | get { 176 | return ResourceManager.GetString("plugin_tool_tip_path", resourceCulture); 177 | } 178 | } 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /ProcessKiller/Properties/Resources.de-DE.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Einen Prozess beenden. 122 | 123 | 124 | Alle Instanzen von "{0}" beenden 125 | 126 | 127 | {0} Prozesse beenden 128 | 129 | 130 | Alle Instanzen beenden 131 | 132 | 133 | Process Killer 134 | 135 | 136 | Mindestanzahl an Treffer, damit "Alle Instanzen beenden" angezeigt wird 137 | 138 | 139 | Befehlszeile des Prozesses im Tooltip anzeigen. 140 | 141 | 142 | Dies kann das Plugin verlangsamen. 143 | 144 | 145 | Befehlszeile 146 | 147 | 148 | Hauptfenster 149 | 150 | 151 | Speichernutzung 152 | 153 | 154 | Pfad 155 | 156 | -------------------------------------------------------------------------------- /ProcessKiller/Properties/Resources.pl-PL.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Zabija procesy. 122 | 123 | 124 | Zabij wszystkie instancje "{0}" 125 | 126 | 127 | Zabij {0} procesów 128 | 129 | 130 | Zabij wszystkie instancje 131 | 132 | 133 | Process Killer 134 | 135 | 136 | Minimalna liczba dopasowań, aby pokazać opcję "Zabij wszystkie instancje" 137 | 138 | 139 | Użycie pamięci 140 | 141 | -------------------------------------------------------------------------------- /ProcessKiller/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Kill a process 122 | 123 | 124 | Kill all instances of "{0}" 125 | 126 | 127 | Kill {0} processes 128 | 129 | 130 | Kill all instances 131 | 132 | 133 | Process Killer 134 | 135 | 136 | Minimum matches to show "Kill all instances" 137 | 138 | 139 | Show command line of the process in the tool tip 140 | 141 | 142 | This may slow down the plugin 143 | 144 | 145 | Show explorer.exe that hosts Windows Shell 146 | 147 | 148 | Command Line 149 | 150 | 151 | Main Window 152 | 153 | 154 | Memory Usage 155 | 156 | 157 | Path 158 | 159 | -------------------------------------------------------------------------------- /ProcessKiller/Properties/Resources.tr-TR.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Bir görevi sonlandır. 122 | 123 | 124 | Tüm "{0}" görevlerini sonlandır 125 | 126 | 127 | {0} görevlerini sonlandır 128 | 129 | 130 | Tüm görevleri sonlandır. 131 | 132 | 133 | Process Killer 134 | 135 | 136 | "Tüm görevleri sonlandır"'ı göstermek için olan minimum eşleşmeler. 137 | 138 | 139 | Gerçekleşen görevin komut satırını araç ipuçlarında göster. 140 | 141 | 142 | Bu eklentiyi yavaşlatabilir. 143 | 144 | 145 | Windows Shell'i hostlayan explorer.exe'yi göster. 146 | 147 | 148 | Komut Satırı 149 | 150 | 151 | Ana Pencere 152 | 153 | 154 | Bellek Kullanımı 155 | 156 | 157 | Dizin 158 | 159 | -------------------------------------------------------------------------------- /ProcessKiller/Properties/Resources.uk-UA.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Завершити процес. 122 | 123 | 124 | Завершити всі екземпляри "{0}" 125 | 126 | 127 | Завершити {0} процесів 128 | 129 | 130 | Завершити всі екземпляри 131 | 132 | 133 | Завершувач процесів 134 | 135 | 136 | Мінімальна кількість збігів для відображення "Завершити всі екземпляри" 137 | 138 | 139 | Показувати командний рядок процесу у підказці 140 | 141 | 142 | Це може уповільнити роботу плагіна. 143 | 144 | 145 | Показувати explorer.exe, який підтримує оболонку Windows 146 | 147 | 148 | Командний рядок 149 | 150 | 151 | Головне вікно 152 | 153 | 154 | Використання пам'яті 155 | 156 | 157 | Шлях 158 | 159 | -------------------------------------------------------------------------------- /ProcessKiller/Properties/Resources.zh-CN.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 终止指定进程 122 | 123 | 124 | 终止所有 "{0}" 实例 125 | 126 | 127 | 这将终止 {0} 个进程 128 | 129 | 130 | 终止所有实例 131 | 132 | 133 | Process Killer 134 | 135 | 136 | 最小匹配数以显示 “终止所有实例” 137 | 138 | 139 | 在工具的提示中显示进程的命令行 140 | 141 | 142 | 这可能会减慢插件的速度 143 | 144 | 145 | 显示 explorer.exe 进程 146 | 147 | 148 | 命令行 149 | 150 | 151 | 主窗口标题 152 | 153 | 154 | 内存使用量 155 | 156 | 157 | 路径 158 | 159 | -------------------------------------------------------------------------------- /ProcessKiller/Properties/Resources.zh-TW.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 終止處理程序 122 | 123 | 124 | 終止所有 "{0}" 程序 125 | 126 | 127 | 終止 {0} 個程序 128 | 129 | 130 | 終止所有程序 131 | 132 | 133 | Process Killer 134 | 135 | 136 | 顯示 "終止所有程序" 的最少數量 137 | 138 | 139 | 在工具提示顯示程序的命令行 140 | 141 | 142 | 這可能會影響插件的效能 143 | 144 | 145 | 命令行 146 | 147 | 148 | 主視窗標題 149 | 150 | 151 | 記憶體使用量 152 | 153 | 154 | 檔案路徑 155 | 156 | -------------------------------------------------------------------------------- /ProcessKiller/copyLib.ps1: -------------------------------------------------------------------------------- 1 | # this script uses [gsudo](https://github.com/gerardog/gsudo) 2 | 3 | Push-Location 4 | Set-Location $PSScriptRoot 5 | 6 | sudo { 7 | $ptPath = "C:\Program Files\PowerToys" 8 | 9 | @( 10 | 'PowerToys.Common.UI.dll', 11 | 'PowerToys.ManagedCommon.dll', 12 | 'PowerToys.Settings.UI.Lib.dll', 13 | 'Wox.Infrastructure.dll', 14 | 'Wox.Plugin.dll' 15 | ) | ForEach-Object { 16 | New-Item ./Lib/$_ -ItemType SymbolicLink -Value "$ptPath\$_" -Force 17 | } 18 | } 19 | 20 | Pop-Location 21 | -------------------------------------------------------------------------------- /ProcessKiller/debug.ps1: -------------------------------------------------------------------------------- 1 | # this script uses [gsudo](https://github.com/gerardog/gsudo) 2 | 3 | Push-Location 4 | Set-Location $PSScriptRoot 5 | 6 | sudo { 7 | Start-Job { Stop-Process -Name PowerToys* } | Wait-Job > $null 8 | 9 | # change this to your PowerToys installation path 10 | $ptPath = 'C:\Program Files\PowerToys' 11 | $project = 'ProcessKiller' 12 | $debug = '.\bin\x64\Debug\net9.0-windows' 13 | $dest = "$env:LOCALAPPDATA\Microsoft\PowerToys\PowerToys Run\Plugins\$project" 14 | $files = @( 15 | "Community.PowerToys.Run.Plugin.$project.deps.json", 16 | "Community.PowerToys.Run.Plugin.$project.dll", 17 | 'plugin.json', 18 | 'Images' 19 | ) 20 | 21 | Set-Location $debug 22 | mkdir $dest -Force -ErrorAction Ignore | Out-Null 23 | Copy-Item $files $dest -Force -Recurse 24 | 25 | & "$ptPath\PowerToys.exe" 26 | } 27 | 28 | Pop-Location 29 | -------------------------------------------------------------------------------- /ProcessKiller/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "78844AE082E24C0C8AC9DB222FF67317", 3 | "ActionKeyword": "kl", 4 | "Disabled": false, 5 | "IsGlobal": false, 6 | "Name": "Process Killer", 7 | "Author": "8LWXpg", 8 | "Version": "1.12.2", 9 | "Language": "csharp", 10 | "Website": "https://github.com/8LWXpg/PowerToysRun-ProcessKiller", 11 | "ExecuteFileName": "Community.PowerToys.Run.Plugin.ProcessKiller.dll", 12 | "IcoPathDark": "Images\\ProcessKiller.dark.png", 13 | "IcoPathLight": "Images\\ProcessKiller.light.png" 14 | } -------------------------------------------------------------------------------- /ProcessKiller/release.ps1: -------------------------------------------------------------------------------- 1 | Push-Location 2 | Set-Location $PSScriptRoot 3 | 4 | $name = 'ProcessKiller' 5 | $assembly = "Community.PowerToys.Run.Plugin.$name" 6 | $version = "v$((Get-Content ./plugin.json | ConvertFrom-Json).Version)" 7 | $archs = @('x64', 'arm64') 8 | 9 | git tag $version 10 | git push --tags 11 | 12 | Remove-Item ./out/*.zip -Recurse -Force -ErrorAction Ignore 13 | foreach ($arch in $archs) { 14 | $releasePath = "./bin/$arch/Release/net9.0-windows" 15 | 16 | dotnet build -c Release /p:Platform=$arch 17 | 18 | Remove-Item "./out/$name/*" -Recurse -Force -ErrorAction Ignore 19 | $items = @( 20 | "$releasePath/$assembly.deps.json", 21 | "$releasePath/$assembly.dll", 22 | "$releasePath/plugin.json", 23 | "$releasePath/Images", 24 | "$releasePath/pl-PL", 25 | "$releasePath/zh-TW", 26 | "$releasePath/de-DE", 27 | "$releasePath/zh-CN", 28 | "$ReleasePath/uk-UA", 29 | "$ReleasePath/tr-TR" 30 | ) 31 | Copy-Item $items "./out/$name" -Recurse -Force 32 | Compress-Archive "./out/$name" "./out/$name-$version-$arch.zip" -Force 33 | } 34 | 35 | gh release create $version (Get-ChildItem ./out/*.zip) 36 | Pop-Location 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ProcessKiller Plugin for PowerToys Run 2 | 3 | A [PowerToys Run](https://aka.ms/PowerToysOverview_PowerToysRun) plugin for killing processes. 4 | 5 | Derived from FlowLauncher Plugin [ProcessKiller](https://github.com/Flow-Launcher/Flow.Launcher/tree/dev/Plugins/Flow.Launcher.Plugin.ProcessKiller). 6 | 7 | Check out the [Template](https://github.com/8LWXpg/PowerToysRun-PluginTemplate) for a starting point to create your own plugin. 8 | 9 | ## Features 10 | 11 | ### Kill a process 12 | 13 | ![kill](./assets/kl.png) 14 | 15 | ### Kill all instances of a process 16 | 17 | ![kill all](./assets/kl_all.png) 18 | 19 | ### Kill a process by Port number 20 | 21 | Use `kl : ` to search for IP and Port. 22 | 23 | ![kill by port](./assets/port.png) 24 | 25 | ## Installation 26 | 27 | ### Manual 28 | 29 | 1. Download the latest release of the from the releases page. 30 | 2. Extract the zip file's contents to `%LocalAppData%\Microsoft\PowerToys\PowerToys Run\Plugins` 31 | 3. Restart PowerToys. 32 | 33 | ### Via [ptr](https://github.com/8LWXpg/ptr) 34 | 35 | ```shell 36 | ptr add ProcessKiller 8LWXpg/PowerToysRun-ProcessKiller 37 | ``` 38 | 39 | ## Usage 40 | 41 | 1. Open PowerToys Run (default shortcut is Alt+Space). 42 | 2. Type `kl` and search for process name or ID. 43 | 44 | ## Building 45 | 46 | 1. Clone the repository and the dependencies in `/lib` with `ProcessKiller/copyLib.ps1`. 47 | 2. Run `dotnet build -c Release`. 48 | 49 | ## Debugging 50 | 51 | 1. Clone the repository and the dependencies in `/lib` with `ProcessKiller/copyLib.ps1`. 52 | 2. Build the project in `Debug` configuration. 53 | 3. Make sure you have [gsudo](https://github.com/gerardog/gsudo) installed in the path. 54 | 4. Run `debug.ps1` (change `$ptPath` if you have PowerToys installed in a different location). 55 | 5. Attach to the `PowerToys.PowerLauncher` process in Visual Studio. 56 | 57 | ## Contributing 58 | 59 | ### Localization 60 | 61 | If you want to help localize this plugin, please check the [localization guide](./Localizing.md) 62 | -------------------------------------------------------------------------------- /assets/kl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-ProcessKiller/9046f5770325f94935f644f05241dcbd70a13612/assets/kl.png -------------------------------------------------------------------------------- /assets/kl_all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-ProcessKiller/9046f5770325f94935f644f05241dcbd70a13612/assets/kl_all.png -------------------------------------------------------------------------------- /assets/port.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-ProcessKiller/9046f5770325f94935f644f05241dcbd70a13612/assets/port.png --------------------------------------------------------------------------------