├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── bug.yml │ └── feature.yml ├── .gitignore ├── GitHubRepo.sln ├── GitHubRepo ├── GitHubRepo.csproj ├── GitHubResponse.cs ├── Images │ ├── dark │ │ ├── Fork.png │ │ ├── Fork.svg │ │ ├── GitHub.png │ │ ├── GitHub.svg │ │ ├── Repo.png │ │ └── Repo.svg │ └── light │ │ ├── Fork.png │ │ ├── Fork.svg │ │ ├── GitHub.png │ │ ├── GitHub.svg │ │ ├── Repo.png │ │ └── Repo.svg ├── Lib │ ├── PowerToys.Common.UI.dll │ ├── PowerToys.ManagedCommon.dll │ ├── PowerToys.Settings.UI.Lib.dll │ ├── Wox.Infrastructure.dll │ └── Wox.Plugin.dll ├── Main.cs ├── Properties │ ├── Resources.Designer.cs │ ├── Resources.de-DE.resx │ ├── Resources.resx │ ├── Resources.uk-UA.resx │ └── Resources.zh-CN.resx ├── QueryResult.cs ├── copyLib.ps1 ├── debug.ps1 ├── plugin.json └── release.ps1 ├── LICENSE ├── Localizing.md ├── README.md └── assets ├── default_user.png ├── repo.png ├── token.png └── user.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 ignore entries 366 | out/ 367 | -------------------------------------------------------------------------------- /GitHubRepo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.8.34511.84 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitHubRepo", "GitHubRepo\GitHubRepo.csproj", "{C871B744-7232-40A5-9BE2-4D812B8262E0}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5EAAFC82-48C4-4ECE-BF15-1C0E485CA57B}" 9 | ProjectSection(SolutionItems) = preProject 10 | .editorconfig = .editorconfig 11 | .gitignore = .gitignore 12 | README.md = README.md 13 | EndProjectSection 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|ARM64 = Debug|ARM64 18 | Debug|x64 = Debug|x64 19 | Release|ARM64 = Release|ARM64 20 | Release|x64 = Release|x64 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {C871B744-7232-40A5-9BE2-4D812B8262E0}.Debug|ARM64.ActiveCfg = Debug|ARM64 24 | {C871B744-7232-40A5-9BE2-4D812B8262E0}.Debug|ARM64.Build.0 = Debug|ARM64 25 | {C871B744-7232-40A5-9BE2-4D812B8262E0}.Debug|x64.ActiveCfg = Debug|x64 26 | {C871B744-7232-40A5-9BE2-4D812B8262E0}.Debug|x64.Build.0 = Debug|x64 27 | {C871B744-7232-40A5-9BE2-4D812B8262E0}.Release|ARM64.ActiveCfg = Release|ARM64 28 | {C871B744-7232-40A5-9BE2-4D812B8262E0}.Release|ARM64.Build.0 = Release|ARM64 29 | {C871B744-7232-40A5-9BE2-4D812B8262E0}.Release|x64.ActiveCfg = Release|x64 30 | {C871B744-7232-40A5-9BE2-4D812B8262E0}.Release|x64.Build.0 = Release|x64 31 | EndGlobalSection 32 | GlobalSection(SolutionProperties) = preSolution 33 | HideSolutionNode = FALSE 34 | EndGlobalSection 35 | GlobalSection(ExtensibilityGlobals) = postSolution 36 | SolutionGuid = {02FA5E3D-9842-4735-A71E-3A30DCCB8B4C} 37 | EndGlobalSection 38 | EndGlobal 39 | -------------------------------------------------------------------------------- /GitHubRepo/GitHubRepo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0-windows 4 | true 5 | enable 6 | enable 7 | Community.PowerToys.Run.Plugin.GitHubRepo 8 | Community.PowerToys.Run.Plugin.GitHubRepo 9 | $([System.IO.File]::ReadAllText('$(MSBuildProjectDirectory)/plugin.json')) 10 | $([System.Text.RegularExpressions.Regex]::Match($(PluginJson), '"Version": "(\S+)"').Groups[1].Value) 11 | x64;ARM64 12 | 8LWXpg 13 | Powertoys Run GitHubRepo 14 | Powertoys Run GitHubRepo Plugin 15 | https://github.com/8LWXpg/PowerToysRun-GitHubRepo 16 | 17 | 18 | 19 | true 20 | DEBUG;TRACE 21 | full 22 | false 23 | 24 | 25 | 26 | TRACE 27 | true 28 | pdbonly 29 | 30 | 31 | 32 | 33 | .\Lib\PowerToys.Common.UI.dll 34 | 35 | 36 | .\Lib\PowerToys.ManagedCommon.dll 37 | 38 | 39 | .\Lib\Wox.Infrastructure.dll 40 | 41 | 42 | .\Lib\Wox.Plugin.dll 43 | 44 | 45 | .\Lib\PowerToys.Settings.UI.Lib.dll 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | True 56 | True 57 | Resources.resx 58 | 59 | 60 | 61 | 62 | 63 | PublicResXFileCodeGenerator 64 | Resources.Designer.cs 65 | 66 | 67 | 68 | 69 | 70 | PreserveNewest 71 | 72 | 73 | PreserveNewest 74 | 75 | 76 | PreserveNewest 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /GitHubRepo/GitHubResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | using System.Net.Http.Headers; 3 | using System.Text.Json; 4 | using System.Text.Json.Serialization; 5 | using Wox.Plugin.Logger; 6 | 7 | namespace Community.PowerToys.Run.Plugin.GitHubRepo; 8 | 9 | public record GitHubResponse 10 | { 11 | [JsonPropertyName("items")] 12 | public List Items { get; init; } 13 | 14 | public GitHubResponse(List items) => Items = items; 15 | } 16 | 17 | public record GitHubRepo 18 | { 19 | [JsonPropertyName("full_name")] 20 | public string FullName { get; init; } 21 | 22 | [JsonPropertyName("html_url")] 23 | public string HtmlUrl { get; init; } 24 | 25 | [JsonPropertyName("description")] 26 | public string Description { get; init; } 27 | 28 | [JsonPropertyName("fork")] 29 | public bool Fork { get; init; } 30 | 31 | public GitHubRepo(string fullName, string htmlUrl, string description, bool fork) 32 | { 33 | FullName = fullName; 34 | HtmlUrl = htmlUrl; 35 | Description = description; 36 | Fork = fork; 37 | } 38 | } 39 | 40 | public static class GitHub 41 | { 42 | private static readonly HttpClient Client; 43 | 44 | // Used to cancel the request if the user types a new query 45 | private static CancellationTokenSource? cts; 46 | private static string _url = "https://api.github.com"; 47 | public static string Url 48 | { 49 | get => _url; 50 | set => _url = string.IsNullOrEmpty(value) ? "https://api.github.com" : value; 51 | } 52 | 53 | static GitHub() 54 | { 55 | Client = new HttpClient(); 56 | Client.DefaultRequestHeaders.UserAgent.Add(ProductInfoHeaderValue.Parse("PowerToys")); 57 | Client.DefaultRequestHeaders.Add("Accept", "application/vnd.github+json"); 58 | Client.DefaultRequestHeaders.Add("X-GitHub-Api-Version", "2022-11-28"); 59 | } 60 | 61 | public static void UpdateAuthSetting(string auth) 62 | { 63 | if (string.IsNullOrEmpty(auth)) 64 | { 65 | _ = Client.DefaultRequestHeaders.Remove("Authorization"); 66 | } 67 | else 68 | { 69 | _ = Client.DefaultRequestHeaders.Remove("Authorization"); 70 | Client.DefaultRequestHeaders.Add("Authorization", $"Bearer {auth}"); 71 | } 72 | } 73 | 74 | public static async Task> RepoQuery(string query, int pageSize) 75 | { 76 | cts?.Cancel(); 77 | cts = new CancellationTokenSource(); 78 | 79 | return await SendRequest($"{_url}/search/repositories?per_page={pageSize}&q={query}", cts.Token); 80 | } 81 | 82 | public static async Task, Exception>?> UserRepoQuery(string user, int pageSize) 83 | { 84 | cts?.Cancel(); 85 | cts = new CancellationTokenSource(); 86 | 87 | try 88 | { 89 | // Sort by latest update, only works if your target is top 30 that recently updated 90 | return await SendRequest>($"{_url}/users/{user}/repos?per_page={pageSize}&sort=updated", cts.Token); 91 | } 92 | catch 93 | { 94 | return null; 95 | } 96 | } 97 | 98 | public static async Task, Exception>?> UserTokenQuery(int pageSize) 99 | { 100 | cts?.Cancel(); 101 | cts = new CancellationTokenSource(); 102 | 103 | try 104 | { 105 | return await SendRequest>($"{_url}/user/repos?per_page={pageSize}&sort=updated", cts.Token); 106 | } 107 | catch 108 | { 109 | return null; 110 | } 111 | } 112 | 113 | private static async Task> SendRequest(string url, CancellationToken token) 114 | { 115 | try 116 | { 117 | HttpResponseMessage responseMessage = await Client.GetAsync(url, token); 118 | _ = responseMessage.EnsureSuccessStatusCode(); 119 | var json = await responseMessage.Content.ReadAsStringAsync(token); 120 | T? response = JsonSerializer.Deserialize(json); 121 | return response!; 122 | } 123 | catch (Exception e) 124 | { 125 | Log.Error(e.Message, typeof(Main)); 126 | return e; 127 | } 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /GitHubRepo/Images/dark/Fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-GitHubRepo/95180bc7503df35783d581bac22017b41b8c2782/GitHubRepo/Images/dark/Fork.png -------------------------------------------------------------------------------- /GitHubRepo/Images/dark/Fork.svg: -------------------------------------------------------------------------------- 1 | 2 | 45 | -------------------------------------------------------------------------------- /GitHubRepo/Images/dark/GitHub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-GitHubRepo/95180bc7503df35783d581bac22017b41b8c2782/GitHubRepo/Images/dark/GitHub.png -------------------------------------------------------------------------------- /GitHubRepo/Images/dark/GitHub.svg: -------------------------------------------------------------------------------- 1 | 2 | 45 | -------------------------------------------------------------------------------- /GitHubRepo/Images/dark/Repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-GitHubRepo/95180bc7503df35783d581bac22017b41b8c2782/GitHubRepo/Images/dark/Repo.png -------------------------------------------------------------------------------- /GitHubRepo/Images/dark/Repo.svg: -------------------------------------------------------------------------------- 1 | 2 | 45 | -------------------------------------------------------------------------------- /GitHubRepo/Images/light/Fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-GitHubRepo/95180bc7503df35783d581bac22017b41b8c2782/GitHubRepo/Images/light/Fork.png -------------------------------------------------------------------------------- /GitHubRepo/Images/light/Fork.svg: -------------------------------------------------------------------------------- 1 | 2 | 45 | -------------------------------------------------------------------------------- /GitHubRepo/Images/light/GitHub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-GitHubRepo/95180bc7503df35783d581bac22017b41b8c2782/GitHubRepo/Images/light/GitHub.png -------------------------------------------------------------------------------- /GitHubRepo/Images/light/GitHub.svg: -------------------------------------------------------------------------------- 1 | 2 | 45 | -------------------------------------------------------------------------------- /GitHubRepo/Images/light/Repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-GitHubRepo/95180bc7503df35783d581bac22017b41b8c2782/GitHubRepo/Images/light/Repo.png -------------------------------------------------------------------------------- /GitHubRepo/Images/light/Repo.svg: -------------------------------------------------------------------------------- 1 | 2 | 45 | -------------------------------------------------------------------------------- /GitHubRepo/Lib/PowerToys.Common.UI.dll: -------------------------------------------------------------------------------- 1 | C:/Program Files/PowerToys/PowerToys.Common.UI.dll -------------------------------------------------------------------------------- /GitHubRepo/Lib/PowerToys.ManagedCommon.dll: -------------------------------------------------------------------------------- 1 | C:/Program Files/PowerToys/PowerToys.ManagedCommon.dll -------------------------------------------------------------------------------- /GitHubRepo/Lib/PowerToys.Settings.UI.Lib.dll: -------------------------------------------------------------------------------- 1 | C:/Program Files/PowerToys/PowerToys.Settings.UI.Lib.dll -------------------------------------------------------------------------------- /GitHubRepo/Lib/Wox.Infrastructure.dll: -------------------------------------------------------------------------------- 1 | C:/Program Files/PowerToys/Wox.Infrastructure.dll -------------------------------------------------------------------------------- /GitHubRepo/Lib/Wox.Plugin.dll: -------------------------------------------------------------------------------- 1 | C:/Program Files/PowerToys/Wox.Plugin.dll -------------------------------------------------------------------------------- /GitHubRepo/Main.cs: -------------------------------------------------------------------------------- 1 | using Community.PowerToys.Run.Plugin.GitHubRepo.Properties; 2 | using LazyCache; 3 | using ManagedCommon; 4 | using Microsoft.PowerToys.Settings.UI.Library; 5 | using System.Globalization; 6 | using System.Text; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Input; 10 | using Wox.Infrastructure; 11 | using Wox.Plugin; 12 | using BrowserInfo = Wox.Plugin.Common.DefaultBrowserInfo; 13 | 14 | namespace Community.PowerToys.Run.Plugin.GitHubRepo; 15 | 16 | public partial class Main : IPlugin, IPluginI18n, ISettingProvider, IReloadable, IDisposable, IDelayedExecutionPlugin, IContextMenu 17 | { 18 | private static readonly CompositeFormat PluginInBrowserName = CompositeFormat.Parse(Resources.in_browser_name); 19 | private const string DefaultUser = nameof(DefaultUser); 20 | private string? _defaultUser; 21 | private const string AuthToken = nameof(AuthToken); 22 | private string? _authToken; 23 | private const string SelfHostUrl = nameof(SelfHostUrl); 24 | private const string ResultNumber = nameof(ResultNumber); 25 | private int _resultNumber; 26 | 27 | private string? _iconFolderPath; 28 | private string? _iconFork; 29 | private string? _iconRepo; 30 | private string? _icon; 31 | private CachingService? _cache; 32 | // additional data for context menu 33 | private record ResultData(string Url); 34 | 35 | private PluginInitContext? _context; 36 | private bool _disposed; 37 | public string Name => Resources.plugin_name; 38 | public string Description => Resources.plugin_description; 39 | public static string PluginID => "47B63DBFBDEE4F9C85EBA5F6CD69E243"; 40 | 41 | public IEnumerable AdditionalOptions => 42 | [ 43 | new() 44 | { 45 | PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Textbox, 46 | Key = DefaultUser, 47 | DisplayLabel = Resources.option_default_user, 48 | DisplayDescription = Resources.option_default_user_desc, 49 | // Max length of a GitHub username is 39 50 | TextBoxMaxLength = 39, 51 | }, 52 | new() 53 | { 54 | PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Textbox, 55 | Key = AuthToken, 56 | DisplayLabel = Resources.option_auth_token, 57 | }, 58 | new() 59 | { 60 | PluginOptionType = PluginAdditionalOption.AdditionalOptionType.CheckboxAndTextbox, 61 | Key = SelfHostUrl, 62 | DisplayLabel = Resources.option_self_host_link, 63 | DisplayDescription = Resources.option_self_host_link_desc, 64 | SecondDisplayLabel = Resources.option_url, 65 | }, 66 | new() 67 | { 68 | PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Numberbox, 69 | Key = ResultNumber, 70 | DisplayLabel = Resources.option_results_number, 71 | DisplayDescription = Resources.option_results_number_desc, 72 | NumberBoxMin = 30, 73 | NumberBoxMax = 100, 74 | }, 75 | ]; 76 | 77 | public void UpdateSettings(PowerLauncherPluginSettings settings) 78 | { 79 | _defaultUser = settings?.AdditionalOptions?.FirstOrDefault(static x => x.Key == DefaultUser)?.TextValue ?? string.Empty; 80 | // TODO: how to hide the auth token in settings? 81 | _authToken = settings?.AdditionalOptions?.FirstOrDefault(static x => x.Key == AuthToken)?.TextValue ?? string.Empty; 82 | _resultNumber = (int?)(settings?.AdditionalOptions?.FirstOrDefault(static x => x.Key == ResultNumber)?.NumberValue) ?? 30; 83 | GitHub.UpdateAuthSetting(_authToken); 84 | PluginAdditionalOption? selfHostUrl = settings?.AdditionalOptions?.FirstOrDefault(static x => x.Key == SelfHostUrl); 85 | GitHub.Url = selfHostUrl!.Value ? selfHostUrl.TextValue : string.Empty; 86 | } 87 | 88 | // handle user repo user 89 | public List Query(Query query) 90 | { 91 | ArgumentNullException.ThrowIfNull(query); 92 | 93 | var search = query.Search; 94 | 95 | // empty query 96 | if (string.IsNullOrEmpty(search)) 97 | { 98 | var arguments = "github.com"; 99 | return 100 | [ 101 | new Result 102 | { 103 | Title = Resources.open_github, 104 | SubTitle = string.Format(CultureInfo.CurrentCulture, PluginInBrowserName, BrowserInfo.Name ?? BrowserInfo.MSEdgeName), 105 | QueryTextDisplay = string.Empty, 106 | IcoPath = _icon, 107 | ProgramArguments = arguments, 108 | Action = action => Helper.OpenCommandInShell(BrowserInfo.Path, BrowserInfo.ArgumentsPattern, arguments), 109 | } 110 | ]; 111 | } 112 | 113 | // delay execution for repo query 114 | if (!search.Contains('/')) 115 | { 116 | return []; 117 | } 118 | 119 | List repos; 120 | string user; 121 | string target; 122 | 123 | if (search.StartsWith('/')) 124 | { 125 | if (string.IsNullOrEmpty(_defaultUser)) 126 | { 127 | return 128 | [ 129 | new Result 130 | { 131 | Title = Resources.default_user_not_set, 132 | SubTitle = Resources.default_user_not_set_description, 133 | QueryTextDisplay = string.Empty, 134 | IcoPath = _icon, 135 | Action = action => true, 136 | } 137 | ]; 138 | } 139 | 140 | user = _defaultUser; 141 | target = search[1..]; 142 | repos = !string.IsNullOrEmpty(_authToken) ? _cache.GetOrAdd(user, UserTokenQuery) : _cache.GetOrAdd(user, () => UserRepoQuery(user)); 143 | } 144 | else 145 | { 146 | var split = search.Split('/', 2); 147 | 148 | user = split[0]; 149 | target = split[1]; 150 | 151 | repos = _cache.GetOrAdd(user, () => UserRepoQuery(user)); 152 | } 153 | 154 | List results = repos.ConvertAll(repo => 155 | { 156 | var parts = repo.FullName.Split('/', 2); 157 | var repoName = parts.Length == 1 ? parts[0] : parts[1]; 158 | MatchResult match = StringMatcher.FuzzySearch(target, repoName); 159 | return new Result 160 | { 161 | Title = repo.FullName, 162 | SubTitle = repo.Description, 163 | QueryTextDisplay = search, 164 | IcoPath = repo.Fork ? _iconFork : _iconRepo, 165 | Score = match.Score, 166 | TitleHighlightData = match.MatchData?.ConvertAll(e => e + user.Length + 1), 167 | ContextData = new ResultData(repo.HtmlUrl), 168 | Action = action => Helper.OpenCommandInShell(BrowserInfo.Path, BrowserInfo.ArgumentsPattern, repo.HtmlUrl), 169 | }; 170 | }); 171 | 172 | if (!string.IsNullOrEmpty(target)) 173 | { 174 | _ = results.RemoveAll(r => r.Score <= 0); 175 | } 176 | 177 | return results; 178 | 179 | List UserRepoQuery(string user) => GitHub.UserRepoQuery(user, _resultNumber).Result!.Match( 180 | ok: r => r, 181 | err: e => [new(e.GetType().Name, string.Empty, e.Message, false)]); 182 | 183 | List UserTokenQuery() => GitHub.UserTokenQuery(_resultNumber).Result!.Match( 184 | ok: r => r, 185 | err: e => [new(e.GetType().Name, string.Empty, e.Message, false)]); 186 | } 187 | 188 | // handle repo search with delay 189 | public List Query(Query query, bool delayedExecution) 190 | { 191 | return !delayedExecution || query.Search.Contains('/') || string.IsNullOrWhiteSpace(query.Search) 192 | ? [] 193 | : RepoQuery(query.Search).ConvertAll(repo => new Result 194 | { 195 | Title = repo.FullName, 196 | SubTitle = repo.Description, 197 | QueryTextDisplay = query.Search, 198 | IcoPath = repo.Fork ? _iconFork : _iconRepo, 199 | ContextData = new ResultData(repo.HtmlUrl), 200 | Action = action => Helper.OpenCommandInShell(BrowserInfo.Path, BrowserInfo.ArgumentsPattern, repo.HtmlUrl), 201 | }); 202 | 203 | List RepoQuery(string search) => GitHub.RepoQuery(search, _resultNumber).Result.Match( 204 | ok: r => r.Items, 205 | err: e => [new(e.GetType().Name, string.Empty, e.Message, false)]); 206 | } 207 | 208 | public List LoadContextMenus(Result selectedResult) 209 | { 210 | if (selectedResult.ContextData is not ResultData selectedData) 211 | { 212 | return []; 213 | } 214 | 215 | var url = selectedData.Url; 216 | var issue = $"{url}/issues"; 217 | var pr = $"{url}/pulls"; 218 | return [ 219 | new () 220 | { 221 | PluginName = Name, 222 | Title = Resources.context_copy_link, 223 | Glyph = "\xE8C8", 224 | FontFamily = "Segoe Fluent Icons,Segoe MDL2 Assets", 225 | AcceleratorKey = Key.C, 226 | AcceleratorModifiers = ModifierKeys.Control, 227 | Action = _ => 228 | { 229 | Clipboard.SetText(url); 230 | return true; 231 | }, 232 | }, 233 | new () 234 | { 235 | PluginName = Name, 236 | Title = Resources.context_open_issues, 237 | Glyph = "\xE958", 238 | FontFamily = "Segoe Fluent Icons,Segoe MDL2 Assets", 239 | AcceleratorKey = Key.I, 240 | AcceleratorModifiers = ModifierKeys.Control, 241 | Action = _ => Helper.OpenCommandInShell(BrowserInfo.Path, BrowserInfo.ArgumentsPattern, issue), 242 | }, 243 | new () 244 | { 245 | PluginName = Name, 246 | Title = Resources.context_open_pull_requests, 247 | Glyph = "\xF003", 248 | FontFamily = "Segoe Fluent Icons,Segoe MDL2 Assets", 249 | AcceleratorKey = Key.P, 250 | AcceleratorModifiers = ModifierKeys.Control, 251 | Action = _ => Helper.OpenCommandInShell(BrowserInfo.Path, BrowserInfo.ArgumentsPattern, pr), 252 | }, 253 | ]; 254 | } 255 | 256 | public void Init(PluginInitContext context) 257 | { 258 | _context = context ?? throw new ArgumentNullException(nameof(context)); 259 | _context.API.ThemeChanged += OnThemeChanged; 260 | _cache = new CachingService(); 261 | _cache.DefaultCachePolicy.DefaultCacheDurationSeconds = (int)TimeSpan.FromMinutes(1).TotalSeconds; 262 | UpdateIconPath(_context.API.GetCurrentTheme()); 263 | BrowserInfo.UpdateIfTimePassed(); 264 | } 265 | 266 | public string GetTranslatedPluginTitle() => Resources.plugin_name; 267 | 268 | public string GetTranslatedPluginDescription() => Resources.plugin_description; 269 | 270 | private void OnThemeChanged(Theme oldTheme, Theme newTheme) => UpdateIconPath(newTheme); 271 | 272 | private void UpdateIconPath(Theme theme) 273 | { 274 | _iconFolderPath = theme is Theme.Light or Theme.HighContrastWhite ? "Images\\light" : "Images\\dark"; 275 | _icon = $"{_iconFolderPath}\\GitHub.png"; 276 | _iconRepo = $"{_iconFolderPath}\\Repo.png"; 277 | _iconFork = $"{_iconFolderPath}\\Fork.png"; 278 | } 279 | 280 | public Control CreateSettingPanel() => throw new NotImplementedException(); 281 | 282 | public void ReloadData() 283 | { 284 | if (_context is null) 285 | { 286 | return; 287 | } 288 | 289 | UpdateIconPath(_context.API.GetCurrentTheme()); 290 | BrowserInfo.UpdateIfTimePassed(); 291 | } 292 | 293 | public void Dispose() 294 | { 295 | Dispose(true); 296 | GC.SuppressFinalize(this); 297 | } 298 | 299 | protected virtual void Dispose(bool disposing) 300 | { 301 | if (!_disposed && disposing) 302 | { 303 | if (_context != null && _context.API != null) 304 | { 305 | _context.API.ThemeChanged -= OnThemeChanged; 306 | } 307 | 308 | _disposed = true; 309 | } 310 | } 311 | } 312 | -------------------------------------------------------------------------------- /GitHubRepo/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.GitHubRepo.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 | public 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.GitHubRepo.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 Copy link (Ctrl+C). 65 | /// 66 | internal static string context_copy_link { 67 | get { 68 | return ResourceManager.GetString("context_copy_link", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to Open issues (Ctrl+I). 74 | /// 75 | internal static string context_open_issues { 76 | get { 77 | return ResourceManager.GetString("context_open_issues", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to Open pull requests (Ctrl+P). 83 | /// 84 | internal static string context_open_pull_requests { 85 | get { 86 | return ResourceManager.GetString("context_open_pull_requests", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// Looks up a localized string similar to Default user is not set. 92 | /// 93 | internal static string default_user_not_set { 94 | get { 95 | return ResourceManager.GetString("default_user_not_set", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// Looks up a localized string similar to Change in settings. 101 | /// 102 | internal static string default_user_not_set_description { 103 | get { 104 | return ResourceManager.GetString("default_user_not_set_description", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// Looks up a localized string similar to In {0}. 110 | /// 111 | internal static string in_browser_name { 112 | get { 113 | return ResourceManager.GetString("in_browser_name", resourceCulture); 114 | } 115 | } 116 | 117 | /// 118 | /// Looks up a localized string similar to Open github.com. 119 | /// 120 | internal static string open_github { 121 | get { 122 | return ResourceManager.GetString("open_github", resourceCulture); 123 | } 124 | } 125 | 126 | /// 127 | /// Looks up a localized string similar to GitHub authentication token. 128 | /// 129 | internal static string option_auth_token { 130 | get { 131 | return ResourceManager.GetString("option_auth_token", resourceCulture); 132 | } 133 | } 134 | 135 | /// 136 | /// Looks up a localized string similar to Default user. 137 | /// 138 | internal static string option_default_user { 139 | get { 140 | return ResourceManager.GetString("option_default_user", resourceCulture); 141 | } 142 | } 143 | 144 | /// 145 | /// Looks up a localized string similar to The user used when type "/". 146 | /// 147 | internal static string option_default_user_desc { 148 | get { 149 | return ResourceManager.GetString("option_default_user_desc", resourceCulture); 150 | } 151 | } 152 | 153 | /// 154 | /// Looks up a localized string similar to Number of results. 155 | /// 156 | internal static string option_results_number { 157 | get { 158 | return ResourceManager.GetString("option_results_number", resourceCulture); 159 | } 160 | } 161 | 162 | /// 163 | /// Looks up a localized string similar to Choose how many results to load each time. 164 | /// 165 | internal static string option_results_number_desc { 166 | get { 167 | return ResourceManager.GetString("option_results_number_desc", resourceCulture); 168 | } 169 | } 170 | 171 | /// 172 | /// Looks up a localized string similar to Search self-hosted GitHub. 173 | /// 174 | internal static string option_self_host_link { 175 | get { 176 | return ResourceManager.GetString("option_self_host_link", resourceCulture); 177 | } 178 | } 179 | 180 | /// 181 | /// Looks up a localized string similar to This replaces default url used. 182 | /// 183 | internal static string option_self_host_link_desc { 184 | get { 185 | return ResourceManager.GetString("option_self_host_link_desc", resourceCulture); 186 | } 187 | } 188 | 189 | /// 190 | /// Looks up a localized string similar to Url of API endpoint. 191 | /// 192 | internal static string option_url { 193 | get { 194 | return ResourceManager.GetString("option_url", resourceCulture); 195 | } 196 | } 197 | 198 | /// 199 | /// Looks up a localized string similar to Search a GitHub repository. 200 | /// 201 | internal static string plugin_description { 202 | get { 203 | return ResourceManager.GetString("plugin_description", resourceCulture); 204 | } 205 | } 206 | 207 | /// 208 | /// Looks up a localized string similar to GitHub Repository. 209 | /// 210 | internal static string plugin_name { 211 | get { 212 | return ResourceManager.GetString("plugin_name", resourceCulture); 213 | } 214 | } 215 | } 216 | } 217 | -------------------------------------------------------------------------------- /GitHubRepo/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 | Issues öffnen (Ctrl+I) 122 | 123 | 124 | Pull Requests öffnen (Ctrl+P) 125 | 126 | 127 | Authentifizierungstoken für GitHub 128 | 129 | 130 | Standardbenutzer für die Suche 131 | 132 | 133 | Standardbenutzer ist nicht festgelegt 134 | 135 | 136 | In den Einstellungen ändern 137 | 138 | 139 | Ein GitHub-Repository durchsuchen 140 | 141 | 142 | github.com öffnen 143 | 144 | 145 | In {0} 146 | Like "Search the web in {the browser name}" 147 | 148 | 149 | GitHub-Repository 150 | 151 | 152 | -------------------------------------------------------------------------------- /GitHubRepo/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 | Copy link (Ctrl+C) 122 | 123 | 124 | Open issues (Ctrl+I) 125 | 126 | 127 | Open pull requests (Ctrl+P) 128 | 129 | 130 | Default user is not set 131 | 132 | 133 | Change in settings 134 | 135 | 136 | In {0} 137 | Like "Search the web in {the browser name}" 138 | 139 | 140 | Open github.com 141 | 142 | 143 | GitHub authentication token 144 | 145 | 146 | Default user 147 | 148 | 149 | The user used when type "/" 150 | 151 | 152 | Number of results 153 | 154 | 155 | Choose how many results to load each time 156 | 157 | 158 | Search self-hosted GitHub 159 | 160 | 161 | This replaces default url used 162 | 163 | 164 | Url of API endpoint 165 | 166 | 167 | Search a GitHub repository 168 | 169 | 170 | GitHub Repository 171 | 172 | -------------------------------------------------------------------------------- /GitHubRepo/Properties/Resources.uk-UA.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/microsoft-resx 5 | 6 | 7 | 2.0 8 | 9 | 10 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 11 | 12 | 13 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 14 | 15 | 16 | Копіювати посилання (Ctrl+C) 17 | 18 | 19 | Відкрити задачі (Ctrl+I) 20 | 21 | 22 | Відкрити запити на злиття (Ctrl+P) 23 | 24 | 25 | Стандартного користувача не встановлено 26 | 27 | 28 | Змініть у налаштуваннях 29 | 30 | 31 | У {0} 32 | Наприклад: "Шукати в інтернеті у {назва браузера}" 33 | 34 | 35 | Відкрити github.com 36 | 37 | 38 | Токен автентифікації GitHub 39 | 40 | 41 | Стандартний користувач 42 | 43 | 44 | Стандартний користувач під час введення «/» 45 | 46 | 47 | Пошук у репозиторії GitHub 48 | 49 | 50 | Репозиторій GitHub 51 | 52 | 53 | Пошук на власному сервері GitHub 54 | 55 | 56 | Замінити стандартну URL-адресу 57 | 58 | 59 | URL-адреса кінцевої точки API 60 | 61 | 62 | -------------------------------------------------------------------------------- /GitHubRepo/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 | 复制链接 (Ctrl+C) 122 | 123 | 124 | 打开 issues (Ctrl+I) 125 | 126 | 127 | 打开 pull requests (Ctrl+P) 128 | 129 | 130 | GitHub 验证令牌 131 | 132 | 133 | 默认用户 134 | 135 | 136 | 当用户输入“/”时使用 137 | 138 | 139 | 默认用户未设置 140 | 141 | 142 | 更改设置 143 | 144 | 145 | 查找 GitHub 仓库 146 | 147 | 148 | 打开 GitHub 149 | 150 | 151 | 通过 {0} 152 | Like "Search the web in {the browser name}" 153 | 154 | 155 | GitHub 仓库 156 | 157 | 158 | -------------------------------------------------------------------------------- /GitHubRepo/QueryResult.cs: -------------------------------------------------------------------------------- 1 | namespace Community.PowerToys.Run.Plugin.GitHubRepo; 2 | 3 | public class QueryResult 4 | { 5 | private readonly bool _success; 6 | private readonly T? Value; 7 | private readonly E? Exception; 8 | 9 | private QueryResult(T? v, E? e, bool success) 10 | { 11 | _success = success; 12 | Value = v; 13 | Exception = e; 14 | } 15 | 16 | public static QueryResult Ok(T v) => new(v, default, true); 17 | public static QueryResult Err(E e) => new(default, e, false); 18 | 19 | public static implicit operator bool(QueryResult result) => result._success; 20 | public static implicit operator QueryResult(T v) => new(v, default, true); 21 | public static implicit operator QueryResult(E e) => new(default, e, false); 22 | 23 | public R Match(Func ok, Func err) => _success ? ok(Value!) : err(Exception!); 24 | } 25 | -------------------------------------------------------------------------------- /GitHubRepo/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\$_" 17 | } 18 | } 19 | 20 | Pop-Location 21 | -------------------------------------------------------------------------------- /GitHubRepo/debug.ps1: -------------------------------------------------------------------------------- 1 | # this script uses [gsudo](https://github.com/gerardog/gsudo) 2 | 3 | Push-Location 4 | Set-Location $PSScriptRoot 5 | 6 | # dotnet build -c Debug /p:Platform=x64 7 | 8 | sudo { 9 | Start-Job { Stop-Process -Name PowerToys* } | Wait-Job > $null 10 | 11 | $ptPath = 'C:\Program Files\PowerToys' 12 | $debug = '.\bin\x64\Debug\net9.0-windows' 13 | $dest = "$env:LOCALAPPDATA\Microsoft\PowerToys\PowerToys Run\Plugins\GitHubRepo" 14 | $files = @( 15 | 'Community.PowerToys.Run.Plugin.GitHubRepo.deps.json', 16 | 'Community.PowerToys.Run.Plugin.GitHubRepo.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 | -------------------------------------------------------------------------------- /GitHubRepo/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "47B63DBFBDEE4F9C85EBA5F6CD69E243", 3 | "ActionKeyword": "gr", 4 | "Disabled": false, 5 | "IsGlobal": false, 6 | "Name": "GitHub Repository", 7 | "Author": "8LWXpg", 8 | "Version": "1.12.0", 9 | "Language": "csharp", 10 | "Website": "https://github.com/8LWXpg/PowerToysRun-GitHubRepo", 11 | "ExecuteFileName": "Community.PowerToys.Run.Plugin.GitHubRepo.dll", 12 | "IcoPathDark": "Images\\dark\\GitHub.png", 13 | "IcoPathLight": "Images\\light\\GitHub.png" 14 | } -------------------------------------------------------------------------------- /GitHubRepo/release.ps1: -------------------------------------------------------------------------------- 1 | Push-Location 2 | Set-Location $PSScriptRoot 3 | 4 | $name = 'GitHubRepo' 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.dll", 21 | "$releasePath/plugin.json", 22 | "$releasePath/Images", 23 | "$releasePath/$assembly.deps.json", 24 | "$releasePath/de-DE", 25 | "$releasePath/zh-CN", 26 | "$ReleasePath/uk-UA" 27 | ) 28 | Copy-Item $items "./out/$name" -Recurse -Force 29 | Compress-Archive "./out/$name" "./out/$name-$version-$arch.zip" -Force 30 | } 31 | 32 | gh release create $version (Get-ChildItem ./out/*.zip) 33 | Pop-Location 34 | -------------------------------------------------------------------------------- /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 `./GitHubRepo/Properties/Resources.resx` to `./GitHubRepo/Properties/Resources..resx`. 10 | 1. Change the `Value`s to the translated text. 11 | 1. Add `"$releasePath/"` to the `$items` array in `./GitHubRepo/release.ps1`. 12 | https://github.com/8LWXpg/PowerToysRun-GitHubRepo/blob/12e642335fcfb889286aa91d282d92bbed6d3fce/GitHubRepo/release.ps1#L19-L24 13 | 1. Commit the change and submit a PR. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitHubRepo Plugin for PowerToys Run 2 | 3 | This is a plugin for [PowerToys Run](https://aka.ms/PowerToysOverview_PowerToysRun) that allows to search for GitHub repositories then open in your default browser. 4 | 5 | Check out the [Template](https://github.com/8LWXpg/PowerToysRun-PluginTemplate) for a starting point to create your own plugin. 6 | 7 | ## Features 8 | 9 | ### Search repo with query: `query` 10 | 11 | ![Search repo with query](./assets/repo.png) 12 | 13 | ### Search repo with user: `user/repo` 14 | 15 | ![Search repo with user](./assets/user.png) 16 | 17 | ### Search repo with default user: `/repo` 18 | 19 | If auth token is set, it will list all the repositories the token has access to. Otherwise, 20 | it will list all the public repositories of the default user. 21 | ![Search repo with default user](./assets/default_user.png) 22 | 23 | ### Context menu 24 | 25 | - **Open issues**: Open the issues page of the repository Ctrl+I. 26 | - **Open pull requests**: Open the pull requests page of the repository Ctrl+P. 27 | - **Copy link**: Copy the repository link to clipboard Ctrl+C. 28 | 29 | ### Settings 30 | 31 | - **Default user**: The default user to search for when typed `/`. 32 | - **GitHub auth token** (optional): The GitHub auth token to use for better rate limiting and access to private repo. 33 | You can generate a fine-grained token with read access to metadata. Detailed instructions 34 | [here](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token). 35 | ![token](./assets/token.png) 36 | 37 | ## Installation 38 | 39 | ### Manual 40 | 41 | 1. Download the latest release of the from the releases page. 42 | 2. Extract the zip file's contents to `%LocalAppData%\Microsoft\PowerToys\PowerToys Run\Plugins` 43 | 3. Restart PowerToys. 44 | 45 | ### Via [ptr](https://github.com/8LWXpg/ptr) 46 | 47 | ```shell 48 | ptr add GitHubRepo 8LWXpg/PowerToysRun-GitHubRepo 49 | ``` 50 | 51 | ## Usage 52 | 53 | 1. Open PowerToys Run (default shortcut is Alt+Space). 54 | 2. Type `gr` followed by your search query. 55 | 3. Select a search result and press `Enter` to open it in browser. 56 | 57 | ## Building 58 | 59 | 1. Clone the repository and the dependencies in `/lib` with `GitHubRepo/copyLib.ps1`. 60 | 2. Run `dotnet build -c Release`. 61 | 62 | ## Debugging 63 | 64 | 1. Clone the repository and the dependencies in `/lib` with `GitHubRepo/copyLib.ps1`. 65 | 2. Build the project in `Debug` configuration. 66 | 3. Make sure you have [gsudo](https://github.com/gerardog/gsudo) installed in the path. 67 | 4. Run `debug.ps1` (change `$ptPath` if you have PowerToys installed in a different location). 68 | 5. Attach to the `PowerToys.PowerLauncher` process in Visual Studio. 69 | 70 | ## Contributing 71 | 72 | ### Localization 73 | 74 | If you want to help localize this plugin, please check the [localization guide](./Localizing.md) 75 | -------------------------------------------------------------------------------- /assets/default_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-GitHubRepo/95180bc7503df35783d581bac22017b41b8c2782/assets/default_user.png -------------------------------------------------------------------------------- /assets/repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-GitHubRepo/95180bc7503df35783d581bac22017b41b8c2782/assets/repo.png -------------------------------------------------------------------------------- /assets/token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-GitHubRepo/95180bc7503df35783d581bac22017b41b8c2782/assets/token.png -------------------------------------------------------------------------------- /assets/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/8LWXpg/PowerToysRun-GitHubRepo/95180bc7503df35783d581bac22017b41b8c2782/assets/user.png --------------------------------------------------------------------------------