pax_global_header 0000666 0000000 0000000 00000000064 14765236611 0014525 g ustar 00root root 0000000 0000000 52 comment=9357b7d093f98e0b5c7aec18f2fc9eea0ae90aab
Vladimir-csp-xdg-terminal-exec-9357b7d/ 0000775 0000000 0000000 00000000000 14765236611 0017740 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/.gitignore 0000664 0000000 0000000 00000000027 14765236611 0021727 0 ustar 00root root 0000000 0000000 xdg-terminal-exec.1.gz
Vladimir-csp-xdg-terminal-exec-9357b7d/LICENSE 0000664 0000000 0000000 00000104505 14765236611 0020752 0 ustar 00root root 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
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 .
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
.
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
.
Vladimir-csp-xdg-terminal-exec-9357b7d/Makefile 0000664 0000000 0000000 00000002244 14765236611 0021402 0 ustar 00root root 0000000 0000000 SHELL = /bin/sh
prefix ?= /usr/local
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/bin
datarootdir ?= $(prefix)/share
mandir ?= $(datarootdir)/man
man1dir ?= $(mandir)/man1
xdg-terminal-exec.1:
@type scdoc >/dev/null || { echo "scdoc not found in PATH" >&2; exit 127; }
@type gzip >/dev/null || { echo "gzip not found in PATH" >&2; exit 127; }
scdoc < xdg-terminal-exec.1.scd | gzip -c > xdg-terminal-exec.1.gz
.PHONY: all
all: xdg-terminal-exec.1
.PHONY: clean
clean:
rm -f xdg-terminal-exec.1.gz
.PHONY: install-man
install-man: xdg-terminal-exec.1
install -Dpm644 xdg-terminal-exec.1.gz -t $(man1dir)
.PHONY: install-bin
install-bin:
install -Dpm755 xdg-terminal-exec -t $(bindir)
.PHONY: install-conf
install-conf:
install -Dpm644 xdg-terminals.list -t $(datarootdir)/xdg-terminal-exec
.PHONY: install
install: install-man install-bin install-conf
.PHONY: uninstall
uninstall:
rm -f $(bindir)/xdg-terminal-exec
rm -f $(man1dir)/xdg-terminal-exec.1.gz
rm -f $(datarootdir)/xdg-terminal-exec/xdg-terminals.list
rmdir $(datarootdir)/xdg-terminal-exec/
.PHONY: test
test:
@type bats >/dev/null || { echo "bats not found in PATH" >&2; exit 127; }
test/tests.bats
Vladimir-csp-xdg-terminal-exec-9357b7d/README.md 0000664 0000000 0000000 00000032071 14765236611 0021222 0 ustar 00root root 0000000 0000000 # xdg-terminal-exec
Proposal for XDG Default Terminal Execution Specification and reference
shell-based implementation. The proposal PR can be found
[here](https://gitlab.freedesktop.org/terminal-wg/specifications/-/merge_requests/3/diffs).
(!) Please be advised that while this spec is in proposed state, backwards
compatibility is maintained as best effort and is not guaranteed.
Since v0.12.0 Desktop entry string keys and Exec are handled (expanded and
dequoted) strictly according to Desktop Entry Spec.
v0.11.0 introduced some important changes:
- Spec:
- Behavior keys and cli options.
- Renamed entry keys to `[X-]TerminalArg*` format.
- `[X-]TerminalArgExec` key is now required.
- Fallback management directives (`[+-]entry.desktop`)
- Implementation:
- Introduced compat and strict mode.
- Compat mode (currently default) continues the old behavior of the
implementation (optional `[X-]ExecArg`|`[X-]TerminalArgExec` with `-e`
default).
- Introduced `/execarg_default:*:*` directives for compat mode to make more
terminals work out of the box.
- Fallback management directives support.
- Config files fallback extended into data dirs for upstream/distro
defaults.
- Added low priority default config with fallback exclusions and execution
arg defaults.
- Build (note for packagers (!)): Added Makefile (Thanks, @quantenzitrone)
# Default Terminal Execution Specification
This spec consists of three parts:
1. Additional keys for the
[desktop-entry-spec](https://specifications.freedesktop.org/desktop-entry-spec/latest/)
that allow terminals to define how they are invoked.
2. The configuration spec for defining and customizing default terminals
in context of Desktop Environments and user overrides. This is crafted in
image of
[mime-apps-spec](https://specifications.freedesktop.org/mime-apps-spec/latest)
using different config files in similar structure, governed by
[basedir-spec](https://specifications.freedesktop.org/basedir-spec/latest).
3. A CLI interface to launch the configured terminal from (2) with the cli
options corresponding to keys from (1). Working reference implementation of
this CLI interface can be found here:
- [github.com/Vladimir-csp/xdg-terminal-exec](https://github.com/Vladimir-csp/xdg-terminal-exec/)
- [gitlab.freedesktop.org/Vladimir-csp/xdg-terminal-exec](https://gitlab.freedesktop.org/Vladimir-csp/xdg-terminal-exec/)
Terminal emulators (with their exec arguments) are described by stock Desktop
Entries located in `applications` subdirs of XDG data hierarchy.
Preferred terminals are configured by listing their
[entry IDs](https://specifications.freedesktop.org/desktop-entry-spec/latest/file-naming.html#desktop-file-id)
in configuration files. Optionally an entry ID can be suffixed with
[action ID](https://specifications.freedesktop.org/desktop-entry-spec/latest/extra-actions.html),
delimited by `:` (`entry-id.desktop:action-id`).
## Desktop entry for a terminal
Stock Desktop Entries for terminal emulator applications are used. Entry
eligible for selection should have `TerminalEmulator` Category and
`X-TerminalArgExec=` key (`X-TerminalArgExec=` while the Specification is in
proposed status) which contains command execution argument: an argument to be
placed before command if it is requested. If the terminal accepts commands
without special argument, this key should be explicitly set to an empty value
(execution argument will be omitted). Although in this case it is recommended to
use `--` if the terminal handles it correctly.
### Additional argument keys
Implementations should expect these keys prefixed with `X-` while the
Specification is in proposed status.
If argument expects a value and is defined as ending with `=`, value should be
appended to the same argument without a white space.
- `X-TerminalArgAppId=` - argument to set `app-id` (Wayland) or `WM_CLASS`
(X11). Terminal is expected to use same argument for either backend.
- `X-TerminalArgTitle=` - argument to set window title.
- `X-TerminalArgDir=` - argument to set working directory.
- `X-TerminalArgHold=` - argument to hold terminal open after requested command
exits.
Since terminal emulators have varying set of features, any option support is
considred best effort.
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 Specification. Some IPC-using terminals provide separate entries or
[actions](https://specifications.freedesktop.org/desktop-entry-spec/latest/extra-actions.html)
for launching separate processes without IPC.
## Configuration
### Location
Configuration files are named `${desktop}-xdg-terminals.list` or
`xdg-terminals.list` and placed in XDG config hierarchy.
`${desktop}` here 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) in order of decreasing priority.
Lower priority fallback config files (for upstream/distribution usage) are
paced in system part of XDG data hierarchy within `xdg-terminal-exec` subdirs.
Default paths for configuration and data are resolved into (in order of
decreasing priority):
- config files:
- main config sequence (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`
- upstream/distribution config fallbacks (subdirs in `${XDG_DATA_DIRS}`):
- `/usr/local/share/xdg-terminal-exec/${desktop}-xdg-terminals.list`
- `/usr/local/share/xdg-terminal-exec/xdg-terminals.list`
- `/usr/share/xdg-terminal-exec/${desktop}-xdg-terminals.list`
- `/usr/share/xdg-terminal-exec/xdg-terminals.list`
- desktop entries (in `${XDG_DATA_HOME}:${XDG_DATA_DIRS}`):
- `${HOME}/.local/share/applications/`
- `/usr/local/share/applications/`
- `/usr/share/applications/`
### File format
The format is a simple newline-separated list with decreasing priority.
Empty lines and lines starting with `#` are ignored, dangling whitespaces are
trimmed.
Line format:
`terminal.desktop` or `terminal.desktop:action`: marks entry for explicit
selection.
`-terminal.desktop` excludes entry from fallback selection.
`+terminal.desktop` protects entry from fallback exclusion.
Special directives for modifying behavior of implementations may be present in
config files. Directives that are not listed by this Specification and are not
understood by a particular implementation should be discarded.
Directives should not contain `.desktop` substring in them. And it is
recommended to start directives with a symbol that is not valid for entry ID,
i.e. `/`.
## Priority of selecting an entry
- A list of explicitly preferred entry IDs and fallback exclusions 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`
- from each dir of system XDG data hierarchy in the order of decreasing
priority:
- from `xdg-terminal-exec/${desktop}-xdg-terminals.list` files in the order
of `$XDG_CURRENT_DESKTOP` items
- from `xdg-terminal-exec/xdg-terminals.list`
- Each entry from the explicit selection list is checked for applicability:
- presense of `TerminalEmulator` category
- validation by the same rules as in Desktop Entry Specification, 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, fallback selection is performed from entries
in XDG data hierarchy (except those discarded and excluded earlier). Each is
checked for applicability:
- presense of `TerminalEmulator` category
- validation by the same rules as in Desktop Entry Specification, 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.
## Syntax
```
xdg-terminal-exec [-[-]options ...] [command [arguments ...]]
```
A set of arguments each starting with `-` and located at the beginning of the
input command line is considered to be options processed by the implementation
and should always be discarded from the resulting command line, inlcuding `-e`
or any matching execution argument. Option processing should end on `--`, `-e`,
or matching execution argument.
Each option should be monolithic: as a single argument, value (if applicable)
delimited by `=`. Recognized options:
- `--app-id=`
- `--title=`
- `--dir=`
- `--hold`
Requested options then translated into arguments according to the keys existing
in the terminal's Desktop Entry (or discarded otherwise).
If a command (with or witout its arguments) is given, and `TerminalArgExec=` key
is not explicitly empty, then the value `TerminalArgExec=` (defaulting to `-e`)
is appended as the next argument.
Next the command and arguments are passed as is.
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.
### Compatibility mode and TerminalArgExec defaults
This implementation is currently set to compatibility mode by default: Previous
style `[X-]ExecArg` execution argument is supported, its presense is not
enforced and value defaults to `-e`. Defaults can also be amended by
`/execarg_default:entry.desktop:arg` directives for specific Entry IDs. It is
not part of the Spec, but a way to make things work until the Spec is made
official and upstream starts shipping `TerminalArgExec`.
Compat mode is enabled by default and can be controlled by first encountered
`/execarg_compat`|`/execarg_strict` direcive in the configs or `XTE_EXECARG_COMPAT`
env var (truthy or falsy value, has priority).
### 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.
This feature is enabled 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.
### Exec command parsing, escape sequences.
Strings in Desktop Entries have a
[set of escape sequences](https://specifications.freedesktop.org/desktop-entry-spec/latest/value-types.html)
to be expanded. On top of that, each arg in `Exec` key is
[expected](https://specifications.freedesktop.org/desktop-entry-spec/latest/exec-variables.html)
to have them too, along with other special characters. This means escape
sequences in `Exec` are expected to be expanded twice: in string value, then
in argument "dequoting".
This implementaton now does proper expansion, dequoting and command
tokenization. It will invalidate entries that fail those rules.
Vladimir-csp-xdg-terminal-exec-9357b7d/test/ 0000775 0000000 0000000 00000000000 14765236611 0020717 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/bin/ 0000775 0000000 0000000 00000000000 14765236611 0021467 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/bin/xterm 0000775 0000000 0000000 00000000032 14765236611 0022547 0 ustar 00root root 0000000 0000000 #!/bin/sh
echo xterm "$@"
Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/ 0000775 0000000 0000000 00000000000 14765236611 0022164 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/custom-action/ 0000775 0000000 0000000 00000000000 14765236611 0024751 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/custom-action/xdg-terminals.list 0000664 0000000 0000000 00000000043 14765236611 0030421 0 ustar 00root root 0000000 0000000 default-term.desktop:custom-action
Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/default/ 0000775 0000000 0000000 00000000000 14765236611 0023610 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/default/xdg-terminals.list 0000664 0000000 0000000 00000000025 14765236611 0027260 0 ustar 00root root 0000000 0000000 default-term.desktop
Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/desktop/ 0000775 0000000 0000000 00000000000 14765236611 0023635 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/desktop/lists/ 0000775 0000000 0000000 00000000000 14765236611 0024773 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/desktop/lists/desktop-xdg-terminals.list 0000664 0000000 0000000 00000000026 14765236611 0032113 0 ustar 00root root 0000000 0000000 specific-term.desktop
Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/desktop/lists/xdg-terminals.list 0000664 0000000 0000000 00000000025 14765236611 0030443 0 ustar 00root root 0000000 0000000 generic-term.desktop
Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/desktop/show/ 0000775 0000000 0000000 00000000000 14765236611 0024615 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/desktop/show/xdg-terminals.list 0000664 0000000 0000000 00000000070 14765236611 0030265 0 ustar 00root root 0000000 0000000 only-term.desktop
not-term.desktop
generic-term.desktop
Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/hidden/ 0000775 0000000 0000000 00000000000 14765236611 0023417 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/hidden/xdg-terminals.list 0000664 0000000 0000000 00000000017 14765236611 0027070 0 ustar 00root root 0000000 0000000 hidden.desktop
Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/missing-action/ 0000775 0000000 0000000 00000000000 14765236611 0025110 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/missing-action/xdg-terminals.list 0000664 0000000 0000000 00000000071 14765236611 0030561 0 ustar 00root root 0000000 0000000 default-term.desktop:missing-action
default-term.desktop
Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/myde-xdg-terminals.list 0000664 0000000 0000000 00000000022 14765236611 0026565 0 ustar 00root root 0000000 0000000 myde-term.desktop
Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/preferred/ 0000775 0000000 0000000 00000000000 14765236611 0024142 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/preferred/xdg-terminals.list 0000664 0000000 0000000 00000000027 14765236611 0027614 0 ustar 00root root 0000000 0000000 preferred-term.desktop
Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/tryexec-fails/ 0000775 0000000 0000000 00000000000 14765236611 0024743 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/tryexec-fails/xdg-terminals.list 0000664 0000000 0000000 00000000026 14765236611 0030414 0 ustar 00root root 0000000 0000000 tryexec-fails.desktop
Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/whitespace/ 0000775 0000000 0000000 00000000000 14765236611 0024320 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/whitespace/xdg-terminals.list 0000664 0000000 0000000 00000000170 14765236611 0027771 0 ustar 00root root 0000000 0000000 # this comment is ignored
# and so are the blank lines
# and the trailing whitespace here:
default-term.desktop
Vladimir-csp-xdg-terminal-exec-9357b7d/test/config/xdg-terminals.list 0000664 0000000 0000000 00000000137 14765236611 0025640 0 ustar 00root root 0000000 0000000 nonexistent.desktop
hidden.desktop
failed-tryexec.desktop
notshowin.desktop
onlyshowin.desktop
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/ 0000775 0000000 0000000 00000000000 14765236611 0021630 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/applications/ 0000775 0000000 0000000 00000000000 14765236611 0024316 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/applications/myde-term.desktop 0000664 0000000 0000000 00000000223 14765236611 0027611 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Type=Application
TryExec=testterm
Exec=testterm myde-term
Name=MYDE specific terminal
OnlyShowIn=MYDE
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/applications/non-listed-term.desktop 0000664 0000000 0000000 00000000202 14765236611 0030724 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Type=Application
TryExec=testterm
Exec=testterm non-listed-term
Name=Non-listed term
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/applications/notshowin.desktop 0000664 0000000 0000000 00000000232 14765236611 0027736 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Type=Application
TryExec=testterm
Exec=testterm notshowin
Name=Not Show In
NotShowIn=MYDE;MYDE2;MYDE3;MYDE4;
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/applications/onlyshowin.desktop 0000664 0000000 0000000 00000000214 14765236611 0030117 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Type=Application
TryExec=testterm
Exec=testterm onlyshowin
Name=Only Show In
OnlyShowIn=MYDE2;
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/default/ 0000775 0000000 0000000 00000000000 14765236611 0023254 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/default/applications/ 0000775 0000000 0000000 00000000000 14765236611 0025742 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/default/applications/default-term.desktop 0000664 0000000 0000000 00000000343 14765236611 0031726 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Name=Default Terminal
Type=Application
Exec=echo default terminal
Categories=TerminalEmulator;
Actions=custom-action
[Desktop Action custom-action]
Name=Custom Action
Exec=echo default terminal - custom action
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/ 0000775 0000000 0000000 00000000000 14765236611 0023301 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/lists/ 0000775 0000000 0000000 00000000000 14765236611 0024437 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/lists/applications/ 0000775 0000000 0000000 00000000000 14765236611 0027125 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/lists/applications/generic-term.desktop 0000664 0000000 0000000 00000000157 14765236611 0033104 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Name=Generic Terminal
Type=Application
Exec=echo generic terminal
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/lists/applications/specific-term.desktop 0000664 0000000 0000000 00000000161 14765236611 0033250 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Name=Specific Terminal
Type=Application
Exec=echo specific terminal
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/notshow/ 0000775 0000000 0000000 00000000000 14765236611 0025002 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/notshow/applications/ 0000775 0000000 0000000 00000000000 14765236611 0027470 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/notshow/applications/a-not-term.desktop 0000664 0000000 0000000 00000000166 14765236611 0033051 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Name=Not Terminal
Type=Application
Exec=echo not terminal
NotShowIn=not;
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/notshow/applications/b-only-term.desktop 0000664 0000000 0000000 00000000172 14765236611 0033230 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Name=Only Terminal
Type=Application
Exec=echo only terminal
OnlyShowIn=only;
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/onlyshow/ 0000775 0000000 0000000 00000000000 14765236611 0025163 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/onlyshow/applications/ 0000775 0000000 0000000 00000000000 14765236611 0027651 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/onlyshow/applications/a-only-term.desktop 0000664 0000000 0000000 00000000172 14765236611 0033410 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Name=Only Terminal
Type=Application
Exec=echo only terminal
OnlyShowIn=only;
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/onlyshow/applications/b-not-term.desktop 0000664 0000000 0000000 00000000166 14765236611 0033233 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Name=Not Terminal
Type=Application
Exec=echo not terminal
NotShowIn=not;
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/show/ 0000775 0000000 0000000 00000000000 14765236611 0024261 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/show/applications/ 0000775 0000000 0000000 00000000000 14765236611 0026747 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/show/applications/generic-term.desktop 0000664 0000000 0000000 00000000157 14765236611 0032726 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Name=Generic Terminal
Type=Application
Exec=echo generic terminal
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/show/applications/not-term.desktop 0000664 0000000 0000000 00000000166 14765236611 0032112 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Name=Not Terminal
Type=Application
Exec=echo not terminal
NotShowIn=not;
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/desktop/show/applications/only-term.desktop 0000664 0000000 0000000 00000000172 14765236611 0032270 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Name=Only Terminal
Type=Application
Exec=echo only terminal
OnlyShowIn=only;
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/execarg/ 0000775 0000000 0000000 00000000000 14765236611 0023246 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/execarg/applications/ 0000775 0000000 0000000 00000000000 14765236611 0025734 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/execarg/applications/execarg-term.desktop 0000664 0000000 0000000 00000000224 14765236611 0031710 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Name=TerminalArgExec Terminal
Type=Application
Exec=echo TerminalArgExec terminal
X-TerminalArgExec=--
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/hidden/ 0000775 0000000 0000000 00000000000 14765236611 0023063 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/hidden/applications/ 0000775 0000000 0000000 00000000000 14765236611 0025551 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/hidden/applications/hidden.desktop 0000664 0000000 0000000 00000000163 14765236611 0030377 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Name=Hidden Entry
Type=Application
Exec=echo hidden entry
Hidden=true
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/huge/ 0000775 0000000 0000000 00000000000 14765236611 0022560 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/huge/applications/ 0000775 0000000 0000000 00000000000 14765236611 0025246 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/huge/applications/huge-term.desktop 0000664 0000000 0000000 00000036444 14765236611 0030551 0 ustar 00root root 0000000 0000000 [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-TerminalArgExec=--
[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;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/preferred/ 0000775 0000000 0000000 00000000000 14765236611 0023606 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/preferred/applications/ 0000775 0000000 0000000 00000000000 14765236611 0026274 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/preferred/applications/preferred-term.desktop 0000664 0000000 0000000 00000000163 14765236611 0032612 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Name=Preferred Terminal
Type=Application
Exec=echo preferred terminal
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/quoting/ 0000775 0000000 0000000 00000000000 14765236611 0023316 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/quoting/applications/ 0000775 0000000 0000000 00000000000 14765236611 0026004 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/quoting/applications/quoting-term.desktop 0000664 0000000 0000000 00000000352 14765236611 0032032 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Name=Default Terminal
Type=Application
Exec=printf "|||%%s|||\\\\n" "quoting terminal" "with 'complex' arguments," "quotes \\"," "" "empty args," "new\nlines," "and \\"back\\\\slashes\\""
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/tryexec-fails/ 0000775 0000000 0000000 00000000000 14765236611 0024407 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/tryexec-fails/applications/ 0000775 0000000 0000000 00000000000 14765236611 0027075 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/data/tryexec-fails/applications/tryexec-fails.desktop 0000664 0000000 0000000 00000000220 14765236611 0033241 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Name=TryExec Fails
Type=Application
Exec=echo tryexec fails
TryExec=executable-that-does-not-exist
Categories=TerminalEmulator;
Vladimir-csp-xdg-terminal-exec-9357b7d/test/nothing/ 0000775 0000000 0000000 00000000000 14765236611 0022365 5 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/nothing/.gitkeep 0000664 0000000 0000000 00000000000 14765236611 0024004 0 ustar 00root root 0000000 0000000 Vladimir-csp-xdg-terminal-exec-9357b7d/test/tests.bats 0000775 0000000 0000000 00000016002 14765236611 0022736 0 ustar 00root root 0000000 0000000 #!/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_failure() {
[ "$status" -ne 0 ] || {
echo "status: $status" >&2
echo "output: $output" >&2
return 1
}
}
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 "TerminalArgExec 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,|||
|||quotes ",|||
||||||
|||empty args,|||
|||new
lines,|||
|||and "back\slashes"|||
|||-e|||
|||and|||
|||custom arguments|||
|||with
newline|||
EOF
}
@test "uses globally configured entry with custom action" {
export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/config/custom-action"
export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/default"
run "$XTE"
assert_success
assert_output "default terminal - custom action"
}
@test "fails on globally configured entry with missing action" {
export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/config/missing-action"
export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/default"
run "$XTE"
assert_failure
}
@test "ignores comments, blank lines, and trailing whitespace" {
export XDG_CONFIG_DIRS="$BATS_TEST_DIRNAME/config/whitespace"
export XDG_DATA_DIRS="$BATS_TEST_DIRNAME/data/default"
run "$XTE"
assert_success
assert_output "default terminal"
}
Vladimir-csp-xdg-terminal-exec-9357b7d/xdg-terminal-exec 0000775 0000000 0000000 00000103303 14765236611 0023203 0 ustar 00root root 0000000 0000000 #!/bin/sh
# Default Terminal Execution Utility
# Reference implementation of proposed Default Terminal Execution Specification
# https://gitlab.freedesktop.org/terminal-wg/specifications/-/merge_requests/3
#
# by Vladimir Kudrya
# https://github.com/Vladimir-csp/
# https://gitlab.freedesktop.org/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 .
#
# 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:
OIFS="$IFS"
# Newline, utility variable used throughout the script
N='
'
# name of executable
SELF_NAME=${0##*/}
# ASCII Record Separator for cache saving
RSEP=$(printf '%b' '\036')
# ASCII Unit Separator for Exec parsing
USEP=$(printf '%b' '\037')
error() {
# Print messages to stderr
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
# append xdg-terminal-exec dirs in XDG_DATA_DIRS to config hierarchy for distro/upstream level defaults
for dir in ${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; 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%/}/xdg-terminal-exec/${desktop}-xdg-terminals.list
done
CONFIGS=${CONFIGS:+${CONFIGS}${IFS}}${dir%/}/xdg-terminal-exec/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 custom string, 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}"
{
# cache 'version', change to invalidate when format changes
echo 3
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_cmd, $cached_exec_usep, $cached_execarg, and others 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
line_num=0
line_limit=50
cached_exec_usep=
finished=0
while IFS='' read -r line; do
line_num=$((line_num + 1))
case "${line_num}" in
1) cached_hash=$line ;;
2) cached_cmd=$line ;;
3) cached_execarg=$line ;;
4) cached_appidarg=$line ;;
5) cached_titlearg=$line ;;
6) cached_dirarg=$line ;;
7) cached_holdarg=$line ;;
"$line_limit")
debug "reached cache line limit ($line_limit)"
return 1
;;
# Line 8 starts command
*)
# Command is stored as raw expanded and tokenized $USEP-separated command,
# technically it can contain newline characters.
# Reconstruct newlines, use ${RSEP}END_OF_EXEC_USEP string as terminator.
cached_exec_usep=${cached_exec_usep}${cached_exec_usep:+$N}${line}
case "${line}" in
*"${RSEP}END_OF_EXEC_USEP")
cached_exec_usep=${cached_exec_usep%"${RSEP}END_OF_EXEC_USEP"}
finished=1
break
;;
esac
;;
esac
done < "${CACHE_FILE}"
if [ "$finished" = "1" ]; then
debug "got cache:" \
"hash=${cached_hash}" \
"cmd=${cached_cmd}" \
"execarg=${cached_execarg}" \
"appidarg=${cached_appidarg}" \
"titlearg=${cached_titlearg}" \
"dirarg=${cached_dirarg}" \
"holdarg=${cached_holdarg}" \
"exec_usep=${cached_exec_usep}"
HASH=$(gen_hash) || return 1
if [ "$HASH" = "$cached_hash" ] && command -v "$cached_cmd" > /dev/null; then
debug "cache is actual"
EXEC_USEP=${cached_exec_usep}
EXECARG=${cached_execarg}
APPIDARG=${cached_appidarg}
TITLEARG=${cached_titlearg}
DIRARG=${cached_dirarg}
HOLDARG=${cached_holdarg}
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
}
save_cache() {
# saves $HASH, $1 (executable), $EXEC_USEP, $EXECARG, other supported args to cache file or removes it if CACHE_ENABLED is false
if check_bool "$CACHE_ENABLED"; then
[ ! -d "${XDG_CACHE_HOME}" ] && mkdir -p "${XDG_CACHE_HOME}"
if [ -z "${HASH-}" ]; then
HASH=$(gen_hash) || {
error "could not hash listing of files, removing '${CACHE_FILE}'"
rm -f "${CACHE_FILE}"
return 0
}
fi
case "${HASH}${1}${EXECARG}${APPIDARG}${TITLEARG}${DIRARG}${HOLDARG}" in
"$N")
error "One or more of terminal's arguments contains a newline, removing '${CACHE_FILE}'"
rm -f "${CACHE_FILE}"
return 0
;;
esac
UM=$(umask)
umask 0077
printf '%s\n' \
"${HASH}" \
"${1}" \
"${EXECARG}" \
"${APPIDARG}" \
"${TITLEARG}" \
"${DIRARG}" \
"${HOLDARG}" \
"${EXEC_USEP}${RSEP}END_OF_EXEC_USEP" > "${CACHE_FILE}"
umask "$UM"
debug "> saved cache:" "${HASH}" "${EXEC_USEP}" "${EXECARG}" "${1}" "^ end of saved cache"
else
debug "cache is disabled, removing '${CACHE_FILE}'"
rm -f "${CACHE_FILE}"
return 0
fi
}
list_contains() {
# checks if list $1 contains item $2 delimited by $3 (default $N)
delimiter=${3:-$N}
case "${delimiter}${1}${delimiter}" in
*"${delimiter}${2}${delimiter}"*) return 0 ;;
*) return 1 ;;
esac
}
# 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${CACHE_CONFIGURED:+ (ignored)}"
[ -z "$CACHE_CONFIGURED" ] || continue
CACHE_ENABLED=true
CACHE_CONFIGURED=1
;;
/disable_cache)
debug "found '$line' directive${CACHE_CONFIGURED:+ (ignored)}"
[ -z "$CACHE_CONFIGURED" ] || continue
CACHE_ENABLED=false
CACHE_CONFIGURED=1
;;
# compat mode
/execarg_compat)
debug "found '$line' directive${EXECARG_COMPAT_CONFIGURED:+ (ignored)}"
[ -z "$EXECARG_COMPAT_CONFIGURED" ] || continue
EXECARG_COMPAT=true
EXECARG_COMPAT_CONFIGURED=1
;;
/execarg_strict)
debug "found '$line' directive${EXECARG_COMPAT_CONFIGURED:+ (ignored)}"
[ -z "$EXECARG_COMPAT_CONFIGURED" ] || continue
EXECARG_COMPAT=false
EXECARG_COMPAT_CONFIGURED=1
;;
# default TerminalArgExec overrides
/execarg_default:*:*)
if ! check_bool "$EXECARG_COMPAT"; then
debug "ignored directive '$line' (strict mode)"
continue
fi
IFS=':' read -r _directive entry_id execarg_default <<- EOF
$line
EOF
if validate_entry_id "${entry_id}"; then
debug "added TerminalArgExec default '${execarg_default}' for '${entry_id}'"
# do not bother with deduplication, first entry ID will win
EXECARG_DEFAULTS=${EXECARG_DEFAULTS}${EXECARG_DEFAULTS:+$N}${entry_id}:${execarg_default}
fi
;;
# `[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_]* | [+-][a-zA-Z0-9_]*)
case "$line" in
[+-]*)
# save and cut exclusion marker
_line=${line#[+-]}
exclusion=${line%"$_line"}
line=$_line
;;
*) exclusion='' ;;
esac
# 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
case "$exclusion" in
'')
ENTRY_IDS=${ENTRY_IDS:+${ENTRY_IDS}${N}}$line
debug "added entry ID with action ID '$line'"
;;
'+')
if list_contains "${EXCLUDED_ENTRY_IDS}" "${entry_id}"; then
debug "entry '${entry_id}' was already excluded from fallback"
elif list_contains "${INCLUDED_ENTRY_IDS}" "${entry_id}"; then
debug "entry '${entry_id}' fallback exclusion was already prevented"
else
debug "preventing fallback exclusion for entry '${entry_id}'"
INCLUDED_ENTRY_IDS=${INCLUDED_ENTRY_IDS:+${INCLUDED_ENTRY_IDS}${N}}${entry_id}
fi
;;
'-')
if list_contains "${INCLUDED_ENTRY_IDS}" "${entry_id}"; then
debug "entry '${entry_id}' fallback exclusion was already prevented"
elif list_contains "${EXCLUDED_ENTRY_IDS}" "${entry_id}"; then
debug "entry '${entry_id}' was already excluded from fallback"
else
debug "excluding entry '${entry_id}' from fallback"
EXCLUDED_ENTRY_IDS=${EXCLUDED_ENTRY_IDS:+${EXCLUDED_ENTRY_IDS}${N}}${entry_id}
fi
;;
esac
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, replaces $2 with $3
# does it in large chunks
# writes result to global REPLACED_STR to avoid $() newline issues
# right part of string
r_remainder=${1}
REPLACED_STR=
while [ -n "$r_remainder" ]; do
# left part before first encounter of $2
r_left=${r_remainder%%"$2"*}
# append
REPLACED_STR=${REPLACED_STR}$r_left
if [ "$r_left" = "$r_remainder" ]; then
# nothing left to cut
break
fi
# append replace substring
REPLACED_STR=${REPLACED_STR}$3
# cut remainder
r_remainder=${r_remainder#*"$2"}
done
}
de_expand_str() {
# expands \s, \n, \t, \r, \\
# https://specifications.freedesktop.org/desktop-entry-spec/latest/value-types.html
# writes result to global $EXPANDED_STR in place to avoid $() expansion newline issues
debug "expander received: $1"
EXPANDED_STR=
exp_remainder=$1
while [ -n "$exp_remainder" ]; do
# left is substring of remainder before the first encountered backslash
exp_left=${exp_remainder%%\\*}
# append left to EXPANDED_STR
EXPANDED_STR=${EXPANDED_STR}${exp_left}
debug "expander appended: $exp_left"
if [ "$exp_left" = "$exp_remainder" ]; then
debug "expander ended: $EXPANDED_STR"
# no more backslashes left
break
fi
# remove left substring and backslash from remainder
exp_remainder=${exp_remainder#"$exp_left"\\}
case "$exp_remainder" in
# expand and append to EXPANDED_STR
s*)
EXPANDED_STR=${EXPANDED_STR}' '
exp_remainder=${exp_remainder#?}
debug "expander substituted space"
;;
n*)
EXPANDED_STR=${EXPANDED_STR}$N
exp_remainder=${exp_remainder#?}
debug "expander substituted newline"
;;
t*)
EXPANDED_STR=${EXPANDED_STR}' '
exp_remainder=${exp_remainder#?}
debug "expander substituted tab"
;;
r*)
EXPANDED_STR=${EXPANDED_STR}$(printf '%b' '\r')
exp_remainder=${exp_remainder#?}
debug "expander substituted caret return"
;;
\\*)
EXPANDED_STR=${EXPANDED_STR}\\
exp_remainder=${exp_remainder#?}
debug "expander substituted backslash"
;;
# unsupported sequence, reappend backslash
#*)
# EXPANDED_STR=${EXPANDED_STR}\\
# debug 'expander reappended backslash'
# ;;
esac
done
}
de_tokenize_exec() {
# Shell-based DE Exec string tokenizer.
# https://specifications.freedesktop.org/desktop-entry-spec/latest/exec-variables.html
# How hard can it be?
# Fills global EXEC_USEP var with $USEP-separated command array in place to avoid $() expansion newline issues
debug "tokenizer received: $1"
EXEC_USEP=
tok_remainder=$1
tok_quoted=0
tok_in_space=0
while [ -n "$tok_remainder" ]; do
# left is substring of remainder before the first encountered special char
tok_left=${tok_remainder%%[[:space:]\"\`\$\\\'\>\<\~\|\&\;\*\?\#\(\)]*}
# left should be safe to append right away
EXEC_USEP=${EXEC_USEP}${tok_left}
debug "tokenizer appended: >$tok_left<"
# end of the line
case "$tok_remainder" in
"$tok_left")
debug "tokenizer is out of special chars"
break
;;
esac
# isolate special char
tok_remainder=${tok_remainder#"$tok_left"}
cut=${tok_remainder#?}
tok_char=${tok_remainder%"$cut"}
unset cut
# cut it from remainder
tok_remainder=${tok_remainder#"$tok_char"}
# check if still in space
case "${tok_in_space}${tok_left}${tok_char}" in
1[[:space:]])
debug "tokenizer still in space :) skipping space character"
continue
;;
1*)
debug "tokenizer no longer in space :("
tok_in_space=0
;;
esac
## decide what to do with the character
# doublequote while quoted
case "${tok_quoted}${tok_char}" in
'1"')
tok_quoted=0
debug "tokenizer closed double quotes"
continue
;;
# doublequote while unquoted
'0"')
tok_quoted=1
debug "tokenizer opened double quotes"
continue
;;
# error out on unquoted special chars
0[\`\$\\\'\>\<\~\|\&\;\*\?\#\(\)])
debug "${entry_id}: Encountered unquoted character: '$tok_char'"
return 1
;;
# error out on quoted but unescaped chars
1[\`\$])
debug "${entry_id}: Encountered unescaped quoted character: '$tok_char'"
return 1
;;
# process quoted escapes
1\\)
case "$tok_remainder" in
# if there is no next char, fail
'')
debug "${entry_id}: Dangling backslash encountered!"
return 1
;;
# cut and append the next char right away
# or a half of multibyte char, the other half should go into the next
# 'tok_left' hopefully...
*)
cut=${tok_remainder#?}
tok_char=${tok_remainder%"$cut"}
tok_remainder=${cut}
unset cut
EXEC_USEP=${EXEC_USEP}${tok_char}
debug "tokenizer appended escaped: >$tok_char<"
;;
esac
;;
# Consider Cosmos
0[[:space:]])
case "${tok_remainder}" in
# there is non-space to follow
*[![:space:]]*)
# append separator
EXEC_USEP=${EXEC_USEP}${USEP}
tok_in_space=1
debug "tokenizer entered spaaaaaace!!!! separator appended"
;;
# ignore unquoted space at the end of string
*)
debug "tokenizer entered outer spaaaaaace!!!! separator skipped, this is the end"
break
;;
esac
;;
# append quoted chars
1[[:space:]\'\>\<\~\|\&\;\*\?\#\(\)])
EXEC_USEP=${EXEC_USEP}${tok_char}
debug "tokenizer appended quoted char: >$tok_char<"
;;
# this should not happen
*)
debug "${entry_id}: parsing error at char '$tok_char', (quoted: $tok_quoted)"
return 1
;;
esac
done
case "$tok_quoted" in
1)
debug "${entry_id}: Double quote was not closed!"
return 1
;;
esac
# shellcheck disable=SC2086
debug "tokenizer ended:" "$(
IFS=$USEP
printf 'D: >%s<\n' $EXEC_USEP
)"
}
de_strip_fields() {
# Operates on $EXEC_USEP
# modifies according to args/fields
# no arguments, erase fields from $EXEC_USEP
exec_usep=''
fu_found=false
IFS=$USEP
for arg in $EXEC_USEP; do
case "$arg" in
# remove deprecated fields
*[!%]'%'[dDnNvm]* | '%'[dDnNvm]*) debug "injector removed deprecated '$arg'" ;;
# treat file fields
*[!%]'%'[fFuU]* | '%'[fFuU]*)
if [ "$fu_found" = "true" ]; then
debug "${entry_id}: Encountered more than one %[fFuU] field!"
return 1
fi
fu_found=true
debug "injector removed '$arg'"
continue
;;
# other fields
*[!%]'%i'* | '%i'* | *[!%]'%c'* | '%c'*)
debug "injector removed '$arg'"
continue
;;
# literal %
*[!%]%%* | %%*)
replace "$arg" "%%" "%"
rarg=$REPLACED_STR
debug "injector replacing '%%': '$arg' -> '$rarg'"
exec_usep=${exec_usep}${exec_usep:+$USEP}${rarg}
;;
# invalid field
*%?* | *[!%]%)
debug "${entry_id}: unknown % field in argument '${arg}'"
return 1
;;
*)
debug "injector keeped: '$arg'"
exec_usep=${exec_usep}${exec_usep:+$USEP}${arg}
;;
esac
done
EXEC_USEP=$exec_usep
IFS=$OIFS
}
# Mask IFS withing function to allow temporary changes
alias de_strip_fields='IFS= de_strip_fields'
reset_keys() {
# init vars used in entry checks
IS_TERMINAL=''
EXEC_USEP=''
EXECARG='-e'
EXECARG_DEFINED=false
APPIDARG=''
TITLEARG=''
DIRARG=''
HOLDARG=''
}
# 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
# exclude entries based on EXCLUDED_ENTRY_IDS
if list_contains "$EXCLUDED_ENTRY_IDS" "$entry_id"; then
debug "entry '${entry_id}' was excluded from fallback"
continue
fi
# 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_USEP : Program to execute, possibly with arguments, delimited by ASCII Unit Separator.
# EXECARG : Execution argument for the terminal emulator.
# IS_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" ] && {
IS_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
if [ "$check_action" = "$action" ]; then
action_listed=true
return 0
fi
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-TerminalArgExec'*=* | 'TerminalArgExec'*=*)
# Set global variable
# values of type string should support escape sequences
de_expand_str "$value"
EXECARG=$EXPANDED_STR
EXECARG_DEFINED=true
debug "read TerminalArgExec '$EXECARG'"
;;
'X-ExecArg'*=* | 'ExecArg'*=*)
# ignore old ExecArg in strict mode
case "${EXECARG_COMPAT}" in
false) return 0 ;;
esac
# Set global variable
# values of type string should support escape sequences
de_expand_str "$value"
EXECARG=$EXPANDED_STR
EXECARG_DEFINED=true
debug "read TerminalArgExec '$EXECARG'"
;;
'X-TerminalArgAppId'*=* | 'TerminalArgAppId'*=*)
# Set global variable
# values of type string should support escape sequences
de_expand_str "$value"
APPIDARG=$EXPANDED_STR
debug "read TerminalArgAppId '$APPIDARG'"
;;
'X-TerminalArgTitle'*=* | 'TerminalArgTitle'*=*)
# Set global variable
# values of type string should support escape sequences
de_expand_str "$value"
TITLEARG=$EXPANDED_STR
debug "read TerminalArgTitle '$TITLEARG'"
;;
'X-TerminalArgDir'*=* | 'TerminalArgDir'*=*)
# Set global variable
# values of type string should support escape sequences
de_expand_str "$value"
DIRARG=$EXPANDED_STR
debug "read TerminalArgDir '$DIRARG'"
;;
'X-TerminalArgHold'*=* | 'TerminalArgHold'*=*)
# Set global variable
# values of type string should support escape sequences
de_expand_str "$value"
HOLDARG=$EXPANDED_STR
debug "read TerminalArgHold '$HOLDARG'"
;;
'TryExec'*=*)
de_expand_str "$value"
debug "checking TryExec executable '$EXPANDED_STR'"
command -v "$(printf '%b' "$EXPANDED_STR")" > /dev/null || return 1
;;
'Hidden'*=*)
debug "checking boolean Hidden '$value'"
case "$value" in
true)
debug "ignored Hidden entry"
return 1
;;
esac
;;
'Exec'*=*)
case "$read_exec" in
false)
debug "ignored Exec from wrong section"
return 0
;;
esac
debug "read Exec '$value'"
# Escape sequences of DE string value (sets $EXPANDED_STR)
de_expand_str "$value"
# Tokenize resulting string (sets $EXEC_USEP)
de_tokenize_exec "$EXPANDED_STR"
# Expand % fields
de_strip_fields
# Get first word from read Exec value
EXEC0=${EXEC_USEP%%"$USEP"*}
debug "checking Exec[0] executable '$EXEC0'"
command -v "$EXEC0" > /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_key='IFS= check_entry_key'
# Read entry from given path
read_entry_path() {
entry_path="$1"
entry_action="$2"
de_checks="$3"
read_exec=false
action_listed=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, continue to next line on success
check_entry_key "$line" "$value" "$entry_action" "$read_exec" "$de_checks" && continue
# Reset values that might have been set
reset_keys
# shellcheck disable=SC2016
debug "entry discarded"
return 1
;;
# found requested action, allow reading Exec
"[Desktop Action ${entry_action}]"*)
if [ "$action_listed" = "true" ]; then
read_exec=true
else
debug "action '$entry_action' was not listed in Actions"
return 1
fi
;;
# 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_USEP}" ] && continue
# ensure entry is a Terminal Emulator
[ -z "${IS_TERMINAL}" ] && continue
# if entry lacks TerminalArgExec
if [ "$EXECARG_DEFINED" != "true" ]; then
# get (custom) default in compat mode
if check_bool "$EXECARG_COMPAT"; then
EXECARG=$(get_default_execarg "$entry_id")
# discard entry in strict mode
else
continue
fi
fi
# 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'
get_default_execarg() {
# based on entry_id ($1) return TerminalArgExec from EXECARG_DEFAULTS
check_entry=$1
while IFS=':' read -r entry_id execarg_default; do
case "$entry_id" in
"$check_entry")
printf '%s' "$execarg_default"
debug "custom default TerminalArgExec '$execarg_default' for '$check_entry'"
return 0
;;
esac
done <<- EOF
$EXECARG_DEFAULTS
EOF
printf '%s' '-e'
debug "using default TerminalArgExec '-e' for '$check_entry'"
}
## globals
LOWERCASE_XDG_CURRENT_DESKTOP=$(printf '%s' "${XDG_CURRENT_DESKTOP-}" | tr '[:upper:]' '[:lower:]')
# compat mode
EXECARG_COMPAT=${XTE_EXECARG_COMPAT-true}
# flag reused in directive encounter
EXECARG_COMPAT_CONFIGURED=${XTE_EXECARG_COMPAT-}
EXEC_USEP=''
EXPANDED_STR=''
# this will receive proper value later
APPLICATIONS_DIRS=''
# this will be filled with values from /execarg_default:*:* directives
EXECARG_DEFAULTS=''
# this (re)sets vars to be filled from desktop entry
reset_keys
# 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 by default, otherwise do the
# usual thing. Editing config to disable cache should invalidate the cache.
CACHE_ENABLED=${XTE_CACHE_ENABLED-true}
# flag reused for directive encounter
CACHE_CONFIGURED=${XTE_CACHE_ENABLED-}
# HASH can be reused
HASH=''
if check_bool "${CACHE_ENABLED}" && 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=''
# Entry IDs excluded from fallback by '-entry.desktop' directives
EXCLUDED_ENTRY_IDS=''
# Entry IDS included (exclusion prevented) by '+entry.desktop' directives
INCLUDED_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_USEP=$EXEC_USEP" "EXECARG=$EXECARG"
# process/discard options
debug "option processing"
APPIDVAL=''
TITLEVAL=''
DIRVAL=''
HOLD=false
TEST_MODE=false
while [ "$#" -gt "0" ]; do
case "$1" in
--)
debug "found explicit end of options $1"
shift
break
;;
-e | "$EXECARG")
debug "found exec arg $1"
shift
break
;;
--app-id=*)
debug "found option $1"
IFS='=' read -r _opt APPIDVAL <<- EOF
$1
EOF
debug "set app-id option to $APPIDVAL"
shift
;;
--title=*)
debug "found option $1"
IFS='=' read -r _opt TITLEVAL <<- EOF
$1
EOF
debug "set title option to $DIRVAL"
shift
;;
--dir=*)
debug "found option $1"
IFS='=' read -r _opt DIRVAL <<- EOF
$1
EOF
debug "set dir option to $DIRVAL"
shift
;;
--hold)
debug "found option $1"
HOLD=true
debug "set HOLD=true"
shift
;;
--test)
debug "found option $1"
TEST_MODE=true
debug "set TEST_MODE=true"
shift
;;
[!-]*)
debug "found non-option $1"
break
;;
-*)
debug "discarding unknown option $1"
shift
;;
esac
done
debug "end of option processing, prependig options"
# option prepend
if [ "$#" -gt 0 ] && [ -n "$EXECARG" ]; then
set -- "$EXECARG" "$@"
debug "prepended $1"
fi
if [ -n "$HOLDARG" ] && check_bool "$HOLD"; then
set -- "${HOLDARG}" "$@"
debug "prepended $1"
elif [ -z "$HOLDARG" ] && check_bool "$HOLD"; then
debug "terminal entry has no TerminalArgHold="
fi
if [ -n "$DIRARG" ] && [ -n "$DIRVAL" ]; then
case "$DIRARG" in
*=)
set -- "${DIRARG}${DIRVAL}" "$@"
debug "prepended $1"
;;
*)
set -- "${DIRARG}" "${DIRVAL}" "$@"
debug "prepended $1 $2"
;;
esac
elif [ -z "$DIRARG" ] && [ -n "$DIRVAL" ]; then
debug "terminal entry has no TerminalArgDir="
fi
if [ -n "$TITLEARG" ] && [ -n "$TITLEVAL" ]; then
case "$TITLEARG" in
*=)
set -- "${TITLEARG}${TITLEVAL}" "$@"
debug "prepended $1"
;;
*)
set -- "${TITLEARG}" "${TITLEVAL}" "$@"
debug "prepended $1 $2"
;;
esac
elif [ -z "$TITLEARG" ] && [ -n "$TITLEVAL" ]; then
debug "terminal entry has no TerminalArgTitle="
fi
if [ -n "$APPIDARG" ] && [ -n "$APPIDVAL" ]; then
case "$APPIDARG" in
*=)
set -- "${APPIDARG}${APPIDVAL}" "$@"
debug "prepended $1"
;;
*)
set -- "${APPIDARG}" "${APPIDVAL}" "$@"
debug "prepended $1 $2"
;;
esac
elif [ -z "$APPIDARG" ] && [ -n "$APPIDVAL" ]; then
debug "terminal entry has no TerminalArgAppId="
fi
debug "end of option prepending"
# prepend Exec
IFS=$USEP
# shellcheck disable=SC2086
set -- $EXEC_USEP "$@"
IFS=$OIFS
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
case "$TEST_MODE" in
true)
printf '%s\n' 'Command and arguments:'
printf ' >%s<\n' "$@"
exit 0
;;
esac
exec "$@"
Vladimir-csp-xdg-terminal-exec-9357b7d/xdg-terminal-exec.1.scd 0000664 0000000 0000000 00000011312 14765236611 0024105 0 ustar 00root root 0000000 0000000 XDG-TERMINAL-EXEC(1)
; scdoc manpage, build and compress:
; scdoc < xdg-terminal-exec.1.scd | gzip -c > xdg-terminal-exec.1.gz
# NAME
*xdg-terminal-exec* - Default Terminal Execution Utility
# SYNOPSIS
*xdg-terminal-exec* [_options_] [--] [_command_ [_arguments ..._]]
# DESCRIPTION
Shell-based implementation of the proposed Default Terminal Execution
Specification. Launches preferred terminal emulator, with or without optionally
supplied command.
Terminal emulators are selected among Desktop Entries that are installed on the
system, or added by user according to XDG Desktop Entry Spec. Only valid Entries
with *TerminalEmulator* category and *X-TerminalArgExec=* key set are
considered (*X-TerminalArgExec=* key is not required in compat mode).
Command execution argument is determined by Entry's *X-TerminalArgExec=* key,
(assumed to be *-e* by default in compat mode). If an actual *-e* or matching
execution argument is given on the command line, it will be silently discarded
along with any unsupported dashed option given before unambiguous command.
It is assumed that the emulator handles command line after the execution
argument *as is* (preserved separate arguments).
# CONFIGURATION
Preferred terminals are configured by listing them in config files
named _${desktop}_*-xdg-terminals.list* or *xdg-terminals.list*
placed in XDG Config hierarchy.
_${desktop}_ here is a lowercased string that is matched (case-insensitively)
against items of _${XDG_CURRENT_DESKTOP}_ (a colon-separated list of names for
the current DE) in order of decreasing priority.
The file is a simple newline-separated list. Empty lines and lines starting with
"*#*" are ignored, dangling whitespaces are trimmed.
Terminals are listed by their Desktop Entry ID:
_terminal_*.desktop*
Optionally with Action ID suffixed via "*:*":
_terminal_*.desktop*:_action_
Files are searched in XDG Config directories in the order of decreasing
priority. In each directory, prefixed files are parsed first, in the order
listed in _${XDG_CURRENT_DESKTOP}_. Unprefixed files parsed last in each dir.
The first listed, found, and valid Desktop Entry is used.
Otherwise fallback to the first found and valid Desktop Entry is performed.
Entries can be excluded from fallback by listing their ID prefixed with "*-*":
*-*_terminal_*.desktop*
Prefixing entry with "*+*" will prevent it from later exclusion (first
encountered directive wins):
*+*_terminal_*.desktop*
Special directives understood by this implementation (the first encountered
directive is used):
*/enable_cache*, */disable_cache*
The cache feature allows storing selected terminal command line in
_${XDG_CACHE_HOME}_ to bypass reading and parsing of configuration and Desktop
Entries until changes are detected in the listing of Desktop Entry files
or config files (enabled by default).
*/execarg_compat*, */execarg_strict*
Compat mode (currently enabled by default) allows support for legacy
*[X-]ExecArg* key and allows entries without execution argument, providing _-e_
default.
*/execarg_default:*_entry.desktop_*:*_arg_
Customize defaults for execution arguments of specific terminal entries (only in
compat mode).
# FILES
Default paths for configuration files (in order of decreasing priority):
In _${XDG_CONFIG_HOME}_:
- _${HOME}_*/.config/*_${desktop}_*-xdg-terminals.list*
- _${HOME}_*/.config/xdg-terminals.list*
In _${XDG_CONFIG_DIRS}_:
- */etc/xdg/*_${desktop}_*-xdg-terminals.list*
- */etc/xdg/xdg-terminals.list*
In _${XDG_DATA_DIRS}_:
- */usr/share/xdg-terminal-exec/*_${desktop}_*-xdg-terminals.list*
- */usr/share/xdg-terminal-exec/xdg-terminals.list*
Default directories for Desktop Entries (in order of decreasing priority):
in _${XDG_DATA_HOME}_:
- _${HOME}_*/.local/share/applications/*
in _${XDG_DATA_DIRS}_:
- */usr/local/share/applications/*
- */usr/share/applications/*
Cache file:
- _${XDG_CACHE_HOME}_*/xdg-terminal-exec*
# ENVIRONMENT
*XTE_CACHE_ENABLED* (truthy or falsy value)
Enable or disable cache feature.
*DEBUG* (truthy or falsy value)
Print debug info to stderr.
# EXTERNAL LINKS
Proposal PR:
https://gitlab.freedesktop.org/terminal-wg/specifications/-/merge_requests/3/diffs
XDG Base Directory Spec:
https://specifications.freedesktop.org/basedir-spec/latest/
XDG Desktop Entry Spec:
https://specifications.freedesktop.org/desktop-entry-spec/latest/
Desktop Entry ID:
https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s02.html#desktop-file-id
Desktop Entry Action ID:
https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s11.html
# AUTHORS
Vladimir-csp (https://github.com/Vladimir-csp, https://gitlab.freedesktop.org/Vladimir-csp)
Thanks to Nathan Teodosio (https://github.com/nteodosio) for jump-starting the creation of this manpage.
Vladimir-csp-xdg-terminal-exec-9357b7d/xdg-terminals.list 0000664 0000000 0000000 00000001647 14765236611 0023423 0 ustar 00root root 0000000 0000000 # This file is intended for low priority configuration:
# xdg-terminal-exec/xdg-terminals in the last item of $XDG_DATA_DIRS.
# i.e. /usr/share/xdg-terminal-exec/xdg-terminals
# exclude unsupported terminals from fallback selection
-org.kde.yakuake.desktop
# add custom ExecArg defaults for various terminals, derived from:
# https://github.com/albertlauncher/albert/blob/6783257df7e15dcfbae49d03023414b7c3692dbd/src/app/terminalprovider.cpp#L120-L150
/execarg_default:com.raggesilver.BlackBox.desktop:--
/execarg_default:contour.desktop:execute
/execarg_default:deepin-terminal.desktop:-x
/execarg_default:io.elementary.terminal.desktop:-x
/execarg_default:org.codeberg.dnkl.foot.desktop:--
/execarg_default:org.gnome.Terminal.desktop:--
/execarg_default:kitty.desktop:--
/execarg_default:mate-terminal.desktop:-x
/execarg_default:roxterm.desktop:-x
/execarg_default:terminator.desktop:-x
/execarg_default:xfce4-terminal.desktop:-x