├── LICENSE ├── README.md └── plugins ├── Copy paste etc. in one line (Everything language).js ├── MenuInspector.js ├── New+.js ├── better-terminal.js ├── common-small-button.js ├── contextmenu-cleaner.js ├── copy-file-path-pro.js ├── file-hash.js ├── win11-ico-pack.js ├── 插件图标主题色.js ├── 桌面右键配置 Breeze - 桌面右键打开 Breeze 数据目录.js └── 链接详情显示.js /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # plugins 2 | Plugin repo for breeze shell. 3 | -------------------------------------------------------------------------------- /plugins/Copy paste etc. in one line (Everything language).js: -------------------------------------------------------------------------------- 1 | // @name: 常用功能小图标 - Copy paste etc. in one line 2 | // @description: 将复制,剪切等常用功能按钮添加到右键菜单的第一行小图标 3 | // @version: 0.0.4 4 | // @author: MicroBlock 5 | 6 | import * as shell from "mshell" 7 | 8 | // ---- CONFIG TEMPLATE ---- 9 | const ICON_CHECKED = `` 10 | const ICON_EMPTY = `` 11 | const CONFIG_FILE = "common-small-button.json" 12 | const PLUGIN_NAME = "常用功能小图标 - Copy paste etc. in one line" 13 | const default_config = { 14 | remove_original: false, 15 | use_original_icon_if_exists: true, 16 | show_name: false, 17 | show_icon: true 18 | } 19 | let config = {}; 20 | const read_config = () => { 21 | const config_dir = shell.breeze.data_directory() + '/config/' 22 | shell.fs.mkdir(config_dir) 23 | if (shell.fs.exists(config_dir + CONFIG_FILE)) { 24 | try { 25 | config = JSON.parse(shell.fs.read(config_dir + CONFIG_FILE)) 26 | } catch (e) { 27 | shell.println('配置文件解析失败', e, '\n', e.stack) 28 | } 29 | } 30 | } 31 | 32 | read_config() 33 | 34 | const read_config_key = key => { 35 | const read = (keys, obj) => { 36 | if (keys.length === 1) { 37 | return obj[keys[0]] 38 | } 39 | if (!obj[keys[0]]) { 40 | return undefined 41 | } 42 | return read(keys.slice(1), obj[keys[0]]) 43 | } 44 | 45 | return read(key.split('.'), config) ?? read(key.split('.'), default_config) 46 | } 47 | 48 | const write_config = () => { 49 | const config_dir = shell.breeze.data_directory() + '/config/' 50 | shell.fs.mkdir(config_dir) 51 | shell.fs.write(config_dir + CONFIG_FILE, JSON.stringify(config, null, 4)) 52 | } 53 | 54 | const write_config_key = (key, value) => { 55 | let obj = config 56 | 57 | const keys = key.split('.') 58 | for (let i = 0; i < keys.length - 1; i++) { 59 | if (!obj[keys[i]]) { 60 | obj[keys[i]] = {} 61 | } 62 | obj = obj[keys[i]] 63 | } 64 | obj[keys[keys.length - 1]] = value 65 | write_config() 66 | } 67 | 68 | on_plugin_menu[PLUGIN_NAME] = ((menu) => { 69 | const createToggleMenu = (menu, name, configKey, submenu) => { 70 | const menuItem = menu.append_menu({ 71 | name, 72 | action() { 73 | try { 74 | write_config_key(configKey, !read_config_key(configKey)) 75 | menuItem.set_data({ 76 | icon_svg: read_config_key(configKey) ? ICON_CHECKED : ICON_EMPTY 77 | }) 78 | } catch (e) { 79 | shell.println(e, e.stack) 80 | } 81 | }, 82 | icon_svg: read_config_key(configKey) ? ICON_CHECKED : ICON_EMPTY, 83 | submenu 84 | }) 85 | return menuItem 86 | } 87 | 88 | createToggleMenu(menu, '移除原始按钮', 'remove_original') 89 | createToggleMenu(menu, '使用原始图标', 'use_original_icon_if_exists') 90 | createToggleMenu(menu, '显示名称', 'show_name') 91 | createToggleMenu(menu, '显示图标', 'show_icon') 92 | }) 93 | 94 | // ---- CONFIG TEMPLATE ---- 95 | const icons = { 96 | dark: { 97 | copy: ` 98 | 99 | 100 | 101 | `, 102 | cut: ` 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | `, delete: ` 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | `, paste: ` 126 | 127 | 128 | 129 | 130 | `, 131 | rename: ` 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | ` 144 | }, 145 | light: { 146 | copy: ` 147 | 148 | 149 | 150 | 151 | 152 | `, 153 | cut: ` 154 | 155 | 156 | 157 | 158 | `, 159 | delete: ` 160 | 161 | 162 | 163 | 164 | `, 165 | paste: ` 166 | 167 | 168 | 169 | 170 | 171 | 172 | `, 173 | rename: ` 174 | 175 | 176 | 177 | 178 | 179 | ` 180 | } 181 | } 182 | shell.menu_controller.add_menu_listener(ctx => { 183 | try { 184 | const light_theme = shell.breeze.is_light_theme(); 185 | const icos = icons[light_theme ? 'light' : 'dark'] 186 | 187 | const small_buttons = [ 188 | { 189 | icon: 'copy', 190 | orig_resid: '29713@SHELL32.dll', 191 | orig_name: ['复制', 'Copy'] 192 | }, { 193 | icon: 'cut', 194 | orig_resid: '31260@SHELL32.dll', 195 | orig_name: ['剪切', 'Cut'] 196 | }, { 197 | icon: 'delete', 198 | orig_resid: '33246@SHELL32.dll', 199 | orig_name: ['删除', 'Delete'] 200 | }, { 201 | icon: 'paste', 202 | orig_resid: "31396@SHELL32.dll", 203 | orig_name: ['粘贴'] 204 | }, 205 | { 206 | icon: 'rename', 207 | orig_resid: "31258@SHELL32.dll", 208 | orig_name: ['重命名', 'Rename'] 209 | } 210 | ] 211 | 212 | const remove_original = read_config_key('remove_original') 213 | const use_original_icon_if_exists = read_config_key('use_original_icon_if_exists') 214 | const show_name = read_config_key('show_name') 215 | const show_icon = read_config_key('show_icon') 216 | 217 | const items = ctx.menu.get_items() 218 | const icon_menu = ctx.menu.prepend_parent_item(); 219 | 220 | for (const button of small_buttons) { 221 | const corresponding_item = items.find(v => { 222 | const data = v.data(); 223 | 224 | if (!data.name) return false; 225 | 226 | // Проверяем, есть ли name_resid и соответствует ли оно button.orig_resid 227 | if (data.name_resid === button.orig_resid) { 228 | return true; 229 | } 230 | 231 | // Если name_resid не совпадает или отсутствует, возвращаем false 232 | return false; 233 | }) 234 | 235 | // Теперь получаем только data.name_resid из corresponding_item 236 | if (corresponding_item) { 237 | const data = corresponding_item.data(); 238 | shell.println(data.name_resid); 239 | } 240 | 241 | 242 | if (!corresponding_item || corresponding_item.data().disabled) 243 | continue 244 | 245 | const data = corresponding_item.data() 246 | const icon = ( 247 | use_original_icon_if_exists && data.icon_svg 248 | ? data.icon_svg 249 | : icos[button.icon] 250 | ) 251 | const action = data.action 252 | 253 | icon_menu.append_child_after({ 254 | icon_svg: show_icon ? icon : null, 255 | action, 256 | name: show_name ? data.name : null 257 | }, -1) 258 | 259 | if (remove_original) 260 | corresponding_item.remove() 261 | } 262 | 263 | if (icon_menu.children().length === 0) 264 | icon_menu.remove() 265 | else 266 | ctx.menu.append_item_after({ 267 | type: 'spacer' 268 | }, 1) 269 | 270 | const items2 = ctx.menu.get_items() 271 | let is_last_spacer = false 272 | for (const item of items2) { 273 | if (item.data().type === 'spacer') { 274 | if (is_last_spacer) { 275 | item.remove() 276 | } 277 | is_last_spacer = true 278 | } else is_last_spacer = false 279 | } 280 | } catch (e) { 281 | shell.println(e, e.stack) 282 | } 283 | }) -------------------------------------------------------------------------------- /plugins/MenuInspector.js: -------------------------------------------------------------------------------- 1 | // @name: MenuInspector 2 | // @description: (开发工具) 显示当前右键菜单相关信息 3 | // @version: 0.0.2 4 | // @author: MicroBlock 5 | 6 | import * as shell from "mshell" 7 | 8 | shell.menu_controller.add_menu_listener(ctx => { 9 | ctx.menu.append_menu({ 10 | name: '菜单数据', 11 | submenu(sub) { 12 | const text = (menu, text, submenu, icon) => { 13 | return menu.append_menu({ 14 | name: text, 15 | submenu, icon_svg: icon, 16 | action() { 17 | shell.clipboard.set_text(text) 18 | ctx.menu.close() 19 | } 20 | }) 21 | } 22 | 23 | const button = (menu, text, action, icon) => { 24 | return menu.append_menu({ 25 | name: text, 26 | action, icon_svg: icon 27 | }) 28 | } 29 | 30 | if (ctx.context.folder_view) { 31 | text(sub, '文件夹视图', sub => { 32 | text(sub, '当前路径', sub => { 33 | text(sub, ctx.context.folder_view.current_path, null, null) 34 | }) 35 | text(sub, '选中文件', sub => { 36 | ctx.context.folder_view.selected_files.forEach(v => { 37 | text(sub, v, null, null) 38 | }) 39 | }) 40 | }) 41 | } 42 | 43 | if (ctx.context.window_info) { 44 | text(sub, '窗口信息', sub => { 45 | text(sub, 'exe', sub => { 46 | text(sub, ctx.context.window_info.executable_path, null, null) 47 | }) 48 | text(sub, '位置', sub => { 49 | text(sub, `${ctx.context.window_info.x}, ${ctx.context.window_info.y}`, null, null) 50 | }) 51 | text(sub, '大小', sub => { 52 | text(sub, `${ctx.context.window_info.width}, ${ctx.context.window_info.height}`, null, null) 53 | }) 54 | text(sub, 'Props', sub => { 55 | if (ctx.context.window_info.props.size === 0) { 56 | text(sub, '无', null, null) 57 | } 58 | for (const {key, value} of ctx.context.window_info.props) { 59 | text(sub, `${key}: ${value}`, null, null) 60 | } 61 | }) 62 | }) 63 | } 64 | 65 | sub.append_menu({ 66 | type: 'spacer' 67 | }) 68 | 69 | for (const menu of ctx.menu.get_items()) { 70 | const data = menu.data() 71 | // if (!data.name) continue; 72 | text(sub, data.name, sub => { 73 | for (const key in data) { 74 | let data_k = data[key] 75 | if (!data_k) continue; 76 | if (typeof data_k === 'function') { 77 | data_k = 'function' 78 | } 79 | 80 | if (typeof data_k === 'object') { 81 | data_k = JSON.stringify(data_k) 82 | } 83 | 84 | sub.append_menu({ 85 | name: key, 86 | action() { 87 | shell.clipboard.set_text(data_k) 88 | ctx.menu.close() 89 | }, 90 | submenu(sub) { 91 | const preview_text = (text) => { 92 | if (text.length > 50) { 93 | return text.substring(0, 50) + '...' 94 | } 95 | return text 96 | } 97 | 98 | button(sub, preview_text(data_k), () => { 99 | shell.clipboard.set_text(data_k) 100 | ctx.menu.close() 101 | }, null) 102 | } 103 | }) 104 | } 105 | }) 106 | } 107 | } 108 | }) 109 | }) 110 | -------------------------------------------------------------------------------- /plugins/New+.js: -------------------------------------------------------------------------------- 1 | // @name: New+ 2 | // @description: 根据模板创建文件/文件夹 3 | // @author: leafmoes 4 | // @version: 1.0.1 5 | import * as shell from "mshell"; 6 | 7 | const { plugin } = globalThis; 8 | 9 | const { 10 | i18n, 11 | config, 12 | config_directory, 13 | set_on_menu, 14 | log, 15 | } = plugin({ 16 | name: "New+", 17 | url: import.meta.url, 18 | }, { 19 | hide_old_new_item: false, 20 | hide_template_file_prefix: true, 21 | hide_template_file_extensions: false, 22 | hide_old_new_item_list: [], 23 | template_items_order: [], 24 | }); 25 | 26 | config.read_config(); 27 | 28 | // 合并图标常量 29 | const ICONS = { 30 | checked: ``, 31 | empty: ``, 32 | add: ``, 33 | openTemplate: `` 34 | }; 35 | 36 | // 工具函数及常量 37 | const PathUtils = { 38 | toWin32: (path) => path.replaceAll("/", "\\"), 39 | basename: (path) => path.split("\\").pop(), 40 | resolve: (...paths) => paths.join("/").replace(/\/+/g, "\\"), 41 | }; 42 | 43 | const CONFIG_FILE_PATH = PathUtils.resolve(config_directory, "/config.json"); 44 | 45 | // 国际化配置 46 | i18n.define("zh-CN", { 47 | "menu.originalNew": "新建", 48 | "menu.new": "新建+", 49 | "menu.open_template": "打开模板目录", 50 | "menu.hide_old_new_item": "在New+插件菜单隐藏旧的新建项目", 51 | "menu.hide_template_file_prefix": "隐藏模板文件名前缀符号(数字/空格/点)", 52 | "menu.hide_template_file_extensions": "隐藏模板文件名拓展名", 53 | "menu.open_template_items_order": "打开模板菜单项顺序配置", 54 | "menu.open_and_reset_template_items_order": "重置", 55 | }); 56 | 57 | i18n.define("en-US", { 58 | "menu.originalNew": "New", 59 | "menu.new": "New+", 60 | "menu.open_template": "Open Template Directory", 61 | "menu.hide_old_new_item": "Hide the legacy New Project item in the New+ plugin menu", 62 | "menu.hide_template_file_prefix": "Hide template filename prefix symbols (numbers, spaces, dots)", 63 | "menu.hide_template_file_extensions": "Hide template file extensions", 64 | "menu.open_template_items_order": "Open Template Menu Item Order Configuration", 65 | "menu.open_and_reset_template_items_order": "Reset", 66 | }); 67 | 68 | i18n.define("ja-JP", { 69 | "menu.originalNew": "新規", 70 | "menu.new": "新規+", 71 | "menu.open_template": "テンプレートディレクトリを開く", 72 | "menu.hide_old_new_item": "New+プラグインのメニューから従来の新規プロジェクト項目を非表示にします", 73 | "menu.hide_template_file_prefix": "テンプレートファイル名の接頭辞記号を非表示(数字・スペース・ドット)", 74 | "menu.hide_template_file_extensions": "テンプレートファイルの拡張子を非表示", 75 | "menu.open_template_items_order": "テンプレートメニュー項目の順序設定を開く", 76 | "menu.open_and_reset_template_items_order": "リセット", 77 | }); 78 | 79 | // 模板管理器 80 | const TemplateManager = { 81 | templateItems: [], 82 | getTemplateFolder() { 83 | return PathUtils.resolve(config_directory, "Template"); 84 | }, 85 | refresh() { 86 | const templatePath = this.getTemplateFolder(); 87 | try { 88 | if (!shell.fs.exists(templatePath)) { 89 | shell.fs.mkdir(templatePath); 90 | } 91 | this.templateItems = shell.fs 92 | .readdir(templatePath) 93 | .map(PathUtils.toWin32); 94 | } catch (e) { 95 | log("模板加载失败:", e); 96 | this.templateItems = []; 97 | } 98 | }, 99 | }; 100 | 101 | // 文件名处理工具 102 | const FilenameUtils = { 103 | parse(filename) { 104 | const lastDotIndex = filename.lastIndexOf("."); 105 | return lastDotIndex <= 0 106 | ? { name: filename, extension: "" } 107 | : { 108 | name: filename.slice(0, lastDotIndex), 109 | extension: filename.slice(lastDotIndex + 1), 110 | }; 111 | }, 112 | formatDisplayName(templatePath) { 113 | const baseName = PathUtils.basename(templatePath); 114 | const { name, extension } = shell.fs.isdir(templatePath) 115 | ? { name: baseName, extension: "" } 116 | : this.parse(baseName); 117 | const displayName = config.get("hide_template_file_prefix") 118 | ? name.replace(/^[\d\s._-]+/g, "") 119 | : name; 120 | return !config.get("hide_template_file_extensions") && extension 121 | ? `${displayName}.${extension}` 122 | : displayName; 123 | }, 124 | }; 125 | 126 | // 文件操作工具 127 | const FileOperations = { 128 | createFromTemplate(targetDir, templatePath, callback) { 129 | shell.fs.copy_shfile(templatePath, targetDir, callback); 130 | }, 131 | generateUniquePath(targetDir, baseName) { 132 | let counter = 1; 133 | let { name, extension } = FilenameUtils.parse(baseName); 134 | let candidate = extension ? `${name}.${extension}` : name; 135 | while (shell.fs.exists(PathUtils.resolve(targetDir, candidate))) { 136 | candidate = extension 137 | ? `${name} (${counter++}).${extension}` 138 | : `${name} (${counter++})`; 139 | } 140 | return PathUtils.resolve(targetDir, candidate); 141 | }, 142 | }; 143 | 144 | // 延时工具 145 | const sleep = (ms) => new Promise((resolve) => shell.infra.setTimeout(resolve, ms)); 146 | 147 | // 菜单构建器 148 | const MenuBuilder = { 149 | createTemplateSubmenu(sub, fv) { 150 | const currentPath = fv.current_path; 151 | const createRegularTemplateMenu = (templatePath) => { 152 | const displayName = FilenameUtils.formatDisplayName(templatePath); 153 | sub.append_menu({ 154 | icon_bitmap: shell.win32.load_file_icon(PathUtils.toWin32(templatePath)), 155 | name: displayName, 156 | action: async () => { 157 | FileOperations.createFromTemplate(currentPath, templatePath, async (ok, path) => { 158 | if (ok) { 159 | while (true) { 160 | const target_item = fv.items().find((item) => item.path() === path); 161 | if (target_item) { 162 | fv.select_none(); 163 | target_item.select(3); 164 | break; 165 | } 166 | await sleep(100); 167 | } 168 | } else { 169 | log("创建失败: 内部 Api 出错!"); 170 | } 171 | }); 172 | sub.close(); 173 | }, 174 | }); 175 | }; 176 | 177 | TemplateManager.refresh(); 178 | const configOrder = config.get("template_items_order"); 179 | const orderedTemplatePaths = TemplateManager.templateItems.sort((a, b) => { 180 | const nameA = PathUtils.basename(a).trim(); 181 | const nameB = PathUtils.basename(b).trim(); 182 | const indexA = configOrder.indexOf(nameA); 183 | const indexB = configOrder.indexOf(nameB); 184 | if (indexA !== -1 && indexB !== -1) return indexA - indexB; 185 | if (indexA !== -1) return -1; 186 | if (indexB !== -1) return 1; 187 | 188 | const isDirA = shell.fs.isdir(a); 189 | const isDirB = shell.fs.isdir(b); 190 | return isDirA !== isDirB ? (isDirA ? -1 : 1) : nameA.localeCompare(nameB); 191 | }); 192 | 193 | configOrder.forEach((item) => { 194 | if (item === "::spacer") { 195 | sub.append_menu({ type: "spacer" }); 196 | } else { 197 | const templatePath = orderedTemplatePaths.find( 198 | (t) => PathUtils.basename(t).trim() === item 199 | ); 200 | if (templatePath) { 201 | createRegularTemplateMenu(templatePath); 202 | } 203 | } 204 | }); 205 | orderedTemplatePaths.forEach((templatePath) => { 206 | if (!configOrder.includes(PathUtils.basename(templatePath).trim())) { 207 | createRegularTemplateMenu(templatePath); 208 | } 209 | }); 210 | sub.append_menu({ type: "spacer" }); 211 | sub.append_menu({ 212 | name: i18n.t("menu.open_template"), 213 | icon_svg: ICONS.openTemplate, 214 | action: () => { 215 | shell.subproc.run_async( 216 | `explorer.exe "${TemplateManager.getTemplateFolder()}"`, 217 | () => {} 218 | ); 219 | sub.close(); 220 | }, 221 | }); 222 | return sub; 223 | }, 224 | }; 225 | 226 | // 设置菜单操作 227 | set_on_menu((m) => { 228 | const createToggleMenu = (name, key) => { 229 | const menuItem = m.append_menu({ 230 | name, 231 | action() { 232 | config.set(key, !config.get(key)); 233 | menuItem.set_data({ 234 | icon_svg: config.get(key) ? ICONS.checked : ICONS.empty, 235 | }); 236 | }, 237 | icon_svg: config.get(key) ? ICONS.checked : ICONS.empty, 238 | }); 239 | return menuItem; 240 | }; 241 | 242 | createToggleMenu(i18n.t("menu.hide_old_new_item"), "hide_old_new_item"); 243 | createToggleMenu(i18n.t("menu.hide_template_file_prefix"), "hide_template_file_prefix"); 244 | createToggleMenu(i18n.t("menu.hide_template_file_extensions"), "hide_template_file_extensions"); 245 | 246 | m.append_menu({ 247 | name: i18n.t("menu.open_template_items_order"), 248 | icon_svg: ICONS.openTemplate, 249 | action: () => { 250 | if (shell.fs.exists(CONFIG_FILE_PATH) && !config.get("template_items_order").length) { 251 | TemplateManager.refresh(); 252 | config.set( 253 | "template_items_order", 254 | TemplateManager.templateItems.map((item) => PathUtils.basename(item)) 255 | ); 256 | config.write_config(); 257 | } 258 | shell.subproc.run_async( 259 | `cmd.exe /c start "" "${CONFIG_FILE_PATH}"`, 260 | () => {} 261 | ); 262 | m.close && m.close(); 263 | }, 264 | submenu: (sub) => { 265 | sub.append_menu({ 266 | name: i18n.t("menu.open_and_reset_template_items_order"), 267 | action: () => { 268 | TemplateManager.refresh(); 269 | config.set( 270 | "template_items_order", 271 | TemplateManager.templateItems.map((item) => PathUtils.basename(item)) 272 | ); 273 | config.write_config(); 274 | shell.subproc.run_async( 275 | `cmd.exe /c start "" "${CONFIG_FILE_PATH}"`, 276 | () => {} 277 | ); 278 | sub.close(); 279 | }, 280 | }); 281 | }, 282 | }); 283 | }); 284 | 285 | shell.menu_controller.add_menu_listener((ctx) => { 286 | const { folder_view: fv } = ctx.context; 287 | if (!fv) return; 288 | 289 | const originalNewMenu = ctx.menu.get_items().find( 290 | (item) => item.data().name === i18n.t("menu.originalNew") 291 | ); 292 | 293 | if (originalNewMenu) { 294 | const originalNewMenuSub = originalNewMenu.data().submenu; 295 | originalNewMenu.set_data({ 296 | name: i18n.t("menu.new"), 297 | icon_svg: ICONS.add, 298 | submenu: (sub) => { 299 | if (!config.get("hide_old_new_item")) { 300 | originalNewMenuSub?.(sub); 301 | const hiddenItems = config.get("hide_old_new_item_list") || []; 302 | sub.get_items().forEach((item) => { 303 | if (hiddenItems.includes(item.data().name || "")) { 304 | item.remove(); 305 | } 306 | }); 307 | sub.append_menu({ type: "spacer" }); 308 | } 309 | MenuBuilder.createTemplateSubmenu(sub, fv); 310 | }, 311 | }); 312 | } 313 | }); 314 | -------------------------------------------------------------------------------- /plugins/better-terminal.js: -------------------------------------------------------------------------------- 1 | // @name: better-terminal 2 | // @description: 增加管理员方式打开终端 3 | // @author: Enlysure 4 | // @version: 0.0.1 5 | 6 | import * as shell from 'mshell' 7 | const CONFIG_FILE = 'better-terminal.json' 8 | const PLUGIN_NAME = 'better-terminal' 9 | const ICON_CHECKED = `` 10 | const ICON_EMPTY = `` 11 | 12 | const languages = { 13 | 'en-US': { 14 | '以Cmd打开': 'Open as Cmd', 15 | '以PS打开': 'Open as PowerShell', 16 | '使用新版 Terminal': 'Use new Terminal', 17 | '以管理员打开': 'Open as admin', 18 | '禁用原本的终端打开方式': 'Disable original terminal open method', 19 | }, 'zh-CN': { 20 | } 21 | } 22 | 23 | const currentLang = shell.breeze.user_language() === 'zh-CN' ? 'zh-CN' : 'en-US' 24 | 25 | const t = (key) => { 26 | return languages[currentLang][key] || key 27 | } 28 | 29 | 30 | 31 | const default_config = { 32 | terminal: { 33 | wt: true, 34 | admin: true, 35 | disableOriginal: false, 36 | }, 37 | } 38 | let config = {} 39 | const read_config = () => { 40 | const config_dir = shell.breeze.data_directory() + '/config/' 41 | shell.fs.mkdir(config_dir) 42 | if (shell.fs.exists(config_dir + CONFIG_FILE)) { 43 | try { 44 | config = JSON.parse(shell.fs.read(config_dir + CONFIG_FILE)) 45 | } catch (e) { 46 | shell.println('配置文件解析失败', e, '\n', e.stack) 47 | } 48 | } 49 | } 50 | 51 | read_config() 52 | 53 | const read_config_key = (key) => { 54 | const read = (keys, obj) => { 55 | if (keys.length === 1) { 56 | return obj[keys[0]] 57 | } 58 | if (!obj[keys[0]]) { 59 | return undefined 60 | } 61 | return read(keys.slice(1), obj[keys[0]]) 62 | } 63 | 64 | return read(key.split('.'), config) ?? read(key.split('.'), default_config) 65 | } 66 | 67 | const write_config = () => { 68 | const config_dir = shell.breeze.data_directory() + '/config/' 69 | shell.fs.mkdir(config_dir) 70 | shell.fs.write(config_dir + CONFIG_FILE, JSON.stringify(config, null, 4)) 71 | } 72 | 73 | const write_config_key = (key, value) => { 74 | let obj = config 75 | 76 | const keys = key.split('.') 77 | for (let i = 0; i < keys.length - 1; i++) { 78 | if (!obj[keys[i]]) { 79 | obj[keys[i]] = {} 80 | } 81 | obj = obj[keys[i]] 82 | } 83 | obj[keys[keys.length - 1]] = value 84 | write_config() 85 | } 86 | 87 | on_plugin_menu[PLUGIN_NAME] = (menu) => { 88 | const createToggleMenu = (menu, name, configKey, submenu) => { 89 | const menuItem = menu.append_menu({ 90 | name, 91 | action() { 92 | try { 93 | write_config_key(configKey, !read_config_key(configKey)) 94 | menuItem.set_data({ 95 | icon_svg: read_config_key(configKey) 96 | ? ICON_CHECKED 97 | : ICON_EMPTY, 98 | }) 99 | } catch (e) { 100 | shell.println(e, e.stack) 101 | } 102 | }, 103 | icon_svg: read_config_key(configKey) ? ICON_CHECKED : ICON_EMPTY, 104 | submenu, 105 | }) 106 | return menuItem 107 | } 108 | 109 | createToggleMenu(menu, t('使用新版 Terminal'), 'terminal.wt') 110 | createToggleMenu(menu, t('以管理员打开'), 'terminal.admin') 111 | createToggleMenu(menu, t('禁用原本的终端打开方式'), 'terminal.disableOriginal') 112 | } 113 | 114 | const PS_ICON = ` 115 | 116 | 117 | 118 | ` 119 | 120 | shell.menu_controller.add_menu_listener((ctx) => { 121 | const fv = ctx.context.folder_view 122 | const current_path = fv.current_path 123 | const selectedPaths = fv.selected_files 124 | 125 | if (read_config_key('terminal.disableOriginal')) { 126 | const items = ctx.menu.get_items(); 127 | const ori = "在终端中打开"; 128 | const ori_menu = items.find((v) => v.data().name === ori); 129 | if (ori_menu) { 130 | ori_menu.remove(); 131 | } 132 | } 133 | 134 | if (selectedPaths.length === 0 || selectedPaths.length === 1) { // 空白位置或选中一个文件 135 | const items = ctx.menu.get_items(); 136 | let targetIndex = items.findIndex((v) => v.data().name === '复制') + 1; 137 | if (targetIndex === 0) { 138 | targetIndex = items.findIndex((v) => v.data().name === '新建') + 1; 139 | } 140 | if (targetIndex === 0) { 141 | return; 142 | } 143 | 144 | 145 | shell.println(current_path); 146 | const runCommand = async (command) => { 147 | try { 148 | await shell.subproc.run(command); 149 | } catch (error) { 150 | shell.println("执行命令时出错:", error); 151 | } finally { 152 | ctx.menu.close(); 153 | } 154 | }; 155 | 156 | function appendMenuButton(type, nameSuffix, command, targetIndex) { 157 | ctx.menu.append_menu_after({ 158 | type: "button", 159 | name: t(`以${type}打开`) + nameSuffix, 160 | icon_svg: PS_ICON, 161 | action: () => runCommand(command), 162 | }, targetIndex); 163 | } 164 | 165 | const isAdmin = read_config_key('terminal.admin'); 166 | const isWT = read_config_key('terminal.wt'); 167 | const nameSuffix = isAdmin ? (isWT ? "(A T)" : "(A)") : (isWT ? "(T)" : ""); 168 | 169 | if (isAdmin) { 170 | if (isWT) { 171 | appendMenuButton("PS", nameSuffix, `powershell -Command "Start-Process wt.exe -ArgumentList 'powershell -NoExit -Command \\"Set-Location ''${current_path}''\\"' -Verb RunAs"`, targetIndex); 172 | appendMenuButton("Cmd", nameSuffix, `powershell -Command "Start-Process wt.exe -ArgumentList '-d \\"${current_path}\\" cmd.exe' -Verb RunAs"`, targetIndex); 173 | } else { 174 | appendMenuButton("PS", nameSuffix, `powershell -Command "Start-Process powershell -ArgumentList '-NoExit -Command \\"Set-Location ''${current_path}''\\"' -Verb RunAs"`, targetIndex); 175 | appendMenuButton("Cmd", nameSuffix, `powershell -Command "Start-Process cmd -ArgumentList '/k cd /d ${current_path}' -Verb RunAs"`, targetIndex); 176 | } 177 | } else { 178 | if (isWT) { 179 | appendMenuButton("PS", nameSuffix, `wt.exe powershell -NoExit -Command "Set-Location '${current_path}'"`, targetIndex); 180 | appendMenuButton("Cmd", nameSuffix, `wt.exe -d "${current_path}" cmd.exe`, targetIndex); 181 | } else { 182 | appendMenuButton("PS", nameSuffix, `Start-Process powershell -ArgumentList "-NoExit", "-Command", "Set-Location '${current_path}'"`, targetIndex); 183 | appendMenuButton("Cmd", nameSuffix, `powershell -Command "Start-Process cmd.exe -ArgumentList '/k','cd /d ${current_path}'"`, targetIndex); 184 | } 185 | } 186 | 187 | } else { 188 | // 选中了多个文件 189 | return 190 | } 191 | 192 | }); -------------------------------------------------------------------------------- /plugins/common-small-button.js: -------------------------------------------------------------------------------- 1 | // @name: 常用功能小图标 - Copy paste etc. in one line 2 | // @description: 将复制,剪切等常用功能按钮添加到右键菜单的第一行小图标 3 | // @version: 0.0.4 4 | // @author: MicroBlock 5 | 6 | import * as shell from "mshell" 7 | 8 | // ---- CONFIG TEMPLATE ---- 9 | const ICON_CHECKED = `` 10 | const ICON_EMPTY = `` 11 | const CONFIG_FILE = "common-small-button.json" 12 | const PLUGIN_NAME = "常用功能小图标 - Copy paste etc. in one line" 13 | const default_config = { 14 | remove_original: false, 15 | use_original_icon_if_exists: true, 16 | show_name: false, 17 | show_icon: true 18 | } 19 | let config = {}; 20 | const read_config = () => { 21 | const config_dir = shell.breeze.data_directory() + '/config/' 22 | shell.fs.mkdir(config_dir) 23 | if (shell.fs.exists(config_dir + CONFIG_FILE)) { 24 | try { 25 | config = JSON.parse(shell.fs.read(config_dir + CONFIG_FILE)) 26 | } catch (e) { 27 | shell.println('配置文件解析失败', e, '\n', e.stack) 28 | } 29 | } 30 | } 31 | 32 | read_config() 33 | 34 | const read_config_key = key => { 35 | const read = (keys, obj) => { 36 | if (keys.length === 1) { 37 | return obj[keys[0]] 38 | } 39 | if (!obj[keys[0]]) { 40 | return undefined 41 | } 42 | return read(keys.slice(1), obj[keys[0]]) 43 | } 44 | 45 | return read(key.split('.'), config) ?? read(key.split('.'), default_config) 46 | } 47 | 48 | const write_config = () => { 49 | const config_dir = shell.breeze.data_directory() + '/config/' 50 | shell.fs.mkdir(config_dir) 51 | shell.fs.write(config_dir + CONFIG_FILE, JSON.stringify(config, null, 4)) 52 | } 53 | 54 | const write_config_key = (key, value) => { 55 | let obj = config 56 | 57 | const keys = key.split('.') 58 | for (let i = 0; i < keys.length - 1; i++) { 59 | if (!obj[keys[i]]) { 60 | obj[keys[i]] = {} 61 | } 62 | obj = obj[keys[i]] 63 | } 64 | obj[keys[keys.length - 1]] = value 65 | write_config() 66 | } 67 | 68 | on_plugin_menu[PLUGIN_NAME] = ((menu) => { 69 | const createToggleMenu = (menu, name, configKey, submenu) => { 70 | const menuItem = menu.append_menu({ 71 | name, 72 | action() { 73 | try { 74 | write_config_key(configKey, !read_config_key(configKey)) 75 | menuItem.set_data({ 76 | icon_svg: read_config_key(configKey) ? ICON_CHECKED : ICON_EMPTY 77 | }) 78 | } catch (e) { 79 | shell.println(e, e.stack) 80 | } 81 | }, 82 | icon_svg: read_config_key(configKey) ? ICON_CHECKED : ICON_EMPTY, 83 | submenu 84 | }) 85 | return menuItem 86 | } 87 | 88 | createToggleMenu(menu, '移除原始按钮', 'remove_original') 89 | createToggleMenu(menu, '使用原始图标', 'use_original_icon_if_exists') 90 | createToggleMenu(menu, '显示名称', 'show_name') 91 | createToggleMenu(menu, '显示图标', 'show_icon') 92 | }) 93 | 94 | // ---- CONFIG TEMPLATE ---- 95 | const icons = { 96 | dark: { 97 | copy: ` 98 | 99 | 100 | 101 | `, 102 | cut: ` 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | `, delete: ` 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | `, paste: ` 126 | 127 | 128 | 129 | 130 | `, 131 | rename: ` 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | ` 144 | }, 145 | light: { 146 | copy: ` 147 | 148 | 149 | 150 | 151 | 152 | `, 153 | cut: ` 154 | 155 | 156 | 157 | 158 | `, 159 | delete: ` 160 | 161 | 162 | 163 | 164 | `, 165 | paste: ` 166 | 167 | 168 | 169 | 170 | 171 | 172 | `, 173 | rename: ` 174 | 175 | 176 | 177 | 178 | 179 | ` 180 | } 181 | } 182 | shell.menu_controller.add_menu_listener(ctx => { 183 | try { 184 | const light_theme = shell.breeze.is_light_theme(); 185 | const icos = icons[light_theme ? 'light' : 'dark'] 186 | 187 | const small_buttons = [ 188 | { 189 | icon: 'copy', 190 | orig_resid: '4162@SHELL32.dll', 191 | orig_name: ['复制', 'Copy'] 192 | }, { 193 | icon: 'cut', 194 | orig_resid: '33576@SHELL32.dll', 195 | orig_name: ['剪切', 'Cut'] 196 | }, { 197 | icon: 'delete', 198 | orig_resid: '4163@SHELL32.dll', 199 | orig_name: ['删除', 'Delete'] 200 | }, { 201 | icon: 'paste', 202 | orig_resid: '33578@SHELL32.dll', 203 | orig_name: ['粘贴'] 204 | }, 205 | { 206 | icon: 'rename', 207 | orig_resid: '4164@SHELL32.dll', 208 | orig_name: ['重命名', 'Rename'] 209 | } 210 | ] 211 | 212 | const remove_original = read_config_key('remove_original') 213 | const use_original_icon_if_exists = read_config_key('use_original_icon_if_exists') 214 | const show_name = read_config_key('show_name') 215 | const show_icon = read_config_key('show_icon') 216 | 217 | const items = ctx.menu.get_items() 218 | const icon_menu = ctx.menu.prepend_parent_item(); 219 | 220 | for (const button of small_buttons) { 221 | const corresponding_item = items.find(v => { 222 | const data = v.data() 223 | if (!data.name) return false 224 | if (button.orig_resid && data.resid === button.orig_resid) return true 225 | if (button.orig_name && button.orig_name.includes(data.name)) return true 226 | return false 227 | }) 228 | 229 | if (!corresponding_item || corresponding_item.data().disabled) 230 | continue 231 | 232 | const data = corresponding_item.data() 233 | const icon = ( 234 | use_original_icon_if_exists && data.icon_svg 235 | ? data.icon_svg 236 | : icos[button.icon] 237 | ) 238 | const action = data.action 239 | 240 | icon_menu.append_child_after({ 241 | icon_svg: show_icon ? icon : null, 242 | action, 243 | name: show_name ? data.name : null 244 | }, -1) 245 | 246 | if (remove_original) 247 | corresponding_item.remove() 248 | } 249 | 250 | if (icon_menu.children().length === 0) 251 | icon_menu.remove() 252 | else 253 | ctx.menu.append_item_after({ 254 | type: 'spacer' 255 | }, 1) 256 | 257 | const items2 = ctx.menu.get_items() 258 | let is_last_spacer = false 259 | for (const item of items2) { 260 | if (item.data().type === 'spacer') { 261 | if (is_last_spacer) { 262 | item.remove() 263 | } 264 | is_last_spacer = true 265 | } else is_last_spacer = false 266 | } 267 | } catch (e) { 268 | shell.println(e, e.stack) 269 | } 270 | }) 271 | 272 | -------------------------------------------------------------------------------- /plugins/contextmenu-cleaner.js: -------------------------------------------------------------------------------- 1 | // @name: 右键菜单清理 - Context Menu Cleaner 2 | // @description: 多功能、可配置的右键菜单清理工具 / A versatile and configurable context menu cleaner 3 | // @author: MicroBlock 4 | // @version: 0.0.10 5 | 6 | import * as shell from 'mshell' 7 | const ICON_CHECKED = `` 8 | const ICON_EMPTY = `` 9 | 10 | const languages = { 11 | 'en-US': { 12 | '合并 "用...打开"': 'Merge "Open with"', 13 | '不合并使用 Code 打开': 'Do not merge open with Code', 14 | 不合并在终端中打开: 'Do not merge open in terminal', 15 | 合并视图操作: 'Merge view operation', 16 | 合并不常用菜单: 'Merge uncommon menu', 17 | 不合并使用: 'Do not merge open with', 18 | 打开方式: 'Open with', 19 | 视图操作: 'View operation', 20 | 不常用: 'Uncommon', 21 | 右键菜单清理: 'Context Menu Cleaner', 22 | }, 23 | 'ja-JP': { 24 | '合并 "用...打开"': '「プログラムから開く」をマージ', 25 | '不合并使用 Code 打开': '「Code で聞く」をマージしない', 26 | 不合并在终端中打开: '「Windows ターミナルで聞く」をマージしない', 27 | 合并视图操作: 'ビュー操作をマージ', 28 | 合并不常用菜单: '他のメニューをマージ', 29 | 不合并使用: '「プログラムから開く」をマージしない', 30 | 打开方式: 'プログラムから開く', 31 | 视图操作: 'ビュー操作', 32 | 不常用: '他のメニュー', 33 | 右键菜单清理: 'コンテキスト メニュー クリーナー', 34 | }, 35 | 'zh-CN': {}, 36 | } 37 | 38 | const currentLang = Object.keys(languages).includes( 39 | shell.breeze.user_language(), 40 | ) 41 | ? shell.breeze.user_language() 42 | : 'en-US' 43 | const t = (key) => { 44 | return languages[currentLang][key] || key 45 | } 46 | 47 | const config_name = 'contextmenu-cleaner.json' 48 | const default_config = { 49 | merge: { 50 | open_with: true, 51 | view_operation: true, 52 | uncommon: true, 53 | }, 54 | } 55 | let config = {} 56 | const read_config = () => { 57 | const config_dir = shell.breeze.data_directory() + '/config/' 58 | shell.fs.mkdir(config_dir) 59 | if (shell.fs.exists(config_dir + config_name)) { 60 | try { 61 | config = JSON.parse(shell.fs.read(config_dir + config_name)) 62 | } catch (e) { 63 | shell.println('[右键菜单清理] 配置文件解析失败', e) 64 | } 65 | } 66 | } 67 | 68 | read_config() 69 | 70 | const read_config_key = (key) => { 71 | const read = (keys, obj) => { 72 | if (keys.length === 1) { 73 | return obj[keys[0]] 74 | } 75 | if (!obj[keys[0]]) { 76 | return undefined 77 | } 78 | return read(keys.slice(1), obj[keys[0]]) 79 | } 80 | 81 | return read(key.split('.'), config) ?? read(key.split('.'), default_config) 82 | } 83 | 84 | const write_config = () => { 85 | const config_dir = shell.breeze.data_directory() + '/config/' 86 | shell.fs.mkdir(config_dir) 87 | shell.fs.write(config_dir + config_name, JSON.stringify(config, null, 4)) 88 | } 89 | 90 | const write_config_key = (key, value) => { 91 | let obj = config 92 | 93 | const keys = key.split('.') 94 | for (let i = 0; i < keys.length - 1; i++) { 95 | if (!obj[keys[i]]) { 96 | obj[keys[i]] = {} 97 | } 98 | obj = obj[keys[i]] 99 | } 100 | obj[keys[keys.length - 1]] = value 101 | write_config() 102 | } 103 | 104 | on_plugin_menu['右键菜单清理 - Context Menu Cleaner'] = (menu) => { 105 | const createToggleMenu = (menu, name, configKey, submenu) => { 106 | const menuItem = menu.append_menu({ 107 | name, 108 | action() { 109 | try { 110 | write_config_key(configKey, !read_config_key(configKey)) 111 | menuItem.set_data({ 112 | icon_svg: read_config_key(configKey) 113 | ? ICON_CHECKED 114 | : ICON_EMPTY, 115 | }) 116 | } catch (e) { 117 | shell.println(e, e.stack) 118 | } 119 | }, 120 | icon_svg: read_config_key(configKey) ? ICON_CHECKED : ICON_EMPTY, 121 | submenu, 122 | }) 123 | return menuItem 124 | } 125 | 126 | createToggleMenu( 127 | menu, 128 | t('合并 "用...打开"'), 129 | 'merge.open_with', 130 | (submenu) => { 131 | createToggleMenu( 132 | submenu, 133 | t('不合并使用 Code 打开'), 134 | 'merge.open_with_allow.code', 135 | ) 136 | createToggleMenu( 137 | submenu, 138 | t('不合并在终端中打开'), 139 | 'merge.open_with_allow.terminal', 140 | ) 141 | }, 142 | ) 143 | createToggleMenu(menu, t('合并视图操作'), 'merge.view_operation') 144 | createToggleMenu(menu, t('合并不常用菜单'), 'merge.uncommon') 145 | } 146 | 147 | shell.menu_controller.add_menu_listener((ctx) => { 148 | try { 149 | const mergedMenus = [] 150 | const mergeMenuItems = (menuItems, newMenuName) => { 151 | const items = menuItems.filter((menu) => menu) 152 | if (items.length > 1) { 153 | const itemDatas = items.map((v) => v.data()) 154 | mergedMenus.push({ 155 | name: newMenuName, 156 | submenu(sub) { 157 | for (const menu of itemDatas) { 158 | sub.append_menu(menu) 159 | } 160 | }, 161 | }) 162 | for (const menu of items) { 163 | menu.remove() 164 | } 165 | } 166 | } 167 | 168 | if (read_config_key('merge.open_with')) { 169 | const ignore = [] 170 | const ignoreResid = [] 171 | if (read_config_key('merge.open_with_allow.code')) { 172 | ignore.push('通过 Code 打开', 'Code で聞く') 173 | } 174 | 175 | if (read_config_key('merge.open_with_allow.terminal')) { 176 | ignore.push( 177 | '在终端中打开', 178 | 'Open in Terminal', 179 | 'Windows Terminal here', 180 | 'Windows Terminal here as administrator', 181 | 'Windows ターミナルで聞く', 182 | ) 183 | } 184 | 185 | mergeMenuItems( 186 | ctx.menu.get_items().filter((menu) => { 187 | const data = menu.data() 188 | const blacklist = [] 189 | const blacklistResid = [ 190 | '51623@SHELL32.dll', // 打开 191 | '5393@SHELL32.dll', // 打开方式 192 | '8535@windows.storage.dll', // 在新标签页中打开 193 | '8533@windows.storage.dll', // 在新窗口中打开 194 | ] 195 | const whitelist = [ 196 | // common matches 197 | '使用', 198 | '播放列表', 199 | '播放队列', 200 | '编辑', 201 | 'edit', 202 | 'open', 203 | 'here', 204 | '打开', 205 | // specific softwares 206 | 'adobe bridge', 207 | 'adobe acrobat', 208 | 'jetbrains', 209 | 'intellij', 210 | 'ida pro', 211 | 'hhd hex editor neo', 212 | 'x32dbg', 213 | 'x64dbg', 214 | 'mediainfo', 215 | ] 216 | const fullmatch = ['WizTree'] 217 | const fullmatchResid = [ 218 | // common matches 219 | '51623@SHELL32.dll', // 打开 220 | ] 221 | 222 | if (ignore.includes(data.name)) return false 223 | if (ignoreResid.includes(data.name_resid)) return false 224 | if (blacklist.includes(data.name)) return false 225 | if (blacklistResid.includes(data.name_resid)) return false 226 | return ( 227 | whitelist.some((name) => 228 | data.name?.toLowerCase().includes(name), 229 | ) || 230 | fullmatch.some((name) => data.name === name) || 231 | fullmatchResid.some( 232 | (resid) => data.name_resid === resid, 233 | ) 234 | ) 235 | }), 236 | t('打开方式'), 237 | ) 238 | } 239 | 240 | if (read_config_key('merge.view_operation')) { 241 | mergeMenuItems( 242 | ctx.menu.get_items().filter((menu) => { 243 | const data = menu.data() 244 | const fullmatch = [ 245 | // zh-CN 246 | '排序方式', 247 | '分组依据', 248 | // en-US 249 | 'Sort by', 250 | 'Group by', 251 | // ja-JP 252 | '並べ替え', 253 | 'グループで表示', 254 | ] 255 | const fullmatchResid = [ 256 | '31161@SHELL32.dll', // 查看 257 | ] 258 | return ( 259 | fullmatch.some((name) => name === data.name) || 260 | fullmatchResid.some( 261 | (resid) => data.name_resid === resid, 262 | ) 263 | ) 264 | }), 265 | t('视图操作'), 266 | ) 267 | } 268 | 269 | if (read_config_key('merge.uncommon')) { 270 | mergeMenuItems( 271 | ctx.menu.get_items().filter((menu) => { 272 | const data = menu.data() 273 | const fullmatch = [ 274 | // zh-CN 275 | '自定义文件夹...', 276 | '授予访问权限', 277 | '还原以前的版本', 278 | '添加到收藏夹', 279 | '共享', 280 | // en-US 281 | 'Cast to Device', 282 | 'Rotate right', 283 | 'Rotate left', 284 | 'Customize folder...', 285 | 'Restore previous versions', 286 | 'Add to favorites', 287 | 'Share', 288 | 'Send to', 289 | 'Give access to', 290 | // ja-JP 291 | 'このフォルダーのカスタマイズ...', 292 | '以前のバージョンの復元', 293 | 'アクセスを許可する', 294 | 'お気に入りに追加', 295 | ] 296 | const fullmatchResid = [ 297 | '119@ntshrui.dll', // 授予访问权限 298 | '34609@SHELL32.dll', // 包含到库中 299 | '51622@SHELL32.dll', // 固定到“开始” 300 | '30328@SHELL32.dll', // 发送 301 | '51624@SHELL32.dll', // 添加到收藏夹 302 | ] 303 | const partial = ['发送', '送る', '上传', '百度网盘'] 304 | return ( 305 | fullmatch.some((name) => data.name === name) || 306 | fullmatchResid.some( 307 | (resid) => data.name_resid === resid, 308 | ) || 309 | partial.some((name) => data.name?.includes(name)) 310 | ) 311 | }), 312 | t('不常用'), 313 | ) 314 | } 315 | 316 | // merge duplicate spacer 317 | const items = ctx.menu.get_items() 318 | let is_last_spacer = false 319 | for (const item of items) { 320 | if (item.data().type === 'spacer') { 321 | if (is_last_spacer) { 322 | item.remove() 323 | } 324 | is_last_spacer = true 325 | } else is_last_spacer = false 326 | } 327 | 328 | // adjust position 329 | if (mergedMenus.length) { 330 | for (const menu of ctx.menu.get_items()) { 331 | const dupname = mergedMenus.find( 332 | (v) => v.name === menu.data().name, 333 | ) 334 | if (dupname) { 335 | const orig_submenu = menu.data().submenu 336 | menu.set_data({ 337 | submenu(sub) { 338 | orig_submenu?.(sub) 339 | sub.append_menu({ 340 | type: 'spacer', 341 | }) 342 | dupname.submenu(sub) 343 | }, 344 | }) 345 | 346 | mergedMenus.splice(mergedMenus.indexOf(dupname), 1) 347 | } 348 | } 349 | const target = ctx.menu 350 | .get_items() 351 | .findIndex((v) => v.data().type == 'spacer') 352 | for (const menu of mergedMenus) { 353 | ctx.menu.append_menu_after(menu, target) 354 | } 355 | ctx.menu.append_menu_after( 356 | { 357 | type: 'spacer', 358 | }, 359 | target, 360 | ) 361 | } 362 | } catch (e) { 363 | shell.println(e, e.stack) 364 | } 365 | }) 366 | -------------------------------------------------------------------------------- /plugins/copy-file-path-pro.js: -------------------------------------------------------------------------------- 1 | // @name: 复制文件路径 Pro 2 | // @description: 复制文件路径,文件名,拓展名,多个文件路径... 3 | // @author: MicroBlock 4 | // @version: 0.0.2 5 | 6 | import * as shell from "mshell" 7 | shell.println(shell.breeze.user_language()) 8 | // ---- CONFIG TEMPLATE ---- 9 | const ICON_CHECKED = `` 10 | const ICON_EMPTY = `` 11 | const CONFIG_FILE = "copy-file-path-pro.json" 12 | const PLUGIN_NAME = "复制文件路径 Pro" 13 | const default_config = { 14 | multifile: { 15 | fullpath: true, 16 | filename: true, 17 | ext: false, 18 | winpath: false, 19 | 20 | enable: true, 21 | copyall_split: '\n' 22 | }, 23 | singlefile: { 24 | fullpath: true, 25 | filename: true, 26 | ext: false, 27 | winpath: true, 28 | 29 | enable: true 30 | } 31 | } 32 | let config = {}; 33 | const read_config = () => { 34 | const config_dir = shell.breeze.data_directory() + '/config/' 35 | shell.fs.mkdir(config_dir) 36 | if (shell.fs.exists(config_dir + CONFIG_FILE)) { 37 | try { 38 | config = JSON.parse(shell.fs.read(config_dir + CONFIG_FILE)) 39 | } catch (e) { 40 | shell.println('配置文件解析失败', e, '\n', e.stack) 41 | } 42 | } 43 | } 44 | 45 | read_config() 46 | 47 | const read_config_key = key => { 48 | const read = (keys, obj) => { 49 | if (keys.length === 1) { 50 | return obj[keys[0]] 51 | } 52 | if (!obj[keys[0]]) { 53 | return undefined 54 | } 55 | return read(keys.slice(1), obj[keys[0]]) 56 | } 57 | 58 | return read(key.split('.'), config) ?? read(key.split('.'), default_config) 59 | } 60 | 61 | const write_config = () => { 62 | const config_dir = shell.breeze.data_directory() + '/config/' 63 | shell.fs.mkdir(config_dir) 64 | shell.fs.write(config_dir + CONFIG_FILE, JSON.stringify(config, null, 4)) 65 | } 66 | 67 | const write_config_key = (key, value) => { 68 | let obj = config 69 | 70 | const keys = key.split('.') 71 | for (let i = 0; i < keys.length - 1; i++) { 72 | if (!obj[keys[i]]) { 73 | obj[keys[i]] = {} 74 | } 75 | obj = obj[keys[i]] 76 | } 77 | obj[keys[keys.length - 1]] = value 78 | write_config() 79 | } 80 | 81 | on_plugin_menu[PLUGIN_NAME] = ((menu) => { 82 | const createToggleMenu = (menu, name, configKey, submenu) => { 83 | const menuItem = menu.append_menu({ 84 | name, 85 | action() { 86 | try { 87 | write_config_key(configKey, !read_config_key(configKey)) 88 | menuItem.set_data({ 89 | icon_svg: read_config_key(configKey) ? ICON_CHECKED : ICON_EMPTY 90 | }) 91 | } catch (e) { 92 | shell.println(e, e.stack) 93 | } 94 | }, 95 | icon_svg: read_config_key(configKey) ? ICON_CHECKED : ICON_EMPTY, 96 | submenu 97 | }) 98 | return menuItem 99 | } 100 | 101 | createToggleMenu(menu, '选中多个文件时启用', 'multifile.enable', sub => { 102 | createToggleMenu(sub, '文件路径', 'multifile.fullpath') 103 | createToggleMenu(sub, '文件名', 'multifile.filename') 104 | createToggleMenu(sub, '拓展名', 'multifile.ext') 105 | createToggleMenu(sub, 'Windows 路径', 'multifile.winpath') 106 | sub.append_menu({ 107 | type: 'spacer' 108 | }) 109 | 110 | const spliters = { 111 | '\n': '换行', 112 | ',': '英文/半角逗号', 113 | ';': '英文/半角分号', 114 | ' ': '空格', 115 | '、': '、', 116 | ',': '中文/全角逗号', 117 | ';': '中文/全角分号', 118 | } 119 | const spliter = sub.append_menu({ 120 | name: '多个文件路径分隔符: ' + spliters[read_config_key('multifile.copyall_split')], 121 | action() { 122 | const keys = Object.keys(spliters) 123 | write_config_key('multifile.copyall_split', keys[(keys.indexOf(read_config_key('multifile.copyall_split')) + 1) % keys.length]) 124 | spliter.set_data({ 125 | name: '多个文件路径分隔符: ' + spliters[read_config_key('multifile.copyall_split')] 126 | }) 127 | } 128 | }) 129 | }) 130 | 131 | createToggleMenu(menu, '选中单个文件时启用', 'singlefile.enable', sub => { 132 | createToggleMenu(sub, '文件路径', 'singlefile.fullpath') 133 | createToggleMenu(sub, '文件名', 'singlefile.filename') 134 | createToggleMenu(sub, '拓展名', 'singlefile.ext') 135 | createToggleMenu(sub, 'Windows 路径', 'singlefile.winpath') 136 | }) 137 | }) 138 | 139 | // ---- CONFIG TEMPLATE ---- 140 | 141 | // fullpath/filename/ext/winpath 142 | let copy_type = 'fullpath' 143 | shell.menu_controller.add_menu_listener(ctx => { 144 | if (ctx.context.folder_view) { 145 | const fv = ctx.context.folder_view 146 | const selectedPaths = fv.selected_files 147 | 148 | const updateMenusAsClipboard = (menus, items, start = 0) => { 149 | for (let i = 0; i < items.length; i++) 150 | menus.get_item(i + start).set_data({ 151 | name: items[i], 152 | action() { 153 | shell.clipboard.set_text(items[i]) 154 | ctx.menu.close() 155 | } 156 | }) 157 | } 158 | 159 | const parsePath = (path) => { 160 | const filename = path.replaceAll('\\', '/').split('/').pop() 161 | const ext = filename.split('.').pop() 162 | const winpath = '"' + path.replaceAll('\\', '\\\\') + '"' 163 | return { 164 | filename, 165 | ext, 166 | fullpath: path, 167 | winpath 168 | } 169 | } 170 | 171 | if (selectedPaths.length === 0) { 172 | return 173 | } 174 | const items = ctx.menu.get_items() 175 | let target = items.findIndex(v => v.data().name === '复制文件地址' || v.data().name === 'Copy as path') 176 | 177 | let menu; 178 | if (target === -1) { 179 | target = items.findIndex(v => v.data().name === '剪切') - 1 180 | menu = ctx.menu.append_menu_after({}, target) 181 | } else { 182 | menu = ctx.menu.get_item(target) 183 | } 184 | 185 | 186 | if (selectedPaths.length === 1) { 187 | const path = parsePath(selectedPaths[0]) 188 | 189 | menu.set_data({ 190 | name: `${path.filename}`, 191 | action() { 192 | shell.clipboard.set_text(path.filename) 193 | ctx.menu.close() 194 | }, 195 | submenu(sub) { 196 | for (const key in path) { 197 | if (read_config_key(`singlefile.${key}`)) { 198 | sub.append_menu({ 199 | name: path[key], 200 | action() { 201 | shell.clipboard.set_text(path[key]) 202 | } 203 | }) 204 | } 205 | } 206 | } 207 | }) 208 | } else if (selectedPaths.length > 1) { 209 | menu.set_data({ 210 | name: '多个文件路径...', 211 | action() { 212 | shell.clipboard.set_text(selectedPaths.join(read_config_key('multifile.copyall_split'))) 213 | ctx.menu.close() 214 | }, 215 | submenu(sub) { 216 | const upd = () => updateMenusAsClipboard(sub, selectedPaths.map(v => 217 | parsePath(v)[copy_type] 218 | ), 2) 219 | const roll = ['fullpath', 'filename', 'ext', 'winpath'].filter( 220 | v => read_config_key(`multifile.${v}`) 221 | ) 222 | const typenames = { 223 | fullpath: '文件路径', 224 | filename: '文件名', 225 | ext: '拓展名', 226 | winpath: 'Windows 路径' 227 | } 228 | const changeType = sub.append_menu({ 229 | name: typenames[copy_type], 230 | action() { 231 | copy_type = roll[(roll.indexOf(copy_type) + 1) % roll.length] 232 | changeType.set_data({ 233 | name: typenames[copy_type] 234 | }) 235 | upd() 236 | } 237 | }) 238 | 239 | sub.append_menu({ 240 | name: '复制全部', 241 | action() { 242 | shell.clipboard.set_text(selectedPaths.map(v => 243 | parsePath(v)[copy_type] 244 | ).join(read_config_key('multifile.copyall_split'))) 245 | ctx.menu.close() 246 | } 247 | }) 248 | 249 | for (let i = 0; i < selectedPaths.length; i++) { 250 | sub.append_menu({ 251 | name: '' 252 | }) 253 | } 254 | upd() 255 | } 256 | }) 257 | } 258 | } 259 | }) 260 | -------------------------------------------------------------------------------- /plugins/file-hash.js: -------------------------------------------------------------------------------- 1 | // @name: File Hash 2 | // @description: File Hash 3 | // @author: Il Harper 4 | // @version: 0.0.1 5 | 6 | import * as shell from 'mshell' 7 | 8 | const languages = { 9 | 'en-US': { 10 | 按下任意键以继续: 'Press any key to continue...', 11 | }, 12 | 'ja-JP': { 13 | 按下任意键以继续: '続行するには何かキーを押してください . . . ', 14 | }, 15 | 'zh-CN': {}, 16 | } 17 | 18 | const currentLang = Object.keys(languages).includes( 19 | shell.breeze.user_language(), 20 | ) 21 | ? shell.breeze.user_language() 22 | : 'en-US' 23 | 24 | const t = (key) => languages[currentLang][key] || key 25 | 26 | // on_plugin_menu['File Hash'] = (menu) => {} 27 | 28 | const algs = [ 29 | 'MACTripleDES', 30 | 'MD5', 31 | 'RIPEMD160', 32 | 'SHA1', 33 | 'SHA256', 34 | 'SHA384', 35 | 'SHA512', 36 | ] 37 | 38 | shell.menu_controller.add_menu_listener((ctx) => { 39 | const fv = ctx.context.folder_view 40 | if (!fv || fv.selected_files.length !== 1) return 41 | ctx.menu.append_menu({ 42 | name: 'File Hash', 43 | submenu: (sub) => { 44 | for (const alg of algs) 45 | sub.append_menu({ 46 | name: alg, 47 | action: () => { 48 | runHashV1(fv.selected_files[0], alg) 49 | }, 50 | }) 51 | }, 52 | }) 53 | }) 54 | 55 | function runHashV1(filePath, alg) { 56 | const fileName = filePath.replaceAll('\\', '/').split('/').pop() 57 | const pressAnyKey = t('按下任意键以继续') 58 | shell.subproc.run_async( 59 | // run 参会直接传入 CreateProcessW 的 lpCommandLine 60 | [ 61 | `wt new-tab --title "[${alg}] ${fileName}" `, // 创建新标签,指定标题 62 | `PowerShell -Command `, // -Command 是 PowerShell CLI 的参数,指示后文为需要运行的脚本 63 | `Get-FileHash -Algorithm ${alg} `, // 指定算法 64 | `'${filePath}' `, // 文件地址使用单引号而非双引号包裹,避免在其他地方意外转义 65 | '| Format-List', // 计算结果后打印输出 66 | '\\;', // 反斜杠用来转义 Windows Terminal 的「新建标签页」行为。转义后,单独的一个分号会续在要运行的 PowerShell 命令后 67 | `'${pressAnyKey}'`, // 单引号包裹按键继续提示,PowerShell 会将单引号包裹的内容视作字串,原样输出 68 | '\\;', 69 | '[Console]::Readkey() | Out-Null', // 等待按键 70 | '\\;', 71 | 'exit', // 退出 72 | ].join(''), 73 | () => {}, 74 | ) 75 | } 76 | 77 | // function runHashV2(filePath, alg) { 78 | // const fileName = filePath.replaceAll('\\', '/').split('/').pop() 79 | // const pressAnyKey = t('按下任意键以继续') 80 | 81 | // const script = [ 82 | // `Get-FileHash -Algorithm ${alg} `, // 指定算法 83 | // `'${filePath}' `, // 文件地址使用单引号而非双引号包裹,避免在其他地方意外转义 84 | // '| Format-List', // 计算结果后打印输出 85 | // '\\;', // 反斜杠用来转义 Windows Terminal 的「新建标签页」行为。转义后,单独的一个分号会续在要运行的 PowerShell 命令后 86 | // `'${pressAnyKey}'`, // 单引号包裹按键继续提示,PowerShell 会将单引号包裹的内容视作字串,原样输出 87 | // '\\;', 88 | // '[Console]::Readkey() | Out-Null', // 等待按键 89 | // '\\;', 90 | // 'exit', // 退出 91 | // ].join('') 92 | // const encodedScript = b64Encode(script) 93 | 94 | // shell.subproc.run_async( 95 | // // run 参会直接传入 CreateProcessW 的 lpCommandLine 96 | // `wt new-tab --title "[${alg}] ${fileName}" PowerShell -EncodedCommand ${encodedScript}`, 97 | // () => {}, 98 | // ) 99 | // } 100 | 101 | // function b64Encode(s) { 102 | // const bytes = new TextEncoder().encode(s) 103 | // const binString = Array.from(bytes, (byte) => 104 | // String.fromCodePoint(byte), 105 | // ).join('') 106 | // return btoa(binString) 107 | // } 108 | 109 | // function b64Decode(d) { 110 | // const binString = atob(base64) 111 | // new TextDecoder().decode( 112 | // Uint8Array.from(binString, (m) => m.codePointAt(0)), 113 | // ) 114 | // } 115 | -------------------------------------------------------------------------------- /plugins/插件图标主题色.js: -------------------------------------------------------------------------------- 1 | // @name: 插件图标主题色 2 | // @description: 让部分插件添加的图标染上系统主题色 / Colorize icons added by other plugins with accent color 3 | // @version: 0.0.3 4 | // @author: Lukoning 5 | 6 | import * as shell from "mshell" 7 | 8 | const scriptsDir = `${shell.breeze.data_directory()}/scripts/` 9 | 10 | const languages = { 11 | "en-US": { 12 | 立即应用: "Apply now", 13 | 主题色改变时自动应用: "Auto apply when accent color changes", 14 | 在此选择需要修改图标的插件: "Select the plugin whose icons you want to colorize", 15 | "(高级)编辑需替换的颜色": "(Advanced) Edit the color you want to replace" 16 | }, 17 | "ja-JP": { 18 | 在此选择需要修改图标的插件: "ここでアイコンの変更が必要なプラグインを選択します", 19 | }, 20 | "zh-CN": { 21 | }, 22 | }; 23 | 24 | const currentLang = Object.keys(languages).includes( 25 | shell.breeze.user_language() 26 | ) 27 | ? shell.breeze.user_language() 28 | : "en-US"; 29 | 30 | const t = (key) => { 31 | return languages[currentLang][key] || key; 32 | }; 33 | 34 | // ---- CONFIG TEMPLATE ---- 35 | const CONFIG_FILE = 'accent-icons.json' 36 | const PLUGIN_NAME = '插件图标主题色' 37 | const ICON_CHECKED = `` 38 | const ICON_EMPTY = `` 39 | const default_config = { 40 | autoApply: true, 41 | patchList: {}, 42 | colorToReplace: { 43 | dark: "#4CC2FF", 44 | light: "#0078D4", 45 | }, 46 | oldColor: { 47 | accent: "", 48 | colorization: "", 49 | }, 50 | advanced: { 51 | plugins: {}, 52 | }, 53 | } 54 | let config = {}; 55 | const read_config = () => { 56 | const config_dir = shell.breeze.data_directory() + '/config/' 57 | shell.fs.mkdir(config_dir) 58 | if (shell.fs.exists(config_dir + CONFIG_FILE)) { 59 | try { 60 | config = JSON.parse(shell.fs.read(config_dir + CONFIG_FILE)) 61 | } catch (e) { 62 | shell.println('配置文件解析失败', e, '\n', e.stack) 63 | } 64 | } 65 | } 66 | 67 | read_config() 68 | 69 | const read_config_key = key => { 70 | const read = (keys, obj) => { 71 | if (keys.length === 1) { 72 | return obj[keys[0]] 73 | } 74 | if (!obj[keys[0]]) { 75 | return undefined 76 | } 77 | return read(keys.slice(1), obj[keys[0]]) 78 | } 79 | 80 | return read(key.split('.'), config) ?? read(key.split('.'), default_config) 81 | } 82 | 83 | const write_config = () => { 84 | const config_dir = shell.breeze.data_directory() + '/config/' 85 | shell.fs.mkdir(config_dir) 86 | shell.fs.write(config_dir + CONFIG_FILE, JSON.stringify(config, null, 4)) 87 | } 88 | 89 | const write_config_key = (key, value) => { 90 | read_config() //解决手动修改配置文件后写配置时,手动改的配置被缓存的旧配置覆盖的问题 91 | 92 | let obj = config 93 | 94 | const keys = key.split('.') 95 | for (let i = 0; i < keys.length - 1; i++) { 96 | if (!obj[keys[i]]) { 97 | obj[keys[i]] = {} 98 | } 99 | obj = obj[keys[i]] 100 | } 101 | obj[keys[keys.length - 1]] = value 102 | write_config() 103 | } 104 | 105 | on_plugin_menu[PLUGIN_NAME] = ((menu) => { 106 | read_config(); 107 | const config_dir = shell.breeze.data_directory() + '/config/' 108 | const createToggleMenu = (menu, name, configKey, submenu) => { 109 | const menuItem = menu.append_menu({ 110 | name, 111 | action() { 112 | try { 113 | write_config_key(configKey, !read_config_key(configKey)) 114 | menuItem.set_data({ 115 | icon_svg: read_config_key(configKey) ? ICON_CHECKED : ICON_EMPTY 116 | }) 117 | } catch (e) { 118 | shell.println(e, e.stack) 119 | } 120 | }, 121 | icon_svg: read_config_key(configKey) ? ICON_CHECKED : ICON_EMPTY, 122 | submenu 123 | }) 124 | return menuItem 125 | } 126 | 127 | async function editColorToReplace(key="colorToReplace") { 128 | if (key) { 129 | write_config_key(`${key}.dark`, read_config_key(`${key}.dark`) ?? read_config_key("colorToReplace.dark")); 130 | write_config_key(`${key}.light`, read_config_key(`${key}.light`) ?? read_config_key("colorToReplace.light")); 131 | } 132 | shell.subproc.run(`cmd /c ${config_dir+CONFIG_FILE}`); 133 | } 134 | 135 | menu.append_menu({ 136 | name: t("立即应用"), 137 | action() {applyNow(); menuctx.menu.close()} 138 | }) 139 | createToggleMenu(menu, t("主题色改变时自动应用"), "autoApply") 140 | menu.append_menu({ 141 | name: t("(高级)编辑需替换的颜色"), 142 | action: ()=>{ 143 | menuctx.menu.close(); 144 | editColorToReplace(); 145 | } 146 | }) 147 | menu.append_spacer(); 148 | menu.append_menu({ 149 | name: t("在此选择需要修改图标的插件"), 150 | disabled: true 151 | }) 152 | const pluginFiles = shell.fs.readdir(scriptsDir); 153 | for (let i=0; i{ 160 | submenu.append_menu({ 161 | name: t("(高级)编辑需替换的颜色"), 162 | action: ()=>{ 163 | menuctx.menu.close(); 164 | editColorToReplace(`advanced.plugins.${nameConfig}.colorToReplace`); 165 | } 166 | }) 167 | } 168 | ) 169 | } 170 | }) 171 | 172 | // ---- CONFIG TEMPLATE ---- 173 | 174 | const REG = { 175 | path: "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\DWM", 176 | accent: "AccentColor", //弃用。这个注册表值更新不及时(系统内表现为窗口标题栏和边框上显示的主题色不正确) 177 | colorization: "ColorizationColor" 178 | }; 179 | 180 | let menuctx 181 | 182 | function compareVersions(v1, v2) { //新版, 旧版 183 | let arr1 = v1.split("."); 184 | let arr2 = v2.split("."); 185 | for (let i=0; i num2) { 191 | return 1; 192 | } 193 | } 194 | return 0; 195 | } 196 | 197 | function getVersionFromContent(content) { 198 | const keyword = "// @version:"; 199 | const startIndex = content.indexOf(keyword); 200 | if (startIndex == -1) {return null}; 201 | 202 | const versionStart = startIndex + keyword.length; 203 | const nextNewline = content.indexOf('\n', versionStart); 204 | const endIndex = nextNewline == -1 ? content.length : nextNewline; 205 | 206 | const rawVersion = content.substring(versionStart, endIndex).trim(); 207 | return rawVersion 208 | } 209 | 210 | function applyAccentColor(color) { 211 | const patchList = read_config_key("patchList") 212 | const patchListKeys = Object.keys(patchList) 213 | let namesConfig = new Array(); 214 | for (let i=0; i{ 247 | const out = back.out 248 | const colorization = out.substr(out.lastIndexOf("0x")+4, 6); 249 | const color = { 250 | //accent: `#${bgrToRgb(accent)}`, 251 | colorization: `#${colorization}` 252 | }; 253 | if (isAuto && color.colorization == read_config_key("oldColor.colorization")) {return} 254 | write_config_key("oldColor.colorization", color.colorization) 255 | applyAccentColor(color) 256 | }) 257 | //const colorizationOut = shell.subproc.run_async(`reg query "${REG.path}" /v "${REG.colorization}"`).out; 258 | //const colorization = colorizationOut.substr(colorizationOut.lastIndexOf("0x")+4, 6); 259 | } catch (error) { 260 | shell.println("获取注册表颜色失败:", error); 261 | return null; 262 | } 263 | } 264 | 265 | shell.menu_controller.add_menu_listener(ctx => { 266 | menuctx = ctx 267 | if (read_config_key("autoApply")) {applyNow(true)} 268 | }) -------------------------------------------------------------------------------- /plugins/桌面右键配置 Breeze - 桌面右键打开 Breeze 数据目录.js: -------------------------------------------------------------------------------- 1 | // @name: 桌面右键配置 Breeze 2 | // @description: 在桌面右键菜单添加“配置 Breeze”选项,点击后打开 Breeze 数据目录 3 | // @author: leafmoes 4 | // @version: 0.0.2 5 | 6 | import * as shell from "mshell"; 7 | 8 | const ICON_CHECKED = `` 9 | const MENU_NAME = "配置 Breeze"; 10 | 11 | const languages = { 12 | 'en-US': { 13 | '配置 Breeze': 'Config Breeze', 14 | }, 'zh-CN': { 15 | } 16 | } 17 | 18 | const currentLang = shell.breeze.user_language() === 'zh-CN' ? 'zh-CN' : 'en-US' 19 | const t = (key) => { 20 | return languages[currentLang][key] || key 21 | } 22 | 23 | shell.menu_controller.add_menu_listener((ctx) => { 24 | const keywords = ["个性化","Personalize"] 25 | const isDesktopMenu = ctx.menu.get_items().some(menu => { 26 | const data = menu.data(); 27 | return keywords.some(name => name === data.name); 28 | }); 29 | 30 | if (isDesktopMenu) { 31 | ctx.menu.append_menu({ 32 | type: "button", 33 | name: t(MENU_NAME), 34 | icon_svg:ICON_CHECKED, 35 | action:() => { 36 | shell.subproc.run_async(`explorer.exe "${shell.breeze.data_directory().replaceAll('/', '\\')}"`,()=>{}) 37 | ctx.menu.close() 38 | }, 39 | },0); 40 | } 41 | }); 42 | -------------------------------------------------------------------------------- /plugins/链接详情显示.js: -------------------------------------------------------------------------------- 1 | // @name: 链接详情显示 2 | // @description: 显示当前选中文件(夹)的链接详情(支持软链接、硬链接、符号链接)。点击路径可以直接复制。 3 | // @author: NahidaBuer 4 | // @version: 0.0.1 5 | import * as shell from "mshell"; 6 | 7 | const languages = { 8 | "en-US": { 9 | 获取失败: "Failed to get", 10 | 可能是权限不足: "It may be due to insufficient permissions", 11 | 或是受保护的系统文件: "Or protected system files", 12 | "链接目标:": "Link target:", 13 | 复制: "Copy", 14 | 打开: "Open", 15 | }, 16 | "ja-JP": { 17 | 获取失败: "取得に失敗しました", 18 | 可能是权限不足: "これは権限が不足しているためかもしれません", 19 | 或是受保护的系统文件: "または保護されたシステムファイル", 20 | "链接目标:": "リンク先:", 21 | 复制: "コピー", 22 | 打开: "開く", 23 | }, 24 | "zh-CN": { 25 | "Is NOT a link": "不是链接", 26 | }, 27 | }; 28 | 29 | const currentLang = Object.keys(languages).includes( 30 | shell.breeze.user_language() 31 | ) 32 | ? shell.breeze.user_language() 33 | : "en-US"; 34 | 35 | const t = (key) => { 36 | return languages[currentLang][key] || key; 37 | }; 38 | 39 | shell.menu_controller.add_menu_listener((ctx) => { 40 | const fv = ctx.context.folder_view; 41 | if (!fv || fv.selected_files.length !== 1) return; 42 | ctx.menu.append_menu({ 43 | name: t("链接详情"), 44 | submenu: (sub) => { 45 | let link_info = get_link_info(fv.selected_files[0]); 46 | if (link_info[0] === "Is NOT a link") { 47 | sub.append_menu({ 48 | name: t(link_info[0]), 49 | }); 50 | } else if (link_info[0] === "") { 51 | sub.append_menu({ 52 | name: t("获取失败"), 53 | }); 54 | sub.append_menu({ 55 | name: t("可能是权限不足"), 56 | }); 57 | sub.append_menu({ 58 | name: t("或是受保护的系统文件"), 59 | }); 60 | } else { 61 | sub.append_menu({ 62 | name: t("链接目标:"), 63 | action: () => {}, 64 | }); 65 | for (let link of link_info) { 66 | sub.append_menu({ 67 | name: `${link}`, 68 | submenu: (sub) => { 69 | sub.append_menu({ 70 | name: t("复制"), 71 | action: () => { 72 | shell.clipboard.set_text(link); 73 | ctx.menu.close(); 74 | }, 75 | }); 76 | sub.append_menu({ 77 | name: t("打开"), 78 | action: () => { 79 | shell.subproc.run_async( 80 | `PowerShell -Command "Invoke-Item ${link}"`, 81 | () => {} 82 | ); 83 | ctx.menu.close(); 84 | }, 85 | }); 86 | }, 87 | action: () => { 88 | shell.clipboard.set_text(link); 89 | ctx.menu.close(); 90 | }, 91 | }); 92 | } 93 | } 94 | }, 95 | }); 96 | }); 97 | function get_link_info(path) { 98 | let cmd = `PowerShell -Command "$p='${path}'; try { if (($i=Get-Item $p -Force -ErrorAction Stop).LinkType) { if ($i.LinkType -match 'SymbolicLink|Junction') { $i.Target } else { fsutil hardlink list $p | ForEach-Object { Join-Path (Split-Path $p -Qualifier) $_ } } } else { 'Is NOT a link' } } catch { '' }"`; 99 | shell.println(cmd); 100 | shell.println(); 101 | let result = shell.subproc.run(cmd); 102 | shell.println(result.code); 103 | // shell.println(result.err); 104 | shell.println(result.out); 105 | return result.out.trim().split("\n"); 106 | } 107 | --------------------------------------------------------------------------------