Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Factory:Rebuild
xdg-terminal-exec
xdg-terminal-exec-20240120+git.efc3517.obscpio
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xdg-terminal-exec-20240120+git.efc3517.obscpio of Package xdg-terminal-exec
07070100000000000081A400000000000000000000000165AC06E100008945000000000000000000000000000000000000002F00000000xdg-terminal-exec-20240120+git.efc3517/LICENSE GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. {one line to give the program's name and a brief idea of what it does.} Copyright (C) {year} {name of author} This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: {project} Copyright (C) {year} {fullname} This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>. 07070100000001000081A400000000000000000000000165AC06E100001C30000000000000000000000000000000000000003100000000xdg-terminal-exec-20240120+git.efc3517/README.md# xdg-terminal-exec Proposal for XDG terminal execution utility and default terminal specification. Reference shell-based implementation. # Default Terminal Execution Spec and Utility This configuration spec is crafted in image of [mime-apps-spec](https://specifications.freedesktop.org/mime-apps-spec/latest/ar01s02.html) and fully relies on [basedir-spec](https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html). Terminal emulators (with their exec arguments) are described by stock Desktop Entries located in `applications` subdirs of XDG data hierarchy and marked by `TerminalEmulator` category. Preferred terminals are configured by listing their [entry IDs](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s02.html#desktop-file-id) in config files named `${desktop}-xdg-terminals.list` or `xdg-terminals.list` placed in XDG config hierarchy. The format is a simple newline-separated list. Optionally an entry ID can be suffixed with [action ID](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s11.html), delimited by `:` (`entry-id.desktop:action-id`). Lines starting with `#` are ignored, dangling whitespaces are trimmed. Special directives for modifying behavior of implementations may be present in config files. Directives that are not listed by this spec and are not understood by a particular implementation should be discarded. It is recommended to start directives with a symbol that is not valid for entry ID, i.e. `/`. Default paths used by utility are resolved into: - config files (in `${XDG_CONFIG_HOME}:${XDG_CONFIG_DIRS}`): - `${HOME}/.config/${desktop}-xdg-terminals.list` - `${HOME}/.config/xdg-terminals.list` - `/etc/xdg/${desktop}-xdg-terminals.list` - `/etc/xdg/xdg-terminals.list` - desktop entries (in `${XDG_DATA_HOME}:${XDG_DATA_DIRS}`): - `${HOME}/.local/share/applications/` - `/usr/local/share/applications/` - `/usr/share/applications/` Where `${desktop}` is a lowercased string that can be matched (case-insensitively) against items of `$XDG_CURRENT_DESKTOP` (a colon-separated list of names for the current DE). ## Priority of selecting an entry - A list of explicitly preferred entry IDs is composed by taking previously unseen IDs: - from each dir of XDG config hierarchy in the order of decreasing priority: - from `${desktop}-xdg-terminals.list` files in the order of `$XDG_CURRENT_DESKTOP` items - from `xdg-terminals.list` - Each entry from the resulting list is checked for applicability: - presense of `TerminalEmulator` category if using stock `applications` data subdirs - validation by the same rules as in Desktop Entry Spec, except `*ShowIn` conditions - entry is discarded if it does not pass the checks - the first applicable entry is used - If no applicable entry is found, each entry from XDG data hierarchy (except those discarded earlier) is checked for applicability: - presense of `TerminalEmulator` category if using stock `applications` data subdirs - validation by the same rules as in Desktop Entry Spec, now including `*ShowIn` conditions - the first applicable entry is used - the order in which found entries under the same base directory are checked in is undefined - If no applicable entry is found, an error is returned. ## Desktop entry for a terminal Stock desktop entry for terminal emulator may be used. Command execution argument defaults to `-e`. Key `X-ExecArg=` can be used to override it or omit by explicitly setting to an empty value. Whether launched terminal process waits for command to finish or exits immediately (i.e. after sending IPC request to a master process) is not defined by the this spec. Some IPC-using terminals provide separate entries or [actions](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s11.html) for launching separate processes without IPC. ## Syntax ``` xdg-terminal-exec [command [arguments]] ``` If run without any arguments, only the terminal itself (value of `Exec=`) is executed. If a command (with or witout its arguments) is given, then values of both `Exec=` and `X-ExecArg=` (if not explicitly empty) are used, along with provided command and arguments that are transmitted as is. If `-e` or matching execution argument is given explicitly as the first argument on the command line, it should be discarded for backwards compatibility with software that hardcodes these arguments. The resulting command is executed without forking. ## Limitations and compliance of terminals There is no mechanism for handling special quoting and arguments/strings that may be required for some terminals. The expected behavior is modelled after xterm and is arguably common for a majority of terminals. This example: ``` xdg-terminal-exec nano "some file with spaces"\ and\ unquoted\ spaces second\ file ``` is expected to launch `nano` editing two files named `some file with spaces and unquoted spaces` and `second file`. # Notes ## Arguments IMHO `xterm -e` handling of arguments is the golden standard, any terminal that fails to do so should be bugreported. Some examples of compliant terminals: xterm, alacritty, kitty, foot, qterminal Terminals that use `-e` but mangle arguments: sakura ## This shell-based implementation and performance Setting `DEBUG` env to a truthy value will output verbose messages to stderr. The shell code itself is quite optimized and fast, especially when using a slick `sh` implementation like `dash`. The most taxing part of the algorithm is reading all the desktop entry files for parsing in search of an applicable terminal among them. Having a valid entry specified in `*xdg-terminals.list` speeds up the process significantly, shifting the bottleneck to `find` calls for composing the list of desktop entries. ### Cache This implementation can also cache selected terminal for fast read at a cost of reading one file (`${XDG_CACHE_HOME:-$HOME/.cache}/xdg-terminal-exec`) and feeding `md5sum` the value of `$XDG_CURRENT_DESKTOP` and output of `ls -LRl` for all possible config file and data dir paths in one go. Valid cache bypasses reading of any other file. Currentry this feature is disabled by default and can be controlled by first encountered `/enable_cache`|`/disable_cache` direcive in the configs or `XTE_CACHE_ENABLED` env var (truthy or falsy value, has priority). Unless `XTE_CACHE_ENABLED` is false, an attempt at reading the cache file is always performed though. Its existence translates into initial assumption about cache feature state. If cache is invalid (which it should be if a config was edited to disable the cache), usual process of reading configs and entries will occur. The cache file is always removed when the script knows for sure that the cache feature is disabled. Caveat: If the cache was enabled solely via truthy `XTE_CACHE_ENABLED` value, and the var was later removed, the script will not know that the cache is disabled until one of three things happens: cache file is removed, something invalidates it (like touching/editing a config/entry), or a run with falsy `XTE_CACHE_ENABLED` is performed. The plan is to eventually enable it by default for unattended fastness. 07070100000002000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000002C00000000xdg-terminal-exec-20240120+git.efc3517/test07070100000003000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003000000000xdg-terminal-exec-20240120+git.efc3517/test/bin07070100000004000081ED00000000000000000000000165AC06E10000001A000000000000000000000000000000000000003600000000xdg-terminal-exec-20240120+git.efc3517/test/bin/xterm#!/bin/sh echo xterm "$@" 07070100000005000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003300000000xdg-terminal-exec-20240120+git.efc3517/test/config07070100000006000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003B00000000xdg-terminal-exec-20240120+git.efc3517/test/config/default07070100000007000081A400000000000000000000000165AC06E100000015000000000000000000000000000000000000004E00000000xdg-terminal-exec-20240120+git.efc3517/test/config/default/xdg-terminals.listdefault-term.desktop 07070100000008000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003B00000000xdg-terminal-exec-20240120+git.efc3517/test/config/desktop07070100000009000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004100000000xdg-terminal-exec-20240120+git.efc3517/test/config/desktop/lists0707010000000A000081A400000000000000000000000165AC06E100000016000000000000000000000000000000000000005C00000000xdg-terminal-exec-20240120+git.efc3517/test/config/desktop/lists/desktop-xdg-terminals.listspecific-term.desktop 0707010000000B000081A400000000000000000000000165AC06E100000015000000000000000000000000000000000000005400000000xdg-terminal-exec-20240120+git.efc3517/test/config/desktop/lists/xdg-terminals.listgeneric-term.desktop 0707010000000C000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004000000000xdg-terminal-exec-20240120+git.efc3517/test/config/desktop/show0707010000000D000081A400000000000000000000000165AC06E100000038000000000000000000000000000000000000005300000000xdg-terminal-exec-20240120+git.efc3517/test/config/desktop/show/xdg-terminals.listonly-term.desktop not-term.desktop generic-term.desktop 0707010000000E000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003A00000000xdg-terminal-exec-20240120+git.efc3517/test/config/hidden0707010000000F000081A400000000000000000000000165AC06E10000000F000000000000000000000000000000000000004D00000000xdg-terminal-exec-20240120+git.efc3517/test/config/hidden/xdg-terminals.listhidden.desktop 07070100000010000081A400000000000000000000000165AC06E100000012000000000000000000000000000000000000004B00000000xdg-terminal-exec-20240120+git.efc3517/test/config/myde-xdg-terminals.listmyde-term.desktop 07070100000011000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003D00000000xdg-terminal-exec-20240120+git.efc3517/test/config/preferred07070100000012000081A400000000000000000000000165AC06E100000017000000000000000000000000000000000000005000000000xdg-terminal-exec-20240120+git.efc3517/test/config/preferred/xdg-terminals.listpreferred-term.desktop 07070100000013000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004100000000xdg-terminal-exec-20240120+git.efc3517/test/config/tryexec-fails07070100000014000081A400000000000000000000000165AC06E100000016000000000000000000000000000000000000005400000000xdg-terminal-exec-20240120+git.efc3517/test/config/tryexec-fails/xdg-terminals.listtryexec-fails.desktop 07070100000015000081A400000000000000000000000165AC06E10000005F000000000000000000000000000000000000004600000000xdg-terminal-exec-20240120+git.efc3517/test/config/xdg-terminals.listnonexistent.desktop hidden.desktop failed-tryexec.desktop notshowin.desktop onlyshowin.desktop 07070100000016000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003100000000xdg-terminal-exec-20240120+git.efc3517/test/data07070100000017000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003E00000000xdg-terminal-exec-20240120+git.efc3517/test/data/applications07070100000018000081A400000000000000000000000165AC06E100000093000000000000000000000000000000000000005000000000xdg-terminal-exec-20240120+git.efc3517/test/data/applications/myde-term.desktop[Desktop Entry] Type=Application TryExec=testterm Exec=testterm myde-term Name=MYDE specific terminal OnlyShowIn=MYDE Categories=TerminalEmulator; 07070100000019000081A400000000000000000000000165AC06E100000082000000000000000000000000000000000000005600000000xdg-terminal-exec-20240120+git.efc3517/test/data/applications/non-listed-term.desktop[Desktop Entry] Type=Application TryExec=testterm Exec=testterm non-listed-term Name=Non-listed term Categories=TerminalEmulator; 0707010000001A000081A400000000000000000000000165AC06E10000009A000000000000000000000000000000000000005000000000xdg-terminal-exec-20240120+git.efc3517/test/data/applications/notshowin.desktop[Desktop Entry] Type=Application TryExec=testterm Exec=testterm notshowin Name=Not Show In NotShowIn=MYDE;MYDE2;MYDE3;MYDE4; Categories=TerminalEmulator; 0707010000001B000081A400000000000000000000000165AC06E10000008C000000000000000000000000000000000000005100000000xdg-terminal-exec-20240120+git.efc3517/test/data/applications/onlyshowin.desktop[Desktop Entry] Type=Application TryExec=testterm Exec=testterm onlyshowin Name=Only Show In OnlyShowIn=MYDE2; Categories=TerminalEmulator; 0707010000001C000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003900000000xdg-terminal-exec-20240120+git.efc3517/test/data/default0707010000001D000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004600000000xdg-terminal-exec-20240120+git.efc3517/test/data/default/applications0707010000001E000081A400000000000000000000000165AC06E10000006F000000000000000000000000000000000000005B00000000xdg-terminal-exec-20240120+git.efc3517/test/data/default/applications/default-term.desktop[Desktop Entry] Name=Default Terminal Type=Application Exec=echo default terminal Categories=TerminalEmulator; 0707010000001F000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003900000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop07070100000020000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003F00000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/lists07070100000021000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004C00000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/lists/applications07070100000022000081A400000000000000000000000165AC06E10000006F000000000000000000000000000000000000006100000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/lists/applications/generic-term.desktop[Desktop Entry] Name=Generic Terminal Type=Application Exec=echo generic terminal Categories=TerminalEmulator; 07070100000023000081A400000000000000000000000165AC06E100000071000000000000000000000000000000000000006200000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/lists/applications/specific-term.desktop[Desktop Entry] Name=Specific Terminal Type=Application Exec=echo specific terminal Categories=TerminalEmulator; 07070100000024000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004100000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/notshow07070100000025000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004E00000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/notshow/applications07070100000026000081A400000000000000000000000165AC06E100000076000000000000000000000000000000000000006100000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/notshow/applications/a-not-term.desktop[Desktop Entry] Name=Not Terminal Type=Application Exec=echo not terminal NotShowIn=not; Categories=TerminalEmulator; 07070100000027000081A400000000000000000000000165AC06E10000007A000000000000000000000000000000000000006200000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/notshow/applications/b-only-term.desktop[Desktop Entry] Name=Only Terminal Type=Application Exec=echo only terminal OnlyShowIn=only; Categories=TerminalEmulator; 07070100000028000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004200000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/onlyshow07070100000029000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004F00000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/onlyshow/applications0707010000002A000081A400000000000000000000000165AC06E10000007A000000000000000000000000000000000000006300000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/onlyshow/applications/a-only-term.desktop[Desktop Entry] Name=Only Terminal Type=Application Exec=echo only terminal OnlyShowIn=only; Categories=TerminalEmulator; 0707010000002B000081A400000000000000000000000165AC06E100000076000000000000000000000000000000000000006200000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/onlyshow/applications/b-not-term.desktop[Desktop Entry] Name=Not Terminal Type=Application Exec=echo not terminal NotShowIn=not; Categories=TerminalEmulator; 0707010000002C000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003E00000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/show0707010000002D000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004B00000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/show/applications0707010000002E000081A400000000000000000000000165AC06E10000006F000000000000000000000000000000000000006000000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/show/applications/generic-term.desktop[Desktop Entry] Name=Generic Terminal Type=Application Exec=echo generic terminal Categories=TerminalEmulator; 0707010000002F000081A400000000000000000000000165AC06E100000076000000000000000000000000000000000000005C00000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/show/applications/not-term.desktop[Desktop Entry] Name=Not Terminal Type=Application Exec=echo not terminal NotShowIn=not; Categories=TerminalEmulator; 07070100000030000081A400000000000000000000000165AC06E10000007A000000000000000000000000000000000000005D00000000xdg-terminal-exec-20240120+git.efc3517/test/data/desktop/show/applications/only-term.desktop[Desktop Entry] Name=Only Terminal Type=Application Exec=echo only terminal OnlyShowIn=only; Categories=TerminalEmulator; 07070100000031000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003900000000xdg-terminal-exec-20240120+git.efc3517/test/data/execarg07070100000032000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004600000000xdg-terminal-exec-20240120+git.efc3517/test/data/execarg/applications07070100000033000081A400000000000000000000000165AC06E10000007C000000000000000000000000000000000000005B00000000xdg-terminal-exec-20240120+git.efc3517/test/data/execarg/applications/execarg-term.desktop[Desktop Entry] Name=ExecArg Terminal Type=Application Exec=echo execarg terminal X-ExecArg=-- Categories=TerminalEmulator; 07070100000034000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003800000000xdg-terminal-exec-20240120+git.efc3517/test/data/hidden07070100000035000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004500000000xdg-terminal-exec-20240120+git.efc3517/test/data/hidden/applications07070100000036000081A400000000000000000000000165AC06E100000073000000000000000000000000000000000000005400000000xdg-terminal-exec-20240120+git.efc3517/test/data/hidden/applications/hidden.desktop[Desktop Entry] Name=Hidden Entry Type=Application Exec=echo hidden entry Hidden=true Categories=TerminalEmulator; 07070100000037000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003600000000xdg-terminal-exec-20240120+git.efc3517/test/data/huge07070100000038000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004300000000xdg-terminal-exec-20240120+git.efc3517/test/data/huge/applications07070100000039000081A400000000000000000000000165AC06E100003D1C000000000000000000000000000000000000005500000000xdg-terminal-exec-20240120+git.efc3517/test/data/huge/applications/huge-term.desktop[Desktop Entry] Type=Application Name[am]=ተርሚናል Name[an]=Terminal Name[ar]=الطرفية Name[as]=টাৰ্মিনেল Name[ast]=Terminal Name[az]=Terminal Name[be]=Тэрмінал Name[be@latin]=Terminał Name[bg]=Терминал Name[bn]=টার্মিনাল Name[bn_IN]=টার্মিন্যাল Name[br]=Termenell Name[bs]=Terminal Name[ca]=Terminal Name[ca@valencia]=Terminal Name[cs]=Terminál Name[cy]=Terfynell Name[da]=Terminal Name[de]=Terminal Name[dz]=ཊར་མི་ནཱལ་། Name[el]=Τερματικό Name[en_CA]=Terminal Name[en_GB]=Terminal Name[en@shaw]=𐑑𐑻𐑥𐑦𐑯𐑩𐑤 Name[eo]=Terminalo Name[es]=Terminal Name[et]=Terminal Name[eu]=Terminala Name[fa]=پایانه Name[fi]=Pääte Name[fr]=Terminal Name[fur]=Terminâl Name[ga]=Teirminéal Name[gd]=Tèirmineal Name[gl]=Terminal Name[gu]=ટર્મિનલ Name[he]=מסוף Name[hi]=टर्मिनल Name[hr]=Terminal Name[hu]=Terminál Name[hy]=Տերմինալ Name[id]=Terminal Name[is]=Skjáhermir (Terminal) Name[it]=Terminale Name[ja]=端末 Name[ka]=ტერმინალი Name[kab]=Anemdu Name[kk]=Терминал Name[km]=ស្ថានីយ Name[kn]=ಟರ್ಮಿನಲ್ Name[ko]=터미널 Name[ku]=Termînal Name[lt]=Terminalas Name[lv]=Terminālis Name[mai]=टर्मिनल Name[mg]=Terminal Name[mk]=Терминал Name[ml]=ടെര്മിനല് Name[mn]=Терминал Name[mr]=टर्मिनल Name[ms]=Terminal Name[nb]=Terminal Name[nds]=Terminal Name[ne]=टर्मिनल Name[nl]=Terminalvenster Name[nn]=Terminal Name[oc]=Terminal Name[or]=ଟର୍ମିନାଲ Name[pa]=ਟਰਮੀਨਲ Name[pl]=Terminal Name[ps]=پايالی Name[pt]=Terminal Name[pt_BR]=Terminal Name[ro]=Terminal Name[ru]=Терминал Name[si]=අග්රය Name[sk]=Terminál Name[sl]=Terminal Name[sq]=Terminali Name[sr]=Терминал Name[sr@latin]=Terminal Name[sv]=Terminal Name[ta]=முனையம் Name[te]=టెర్మినల్ Name[tg]=Терминал Name[th]=เทอร์มินัล Name[tr]=Uçbirim Name[ug]=تېرمىنال Name[uk]=Термінал Name[vi]=Thiết bị cuối Name[wa]=Terminå Name[xh]=i-Terminal Name[zh_CN]=终端 Name[zh_HK]=終端機 Name[zh_TW]=終端機 Name=Terminal Comment[an]=Emplega la linia de comandos Comment[ar]=استعمل سطر الأوامر Comment[as]=কমান্ড শাৰী ব্যৱহাৰ কৰক Comment[ast]=Usar llinia de comandos Comment[be]=Загадны радок Comment[be@latin]=Užyj zahadny radok Comment[bg]=Използване на команден ред Comment[bn]=কমান্ড লাইন ব্যবহার করুন Comment[bn_IN]=কমান্ড লাইন ব্যবহার করুন Comment[br]=Arverañ al linenn arc'had Comment[bs]=Koristi komandnu liniju Comment[ca]=Obriu la línia d'ordres Comment[ca@valencia]=Obriu la línia d'ordes Comment[cs]=Používejte příkazový řádek Comment[cy]=Defnyddio'r llinell orchymyn Comment[da]=Brug kommandolinjen Comment[de]=Befehlszeile verwenden Comment[dz]=བཀོད་ལམ་ལག་ལེན་འཐབ། Comment[el]=Χρησιμοποιήστε τη γραμμή εντολών Comment[en_CA]=Use the command line Comment[en_GB]=Use the command line Comment[en@shaw]=𐑿𐑕 𐑞 𐑒𐑩𐑥𐑭𐑯𐑛 𐑤𐑲𐑯 Comment[eo]=Uzi la komandolinion Comment[es]=Use la línea de comandos Comment[et]=Käsurea kasutamine Comment[eu]=Erabili komando-lerroa Comment[fa]=استفاده از خط فرمان Comment[fi]=Käytä komentoriviä Comment[fr]=Utiliser la ligne de commande Comment[fur]=Dopre la rie di comant Comment[ga]=Bain úsáid as líne na n-orduithe Comment[gd]=Cleachd an loidhne-àithne Comment[gl]=Usar a liña de ordes Comment[gu]=આદેશ વાક્ય વાપરો Comment[he]=שימוש בשורת הפקודה Comment[hi]=कमांड लाइन का प्रयोग करें Comment[hr]=Koristite naredbeni redak Comment[hu]=Parancssor használata Comment[id]=Menggunakan baris perintah Comment[is]=Nota skipanalínu Comment[it]=Usa la riga di comando Comment[ja]=コマンドライン端末です Comment[ka]=ბრძანების სტრიქონის გამოყენება Comment[kk]=Командалық жолды қолдану Comment[km]=ប្រើបន្ទាត់ពាក្យបញ្ជា Comment[kn]=ಆಜ್ಞಾ ಸಾಲನ್ನು ಬಳಸು Comment[ko]=명령 행을 사용합니다 Comment[ku]=Rêzika fermanan bikar bîne Comment[lt]=Naudoti komandų eilutę Comment[lv]=Izmantot komandrindu Comment[mai]=कमांड लाइन क' प्रयोग करू Comment[mg]=Hampiasa ny lazam-baiko Comment[mk]=Користи ја командната линија Comment[ml]=കമാന്ഡ് ലൈന് ഉപയോഗിക്കുക Comment[mn]=Тушаалын мөр хэрэглэ Comment[mr]=आदेश पंक्ती वापरा Comment[ms]=Guna baris perintah Comment[nb]=Bruk kommandolinjen Comment[nds]=De Orderreeg bruken Comment[ne]=आदेश रेखा प्रयोग गर्नुहोस् Comment[nl]=Gebruik de opdrachtregel Comment[nn]=Bruk kommandolinja Comment[oc]=Utilizar la linha de comanda Comment[or]=ନିର୍ଦ୍ଦେଶ ଧାରାକୁ ବ୍ୟବହାର କରନ୍ତୁ Comment[pa]=ਕਮਾਂਡ ਲਾਇਨ ਵਰਤੋਂ Comment[pl]=Wiersz poleceń Comment[ps]=بولۍ ليکه کارول Comment[pt]=Utilizar a linha de comando Comment[pt_BR]=Use a linha de comando Comment[ro]=Folosește linia de comandă Comment[ru]=Использовать командную строку Comment[sk]=Umožňuje používať príkazový riadok Comment[sl]=Uporabi ukazno vrstico Comment[sq]=Përdor rreshtin e komandës Comment[sr]=Користите линију наредби Comment[sr@latin]=Koristite liniju naredbi Comment[sv]=Använd kommandoraden Comment[ta]=கட்டளை வரியை பயன்படுத்து Comment[te]=ఆదేశ లైనును ఉపయోగించండి Comment[tg]=Истифодаи хати фармон Comment[th]=สั่งการด้วยบรรทัดคำสั่ง Comment[tr]=Komut satırını kullan Comment[ug]=بۇيرۇق قۇرىنى ئىشلەت Comment[uk]=Командний рядок Comment[vi]=Dùng dòng lệnh Comment[wa]=Eployî l' roye di comande Comment[zh_CN]=使用命令行 Comment[zh_HK]=使用命令列 Comment[zh_TW]=使用命令列 Comment=Use the command line Keywords[ar]=طرفية;صدفة;سطر;أوامر;أمر; Keywords[be]=абалонка;загадны радок;загад; Keywords[bg]=обвивка;терминал;команда;команден;ред;интерпретатор;eмулатор;конзола;баш;шел;дос;shell;prompt;command;commandline;cmd; Keywords[bn_IN]=সেল;প্রম্পট;কম্যান্ড;কম্যান্ডলাইন;cmd; Keywords[ca]=intèrpret d'ordres;indicador;ordre;línia d'ordres; Keywords[ca@valencia]=intèrpret d'ordes;indicador;orde;línia d'ordes; Keywords[cs]=shell;prompt;výzva;příkaz;příkazový řádek;příkazová řádka; Keywords[da]=shell;skal;prompt;kommando;kommandolinje;cmd; Keywords[de]=Shell;Prompt;Eingabeaufforderung;Befehl;Befehlszeile;cmd; Keywords[el]=κέλυφος;προτροπή;εντολή;γραμμή εντολών;shell;prompt;command;commandline;cmd; Keywords[en_GB]=shell;prompt;command;commandline;cmd; Keywords[eo]=ŝelo;invito;komando;komandlinio;kmd;cmd; Keywords[es]=shell;prompt;comando;línea de comandos;cmd; Keywords[eu]=shell;gonbitea;komandoa;komando-lerroa;kmd; Keywords[fa]=shell;prompt;command;commandline;cmd;فرمان;خط فرمان;پایانه; Keywords[fi]=shell;prompt;command;commandline;cmd;komento;kehote;komentorivi;cli; Keywords[fr]=shell;prompt;commande;ligne de commande;cmd; Keywords[fur]=shell;prompt;terminâl;comant;riedicomant;cmd; Keywords[gd]=shell;prompt;command;commandline;loidhne-àithne;àithne;àitheantan;cmd;slige; Keywords[gl]=shell;consola;orde;liña de ordes;cmd;comando; Keywords[he]=מעטפת;פקודה;שורת פקודה;שורה;מסך שחור;חלון דוס;cmd; Keywords[hr]=ljuska;prompt;naredba;naredbeni redak;cmd; Keywords[hu]=parancsértelmező;prompt;parancs;parancssor;cmd; Keywords[id]=shell;prompt;perintah;baris perintah;cmd; Keywords[is]=skel;kvaðning;skipun;skipanalína;cmd; Keywords[it]=shell;prompt;terminale;rigadicomando;comando;cmd; Keywords[ja]=shell;prompt;command;commandline;cmd;シェル;コマンドプロンプト;コマンドライン;terminal;ターミナル;端末; Keywords[ka]=shell;prompt;command;commandline;cmd; Keywords[kk]=shell;prompt;command;commandline;cmd;қоршам;сұрау;команда;командалық жол; Keywords[ko]=shell;셸;쉘;prompt;프롬프트;command;명령;commandline;명령행;커맨드;라인;cmd; Keywords[lt]=apvalkalas;eilutė;komanda;komandų eilutė;cmd; Keywords[lv]=čaula;uzvedne;komanda;komandrinda;cmd; Keywords[ml]=shell;prompt;command;commandline;cmd; Keywords[ms]=shell;bisikan;perintah;baris perintah;cmd; Keywords[nb]=skall;kommando;kommandolinje; Keywords[ne]=शेल;प्रोम्प्ट;आदेश;आदेशरेखा;cmd; Keywords[nl]=shell;prompt;command;commando;opdrachtregel;cli;commandline;terminal;cmd; Keywords[oc]=shell;prompt;comanda;linha de comanda; Keywords[pa]=ਸ਼ੈਲ;ਪਰੌਂਟ;ਕਮਾਂਡ;ਕਮਾਂਡ-ਲਾਈਨ;ਕਮਾਂਡ; Keywords[pl]=powłoka;shell;prompt;polecenie;komenda;wiersz poleceń;linia poleceń;wiersz komend;linia komend;cmd;konsola; Keywords[pt]=consola;linha;comando;terminal; Keywords[pt_BR]=shell;prompt;comando;linha de comando;cmd; Keywords[ro]=shell;prompt;command;commandline;cmd;linie;comandă; Keywords[ru]=оболочка;строка;команда;командная строка;cmd; Keywords[sk]=shell;výzva;príkaz;príkazový riadok;cmd; Keywords[sl]=lupina;ukazna vrstica;ukaz;cmd;command;terminal; Keywords[sr]=љуска;шкољка;упит;наредба;команда;shell;prompt;command;commandline;cmd; Keywords[sr@latin]=ljuska;školjka;upit;naredba;komanda; Keywords[sv]=skal;shell;prompt;kommando;kommandorad;cmd; Keywords[tg]=восит;сатри фармон;фармон;хати фармон;cmd;shell;prompt;command;commandline; Keywords[th]=เชลล์;พรอมต์;คำสั่ง;บรรทัดคำสั่ง;cmd; Keywords[tr]=shell;kabuk;istem;komut;komut satırı;cmd;kmt; Keywords[uk]=shell;prompt;command;commandline;cmd;оболонка;командний;рядок;команда; Keywords[vi]=shell;hệ vỏ;he vo;prompt;nhắc lệnh;nhac lenh;command;lệnh;lenh;commandline;dòng lệnh;dong lenh;cmd; Keywords[zh_CN]=shell;prompt;command;commandline;命令;提示符;命令行; Keywords[zh_TW]=shell;prompt;command;commandline;cmd;外表殼;殼層;提示;指令;命令列; Keywords=shell;prompt;command;commandline;cmd; TryExec=echo Exec=echo huge terminal Icon=org.gnome.Terminal Type=Application Categories=GNOME;GTK;System;TerminalEmulator; StartupNotify=true StartupWMClass=Gnome-terminal X-GNOME-SingleWindow=false Actions=new-window;preferences; X-ExecArg=-- [Desktop Action new-window] Name[am]=አዲስ መስኮት Name[ar]=نافذة جديدة Name[ast]=Ventana nueva Name[az]=Yeni Pəncərə Name[be]=Новае акно Name[be@latin]=Novaje akno Name[bg]=Нов прозорец Name[bn]=নতুন উইন্ডো Name[bn_IN]=নতুন উইন্ডো Name[br]=Prenestr nevez Name[ca]=Finestra nova Name[cs]=Nové okno Name[cy]=Ffenest Newydd Name[da]=Nyt vindue Name[de]=Neues Fenster Name[dz]=སྒོ་སྒྲིག་གསརཔ། Name[el]=Νέο παράθυρο Name[en_CA]=New Window Name[en_GB]=New Window Name[en@shaw]=𐑯𐑿 𐑢𐑦𐑯𐑛𐑴 Name[eo]=Nova fenestro Name[es]=Ventana nueva Name[eu]=Leiho berria Name[fa]=پنجرهٔ جدید Name[fi]=Uusi ikkuna Name[fr]=Nouvelle fenêtre Name[fur]=Gnûf barcon Name[ga]=Fuinneog Nua Name[gl]=Xanela nova Name[he]=חלון חדש Name[hr]=Novi prozor Name[hu]=Új ablak Name[hy]=Նոր Պատուհան Name[id]=Jendela Baru Name[is]=Nýr gluggi Name[it]=Nuova finestra Name[ja]=新しいウィンドウを開く Name[ka]=ახალი ფანჯარა Name[kab]=Asfaylu amaynut Name[kk]=Жаңа терезе Name[ko]=새 창 Name[ku]=Paceya nû Name[lt]=Naujas langas Name[lv]=Jauns logs Name[mai]=नवीन विंडो Name[mg]=Fikandrana vaovao Name[mk]=Нов прозорец Name[ml]=പുതിയ ജാലകം Name[mn]=Шинэ цонх Name[ms]=Tetingkap Baharu Name[nb]=Nytt vindu Name[nds]=Nejes Finster Name[ne]=नयाँ सञ्झ्याल Name[nl]=Nieuw venster Name[nn]=Nytt vindauge Name[oc]=Fenèstra novèla Name[or]=ନୂଆ ଉଇଣ୍ଡୋ Name[pa]=ਨਵੀਂ ਵਿੰਡੋ Name[pl]=Nowe okno Name[ps]=نوې کړکۍ Name[pt]=Nova janela Name[pt_BR]=Nova janela Name[ro]=Fereastră nouă Name[ru]=Создать окно Name[rw]=Irindi Dirishya Name[si]=නව කවුළුව Name[sk]=Nové okno Name[sl]=Novo okno Name[sq]=Dritare e Re Name[sr]=Нови прозор Name[sr@latin]=Novi prozor Name[sv]=Nytt fönster Name[tr]=Yeni Pencere Name[ug]=يېڭى كۆزنەك Name[uk]=Нове вікно Name[vi]=Cửa sổ mới Name[wa]=Novea purnea Name[xh]=I-Window eNtsha Name[zh_CN]=新建窗口 Name[zh_TW]=新增視窗 Name=New Window Exec=echo huge terminal --window [Desktop Action preferences] Name[ab]=Ахышәарақәа Name[an]=Preferencias Name[ar]=التفضيلات Name[as]=পছন্দসমূহ Name[be]=Настройкі Name[bg]=Настройки Name[bn_IN]=পছন্দ Name[bs]=Postavke Name[ca]=Preferències Name[ca@valencia]=Preferències Name[cs]=Předvolby Name[da]=Indstillinger Name[de]=Einstellungen Name[el]=Προτιμήσεις Name[en_GB]=Preferences Name[eo]=Agordoj Name[es]=Preferencias Name[et]=Eelistused Name[eu]=Hobespenak Name[fa]=ترجیحات Name[fi]=Asetukset Name[fr]=Préférences Name[fur]=Preferencis Name[ga]=Sainroghanna Name[gd]=Roghainnean Name[gl]=Preferencias Name[gu]=પસંદગીઓ Name[he]=העדפות Name[hi]=वरीयताएँ Name[hr]=Osobitosti Name[hu]=Beállítások Name[id]=Preferensi Name[is]=Kjörstillingar Name[it]=Preferenze Name[ja]=設定 Name[ka]=მორგება Name[kab]=Ismenyifen Name[kk]=Баптаулар Name[km]=ចំណូលចិត្ត Name[kn]=ಆದ್ಯತೆಗಳು Name[ko]=기본 설정 Name[lt]=Nuostatos Name[lv]=Iestatījumi Name[ml]=മുന്ഗണനകള് Name[mr]=पसंती Name[ms]=Keutamaan Name[nb]=Brukervalg Name[ne]=प्राथमिकताहरू Name[nl]=Voorkeuren Name[oc]=Preferéncias Name[or]=ପସନ୍ଦ Name[pa]=ਮੇਰੀ ਪਸੰਦ Name[pl]=Preferencje Name[pt]=Preferências Name[pt_BR]=Preferências Name[ro]=Preferințe Name[ru]=Параметры Name[sk]=Nastavenia Name[sl]=Možnosti Name[sr]=Поставке Name[sr@latin]=Postavke Name[sv]=Inställningar Name[ta]=விருப்பங்கள் Name[te]=అభీష్టాలు Name[tg]=Хусусиятҳо Name[th]=ปรับแต่ง Name[tr]=Tercihler Name[ug]=مايىللىق Name[uk]=Параметри Name[vi]=Tùy thích Name[zh_CN]=首选项 Name[zh_HK]=偏好設定 Name[zh_TW]=偏好設定 Name=Preferences Exec=echo huge terminal --preferences Categories=TerminalEmulator; 0707010000003A000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003B00000000xdg-terminal-exec-20240120+git.efc3517/test/data/preferred0707010000003B000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004800000000xdg-terminal-exec-20240120+git.efc3517/test/data/preferred/applications0707010000003C000081A400000000000000000000000165AC06E100000073000000000000000000000000000000000000005F00000000xdg-terminal-exec-20240120+git.efc3517/test/data/preferred/applications/preferred-term.desktop[Desktop Entry] Name=Preferred Terminal Type=Application Exec=echo preferred terminal Categories=TerminalEmulator; 0707010000003D000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003900000000xdg-terminal-exec-20240120+git.efc3517/test/data/quoting0707010000003E000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004600000000xdg-terminal-exec-20240120+git.efc3517/test/data/quoting/applications0707010000003F000081A400000000000000000000000165AC06E1000000B2000000000000000000000000000000000000005B00000000xdg-terminal-exec-20240120+git.efc3517/test/data/quoting/applications/quoting-term.desktop[Desktop Entry] Name=Default Terminal Type=Application Exec=printf '|||%s|||\n' quoting\ terminal "with 'complex' arguments" 'and \"back\\slashes\"' Categories=TerminalEmulator; 07070100000040000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003F00000000xdg-terminal-exec-20240120+git.efc3517/test/data/tryexec-fails07070100000041000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000004C00000000xdg-terminal-exec-20240120+git.efc3517/test/data/tryexec-fails/applications07070100000042000081A400000000000000000000000165AC06E100000090000000000000000000000000000000000000006200000000xdg-terminal-exec-20240120+git.efc3517/test/data/tryexec-fails/applications/tryexec-fails.desktop[Desktop Entry] Name=TryExec Fails Type=Application Exec=echo tryexec fails TryExec=executable-that-does-not-exist Categories=TerminalEmulator; 07070100000043000041ED00000000000000000000000265AC06E100000000000000000000000000000000000000000000003400000000xdg-terminal-exec-20240120+git.efc3517/test/nothing07070100000044000081A400000000000000000000000165AC06E100000000000000000000000000000000000000000000003D00000000xdg-terminal-exec-20240120+git.efc3517/test/nothing/.gitkeep07070100000045000081ED00000000000000000000000165AC06E100001865000000000000000000000000000000000000003700000000xdg-terminal-exec-20240120+git.efc3517/test/tests.bats#!/usr/bin/env bats # TODO: Add following tests: # Ensure that duplicates are removed setup() { : "${XTE:=$BATS_TEST_DIRNAME/../xdg-terminal-exec}" unset XDG_CURRENT_DESKTOP export XDG_CONFIG_HOME="$BATS_TEST_DIRNAME/nothing" export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/nothing" export XDG_DATA_HOME="$BATS_TEST_DIRNAME/nothing" export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/nothing" export PATH="$BATS_TEST_DIRNAME/bin:$PATH" } assert_success() { [ "$status" -eq 0 ] || { echo "status: $status" >&2 echo "output: $output" >&2 return 1 } } assert_output() { expected="${*:-$(cat)}" [ "$output" = "$expected" ] || { echo "status: $status" >&2 echo "output diff:" >&2 diff -u <(echo "$expected") <(echo "$output") >&2 return 1 } } @test "uses globally configured entry" { export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/config/default" export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/default" run "$XTE" assert_success assert_output "default terminal" } @test "ignores missing config directory" { export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/missing:$BATS_TEST_DIRNAME/config/default" export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/default" run "$XTE" assert_success assert_output "default terminal" } @test "ignores missing data directory" { export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/config/default" export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/missing:$BATS_TEST_DIRNAME/data/default" run "$XTE" assert_success assert_output "default terminal" } @test "uses locally configured entry" { export XDG_CONFIG_HOME="$BATS_TEST_DIRNAME/config/default" export XDG_DATA_HOME="$BATS_TEST_DIRNAME/data/default" run "$XTE" assert_success assert_output "default terminal" } @test "finds any global entry when there is no configuration" { export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/default" run "$XTE" assert_success assert_output "default terminal" } @test "uses configured exec arg" { export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/execarg" run "$XTE" argument assert_success assert_output "execarg terminal -- argument" } @test "adds default exec arg" { export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/default" run "$XTE" argument assert_success assert_output "default terminal -e argument" } @test "deals with large desktop entries" { export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/huge" run "$XTE" assert_success assert_output "huge terminal" } @test "finds any local entry when there is no configuration" { export XDG_DATA_HOME="$BATS_TEST_DIRNAME/data/default" run "$XTE" assert_success assert_output "default terminal" } @test "prefers earlier configured entry" { export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/config/preferred:$BATS_TEST_DIRNAME/config/default" export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/preferred:$BATS_TEST_DIRNAME/data/default" run "$XTE" assert_success assert_output "preferred terminal" } @test "prefers locally configured entry" { export XDG_CONFIG_HOME="$BATS_TEST_DIRNAME/config/preferred" export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/config/default" export XDG_DATA_HOME="$BATS_TEST_DIRNAME/data/preferred" export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/default" run "$XTE" assert_success assert_output "preferred terminal" } @test "ignores hidden entry" { export XDG_CONFIG_HOME="$BATS_TEST_DIRNAME/config/hidden" export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/config/default" export XDG_DATA_HOME="$BATS_TEST_DIRNAME/data/hidden" export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/default" run "$XTE" assert_success assert_output "default terminal" } @test "ignores entry when its TryExec fails" { export XDG_CONFIG_HOME="$BATS_TEST_DIRNAME/config/tryexec-fails" export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/config/default" export XDG_DATA_HOME="$BATS_TEST_DIRNAME/data/tryexec-fails" export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/default" run "$XTE" assert_success assert_output "default terminal" } @test "uses desktop-specific configuration when available" { export XDG_CONFIG_HOME="$BATS_TEST_DIRNAME/config/desktop/lists" export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/config/default" export XDG_DATA_HOME="$BATS_TEST_DIRNAME/data/desktop/lists" export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/default" export XDG_CURRENT_DESKTOP=desktop run "$XTE" assert_success assert_output "specific terminal" } @test "uses desktop-agnostic configuration when none is available" { export XDG_CONFIG_HOME="$BATS_TEST_DIRNAME/config/desktop/lists" export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/config/default" export XDG_DATA_HOME="$BATS_TEST_DIRNAME/data/desktop/lists" export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/default" export XDG_CURRENT_DESKTOP=other run "$XTE" assert_success assert_output "generic terminal" } @test "considers entry when its OnlyShowIn matches" { export XDG_CONFIG_HOME="$BATS_TEST_DIRNAME/nothing" export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/nothing" export XDG_DATA_HOME="$BATS_TEST_DIRNAME/data/desktop/onlyshow" export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/default" export XDG_CURRENT_DESKTOP=only:not run "$XTE" assert_success assert_output "only terminal" } @test "considers entry when its NotShowIn does not match" { export XDG_CONFIG_HOME="$BATS_TEST_DIRNAME/nothing" export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/nothing" export XDG_DATA_HOME="$BATS_TEST_DIRNAME/data/desktop/notshow" export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/default" export XDG_CURRENT_DESKTOP=other run "$XTE" assert_success assert_output "not terminal" } @test "ignores entry when its NotShowIn matches or its OnlyShowIn does not match" { export XDG_CONFIG_HOME="$BATS_TEST_DIRNAME/nothing" export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/nothing" export XDG_DATA_HOME="$BATS_TEST_DIRNAME/data/desktop/show" export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/default" export XDG_CURRENT_DESKTOP=not run "$XTE" assert_success assert_output "generic terminal" } @test "quotes commands and arguments correctly" { export XDG_DATA_HOME="$BATS_TEST_DIRNAME/data/quoting" run "$XTE" and 'custom arguments' 'with newline' assert_success assert_output <<-'EOF' |||quoting terminal||| |||with 'complex' arguments||| |||and \"back\\slashes\"||| |||-e||| |||and||| |||custom arguments||| |||with newline||| EOF } 07070100000046000081ED00000000000000000000000165AC06E1000046F9000000000000000000000000000000000000003900000000xdg-terminal-exec-20240120+git.efc3517/xdg-terminal-exec#!/bin/sh # Proposal for XDG terminal execution utility # # by Vladimir Kudrya # https://github.com/Vladimir-csp/ # # This script is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. See <http://www.gnu.org/licenses/>. # # Contributors: # Roman Chistokhodov https://github.com/FreeSlave/ # fluvf https://github.com/fluvf # Treat non-zero exit status from simple commands as an error # Treat unset variables as errors when performing parameter expansion # Disable pathname expansion set -euf # Store original IFS value, assumed to contain the default: <space><tab><newline> OIFS="$IFS" # Newline, utility variable used throughout the script N=' ' # Utility function to print messages to stderr error() { printf '%s\n' "$@" >&2; } check_bool() { case "$1" in true | True | TRUE | yes | Yes | YES | 1) return 0 ;; false | False | FALSE | no | No | NO | 0) return 1 ;; *) error "Assuming '$1' means no" return 1 ;; esac } # Utility function to print debug messages to stderr (or not) if check_bool "${DEBUG-0}"; then debug() { printf 'D: %s\n' "$@" >&2; } else debug() { :; } fi # Populates global constants and lists for later use and iteration make_paths() { IFS=':' # Populate list of config files to read, in descending order of preference for dir in ${XDG_CONFIG_HOME:-"${HOME}/.config"}${IFS}${XDG_CONFIG_DIRS:-/etc/xdg}; do # Normalise base path and append the data subdirectory with a trailing '/' for desktop in ${LOWERCASE_XDG_CURRENT_DESKTOP}; do CONFIGS=${CONFIGS:+${CONFIGS}${IFS}}${dir%/}/${desktop}-xdg-terminals.list done CONFIGS=${CONFIGS:+${CONFIGS}${IFS}}${dir%/}/xdg-terminals.list done # Populate list of directories to search for entries in, in ascending order of preference for dir in ${XDG_DATA_HOME:-${HOME}/.local/share}${IFS}${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; do # Normalise base path and append the data subdirectory with a trailing '/' APPLICATIONS_DIRS=${dir%/}/applications/${APPLICATIONS_DIRS:+${IFS}${APPLICATIONS_DIRS}} done # cache XDG_CACHE_HOME=${XDG_CACHE_HOME:-"${HOME}/.cache"} CACHE_FILE="${XDG_CACHE_HOME}/xdg-terminal-exec" debug "paths:" "CONFIGS=${CONFIGS}" "APPLICATIONS_DIRS=${APPLICATIONS_DIRS}" } # Mask IFS withing function to allow temporary changes alias make_paths='IFS= make_paths' gen_hash() { # return md5 of XDG_CURRENT DESKTOP and ls -LRl output for config and data paths # md5 is 4x faster than sha*, and there is no need for cryptography here # shellcheck disable=SC2034 read -r hash drop <<- EOH $( hash_paths="${CONFIGS}:${APPLICATIONS_DIRS}" { echo "${XDG_CURRENT_DESKTOP-}" IFS=':' # shellcheck disable=SC2086 debug "> hashing '${XDG_CURRENT_DESKTOP-}' and listing of:" $hash_paths "^ end of hash listing" # shellcheck disable=SC2012,SC2086 LANG=C ls -LRl ${hash_paths} 2> /dev/null } | md5sum 2> /dev/null ) EOH case "$hash" in [0-9a-f]??????????????????????????????[0-9a-f]) debug "got fresh hash '$hash'" echo "$hash" return 0 ;; *) debug "failed to get fresh hash, got '$hash'" return 1 ;; esac } read_cache() { # reads $cached_hash, $cached_exec, $cached_execarg, $cached_cmd from cache file, # checks if cache is actual and applies it, otherwise returns 1 # tries to bail out as soon as possible if something does not fit if [ -f "${CACHE_FILE}" ]; then IFS=${N} line_num=0 while read -r line; do line_num=$((line_num + 1)) case "${line_num}_${line}" in 1_[0-9a-f]??????????????????????????????[0-9a-f]) cached_hash=$line ;; 2_*) cached_exec=$line ;; 3_ | 3_*) cached_execarg=$line ;; 4_*) # get cmd and break right away, line_num will be left at 4 cached_cmd=$line break ;; *) debug "cache line ${line_num} is invalid: ${line}" return 1 ;; esac done < "${CACHE_FILE}" if [ "$line_num" = "4" ]; then debug "got cache:" "${cached_hash}" "${cached_exec}" "${cached_execarg}" "${cached_cmd}" IFS=$OIFS HASH=$(gen_hash) || return 1 if [ "$HASH" = "$cached_hash" ] && command -v "$cached_cmd" > /dev/null; then debug "cache is actual" EXEC=${cached_exec} EXECARG=${cached_execarg} return 0 else debug "cache is out-of-date" return 1 fi else debug "invalid cache data" return 1 fi else debug "no cache data" return 1 fi } # Mask IFS withing function to allow temporary changes alias read_cache='IFS= read_cache' save_cache() { # saves $HASH, $EXEC, $EXECARG, $1 (executable) to cache file or removes it if CACHE_ENABLE is false if check_bool "$CACHE_ENABLED"; then [ ! -d "${XDG_CACHE_HOME}" ] && mkdir -p "${XDG_CACHE_HOME}" if [ -z "${HASH-}" ]; then HASH=$(gen_hash) || { echo "could not hash listing, removing '${CACHE_FILE}'" >&2 rm -f "${CACHE_FILE}" return 0 } fi UM=$(umask) umask 0077 printf '%s\n' "${HASH}" "${EXEC}" "${EXECARG}" "${1}" > "${CACHE_FILE}" umask "$UM" debug "> saved cache:" "${HASH}" "${EXEC}" "${EXECARG}" "${1}" "^ end of saved cache" else debug "cache is disabled, removing '${CACHE_FILE}'" rm -f "${CACHE_FILE}" return 0 fi } # Parse all config files and populate $ENTRY_IDS with read desktop entry IDs read_config_paths() { # All config files are read immediatelly, rather than on demand, even if it's more IO intensive # This way all IDs are already known, and in order of preference, before iterating over them IFS=':' for config_path in ${CONFIGS}; do debug "reading config '$config_path'" # Nonexistant file is not an error [ -f "$config_path" ] || continue # Let `read` trim leading/trailing whitespace from the line while IFS="$OIFS" read -r line; do #debug "read line '$line'" case $line in # Catch directives first # cache control /enable_cache) debug "found '$line' directive${XTE_CACHE_ENABLED+ (ignored)}" CACHE_ENABLED=${XTE_CACHE_ENABLED-true} ;; /disable_cache) debug "found '$line' directive${XTE_CACHE_ENABLED+ (ignored)}" CACHE_ENABLED=${XTE_CACHE_ENABLED-false} ;; # `[The extensionless entry filename] should be a valid D-Bus well-known name.` # `a sequence of non-empty elements separated by dots (U+002E FULL STOP), # none of which starts with a digit, and each of which contains only characters from the set [a-zA-Z0-9-_]` # Stricter parts seem to be related only to reversed DNS notation but not common naming # i.e. there is `2048-qt.desktop`. # I do not know of any terminal that starts with a number, but it's valid. # Catch and validate potential entry ID with action ID (be graceful about an empty one) [a-zA-Z0-9_]*) # consider only the first ':' as a delimiter IFS=':' read -r entry_id action_id <<- EOL $line EOL if validate_entry_id "${entry_id}" && validate_action_id "${action_id}"; then ENTRY_IDS=${ENTRY_IDS:+${ENTRY_IDS}${N}}$line debug "added entry ID with action ID '$line'" else error "Discarded possibly misspelled entry '$line'" fi ;; esac # By default empty lines and comments get ignored done < "$config_path" done } # Mask IFS withing function to allow temporary changes alias read_config_paths='IFS= read_config_paths' replace() { # takes $1, finds $2, replaces with $3 # does it in large chunks # var to be modified string=${1} # right part of string r_string=${1} # left part of string l_string='' # previous right part of string prev_r_string='' while true; do # save previous r_string prev_r_string=${r_string} # cut the right part with search string from the left r_string=${r_string#*"${2}"} # cut the left part with search string and rigth part from the right l_string=${string%"${2}${r_string}"} case "$r_string" in # if the right part was not unmodified, there is nothing to replace "$prev_r_string") break ;; # if the right part was is modified, update string with: # the left part, replace string, the right part *) string=${l_string}${3}${r_string} ;; esac done echo "$string" } # Find and map all desktop entry files from standardised paths into aliases find_entry_paths() { debug "registering entries" # Append application directory paths to be searched IFS=':' for directory in $APPLICATIONS_DIRS; do # Append '.' to delimit start of entry ID set -- "$@" "$directory". done # Find all files set -- "$@" -type f # Append path conditions per directory or_arg='' for directory in $APPLICATIONS_DIRS; do # Match full path with proper first character of entry ID and .desktop extension # Reject paths with invalid characters in entry ID set -- "$@" ${or_arg} '(' -path "$directory"'./[a-zA-Z0-9_]*.desktop' ! -path "$directory"'./*[^a-zA-Z0-9_./-]*' ')' or_arg='-o' done # Loop through found entry paths and IDs IFS=$N while read -r entry_path && read -r entry_id; do # Entries are checked in ascending order of preference, so use last found if duplicate # shellcheck disable=SC2139 alias "$entry_id"="entry_path='$entry_path'" debug "registered '$entry_path' as entry '$entry_id'" # Add as a fallback ID regardles if it's a duplicate FALLBACK_ENTRY_IDS=${entry_id}${FALLBACK_ENTRY_IDS:+${N}${FALLBACK_ENTRY_IDS}} debug "added fallback ID '$entry_id'" done <<- EOE $( # Don't complain about nonexistent directories find -L "$@" 2> /dev/null | # Print entry path and convert it into an ID and print that too awk '{ print; sub(".*/[.]/", ""); gsub("/", "-"); print }' ) EOE } # Mask IFS withing function to allow temporary changes alias find_entry_paths='IFS= find_entry_paths' # Check validity of a given entry key - value pair # Modifies following global variables: # EXEC : Program to execute, possibly with arguments. See spec for details. # EXECARG : Execution argument for the terminal emulator. # TERMINAL : Set if application has been categorized as a terminal emulator check_entry_key() { key="$1" value="$2" action="$3" read_exec="$4" de_checks="$5" # Order of checks is important case $key in 'Categories'*=*) debug "checking for 'TerminalEmulator' in Categories '$value'" IFS=';' for category in $value; do [ "$category" = "TerminalEmulator" ] && { TERMINAL=true return 0 } done # Default in this case is to fail return 1 ;; 'Actions'*=*) # `It is not valid to have an action group for an action identifier not mentioned in the Actions key. # Such an action group must be ignored by implementors.` # ignore if no action requested [ -z "$action" ] && return 0 debug "checking for '$action' in Actions '$value'" IFS=';' for check_action in $value; do [ "$check_action" = "$action" ] && return 0 done # Default in this case is to fail return 1 ;; 'OnlyShowIn'*=*) case "$de_checks" in true) debug "checking for intersecion between '${XDG_CURRENT_DESKTOP-}' and OnlyShowIn '$value'" ;; false) debug "skipping OnlyShowIn check" return 0 ;; esac IFS=';' for target in $value; do IFS=':' for desktop in ${XDG_CURRENT_DESKTOP-}; do [ "$desktop" = "$target" ] && return 0 done done # Default in this case is to fail return 1 ;; 'NotShowIn'*=*) case "$de_checks" in true) debug "checking for intersecion between '${XDG_CURRENT_DESKTOP-}' and NotShowIn '$value'" ;; false) debug "skipping NotShowIn check" return 0 ;; esac IFS=';' for target in $value; do IFS=':' for desktop in ${XDG_CURRENT_DESKTOP-}; do debug "checking NotShowIn match '$desktop'='$target'" [ "$desktop" = "$target" ] && return 1 done done # Default in this case is to succeed return 0 ;; 'X-ExecArg'*=* | 'ExecArg'*=*) # Set global variable EXECARG=$value debug "read ExecArg '$EXECARG'" ;; 'TryExec'*=*) debug "checking TryExec executable '$value'" command -v "$value" > /dev/null || return 1 ;; 'Hidden'*=*) debug "checking boolean Hidden '$value'" [ "$value" = 'true' ] && return 1 ;; 'Exec'*=*) case "$read_exec" in false) debug "ignored Exec from wrong section" return 0 ;; esac debug "read Exec '$value'" # Set global variable EXEC=$value # Get first word from read Exec value IFS="$OIFS" eval "set -- $EXEC" debug "checking Exec[0] executable '$1'" command -v "$1" > /dev/null || return 1 ;; esac # By default unrecognised keys, empty lines and comments get ignored } # Mask IFS withing function to allow temporary changes alias check_entry='IFS= check_entry' # Read entry from given path read_entry_path() { entry_path="$1" entry_action="$2" de_checks="$3" read_exec=false # shellcheck disable=SC2016 debug "reading desktop entry '$entry_path'${entry_action:+ action '}$entry_action${entry_action:+'}" # Let `read` trim leading/trailing whitespace from the line while IFS="$OIFS" read -r line; do case $line in # `There should be nothing preceding [the Desktop Entry group] in the desktop entry file but [comments]` # if entry_action is not requested, allow reading Exec right away from the main group '[Desktop Entry]'*) [ -z "$entry_action" ] && read_exec=true ;; # A `Key=Value` pair [a-zA-Z0-9-]*) # Split value from pair value=${line#*=} # Remove all but leading spaces, and trim that from the value value=${value#"${value%%[! ]*}"} # Check the key check_entry_key "$line" "$value" "$entry_action" "$read_exec" "$de_checks" && continue # Reset values that might have been set unset EXEC unset EXECARG unset TERMINAL # shellcheck disable=SC2016 debug "entry discarded" return 1 ;; # found requested action, allow reading Exec "[Desktop Action ${entry_action}]"*) read_exec=true ;; # Start of the next group header, stop if already read exec '['*) [ "$read_exec" = "true" ] && break ;; esac # By default empty lines and comments get ignored done < "$entry_path" } validate_entry_id() { # validates entry ID ($1) case "$1" in # invalid characters or degrees of emptiness *[!a-zA-Z0-9_.-]* | *[!a-zA-Z0-9_.-] | [!a-zA-Z0-9_.-]* | [!a-zA-Z0-9_.-] | '' | .desktop) debug "string not valid as Entry ID: '$1'" return 1 ;; # all that left with .desktop *.desktop) return 0 ;; # and without *) debug "string not valid as Entry ID '$1'" return 1 ;; esac } validate_action_id() { # validates action ID ($1) case "$1" in # empty is ok '') return 0 ;; # invalid characters *[!a-zA-Z0-9-]* | *[!a-zA-Z0-9-] | [!a-zA-Z0-9-]* | [!a-zA-Z0-9-]) debug "string not valid as Action ID: '$1'" return 1 ;; # all that left *) return 0 ;; esac } # Loop through IDs and try to find a valid entry find_entry() { # for explicitly listed entries do not apply DE *ShowIn limits de_checks=false IFS="$N" for entry_id in ${ENTRY_IDS}${N}//fallback_start//${N}$FALLBACK_ENTRY_IDS; do case "$entry_id" in # entry has an action appended *:*) entry_action=${entry_id#*:} entry_id=${entry_id%:*} ;; # skip empty line '') continue ;; # fallback entries ahead, enable *ShowIn checks '//fallback_start//') de_checks=true continue ;; # nullify action *) entry_action='' ;; esac debug "matching path for entry ID '$entry_id'" # Check if a matching path was found for ID alias "$entry_id" > /dev/null 2>&1 || continue # Evaluates the alias, it sets $entry_path eval "$entry_id" # Unset the alias, so duplicate entries are skipped unalias "$entry_id" read_entry_path "$entry_path" "$entry_action" "$de_checks" || continue # Check that the entry is actually executable [ -z "${EXEC-}" ] && continue # ensure entry is a Terminal Emulator [ -z "${TERMINAL-}" ] && continue # Set defaults : "${EXECARG="-e"}" # Entry is valid, stop return 0 done # shellcheck disable=SC2086 IFS=':' error "No valid terminal entry was found in:" ${APPLICATIONS_DIRS} return 1 } # Mask IFS withing function to allow temporary changes alias find_entry='IFS= find_entry' ## globals LOWERCASE_XDG_CURRENT_DESKTOP=$(echo "${XDG_CURRENT_DESKTOP-}" | tr '[:upper:]' '[:lower:]') # this will receive proper value later APPLICATIONS_DIRS='' # path iterators make_paths # At this point we have no way of telling if cache is enabled or not, unless XTE_CACHE_ENABLED is set, # so just try reading it as if default is true, otherwise do the usual thing. # Editing config to disable cache should invalidate the cache. # The true default is false though: CACHE_ENABLED=${XTE_CACHE_ENABLED-false} # HASH can be reused HASH='' if check_bool "${XTE_CACHE_ENABLED-true}" && read_cache; then CACHE_USED=true else # continue with globals CACHE_USED=false # All desktop entry ids in descending order of preference from *xdg-terminals.list configs, # with duplicates removed ENTRY_IDS='' # All desktop entry ids found in data dirs in descending order of preference, # with duplicates (including those in $ENTRY_IDS) removed FALLBACK_ENTRY_IDS='' # Modifies $ENTRY_IDS read_config_paths # Modifies $ENTRY_IDS and sets global aliases find_entry_paths # shellcheck disable=SC2086 IFS="$N" debug "> final entry ID list:" ${ENTRY_IDS} "^ end of final entry ID list" # shellcheck disable=SC2086 IFS="$N" debug "> final fallback entry ID list:" ${FALLBACK_ENTRY_IDS} "^ end of final fallback entry ID list" # walk ID lists and find first applicable find_entry || exit 1 fi # Store original argument list, before it's modified debug "> original args:" "$@" "^ end of original args" "EXEC=$EXEC" "EXECARG=$EXECARG" # drop -e or custom ExecArg if given as the first arg case "${1-}" in '-e' | "$EXECARG") debug "dropping '$1' from received args" shift ;; esac # `Implementations must undo quoting [in the Exec argument(s)][...]` if [ "$#" -gt 0 ]; then eval "set -- $EXEC ${EXECARG:+'"$EXECARG"'} \"\$@\"" else eval "set -- $EXEC" fi debug "> final args:" "$@" "^ end of final args" if [ "$CACHE_USED" = "false" ]; then # saves or removes cache, forked out of the way save_cache "$1" & fi exec "$@" 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!193 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor