[gnome] Move to Grimble tiling manager

This commit is contained in:
2026-01-14 00:55:43 -05:00
parent de41369f5f
commit 941c727d38
90 changed files with 3999 additions and 9602 deletions

View File

@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
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
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@ -1,53 +0,0 @@
{
"overrides": [
{ "wmClass": "org.gnome.Shell.Extensions", "wmTitle": "Forge Settings", "mode": "float" },
{ "wmClass": "jetbrains-toolbox", "mode": "float" },
{ "wmClass": "jetbrains-goland", "wmTitle": "splash", "mode": "float" },
{ "wmClass": "jetbrains-webstorm", "wmTitle": "splash", "mode": "float" },
{ "wmClass": "jetbrains-phpstorm", "wmTitle": "splash", "mode": "float" },
{ "wmClass": "jetbrains-datagrip", "wmTitle": "splash", "mode": "float" },
{ "wmClass": "jetbrains-rubymine", "wmTitle": "splash", "mode": "float" },
{ "wmClass": "jetbrains-idea", "wmTitle": "splash", "mode": "float" },
{ "wmClass": "com.github.amezin.ddterm", "mode": "float" },
{ "wmClass": "com.github.donadigo.eddy", "mode": "float" },
{ "wmClass": "Conky", "mode": "float" },
{ "wmClass": "Gnome-initial-setup", "mode": "float" },
{ "wmClass": "org.gnome.Calculator", "mode": "float" },
{ "wmClass": "gnome-terminal-server", "wmTitle": "Preferences General", "mode": "float" },
{ "wmClass": "gnome-terminal-preferences", "mode": "float" },
{ "wmClass": "Guake", "mode": "float" },
{ "wmClass": "zoom", "mode": "float" },
{ "wmClass": "firefox", "wmTitle": "About Mozilla Firefox", "mode": "float" },
{ "wmClass": "firefox", "wmTitle": "!Mozilla Firefox", "mode": "float" },
{
"wmClass": "org.mozilla.firefox.desktop",
"wmTitle": "About Mozilla Firefox",
"mode": "float"
},
{ "wmClass": "org.mozilla.firefox.desktop", "wmTitle": "!Mozilla Firefox", "mode": "float" },
{ "wmClass": "thunderbird", "wmTitle": "About Mozilla Thunderbird", "mode": "float" },
{ "wmClass": "thunderbird", "wmTitle": "!Mozilla Thunderbird", "mode": "float" },
{
"wmClass": "org.mozilla.Thunderbird.desktop",
"wmTitle": "About Mozilla Thunderbird",
"mode": "float"
},
{
"wmClass": "org.mozilla.Thunderbird.desktop",
"wmTitle": "!Mozilla Thunderbird",
"mode": "float"
},
{
"wmClass": "evolution-alarm-notify",
"mode": "float"
},
{
"wmClass": "variety",
"mode": "float"
},
{
"wmClass": "update-manager",
"mode": "float"
}
]
}

View File

@ -1,103 +0,0 @@
/*
* This file is part of the Forge GNOME extension
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Gnome imports
import * as Main from "resource:///org/gnome/shell/ui/main.js";
import { Extension, gettext as _ } from "resource:///org/gnome/shell/extensions/extension.js";
// Shared state
import { Logger } from "./lib/shared/logger.js";
import { ConfigManager } from "./lib/shared/settings.js";
// Application imports
import { Keybindings } from "./lib/extension/keybindings.js";
import { WindowManager } from "./lib/extension/window.js";
import { FeatureIndicator, FeatureMenuToggle } from "./lib/extension/indicator.js";
import { ExtensionThemeManager } from "./lib/extension/extension-theme-manager.js";
export default class ForgeExtension extends Extension {
enable() {
this.settings = this.getSettings();
this.kbdSettings = this.getSettings("org.gnome.shell.extensions.forge.keybindings");
Logger.init(this.settings);
Logger.info("enable");
this.configMgr = new ConfigManager(this);
this.theme = new ExtensionThemeManager(this);
this.extWm = new WindowManager(this);
this.keybindings = new Keybindings(this);
this._onSessionModeChanged(Main.sessionMode);
this._sessionId = Main.sessionMode.connect("updated", this._onSessionModeChanged.bind(this));
this.theme.patchCss();
this.theme.reloadStylesheet();
this.extWm.enable();
Logger.info(`enable: finalized vars`);
}
disable() {
Logger.info("disable");
// See session mode unlock-dialog explanation on _onSessionModeChanged()
if (this._sessionId) {
Main.sessionMode.disconnect(this._sessionId);
this._sessionId = null;
}
this._removeIndicator();
this.extWm?.disable();
this.keybindings?.disable();
this.keybindings = null;
this.extWm = null;
this.themeWm = null;
this.configMgr = null;
this.settings = null;
this.kbdSettings = null;
}
_onSessionModeChanged(session) {
if (session.currentMode === "user" || session.parentMode === "user") {
Logger.info("user on session change");
this._addIndicator();
this.keybindings?.enable();
} else if (session.currentMode === "unlock-dialog") {
// To the reviewer and maintainer: this extension needs to persist the window data structure in memory so it has to keep running on lock screen.
// This is previous feature but was removed during GNOME 45 update due to the session-mode rule review.
// The argument is that users will keep re-arranging windows when it times out or locks up.
// Intent to serialize/deserialize to disk but that will take a longer time or probably a longer argument during review.
// To keep following, added to only disable keybindings() and re-enable them during user session.
// https://gjs.guide/extensions/review-guidelines/review-guidelines.html#session-modes
Logger.info("lock-screen on session change");
this.keybindings?.disable();
this._removeIndicator();
}
}
_addIndicator() {
this.indicator ??= new FeatureIndicator(this);
this.indicator.quickSettingsItems.push(new FeatureMenuToggle(this));
Main.panel.statusArea.quickSettings.addExternalIndicator(this.indicator);
}
_removeIndicator() {
this.indicator?.quickSettingsItems.forEach((item) => item.destroy());
this.indicator?.destroy();
this.indicator = null;
}
}

View File

@ -1,9 +0,0 @@
(The MIT License)
Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,100 +0,0 @@
# CSS module in Forge
API to work with CSS code and files and update the extension's stylesheet.css
## CSS Parser from ReworkCSS
Credits: https://github.com/reworkcss/css
Modified to work in GNOME-Shell by Forge
### Usage
```js
import {
parse,
stringify,
write,
load,
} from './css/index.js';
// Raw APIs from ReworkCSS
let obj = parse('body { font-size: 12px; }');
let code = stringify(obj);
// Convenience
write(code, "/path/to/stylesheet.css");
let ast = load("/path/to/stylesheet.css");
// ... Do something with AST ...
```
### Example
CSS:
```css
body {
background: #eee;
color: #888;
}
```
Parse tree:
```json
{
"type": "stylesheet",
"stylesheet": {
"rules": [
{
"type": "rule",
"selectors": [
"body"
],
"declarations": [
{
"type": "declaration",
"property": "background",
"value": "#eee",
"position": {
"start": {
"line": 2,
"column": 3
},
"end": {
"line": 2,
"column": 19
}
}
},
{
"type": "declaration",
"property": "color",
"value": "#888",
"position": {
"start": {
"line": 3,
"column": 3
},
"end": {
"line": 3,
"column": 14
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 4,
"column": 2
}
}
}
]
}
}
```

View File

@ -1,888 +0,0 @@
// Credits: https://github.com/reworkcss/css/tree/master/lib/parse
// Licensed under MIT
// Forge: modified while{} loop declarations on some lines to reduce errors on logging
// http://www.w3.org/TR/CSS21/grammar.html
// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
const commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
export function parse(css, options) {
options = options || {};
/**
* Positional.
*/
var lineno = 1;
var column = 1;
/**
* Update lineno and column based on `str`.
*/
function updatePosition(str) {
var lines = str.match(/\n/g);
if (lines) lineno += lines.length;
var i = str.lastIndexOf("\n");
column = ~i ? str.length - i : column + str.length;
}
/**
* Mark position and patch `node.position`.
*/
function position() {
var start = { line: lineno, column: column };
return function (node) {
node.position = new Position(start);
whitespace();
return node;
};
}
/**
* Store position information for a node
*/
class Position {
/**
* Non-enumerable source string
*/
content = css;
constructor(start) {
this.start = start;
this.end = { line: lineno, column: column };
this.source = options.source;
}
}
/**
* Error `msg`.
*/
var errorsList = [];
function error(msg) {
var err = new Error(options.source + ":" + lineno + ":" + column + ": " + msg);
err.reason = msg;
err.filename = options.source;
err.line = lineno;
err.column = column;
err.source = css;
if (options.silent) {
errorsList.push(err);
} else {
throw err;
}
}
/**
* Parse stylesheet.
*/
function stylesheet() {
var rulesList = rules();
return {
type: "stylesheet",
stylesheet: {
source: options.source,
rules: rulesList,
parsingErrors: errorsList,
},
};
}
/**
* Opening brace.
*/
function open() {
return match(/^{\s*/);
}
/**
* Closing brace.
*/
function close() {
return match(/^}/);
}
/**
* Parse ruleset.
*/
function rules() {
var node;
var rules = [];
whitespace();
comments(rules);
while (css.length && css.charAt(0) != "}" && (node = atrule() || rule())) {
if (node !== false) {
rules.push(node);
comments(rules);
}
}
return rules;
}
/**
* Match `re` and return captures.
*/
function match(re) {
var m = re.exec(css);
if (!m) return;
var str = m[0];
updatePosition(str);
css = css.slice(str.length);
return m;
}
/**
* Parse whitespace.
*/
function whitespace() {
match(/^\s*/);
}
/**
* Parse comments;
*/
function comments(rules) {
rules = rules || [];
for (var c; (c = comment()); ) {
if (c !== false) {
rules.push(c);
}
}
return rules;
}
/**
* Parse comment.
*/
function comment() {
var pos = position();
if ("/" != css.charAt(0) || "*" != css.charAt(1)) return;
var i = 2;
while ("" != css.charAt(i) && ("*" != css.charAt(i) || "/" != css.charAt(i + 1))) ++i;
i += 2;
if ("" === css.charAt(i - 1)) {
return error("End of comment missing");
}
var str = css.slice(2, i - 2);
column += 2;
updatePosition(str);
css = css.slice(i);
column += 2;
return pos({
type: "comment",
comment: str,
});
}
/**
* Parse selector.
*/
function selector() {
var m = match(/^([^{]+)/);
if (!m) return;
/* @fix Remove all comments from selectors
* http://ostermiller.org/findcomment.html */
return trim(m[0])
.replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, "")
.replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function (m) {
return m.replace(/,/g, "\u200C");
})
.split(/\s*(?![^(]*\)),\s*/)
.map(function (s) {
return s.replace(/\u200C/g, ",");
});
}
/**
* Parse declaration.
*/
function declaration() {
var pos = position();
// prop
var prop = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
if (!prop) return;
prop = trim(prop[0]);
// :
if (!match(/^:\s*/)) return error("property missing ':'");
// val
var val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/);
var ret = pos({
type: "declaration",
property: prop.replace(commentre, ""),
value: val ? trim(val[0]).replace(commentre, "") : "",
});
// ;
match(/^[;\s]*/);
return ret;
}
/**
* Parse declarations.
*/
function declarations() {
var decls = [];
if (!open()) return error("missing '{'");
comments(decls);
// declarations
for (var decl; (decl = declaration()); ) {
if (decl !== false) {
decls.push(decl);
comments(decls);
}
}
if (!close()) return error("missing '}'");
return decls;
}
/**
* Parse keyframe.
*/
function keyframe() {
var vals = [];
var pos = position();
for (var m; (m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)); ) {
vals.push(m[1]);
match(/^,\s*/);
}
if (!vals.length) return;
return pos({
type: "keyframe",
values: vals,
declarations: declarations(),
});
}
/**
* Parse keyframes.
*/
function atkeyframes() {
var pos = position();
var m = match(/^@([-\w]+)?keyframes\s*/);
if (!m) return;
var vendor = m[1];
// identifier
var m = match(/^([-\w]+)\s*/);
if (!m) return error("@keyframes missing name");
var name = m[1];
if (!open()) return error("@keyframes missing '{'");
var frames = comments();
for (var frame; (frame = keyframe()); ) {
frames.push(frame);
frames = frames.concat(comments());
}
if (!close()) return error("@keyframes missing '}'");
return pos({
type: "keyframes",
name: name,
vendor: vendor,
keyframes: frames,
});
}
/**
* Parse supports.
*/
function atsupports() {
var pos = position();
var m = match(/^@supports *([^{]+)/);
if (!m) return;
var supports = trim(m[1]);
if (!open()) return error("@supports missing '{'");
var style = comments().concat(rules());
if (!close()) return error("@supports missing '}'");
return pos({
type: "supports",
supports: supports,
rules: style,
});
}
/**
* Parse host.
*/
function athost() {
var pos = position();
var m = match(/^@host\s*/);
if (!m) return;
if (!open()) return error("@host missing '{'");
var style = comments().concat(rules());
if (!close()) return error("@host missing '}'");
return pos({
type: "host",
rules: style,
});
}
/**
* Parse media.
*/
function atmedia() {
var pos = position();
var m = match(/^@media *([^{]+)/);
if (!m) return;
var media = trim(m[1]);
if (!open()) return error("@media missing '{'");
var style = comments().concat(rules());
if (!close()) return error("@media missing '}'");
return pos({
type: "media",
media: media,
rules: style,
});
}
/**
* Parse custom-media.
*/
function atcustommedia() {
var pos = position();
var m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
if (!m) return;
return pos({
type: "custom-media",
name: trim(m[1]),
media: trim(m[2]),
});
}
/**
* Parse paged media.
*/
function atpage() {
var pos = position();
var m = match(/^@page */);
if (!m) return;
var sel = selector() || [];
if (!open()) return error("@page missing '{'");
var decls = comments();
// declarations
for (var decl; (decl = declaration()); ) {
decls.push(decl);
decls = decls.concat(comments());
}
if (!close()) return error("@page missing '}'");
return pos({
type: "page",
selectors: sel,
declarations: decls,
});
}
/**
* Parse document.
*/
function atdocument() {
var pos = position();
var m = match(/^@([-\w]+)?document *([^{]+)/);
if (!m) return;
var vendor = trim(m[1]);
var doc = trim(m[2]);
if (!open()) return error("@document missing '{'");
var style = comments().concat(rules());
if (!close()) return error("@document missing '}'");
return pos({
type: "document",
document: doc,
vendor: vendor,
rules: style,
});
}
/**
* Parse font-face.
*/
function atfontface() {
var pos = position();
var m = match(/^@font-face\s*/);
if (!m) return;
if (!open()) return error("@font-face missing '{'");
var decls = comments();
// declarations
for (var decl; (decl = declaration()); ) {
decls.push(decl);
decls = decls.concat(comments());
}
if (!close()) return error("@font-face missing '}'");
return pos({
type: "font-face",
declarations: decls,
});
}
/**
* Parse import
*/
var atimport = _compileAtrule("import");
/**
* Parse charset
*/
var atcharset = _compileAtrule("charset");
/**
* Parse namespace
*/
var atnamespace = _compileAtrule("namespace");
/**
* Parse non-block at-rules
*/
function _compileAtrule(name) {
var re = new RegExp("^@" + name + "\\s*([^;]+);");
return function () {
var pos = position();
var m = match(re);
if (!m) return;
var ret = { type: name };
ret[name] = m[1].trim();
return pos(ret);
};
}
/**
* Parse at rule.
*/
function atrule() {
if (css[0] != "@") return;
return (
atkeyframes() ||
atmedia() ||
atcustommedia() ||
atsupports() ||
atimport() ||
atcharset() ||
atnamespace() ||
atdocument() ||
atpage() ||
athost() ||
atfontface()
);
}
/**
* Parse rule.
*/
function rule() {
var pos = position();
var sel = selector();
if (!sel) return error("selector missing");
comments();
return pos({
type: "rule",
selectors: sel,
declarations: declarations(),
});
}
return addParent(stylesheet());
}
/**
* Trim `str`.
*/
export function trim(str) {
return str ? str.replace(/^\s+|\s+$/g, "") : "";
}
/**
* Adds non-enumerable parent node reference to each node.
*/
export function addParent(obj, parent) {
var isNode = obj && typeof obj.type === "string";
var childParent = isNode ? obj : parent;
for (var k in obj) {
var value = obj[k];
if (Array.isArray(value)) {
value.forEach(function (v) {
addParent(v, childParent);
});
} else if (value && typeof value === "object") {
addParent(value, childParent);
}
}
if (isNode) {
Object.defineProperty(obj, "parent", {
configurable: true,
writable: true,
enumerable: false,
value: parent || null,
});
}
return obj;
}
// Credits: https://github.com/reworkcss/css/blob/master/lib/stringify
// Forge: derived the identity.js module only
export class Compiler {
constructor(options) {
options ||= {};
this.indentation = typeof options.indent === "string" ? options.indent : " ";
}
/**
* Emit `str`
*/
emit(str) {
return str;
}
/**
* Visit `node`.
*/
visit(node) {
return this[node.type](node);
}
/**
* Map visit over array of `nodes`, optionally using a `delim`
*/
mapVisit(nodes, delim) {
var buf = "";
delim = delim || "";
for (var i = 0, length = nodes.length; i < length; i++) {
buf += this.visit(nodes[i]);
if (delim && i < length - 1) buf += this.emit(delim);
}
return buf;
}
/**
* Compile `node`.
*/
compile(node) {
return this.stylesheet(node);
}
/**
* Visit stylesheet node.
*/
stylesheet(node) {
return this.mapVisit(node.stylesheet.rules, "\n\n");
}
/**
* Visit comment node.
*/
comment(node) {
return this.emit(this.indent() + "/*" + node.comment + "*/", node.position);
}
/**
* Visit import node.
*/
import(node) {
return this.emit("@import " + node.import + ";", node.position);
}
/**
* Visit media node.
*/
media(node) {
return (
this.emit("@media " + node.media, node.position) +
this.emit(" {\n" + this.indent(1)) +
this.mapVisit(node.rules, "\n\n") +
this.emit(this.indent(-1) + "\n}")
);
}
/**
* Visit document node.
*/
document(node) {
var doc = "@" + (node.vendor || "") + "document " + node.document;
return (
this.emit(doc, node.position) +
this.emit(" " + " {\n" + this.indent(1)) +
this.mapVisit(node.rules, "\n\n") +
this.emit(this.indent(-1) + "\n}")
);
}
/**
* Visit charset node.
*/
charset(node) {
return this.emit("@charset " + node.charset + ";", node.position);
}
/**
* Visit namespace node.
*/
namespace(node) {
return this.emit("@namespace " + node.namespace + ";", node.position);
}
/**
* Visit supports node.
*/
supports(node) {
return (
this.emit("@supports " + node.supports, node.position) +
this.emit(" {\n" + this.indent(1)) +
this.mapVisit(node.rules, "\n\n") +
this.emit(this.indent(-1) + "\n}")
);
}
/**
* Visit keyframes node.
*/
keyframes(node) {
return (
this.emit("@" + (node.vendor || "") + "keyframes " + node.name, node.position) +
this.emit(" {\n" + this.indent(1)) +
this.mapVisit(node.keyframes, "\n") +
this.emit(this.indent(-1) + "}")
);
}
/**
* Visit keyframe node.
*/
keyframe(node) {
var decls = node.declarations;
return (
this.emit(this.indent()) +
this.emit(node.values.join(", "), node.position) +
this.emit(" {\n" + this.indent(1)) +
this.mapVisit(decls, "\n") +
this.emit(this.indent(-1) + "\n" + this.indent() + "}\n")
);
}
/**
* Visit page node.
*/
page(node) {
var sel = node.selectors.length ? node.selectors.join(", ") + " " : "";
return (
this.emit("@page " + sel, node.position) +
this.emit("{\n") +
this.emit(this.indent(1)) +
this.mapVisit(node.declarations, "\n") +
this.emit(this.indent(-1)) +
this.emit("\n}")
);
}
/**
* Visit font-face node.
*/
["font-face"] = function (node) {
return (
this.emit("@font-face ", node.position) +
this.emit("{\n") +
this.emit(this.indent(1)) +
this.mapVisit(node.declarations, "\n") +
this.emit(this.indent(-1)) +
this.emit("\n}")
);
};
/**
* Visit host node.
*/
host(node) {
return (
this.emit("@host", node.position) +
this.emit(" {\n" + this.indent(1)) +
this.mapVisit(node.rules, "\n\n") +
this.emit(this.indent(-1) + "\n}")
);
}
/**
* Visit custom-media node.
*/
["custom-media"] = function (node) {
return this.emit("@custom-media " + node.name + " " + node.media + ";", node.position);
};
/**
* Visit rule node.
*/
rule(node) {
var indent = this.indent();
var decls = node.declarations;
if (!decls.length) return "";
return (
this.emit(
node.selectors
.map(function (s) {
return indent + s;
})
.join(",\n"),
node.position
) +
this.emit(" {\n") +
this.emit(this.indent(1)) +
this.mapVisit(decls, "\n") +
this.emit(this.indent(-1)) +
this.emit("\n" + this.indent() + "}")
);
}
/**
* Visit declaration node.
*/
declaration(node) {
return (
this.emit(this.indent()) +
this.emit(node.property + ": " + node.value, node.position) +
this.emit(";")
);
}
/**
* Increase, decrease or return current indentation.
*/
indent(level) {
this.level = this.level || 1;
if (null != level) {
this.level += level;
return "";
}
return Array(this.level).join(this.indentation);
}
}
// Credits: https://github.com/reworkcss/css/tree/master/lib/stringify
// Licensed under MIT
// Forge: removed unused options
/**
* Stringfy the given AST `node`.
*
* @param {Object} node
* @param {Object} [_options]
* @return {String}
* @api public
*/
export function stringify(node, _options) {
_options ||= {};
var compiler = new Compiler(_options);
var code = compiler.compile(node);
return code;
}

View File

@ -1,43 +0,0 @@
import GObject from "gi://GObject";
import St from "gi://St";
import { ThemeManagerBase } from "../shared/theme.js";
import { Logger } from "../shared/logger.js";
import { production } from "../shared/settings.js";
export class ExtensionThemeManager extends ThemeManagerBase {
static {
GObject.registerClass(this);
}
/**
* @param {import("../../extension.js").default} extension
*/
constructor(extension) {
super(extension);
this.metadata = extension.metadata;
}
reloadStylesheet() {
const uuid = this.metadata.uuid;
const stylesheetFile = this.configMgr.stylesheetFile;
const defaultStylesheetFile = this.configMgr.defaultStylesheetFile;
let theme = St.ThemeContext.get_for_stage(global.stage).get_theme();
try {
theme.unload_stylesheet(defaultStylesheetFile);
theme.unload_stylesheet(stylesheetFile);
if (production) {
theme.load_stylesheet(stylesheetFile);
this.stylesheet = stylesheetFile;
} else {
theme.load_stylesheet(defaultStylesheetFile);
this.stylesheet = defaultStylesheetFile;
}
} catch (e) {
Logger.error(`${uuid} - ${e}`);
return;
}
}
}

View File

@ -1,129 +0,0 @@
import GObject from "gi://GObject";
import Gio from "gi://Gio";
import * as Main from "resource:///org/gnome/shell/ui/main.js";
import { gettext as _ } from "resource:///org/gnome/shell/extensions/extension.js";
import { QuickMenuToggle, SystemIndicator } from "resource:///org/gnome/shell/ui/quickSettings.js";
import {
PopupSwitchMenuItem,
PopupSeparatorMenuItem,
} from "resource:///org/gnome/shell/ui/popupMenu.js";
import * as Utils from "./utils.js";
import { Logger } from "../shared/logger.js";
const iconName = "view-grid-symbolic";
/** @typedef {import('../../extension.js').default} ForgeExtension */
class SettingsPopupSwitch extends PopupSwitchMenuItem {
static {
GObject.registerClass(this);
}
/** @type {ForgeExtension} extension */
extension;
/**
* @param {string} title
* @param {ForgeExtension} extension
* @param {string} bind
*/
constructor(title, extension, bind) {
const active = !!extension.settings.get_boolean(bind);
super(title, active);
this.extension = extension;
Logger.info(bind, active);
this.connect("toggled", (item) => this.extension.settings.set_boolean(bind, item.state));
}
}
export class FeatureMenuToggle extends QuickMenuToggle {
static {
GObject.registerClass(this);
}
constructor(extension) {
const title = _("Tiling");
const initSettings = Utils.isGnomeGTE(45)
? { title, iconName, toggleMode: true }
: { label: title, iconName, toggleMode: true };
super(initSettings);
this.extension = extension;
this.extension.settings.bind(
"tiling-mode-enabled",
this,
"checked",
Gio.SettingsBindFlags.DEFAULT
);
this.extension.settings.bind(
"quick-settings-enabled",
this,
"visible",
Gio.SettingsBindFlags.DEFAULT
);
this.menu.setHeader(iconName, _("Forge"), _("Tiling Window Management"));
this.menu.addMenuItem(
(this._singleSwitch = new SettingsPopupSwitch(
_("Gaps Hidden when Single"),
this.extension,
"window-gap-hidden-on-single"
))
);
this.menu.addMenuItem(
(this._focusHintSwitch = new SettingsPopupSwitch(
_("Show Focus Hint Border"),
this.extension,
"focus-border-toggle"
))
);
this.menu.addMenuItem(
(this._focusMovePointer = new SettingsPopupSwitch(
_("Move Pointer with the Focus"),
this.extension,
"move-pointer-focus-enabled"
))
);
// Add an entry-point for more settings
this.menu.addMenuItem(new PopupSeparatorMenuItem());
const settingsItem = this.menu.addAction(_("Settings"), () => this.extension.openPreferences());
// Ensure the settings are unavailable when the screen is locked
settingsItem.visible = Main.sessionMode.allowSettings;
this.menu._settingsActions[this.extension.uuid] = settingsItem;
}
}
export class FeatureIndicator extends SystemIndicator {
static {
GObject.registerClass(this);
}
constructor(extension) {
super();
this.extension = extension;
// Create the icon for the indicator
this._indicator = this._addIndicator();
this._indicator.icon_name = iconName;
const tilingModeEnabled = this.extension.settings.get_boolean("tiling-mode-enabled");
const quickSettingsEnabled = this.extension.settings.get_boolean("quick-settings-enabled");
this._indicator.visible = tilingModeEnabled && quickSettingsEnabled;
this.extension.settings.connect("changed", (_, name) => {
switch (name) {
case "tiling-mode-enabled":
case "quick-settings-enabled":
this._indicator.visible = this.extension.settings.get_boolean(name);
}
});
}
}

View File

@ -1,493 +0,0 @@
/*
* This file is part of the Forge extension for GNOME
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Gnome imports
import GObject from "gi://GObject";
import Meta from "gi://Meta";
import Shell from "gi://Shell";
// Gnome Shell imports
import * as Main from "resource:///org/gnome/shell/ui/main.js";
// Shared state
import { Logger } from "../shared/logger.js";
export class Keybindings extends GObject.Object {
static {
GObject.registerClass(this);
}
/** @type {import('./extension.js').default} */
ext;
constructor(ext) {
super();
Logger.debug(`created keybindings`);
this._grabbers = new Map();
// this._bindSignals();
this.ext = ext;
this.extWm = ext.extWm;
this.kbdSettings = ext.kbdSettings;
this.settings = ext.settings;
this.buildBindingDefinitions();
}
// @deprecated
_acceleratorActivate(action) {
let grabber = this._grabbers.get(action);
if (grabber) {
Logger.debug(`Firing accelerator ${grabber.accelerator} : ${grabber.name}`);
grabber.callback();
} else {
Logger.error(`No listeners [action={${action}}]`);
}
}
// @deprecated
_bindSignals() {
global.display.connect("accelerator-activated", (_display, action, _deviceId, _timestamp) => {
this._acceleratorActivate(action);
});
}
enable() {
let keybindings = this._bindings;
for (const key in keybindings) {
Main.wm.addKeybinding(
key,
this.kbdSettings,
Meta.KeyBindingFlags.NONE,
Shell.ActionMode.NORMAL,
keybindings[key]
);
}
Logger.debug(`keybindings:enable`);
}
disable() {
let keybindings = this._bindings;
for (const key in keybindings) {
Main.wm.removeKeybinding(key);
}
Logger.debug(`keybindings:disable`);
}
// @deprecated
enableListenForBindings() {
windowConfig.forEach((config) => {
config.shortcut.forEach((shortcut) => {
this.listenFor(shortcut, () => {
config.actions.forEach((action) => {
this.extWm.command(action);
});
});
});
});
}
// @deprecated
disableListenForBindings() {
// The existing grabber items are from the custom config by
// this extension.
this._grabbers.forEach((grabber) => {
global.display.ungrab_accelerator(grabber.action);
Main.wm.allowKeybinding(grabber.name, Shell.ActionMode.NONE);
});
this._grabbers.clear();
}
/**
* API for quick binding of keys to function. This is going to be useful with SpaceMode
*
* @param {String} accelerator - keybinding combinations
* @param {Function} callback - function to call when the accelerator is invoked
*
* Credits:
* - https://superuser.com/a/1182899
* - Adapted based on current Gnome-shell API or syntax
*/
listenFor(accelerator, callback) {
let grabFlags = Meta.KeyBindingFlags.NONE;
let action = global.display.grab_accelerator(accelerator, grabFlags);
if (action == Meta.KeyBindingAction.NONE) {
Logger.error(`Unable to grab accelerator [binding={${accelerator}}]`);
// TODO - check the gnome keybindings for conflicts and notify the user
} else {
let name = Meta.external_binding_name_for_action(action);
Logger.debug(`Requesting WM to allow binding [name={${name}}]`);
Main.wm.allowKeybinding(name, Shell.ActionMode.ALL);
this._grabbers.set(action, {
name: name,
accelerator: accelerator,
callback: callback,
action: action,
});
}
}
get modifierState() {
const [_x, _y, state] = this.extWm.getPointer();
return state;
}
allowDragDropTile() {
const tileModifier = this.kbdSettings.get_string("mod-mask-mouse-tile");
const modState = this.modifierState;
// Using Clutter.ModifierType values and also testing for pointer
// being grabbed (256). E.g. grabbed + pressing Super = 256 + 64 = 320
// See window.js#_handleMoving() - an overlay preview is shown.
// See window.js#_handleGrabOpEnd() - when the drag has been dropped
switch (tileModifier) {
case "Super":
return modState === 64 || modState === 320;
case "Alt":
return modState === 8 || modState === 264;
case "Ctrl":
return modState === 4 || modState === 260;
case "None":
return true;
}
return false;
}
buildBindingDefinitions() {
this._bindings = {
"window-toggle-float": () => {
let actions = [
{
name: "FloatToggle",
mode: "float",
x: "center",
y: "center",
width: 0.65,
height: 0.75,
},
];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"window-toggle-always-float": () => {
let action = {
name: "FloatClassToggle",
mode: "float",
x: "center",
y: "center",
width: 0.65,
height: 0.75,
};
this.extWm.command(action);
},
"window-focus-left": () => {
let actions = [
{
name: "Focus",
direction: "Left",
},
];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"window-focus-down": () => {
let actions = [
{
name: "Focus",
direction: "Down",
},
];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"window-focus-up": () => {
let actions = [
{
name: "Focus",
direction: "Up",
},
];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"window-focus-right": () => {
let actions = [
{
name: "Focus",
direction: "Right",
},
];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"window-swap-left": () => {
let actions = [
{
name: "Swap",
direction: "Left",
},
];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"window-swap-down": () => {
let actions = [
{
name: "Swap",
direction: "Down",
},
];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"window-swap-up": () => {
let actions = [
{
name: "Swap",
direction: "Up",
},
];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"window-swap-right": () => {
let actions = [
{
name: "Swap",
direction: "Right",
},
];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"window-move-left": () => {
let actions = [
{
name: "Move",
direction: "Left",
},
];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"window-move-down": () => {
let actions = [
{
name: "Move",
direction: "Down",
},
];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"window-move-up": () => {
let actions = [
{
name: "Move",
direction: "Up",
},
];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"window-move-right": () => {
let actions = [
{
name: "Move",
direction: "Right",
},
];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"con-split-layout-toggle": () => {
let actions = [{ name: "LayoutToggle" }];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"con-split-vertical": () => {
let actions = [{ name: "Split", orientation: "vertical" }];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"con-split-horizontal": () => {
let actions = [{ name: "Split", orientation: "horizontal" }];
actions.forEach((action) => {
this.extWm.command(action);
});
},
"con-stacked-layout-toggle": () => {
let action = { name: "LayoutStackedToggle" };
this.extWm.command(action);
},
"con-tabbed-layout-toggle": () => {
let action = { name: "LayoutTabbedToggle" };
this.extWm.command(action);
},
"con-tabbed-showtab-decoration-toggle": () => {
let action = { name: "ShowTabDecorationToggle" };
this.extWm.command(action);
},
"focus-border-toggle": () => {
let action = { name: "FocusBorderToggle" };
this.extWm.command(action);
},
"prefs-tiling-toggle": () => {
let action = { name: "TilingModeToggle" };
this.extWm.command(action);
},
"window-gap-size-increase": () => {
let action = { name: "GapSize", amount: 1 };
this.extWm.command(action);
},
"window-gap-size-decrease": () => {
let action = { name: "GapSize", amount: -1 };
this.extWm.command(action);
},
"workspace-active-tile-toggle": () => {
let action = { name: "WorkspaceActiveTileToggle" };
this.extWm.command(action);
},
"prefs-open": () => {
let action = { name: "PrefsOpen" };
this.extWm.command(action);
},
"window-swap-last-active": () => {
let action = {
name: "WindowSwapLastActive",
};
this.extWm.command(action);
},
"window-snap-one-third-right": () => {
let action = {
name: "SnapLayoutMove",
direction: "Right",
amount: 1 / 3,
};
this.extWm.command(action);
},
"window-snap-two-third-right": () => {
let action = {
name: "SnapLayoutMove",
direction: "Right",
amount: 2 / 3,
};
this.extWm.command(action);
},
"window-snap-one-third-left": () => {
let action = {
name: "SnapLayoutMove",
direction: "Left",
amount: 1 / 3,
};
this.extWm.command(action);
},
"window-snap-two-third-left": () => {
let action = {
name: "SnapLayoutMove",
direction: "Left",
amount: 2 / 3,
};
this.extWm.command(action);
},
"window-snap-center": () => {
let action = {
name: "SnapLayoutMove",
direction: "Center",
};
this.extWm.command(action);
},
"window-resize-top-increase": () => {
let action = {
name: "WindowResizeTop",
amount: this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
"window-resize-top-decrease": () => {
let action = {
name: "WindowResizeTop",
amount: -1 * this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
"window-resize-bottom-increase": () => {
let action = {
name: "WindowResizeBottom",
amount: this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
"window-resize-bottom-decrease": () => {
let action = {
name: "WindowResizeBottom",
amount: -1 * this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
"window-resize-left-increase": () => {
let action = {
name: "WindowResizeLeft",
amount: this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
"window-resize-left-decrease": () => {
let action = {
name: "WindowResizeLeft",
amount: -1 * this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
"window-resize-right-increase": () => {
let action = {
name: "WindowResizeRight",
amount: this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
"window-resize-right-decrease": () => {
let action = {
name: "WindowResizeRight",
amount: -1 * this.settings.get_uint("resize-amount"),
};
this.extWm.command(action);
},
};
}
}

View File

@ -1,407 +0,0 @@
/*
* This file is part of the Forge extension for GNOME
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Credits:
* This file has some code from Dash-To-Panel extension: convenience.js
* Some code was also adapted from the upstream Gnome Shell source code.
*/
// Gnome imports
import Meta from "gi://Meta";
import St from "gi://St";
// Gnome-shell imports
import { PACKAGE_VERSION } from "resource:///org/gnome/shell/misc/config.js";
// App imports
import { ORIENTATION_TYPES, LAYOUT_TYPES, POSITION } from "./tree.js";
import { GRAB_TYPES } from "./window.js";
const [major] = PACKAGE_VERSION.split(".").map((s) => Number(s));
/**
*
* Turns an array into an immutable enum-like object
*
*/
export function createEnum(anArray) {
const enumObj = {};
for (const val of anArray) {
enumObj[val] = val;
}
return Object.freeze(enumObj);
}
export function resolveX(rectRequest, metaWindow) {
let metaRect = metaWindow.get_frame_rect();
let monitorRect = metaWindow.get_work_area_current_monitor();
let val = metaRect.x;
let x = rectRequest.x;
switch (typeof x) {
case "string": //center,
switch (x) {
case "center":
val = monitorRect.width * 0.5 - this.resolveWidth(rectRequest, metaWindow) * 0.5;
break;
case "left":
val = 0;
break;
case "right":
val = monitorRect.width - this.resolveWidth(rectRequest, metaWindow);
break;
default:
break;
}
break;
case "number":
val = x;
break;
default:
break;
}
val = monitorRect.x + val;
return val;
}
export function resolveY(rectRequest, metaWindow) {
let metaRect = metaWindow.get_frame_rect();
let monitorRect = metaWindow.get_work_area_current_monitor();
let val = metaRect.y;
let y = rectRequest.y;
switch (typeof y) {
case "string": //center,
switch (y) {
case "center":
val = monitorRect.height * 0.5 - this.resolveHeight(rectRequest, metaWindow) * 0.5;
break;
case "top":
val = 0;
break;
case "bottom": // inverse of y=0
val = monitorRect.height - this.resolveHeight(rectRequest, metaWindow);
break;
default:
break;
}
break;
case "number":
val = y;
break;
default:
break;
}
val = monitorRect.y + val;
return val;
}
export function resolveWidth(rectRequest, metaWindow) {
let metaRect = metaWindow.get_frame_rect();
let monitorRect = metaWindow.get_work_area_current_monitor();
let val = metaRect.width;
let width = rectRequest.width;
switch (typeof width) {
case "number":
if (Number.isInteger(width) && width != 1) {
val = width;
} else {
let monitorWidth = monitorRect.width;
val = monitorWidth * width;
}
break;
default:
break;
}
return val;
}
export function resolveHeight(rectRequest, metaWindow) {
let metaRect = metaWindow.get_frame_rect();
let monitorRect = metaWindow.get_work_area_current_monitor();
let val = metaRect.height;
let height = rectRequest.height;
switch (typeof height) {
case "number":
if (Number.isInteger(height) && height != 1) {
val = height;
} else {
let monitorHeight = monitorRect.height;
val = monitorHeight * height;
}
break;
default:
break;
}
return val;
}
export function orientationFromDirection(direction) {
return direction === Meta.MotionDirection.LEFT || direction === Meta.MotionDirection.RIGHT
? ORIENTATION_TYPES.HORIZONTAL
: ORIENTATION_TYPES.VERTICAL;
}
export function orientationFromLayout(layout) {
switch (layout) {
case LAYOUT_TYPES.HSPLIT:
case LAYOUT_TYPES.TABBED:
return ORIENTATION_TYPES.HORIZONTAL;
case LAYOUT_TYPES.VSPLIT:
case LAYOUT_TYPES.STACKED:
return ORIENTATION_TYPES.VERTICAL;
default:
break;
}
}
export function positionFromDirection(direction) {
return direction === Meta.MotionDirection.LEFT || direction === Meta.MotionDirection.UP
? POSITION.BEFORE
: POSITION.AFTER;
}
export function resolveDirection(directionString) {
if (directionString) {
directionString = directionString.toUpperCase();
if (directionString === "LEFT") {
return Meta.MotionDirection.LEFT;
}
if (directionString === "RIGHT") {
return Meta.MotionDirection.RIGHT;
}
if (directionString === "UP") {
return Meta.MotionDirection.UP;
}
if (directionString === "DOWN") {
return Meta.MotionDirection.DOWN;
}
}
return null;
}
export function directionFrom(position, orientation) {
if (position === POSITION.AFTER) {
if (orientation === ORIENTATION_TYPES.HORIZONTAL) {
return Meta.DisplayDirection.RIGHT;
} else {
return Meta.DisplayDirection.DOWN;
}
} else if (position === POSITION.BEFORE) {
if (orientation === ORIENTATION_TYPES.HORIZONTAL) {
return Meta.DisplayDirection.LEFT;
} else {
return Meta.DisplayDirection.UP;
}
}
}
export function rectContainsPoint(rect, pointP) {
if (!(rect && pointP)) return false;
return (
rect.x <= pointP[0] &&
pointP[0] <= rect.x + rect.width &&
rect.y <= pointP[1] &&
pointP[1] <= rect.y + rect.height
);
}
export function orientationFromGrab(grabOp) {
if (
grabOp === Meta.GrabOp.RESIZING_N ||
grabOp === Meta.GrabOp.RESIZING_S ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_N ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_S
) {
return ORIENTATION_TYPES.VERTICAL;
} else if (
grabOp === Meta.GrabOp.RESIZING_E ||
grabOp === Meta.GrabOp.RESIZING_W ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_E ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_W
) {
return ORIENTATION_TYPES.HORIZONTAL;
}
return ORIENTATION_TYPES.NONE;
}
export function positionFromGrabOp(grabOp) {
if (
grabOp === Meta.GrabOp.RESIZING_W ||
grabOp === Meta.GrabOp.RESIZING_N ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_W ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_N
) {
return POSITION.BEFORE;
} else if (
grabOp === Meta.GrabOp.RESIZING_E ||
grabOp === Meta.GrabOp.RESIZING_S ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_E ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_S
) {
return POSITION.AFTER;
}
return POSITION.UNKNOWN;
}
export function allowResizeGrabOp(grabOp) {
grabOp &= ~1024; // ignore META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED
return (
grabOp === Meta.GrabOp.RESIZING_N ||
grabOp === Meta.GrabOp.RESIZING_E ||
grabOp === Meta.GrabOp.RESIZING_W ||
grabOp === Meta.GrabOp.RESIZING_S ||
grabOp === Meta.GrabOp.RESIZING_NE ||
grabOp === Meta.GrabOp.RESIZING_NW ||
grabOp === Meta.GrabOp.RESIZING_SE ||
grabOp === Meta.GrabOp.RESIZING_SW ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_N ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_E ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_W ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_S ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN
);
}
export function grabMode(grabOp) {
grabOp &= ~1024; // ignore META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED
if (
grabOp === Meta.GrabOp.RESIZING_N ||
grabOp === Meta.GrabOp.RESIZING_E ||
grabOp === Meta.GrabOp.RESIZING_W ||
grabOp === Meta.GrabOp.RESIZING_S ||
grabOp === Meta.GrabOp.RESIZING_NE ||
grabOp === Meta.GrabOp.RESIZING_NW ||
grabOp === Meta.GrabOp.RESIZING_SE ||
grabOp === Meta.GrabOp.RESIZING_SW ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_N ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_E ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_W ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_S ||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN
) {
return GRAB_TYPES.RESIZING;
} else if (
grabOp === Meta.GrabOp.KEYBOARD_MOVING ||
grabOp === Meta.GrabOp.MOVING ||
grabOp === Meta.GrabOp.MOVING_UNCONSTRAINED
) {
return GRAB_TYPES.MOVING;
}
return GRAB_TYPES.UNKNOWN;
}
export function decomposeGrabOp(grabOp) {
grabOp &= ~1024; // ignore META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED
switch (grabOp) {
case Meta.GrabOp.RESIZING_NE:
return [Meta.GrabOp.RESIZING_N, Meta.GrabOp.RESIZING_E];
case Meta.GrabOp.RESIZING_NW:
return [Meta.GrabOp.RESIZING_N, Meta.GrabOp.RESIZING_W];
case Meta.GrabOp.RESIZING_SE:
return [Meta.GrabOp.RESIZING_S, Meta.GrabOp.RESIZING_E];
case Meta.GrabOp.RESIZING_SW:
return [Meta.GrabOp.RESIZING_S, Meta.GrabOp.RESIZING_W];
default:
return [grabOp];
}
}
export function directionFromGrab(grabOp) {
if (grabOp === Meta.GrabOp.RESIZING_E || grabOp === Meta.GrabOp.KEYBOARD_RESIZING_E) {
return Meta.MotionDirection.RIGHT;
} else if (grabOp === Meta.GrabOp.RESIZING_W || grabOp === Meta.GrabOp.KEYBOARD_RESIZING_W) {
return Meta.MotionDirection.LEFT;
} else if (grabOp === Meta.GrabOp.RESIZING_N || grabOp === Meta.GrabOp.KEYBOARD_RESIZING_N) {
return Meta.MotionDirection.UP;
} else if (grabOp === Meta.GrabOp.RESIZING_S || grabOp === Meta.GrabOp.KEYBOARD_RESIZING_S) {
return Meta.MotionDirection.DOWN;
}
}
export function removeGapOnRect(rectWithGap, gap) {
rectWithGap.x = rectWithGap.x -= gap;
rectWithGap.y = rectWithGap.y -= gap;
rectWithGap.width = rectWithGap.width += gap * 2;
rectWithGap.height = rectWithGap.height += gap * 2;
return rectWithGap;
}
// Credits: PopShell
export function findWindowWith(title) {
let display = global.display;
let type = Meta.TabList.NORMAL_ALL;
let workspaceMgr = display.get_workspace_manager();
let workspaces = workspaceMgr.get_n_workspaces();
for (let wsId = 1; wsId <= workspaces; wsId++) {
let workspace = workspaceMgr.get_workspace_by_index(wsId);
for (const metaWindow of display.get_tab_list(type, workspace)) {
if (
metaWindow.title &&
title &&
(metaWindow.title === title || metaWindow.title.includes(title))
) {
return metaWindow;
}
}
}
return undefined;
}
export function oppositeDirectionOf(direction) {
if (direction === Meta.MotionDirection.LEFT) {
return Meta.MotionDirection.RIGHT;
} else if (direction === Meta.MotionDirection.RIGHT) {
return Meta.MotionDirection.LEFT;
} else if (direction === Meta.MotionDirection.UP) {
return Meta.MotionDirection.DOWN;
} else if (direction === Meta.MotionDirection.DOWN) {
return Meta.MotionDirection.UP;
}
}
export function monitorIndex(monitorValue) {
if (!monitorValue) return -1;
let wsIndex = monitorValue.indexOf("ws");
let indexVal = monitorValue.slice(0, wsIndex);
indexVal = indexVal.replace("mo", "");
return parseInt(indexVal);
}
export function _disableDecorations() {
let decos = global.window_group.get_children().filter((a) => a.type != null);
decos.forEach((d) => {
global.window_group.remove_child(d);
d.destroy();
});
}
export function dpi() {
return St.ThemeContext.get_for_stage(global.stage).scale_factor;
}
export function isGnome(majorVersion) {
return major == majorVersion;
}
export function isGnomeGTE(majorVersion) {
return major >= majorVersion;
}

View File

@ -1,221 +0,0 @@
// Gnome imports
import Adw from "gi://Adw";
import GObject from "gi://GObject";
import Gdk from "gi://Gdk";
// Extension imports
import { gettext as _ } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js";
// Shared state
import { ConfigManager } from "../shared/settings.js";
import { PrefsThemeManager } from "./prefs-theme-manager.js";
// Prefs UI
import { ColorRow, PreferencesPage, ResetButton, SpinButtonRow, SwitchRow } from "./widgets.js";
import { Logger } from "../shared/logger.js";
export class AppearancePage extends PreferencesPage {
static {
GObject.registerClass(this);
}
/**
* @param {string} selector
*/
static getCssSelectorAsMessage(selector) {
switch (selector) {
// TODO: make separate color selection for preview hint
case ".window-tiled-border":
return _("Tiled window");
case ".window-tabbed-border":
return _("Tabbed window");
case ".window-stacked-border":
return _("Stacked window");
case ".window-floated-border":
return _("Floating window");
case ".window-split-border":
return _("Split direction hint");
}
}
constructor({ settings, dir }) {
super({ title: _("Appearance"), icon_name: "brush-symbolic" });
this.settings = settings;
let configMgr = new ConfigManager({ dir });
this.themeMgr = new PrefsThemeManager({ configMgr: configMgr, settings: settings });
this.add_group({
title: _("Gaps"),
description: _("Change the gap size between windows"),
children: [
new SpinButtonRow({
title: _("Gap size"),
range: [0, 32, 1],
settings,
bind: "window-gap-size",
}),
new SpinButtonRow({
title: _("Gap size multiplier"),
range: [0, 32, 1],
settings,
bind: "window-gap-size-increment",
}),
new SwitchRow({
title: _("Disable gaps for single window"),
subtitle: _("Disables window gaps when only a single window is present"),
settings,
bind: "window-gap-hidden-on-single",
}),
],
});
this.add_group({
title: _("Style"),
description: _("Change how the shell looks"),
children: [
new SwitchRow({
title: _("Preview hint"),
subtitle: _("Shows where the window will be tiled when you let go of it"),
experimental: true,
settings,
bind: "preview-hint-enabled",
}),
new SwitchRow({
title: _("Border around focused window"),
subtitle: _("Display a colored border around the focused window"),
settings,
bind: "focus-border-toggle",
}),
new SwitchRow({
title: _("Window split hint border"),
subtitle: _("Show split direction border on focused window"),
settings,
bind: "split-border-toggle",
}),
new SwitchRow({
title: _("Forge in quick settings"),
subtitle: _("Toggles the Forge tile in quick settings"),
experimental: true,
settings,
bind: "quick-settings-enabled",
}),
],
});
this.add_group({
title: _("Color"),
description: _("Changes the focused window's border and preview hint colors"),
children: [
"window-tiled-border",
"window-tabbed-border",
"window-stacked-border",
"window-floated-border",
"window-split-border",
].map((x) => this._createColorOptionWidget(x)),
});
}
/**
* @param {string} prefix
*/
_createColorOptionWidget(prefix) {
const selector = `.${prefix}`;
const theme = this.themeMgr;
const title = AppearancePage.getCssSelectorAsMessage(selector);
const colorScheme = theme.getColorSchemeBySelector(selector);
const row = new Adw.ExpanderRow({ title });
const borderSizeRow = new SpinButtonRow({
title: _("Border size"),
range: [1, 6, 1],
// subtitle: 'Properties of the focus hint',
max_width_chars: 1,
max_length: 1,
width_chars: 2,
xalign: 1,
init: theme.removePx(theme.getCssProperty(selector, "border-width").value),
onChange: (value) => {
const px = theme.addPx(value);
Logger.debug(`Setting border width for selector: ${selector} ${px}`);
theme.setCssProperty(selector, "border-width", px);
},
});
borderSizeRow.add_suffix(
new ResetButton({
onReset: () => {
const borderDefault = theme.defaultPalette[colorScheme]["border-width"];
theme.setCssProperty(selector, "border-width", theme.addPx(borderDefault));
borderSizeRow.activatable_widget.value = borderDefault;
},
})
);
const updateCssColors = (rgbaString) => {
const rgba = new Gdk.RGBA();
if (rgba.parse(rgbaString)) {
Logger.debug(`Setting color for selector: ${selector} ${rgbaString}`);
const previewBorderRgba = rgba.copy();
const previewBackgroundRgba = rgba.copy();
const overviewBackgroundRgba = rgba.copy();
previewBorderRgba.alpha = 0.3;
previewBackgroundRgba.alpha = 0.2;
overviewBackgroundRgba.alpha = 0.5;
// The primary color updates the focus hint:
theme.setCssProperty(selector, "border-color", rgba.to_string());
// Only apply below on the tabbed scheme
if (colorScheme === "tabbed") {
const tabBorderRgba = rgba.copy();
const tabActiveBackgroundRgba = rgba.copy();
tabBorderRgba.alpha = 0.6;
theme.setCssProperty(
`.window-${colorScheme}-tab`,
"border-color",
tabBorderRgba.to_string()
);
theme.setCssProperty(
`.window-${colorScheme}-tab-active`,
"background-color",
tabActiveBackgroundRgba.to_string()
);
}
// And then finally the preview when doing drag/drop tiling:
theme.setCssProperty(
`.window-tilepreview-${colorScheme}`,
"border-color",
previewBorderRgba.to_string()
);
theme.setCssProperty(
`.window-tilepreview-${colorScheme}`,
"background-color",
previewBackgroundRgba.to_string()
);
}
};
const borderColorRow = new ColorRow({
title: _("Border color"),
init: theme.getCssProperty(selector, "border-color").value,
onChange: updateCssColors,
});
borderColorRow.add_suffix(
new ResetButton({
onReset: () => {
const selectorColor = theme.defaultPalette[colorScheme].color;
updateCssColors(selectorColor);
const rgba = new Gdk.RGBA();
if (rgba.parse(selectorColor)) {
borderColorRow.colorButton.set_rgba(rgba);
}
},
})
);
row.add_row(borderColorRow);
row.add_row(borderSizeRow);
return row;
}
}

View File

@ -1,82 +0,0 @@
// Gtk imports
import Gtk from "gi://Gtk";
import GObject from "gi://GObject";
// Gnome imports
import { gettext as _ } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js";
// Extension imports
import { PreferencesPage, RemoveItemRow, ResetButton } from "./widgets.js";
import { ConfigManager } from "../shared/settings.js";
export class FloatingPage extends PreferencesPage {
static {
GObject.registerClass(this);
}
constructor({ settings, dir }) {
super({ title: _("Windows"), icon_name: "window-symbolic" });
this.settings = settings;
this.configMgr = new ConfigManager({ dir });
let overrides = this.configMgr.windowProps.overrides;
this.rows = this.loadItemsFromConfig(overrides);
this.floatingWindowGroup = this.add_group({
title: _("Floating Windows"),
description: _("Windows that will not be tiled"),
header_suffix: new ResetButton({ onReset: () => this.onResetHandler() }),
children: this.rows,
});
}
loadItemsFromConfig(overrides) {
let children = [];
for (let override of overrides) {
if (override.mode === "float") {
let itemrow = new RemoveItemRow({
title: override.wmTitle ?? override.wmClass,
subtitle: override.wmClass,
onRemove: (item, parent) => this.onRemoveHandler(item, parent),
});
children.push(itemrow);
}
}
return children;
}
onRemoveHandler(item, parent) {
this.floatingWindowGroup.remove(parent);
this.rows = this.rows.filter((row) => row != parent);
const existing = this.configMgr.windowProps.overrides;
const modified = existing.filter((row) => item != row.wmClass);
this.saveOverrides(modified);
}
saveOverrides(modified) {
if (modified) {
this.configMgr.windowProps = {
overrides: modified,
};
// Signal the main extension to reload floating overrides
const changed = Math.floor(Date.now() / 1000);
this.settings.set_uint("window-overrides-reload-trigger", changed);
}
}
onResetHandler() {
const defaultWindowProps = this.configMgr.loadDefaultWindowConfigContents();
const original = defaultWindowProps.overrides;
this.saveOverrides(original);
for (const child of this.rows) {
this.floatingWindowGroup.remove(child);
}
this.rows = this.loadItemsFromConfig(original);
for (const item of this.rows) {
this.floatingWindowGroup.add(item);
}
}
}

View File

@ -1,103 +0,0 @@
// Gnome imports
import Adw from "gi://Adw";
import GObject from "gi://GObject";
import Gtk from "gi://Gtk";
// Extension Imports
import { gettext as _ } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js";
// Prefs UI
import { EntryRow, PreferencesPage, RadioRow } from "./widgets.js";
import { Logger } from "../shared/logger.js";
export class KeyboardPage extends PreferencesPage {
static {
GObject.registerClass(this);
}
constructor({ kbdSettings }) {
super({ title: _("Keyboard"), icon_name: "input-keyboard-symbolic" });
this.add_group({
title: _("Drag-and-drop modifier key"),
description: _(
"Change the modifier key for tiling windows via drag-and-drop. Select 'None' to always tile"
),
children: [
new RadioRow({
title: _("Modifier key"),
settings: kbdSettings,
bind: "mod-mask-mouse-tile",
options: {
Super: _("Super"),
Ctrl: _("Ctrl"),
Alt: _("Alt"),
None: _("None"),
},
}),
],
});
this.add_group({
title: _("Shortcuts"),
description: _(
'Change the tiling shortcuts. To clear a shortcut clear the input field. To apply a shortcut press enter. <a href="https://github.com/forge-ext/forge/wiki/Keyboard-Shortcuts">Syntax examples</a>'
),
children: Object.entries({
window: "Tiling shortcuts",
con: "Container shortcuts",
workspace: "Workspace shortcuts",
focus: "Appearance shortcuts",
prefs: "Other shortcuts",
}).map(([prefix, gettextKey]) =>
KeyboardPage.makeKeygroupExpander(prefix, gettextKey, kbdSettings)
),
});
}
static makeKeygroupExpander(prefix, gettextKey, settings) {
const expander = new Adw.ExpanderRow({ title: _(gettextKey) });
KeyboardPage.createKeyList(settings, prefix).forEach((key) =>
expander.add_row(
new EntryRow({
title: key,
settings,
bind: key,
map: {
from(settings, bind) {
return settings.get_strv(bind).join(",");
},
to(settings, bind, value) {
if (!!value) {
const mappings = value.split(",").map((x) => {
const [, key, mods] = Gtk.accelerator_parse(x);
return Gtk.accelerator_valid(key, mods) && Gtk.accelerator_name(key, mods);
});
if (mappings.every((x) => !!x)) {
Logger.info("setting", bind, "to", mappings);
settings.set_strv(bind, mappings);
}
} else {
// If value deleted, unset the mapping
settings.set_strv(bind, []);
}
},
},
})
)
);
return expander;
}
static createKeyList(settings, categoryName) {
return settings
.list_keys()
.filter((keyName) => !!keyName && !!categoryName && keyName.startsWith(categoryName))
.sort((a, b) => {
const aUp = a.toUpperCase();
const bUp = b.toUpperCase();
if (aUp < bUp) return -1;
if (aUp > bUp) return 1;
return 0;
});
}
}

View File

@ -1,2 +0,0 @@
export const developers = Object.entries([
].reduce((acc, x) => ({ ...acc, [x.email]: acc[x.email] ?? x.name }), {})).map(([email, name]) => name + ' <' + email + '>')

View File

@ -1,13 +0,0 @@
import GObject from "gi://GObject";
import { ThemeManagerBase } from "../shared/theme.js";
export class PrefsThemeManager extends ThemeManagerBase {
static {
GObject.registerClass(this);
}
reloadStylesheet() {
this.settings.set_string("css-updated", Date.now().toString());
}
}

View File

@ -1,150 +0,0 @@
// Gnome imports
import Adw from "gi://Adw";
import Gtk from "gi://Gtk";
import GObject from "gi://GObject";
// Shared state
import { Logger } from "../shared/logger.js";
import { production } from "../shared/settings.js";
// Prefs UI
import { DropDownRow, SwitchRow, PreferencesPage, EntryRow } from "./widgets.js";
// Extension imports
import { gettext as _ } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js";
import { PACKAGE_VERSION } from "resource:///org/gnome/Shell/Extensions/js/misc/config.js";
import { developers } from "./metadata.js";
function showAboutWindow(parent, { version, description: comments }) {
version = version ?? "development";
const abt = new Adw.AboutWindow({
...(parent && { transient_for: parent }),
// TODO: fetch these from github at build time
application_name: _("Forge"),
application_icon: "forge-logo-symbolic",
version: `${PACKAGE_VERSION}-${version.toString()}`,
copyright: `© 2021-${new Date().getFullYear()} jmmaranan`,
issue_url: "https://github.com/forge-ext/forge/issues/new",
license_type: Gtk.License.GPL_3_0,
website: "https://github.com/forge-ext/forge",
developers,
comments,
designers: [],
translator_credits: _("translator-credits"),
});
abt.present();
}
function makeAboutButton(parent, metadata) {
const button = new Gtk.Button({
icon_name: "help-about-symbolic",
tooltip_text: _("About"),
valign: Gtk.Align.CENTER,
});
button.connect("clicked", () => showAboutWindow(parent, metadata));
return button;
}
export class SettingsPage extends PreferencesPage {
static {
GObject.registerClass(this);
}
constructor({ settings, window, metadata }) {
super({ title: _("Tiling"), icon_name: "view-grid-symbolic" });
this.add_group({
title: _("Behavior"),
description: _("Change how the tiling behaves"),
header_suffix: makeAboutButton(window, metadata),
children: [
new SwitchRow({
title: _("Focus on Hover"),
subtitle: _("Window focus follows the pointer"),
experimental: true,
settings,
bind: "focus-on-hover-enabled",
}),
new SwitchRow({
title: _("Move pointer with focused window"),
subtitle: _("Moves the pointer when focusing or swapping via keyboard"),
experimental: true,
settings,
bind: "move-pointer-focus-enabled",
}),
new SwitchRow({
title: _("Quarter tiling"),
subtitle: _("Places new windows in a clock-wise fashion"),
experimental: true,
settings,
bind: "auto-split-enabled",
}),
new SwitchRow({
title: _("Stacked tiling"),
subtitle: _("Stacks windows on top of each other while still tiling them"),
experimental: true,
settings,
bind: "stacked-tiling-mode-enabled",
}),
new SwitchRow({
title: _("Tabbed tiling"),
subtitle: _("Groups windows as tabs"),
experimental: true,
settings,
bind: "tabbed-tiling-mode-enabled",
}),
new SwitchRow({
title: _("Auto exit tabbed tiling"),
subtitle: _("Exit tabbed tiling mode when only a single tab remains"),
settings,
bind: "auto-exit-tabbed",
bind: "move-pointer-focus-enabled",
}),
new DropDownRow({
title: _("Drag-and-drop behavior"),
subtitle: _("What to do when dragging one window on top of another"),
settings,
type: "s",
bind: "dnd-center-layout",
items: [
{ id: "swap", name: _("Swap") },
{ id: "tabbed", name: _("Tabbed") },
{ id: "stacked", name: _("Stacked") },
],
}),
new SwitchRow({
title: _("Always on Top mode for floating windows"),
subtitle: _("Makes floating windows appear above tiled windows"),
experimental: true,
settings,
bind: "float-always-on-top-enabled",
}),
],
});
this.add_group({
title: _("Non-tiling workspaces"),
description: _("Disables tiling on specified workspaces. Starts from 0, separated by commas"),
children: [
new EntryRow({
title: _("Example: 0,1,2"),
settings,
bind: "workspace-skip-tile",
}),
],
});
if (!production) {
this.add_group({
title: _("Logger"),
children: [
new DropDownRow({
title: _("Log level"),
settings,
bind: "log-level",
items: Object.entries(Logger.LOG_LEVELS).map(([name, id]) => ({ id, name })),
type: "u",
}),
],
});
}
}
}

View File

@ -1,356 +0,0 @@
/** @license (c) aylur. GPL v3 */
import Adw from "gi://Adw";
import Gio from "gi://Gio";
import Gdk from "gi://Gdk";
import Gtk from "gi://Gtk";
import GObject from "gi://GObject";
// GNOME imports
import { gettext as _ } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js";
// Shared state
import { Logger } from "../shared/logger.js";
export class PreferencesPage extends Adw.PreferencesPage {
static {
GObject.registerClass(this);
}
add_group({ title, description = "", children, header_suffix = "" }) {
const group = new Adw.PreferencesGroup({ title, description });
for (const child of children) group.add(child);
if (header_suffix) group.set_header_suffix(header_suffix);
this.add(group);
return group;
}
}
export class SwitchRow extends Adw.ActionRow {
static {
GObject.registerClass(this);
}
constructor({ title, settings, bind, subtitle = "", experimental = false }) {
super({ title, subtitle });
const gswitch = new Gtk.Switch({
active: settings.get_boolean(bind),
valign: Gtk.Align.CENTER,
});
settings.bind(bind, gswitch, "active", Gio.SettingsBindFlags.DEFAULT);
if (experimental) {
const icon = new Gtk.Image({ icon_name: "bug-symbolic" });
icon.set_tooltip_markup(
_("<b>CAUTION</b>: Enabling this setting can lead to bugs or cause the shell to crash")
);
this.add_suffix(icon);
}
this.add_suffix(gswitch);
this.activatable_widget = gswitch;
}
}
export class ColorRow extends Adw.ActionRow {
static {
GObject.registerClass(this);
}
constructor({ title, init, onChange, subtitle = "" }) {
super({ title, subtitle });
let rgba = new Gdk.RGBA();
rgba.parse(init);
this.colorButton = new Gtk.ColorButton({ rgba, use_alpha: true, valign: Gtk.Align.CENTER });
this.colorButton.connect("color-set", () => {
onChange(this.colorButton.get_rgba().to_string());
});
this.add_suffix(this.colorButton);
this.activatable_widget = this.colorButton;
}
}
export class SpinButtonRow extends Adw.ActionRow {
static {
GObject.registerClass(this);
}
constructor({
title,
range: [low, high, step],
subtitle = "",
init = undefined,
onChange = undefined,
max_width_chars = undefined,
max_length = undefined,
width_chars = undefined,
xalign = undefined,
settings = undefined,
bind = undefined,
}) {
super({ title, subtitle });
const gspin = Gtk.SpinButton.new_with_range(low, high, step);
gspin.xalign = 1;
if (bind && settings) {
settings.bind(bind, gspin, "value", Gio.SettingsBindFlags.DEFAULT);
} else if (init) {
gspin.value = init;
gspin.connect("value-changed", (widget) => {
onChange?.(widget.value);
});
}
this.add_suffix(gspin);
this.set_css_classes(["spin"]);
this.activatable_widget = gspin;
}
}
export class DropDownRow extends Adw.ActionRow {
static {
GObject.registerClass(this);
}
/**
* @type {string}
* Name of the gsetting key to bind to
*/
bind;
/**
* @type {'b'|'y'|'n'|'q'|'i'|'u'|'x'|'t'|'h'|'d'|'s'|'o'|'g'|'?'|'a'|'m'}
* - b: the type string of G_VARIANT_TYPE_BOOLEAN; a boolean value.
* - y: the type string of G_VARIANT_TYPE_BYTE; a byte.
* - n: the type string of G_VARIANT_TYPE_INT16; a signed 16 bit integer.
* - q: the type string of G_VARIANT_TYPE_UINT16; an unsigned 16 bit integer.
* - i: the type string of G_VARIANT_TYPE_INT32; a signed 32 bit integer.
* - u: the type string of G_VARIANT_TYPE_UINT32; an unsigned 32 bit integer.
* - x: the type string of G_VARIANT_TYPE_INT64; a signed 64 bit integer.
* - t: the type string of G_VARIANT_TYPE_UINT64; an unsigned 64 bit integer.
* - h: the type string of G_VARIANT_TYPE_HANDLE; a signed 32 bit value that, by convention, is used as an index into an array of file descriptors that are sent alongside a D-Bus message.
* - d: the type string of G_VARIANT_TYPE_DOUBLE; a double precision floating point value.
* - s: the type string of G_VARIANT_TYPE_STRING; a string.
* - o: the type string of G_VARIANT_TYPE_OBJECT_PATH; a string in the form of a D-Bus object path.
* - g: the type string of G_VARIANT_TYPE_SIGNATURE; a string in the form of a D-Bus type signature.
* - ?: the type string of G_VARIANT_TYPE_BASIC; an indefinite type that is a supertype of any of the basic types.
* - v: the type string of G_VARIANT_TYPE_VARIANT; a container type that contain any other type of value.
* - a: used as a prefix on another type string to mean an array of that type; the type string “ai”, for example, is the type of an array of signed 32-bit integers.
* - m: used as a prefix on another type string to mean a “maybe”, or “nullable”, version of that type; the type string “ms”, for example, is the type of a value that maybe contains a string, or maybe contains nothing.
*/
type;
selected = 0;
/** @type {{name: string; id: string}[]} */
items;
model = new Gtk.StringList();
/** @type {Gtk.DropDown} */
dropdown;
constructor({ title, settings, bind, items, subtitle = "", type }) {
super({ title, subtitle });
this.settings = settings;
this.items = items;
this.bind = bind;
this.type = type ?? this.settings.get_value(bind)?.get_type() ?? "?";
this.#build();
this.add_suffix(this.dropdown);
this.add_suffix(new ResetButton({ settings, bind, onReset: () => this.reset() }));
}
reset() {
this.dropdown.selected = 0;
this.selected = 0;
}
#build() {
for (const { name, id } of this.items) {
this.model.append(name);
if (this.#get() === id) this.selected = this.items.findIndex((x) => x.id === id);
}
const { model, selected } = this;
this.dropdown = new Gtk.DropDown({ valign: Gtk.Align.CENTER, model, selected });
this.dropdown.connect("notify::selected", () => this.#onSelected());
this.activatable_widget = this.dropdown;
}
#onSelected() {
this.selected = this.dropdown.selected;
const { id } = this.items[this.selected];
Logger.debug("setting", id, this.selected);
this.#set(this.bind, id);
}
static #settingsTypes = {
b: "boolean",
y: "byte",
n: "int16",
q: "uint16",
i: "int32",
u: "uint",
x: "int64",
t: "uint64",
d: "double",
s: "string",
o: "objv",
};
/**
* @param {string} x
*/
#get(x = this.bind) {
const methodName = `get_${DropDownRow.#settingsTypes[this.type] ?? "value"}`;
return this.settings[methodName]?.(x);
}
/**
* @param {string} x
* @param {unknown} y
*/
#set(x, y) {
const methodName = `set_${DropDownRow.#settingsTypes[this.type] ?? "value"}`;
Logger.log(`${methodName}(${x}, ${y})`);
return this.settings[methodName]?.(x, y);
}
}
export class ClearButton extends Gtk.Button {
static {
GObject.registerClass(this);
}
constructor({ settings = undefined, bind = undefined, onClear }) {
super({
icon_name: "edit-clear-symbolic",
tooltip_text: _("Clear shortcut"),
css_classes: ["flat", "circular"],
valign: Gtk.Align.CENTER,
});
this.connect("clicked", () => {
onClear?.();
});
}
}
export class ResetButton extends Gtk.Button {
static {
GObject.registerClass(this);
}
constructor({ settings = undefined, bind = undefined, onReset }) {
super({
icon_name: "edit-undo-symbolic",
tooltip_text: _("Reset to default"),
css_classes: ["flat", "circular"],
valign: Gtk.Align.CENTER,
});
this.connect("clicked", () => {
settings?.reset(bind);
onReset?.();
});
}
}
export class RemoveButton extends Gtk.Button {
static {
GObject.registerClass(this);
}
constructor({ item, parent, onRemove }) {
super({
icon_name: "edit-delete-symbolic",
tooltip_text: _("Remove Item"),
css_classes: ["flat", "circular"],
valign: Gtk.Align.CENTER,
});
this.connect("clicked", () => {
onRemove?.(item, parent);
});
}
}
export class EntryRow extends Adw.EntryRow {
static {
GObject.registerClass(this);
}
constructor({ title, settings, bind, map }) {
super({ title });
this.connect("changed", () => {
const text = this.get_text();
if (typeof text === "string")
if (map) {
map.to(settings, bind, text);
} else {
settings.set_string(bind, text);
}
});
const current = map ? map.from(settings, bind) : settings.get_string(bind);
this.set_text(current ?? "");
this.add_suffix(
new ClearButton({
settings,
bind,
onClear: () => {
this.set_text("");
},
})
);
this.add_suffix(
new ResetButton({
settings,
bind,
onReset: () => {
this.set_text((map ? map.from(settings, bind) : settings.get_string(bind)) ?? "");
},
})
);
}
}
export class RadioRow extends Adw.ActionRow {
static {
GObject.registerClass(this);
}
static orientation = Gtk.Orientation.HORIZONTAL;
static spacing = 3;
static valign = Gtk.Align.CENTER;
constructor({ title, subtitle = "", settings, bind, options }) {
super({ title, subtitle });
const current = settings.get_string(bind);
const labels = Object.fromEntries(Object.entries(options).map(([k, v]) => [v, k]));
const { orientation, spacing, valign } = RadioRow;
const hbox = new Gtk.Box({ orientation, spacing, valign });
let group;
for (const [key, label] of Object.entries(options)) {
const toggle = new Gtk.ToggleButton({ label, ...(group && { group }) });
group ||= toggle;
toggle.active = key === current;
toggle.set_css_classes(["flat"]);
toggle.connect("clicked", () => {
if (toggle.active) {
settings.set_string(bind, labels[toggle.label]);
}
});
hbox.append(toggle);
}
this.add_suffix(hbox);
}
}
export class RemoveItemRow extends Adw.ActionRow {
static {
GObject.registerClass(this);
}
constructor({ title, subtitle = "", onRemove = undefined }) {
super({ title, subtitle });
const rmbutton = new RemoveButton({
item: subtitle,
parent: this,
onRemove: onRemove,
});
this.add_suffix(rmbutton);
}
}

View File

@ -1,80 +0,0 @@
/*
* This file is part of the Forge extension for GNOME
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import { production } from "./settings.js";
export class Logger {
static #settings;
static LOG_LEVELS = {
OFF: 0,
FATAL: 1,
ERROR: 2,
WARN: 3,
INFO: 4,
DEBUG: 5,
TRACE: 6,
ALL: 7,
};
static init(settings) {
this.#settings = settings;
}
static get #level() {
if (this.#settings?.get_boolean?.("logging-enabled")) {
return production
? Logger.LOG_LEVELS.OFF
: this.#settings?.get_uint?.("log-level") ?? Logger.LOG_LEVELS.OFF;
}
return Logger.LOG_LEVELS.OFF;
}
// TODO: use console.* methods
static format(msg, ...params) {
return params.reduce((acc, val) => acc.replace("{}", val), msg);
}
static fatal(...args) {
if (this.#level > Logger.LOG_LEVELS.OFF) log(`[Forge] [FATAL]`, ...args);
}
static error(...args) {
if (this.#level > Logger.LOG_LEVELS.FATAL) log(`[Forge] [ERROR]`, ...args);
}
static warn(...args) {
if (this.#level > Logger.LOG_LEVELS.ERROR) log(`[Forge] [WARN]`, ...args);
}
static info(...args) {
if (this.#level > Logger.LOG_LEVELS.WARN) log(`[Forge] [INFO]`, ...args);
}
static debug(...args) {
if (this.#level > Logger.LOG_LEVELS.INFO) log(`[Forge] [DEBUG]`, ...args);
}
static trace(...args) {
if (this.#level > Logger.LOG_LEVELS.DEBUG) log(`[Forge] [TRACE]`, ...args);
}
static log(...args) {
if (this.#level > Logger.LOG_LEVELS.OFF) log(`[Forge] [LOG]`, ...args);
}
}

View File

@ -1,166 +0,0 @@
/*
* This file is part of the Forge Window Manager extension for Gnome 3
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Gnome imports
import Gio from "gi://Gio";
import GLib from "gi://GLib";
import GObject from "gi://GObject";
import { Logger } from "./logger.js";
// Dev or Prod mode, see Makefile:debug
export const production = true;
export class ConfigManager extends GObject.Object {
static {
GObject.registerClass(this);
}
#confDir = GLib.get_user_config_dir();
constructor({ dir }) {
super();
this.extensionPath = dir.get_path();
}
get confDir() {
return `${this.#confDir}/forge`;
}
get defaultStylesheetFile() {
const defaultStylesheet = GLib.build_filenamev([this.extensionPath, `stylesheet.css`]);
Logger.trace(`default-stylesheet: ${defaultStylesheet}`);
const defaultStylesheetFile = Gio.File.new_for_path(defaultStylesheet);
if (defaultStylesheetFile.query_exists(null)) {
return defaultStylesheetFile;
}
return null;
}
get stylesheetFile() {
const profileSettingPath = `${this.confDir}/stylesheet/forge`;
const settingFile = "stylesheet.css";
const defaultSettingFile = this.defaultStylesheetFile;
return this.loadFile(profileSettingPath, settingFile, defaultSettingFile);
}
get defaultWindowConfigFile() {
const defaultWindowConfig = GLib.build_filenamev([
this.extensionPath,
`config`,
`windows.json`,
]);
Logger.trace(`default-window-config: ${defaultWindowConfig}`);
const defaultWindowConfigFile = Gio.File.new_for_path(defaultWindowConfig);
if (defaultWindowConfigFile.query_exists(null)) {
return defaultWindowConfigFile;
}
return null;
}
loadDefaultWindowConfigContents() {
const defaultSettingFile = this.defaultWindowConfigFile;
if (defaultSettingFile) {
const contents = this.loadFileContents(defaultSettingFile);
if (contents) {
return JSON.parse(contents);
}
}
return null;
}
get windowConfigFile() {
const profileSettingPath = `${this.confDir}/config`;
const settingFile = "windows.json";
const defaultSettingFile = this.defaultWindowConfigFile;
return this.loadFile(profileSettingPath, settingFile, defaultSettingFile);
}
loadFile(path, file, defaultFile) {
const customSetting = GLib.build_filenamev([path, file]);
Logger.trace(`custom-setting-file: ${customSetting}`);
const customSettingFile = Gio.File.new_for_path(customSetting);
if (customSettingFile.query_exists(null)) {
return customSettingFile;
} else {
const profileCustomSettingDir = Gio.File.new_for_path(path);
if (!profileCustomSettingDir.query_exists(null)) {
if (profileCustomSettingDir.make_directory_with_parents(null)) {
const createdStream = customSettingFile.create(Gio.FileCreateFlags.NONE, null);
const defaultContents = this.loadFileContents(defaultFile);
Logger.trace(defaultContents);
createdStream.write_all(defaultContents, null);
}
}
}
return null;
}
loadFileContents(configFile) {
let [success, contents] = configFile.load_contents(null);
if (success) {
const stringContents = imports.byteArray.toString(contents);
return stringContents;
}
}
get windowProps() {
let windowConfigFile = this.windowConfigFile;
let windowProps = null;
// if (!windowConfigFile || !production) {
if (!windowConfigFile) {
windowConfigFile = this.defaultWindowConfigFile;
}
let [success, contents] = windowConfigFile.load_contents(null);
if (success) {
const windowConfigContents = imports.byteArray.toString(contents);
Logger.trace(`${windowConfigContents}`);
windowProps = JSON.parse(windowConfigContents);
}
return windowProps;
}
set windowProps(props) {
let windowConfigFile = this.windowConfigFile;
// if (!windowConfigFile || !production) {
if (!windowConfigFile) {
windowConfigFile = this.defaultWindowConfigFile;
}
let windowConfigContents = JSON.stringify(props, null, 4);
const PERMISSIONS_MODE = 0o744;
if (GLib.mkdir_with_parents(windowConfigFile.get_parent().get_path(), PERMISSIONS_MODE) === 0) {
let [_, _tag] = windowConfigFile.replace_contents(
windowConfigContents,
null,
false,
Gio.FileCreateFlags.REPLACE_DESTINATION,
null
);
}
}
}

View File

@ -1,279 +0,0 @@
/*
* This file is part of the Forge extension for GNOME
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Gnome imports
import Gio from "gi://Gio";
import GLib from "gi://GLib";
import GObject from "gi://GObject";
// Application imports
import { stringify, parse } from "../css/index.js";
import { production } from "./settings.js";
export class ThemeManagerBase extends GObject.Object {
static {
GObject.registerClass(this);
}
constructor({ configMgr, settings }) {
super();
this.configMgr = configMgr;
this.settings = settings;
this._importCss();
this.defaultPalette = this.getDefaultPalette();
// A random number to denote an update on the css, usually the possible next version
// in extensions.gnome.org
// TODO: need to research the most effective way to bring in CSS updates
// since the schema css-last-update might be triggered when there is a
// code change on the schema unrelated to css updates.
// For now tagging works. See @this.patchCss() and @this._needUpdate().
this.cssTag = 37;
// TODO: should the patchCss() call be done here?
}
/**
* @param {string} value
*/
addPx(value) {
return `${value}px`;
}
/**
* @param {string} value
*/
removePx(value) {
return value.replace("px", "");
}
getDefaultPalette() {
return {
tiled: this.getDefaults("tiled"),
split: this.getDefaults("split"),
floated: this.getDefaults("floated"),
stacked: this.getDefaults("stacked"),
tabbed: this.getDefaults("tabbed"),
};
}
/**
* The scheme name is in between the CSS selector name
* E.g. window-tiled-color should return `tiled`
* @param {string} selector
*/
getColorSchemeBySelector(selector) {
if (!selector.includes("-")) return null;
let firstDash = selector.indexOf("-");
let secondDash = selector.indexOf("-", firstDash + 1);
const scheme = selector.substr(firstDash + 1, secondDash - firstDash - 1);
return scheme;
}
/**
* @param {string} color
*/
getDefaults(color) {
return {
color: this.getCssProperty(`.${color}`, "color").value,
"border-width": this.removePx(this.getCssProperty(`.${color}`, "border-width").value),
opacity: this.getCssProperty(`.${color}`, "opacity").value,
};
}
/**
* @param {any} selector
*/
getCssRule(selector) {
if (this.cssAst) {
const rules = this.cssAst.stylesheet.rules;
// return only the first match, Forge CSS authors should make sure class names are unique :)
const matchRules = rules.filter((r) => r.selectors.filter((s) => s === selector).length > 0);
return matchRules.length > 0 ? matchRules[0] : {};
}
return {};
}
/**
* @param {string} selector
* @param {string} propertyName
*/
getCssProperty(selector, propertyName) {
const cssRule = this.getCssRule(selector);
if (cssRule) {
const matchDeclarations = cssRule.declarations.filter((d) => d.property === propertyName);
return matchDeclarations.length > 0 ? matchDeclarations[0] : {};
}
return {};
}
/**
* @param {string} selector
* @param {string} propertyName
* @param {string} propertyValue
*/
setCssProperty(selector, propertyName, propertyValue) {
const cssProperty = this.getCssProperty(selector, propertyName);
if (cssProperty) {
cssProperty.value = propertyValue;
this._updateCss();
return true;
}
return false;
}
/**
* Returns the AST for stylesheet.css
*/
_importCss() {
let cssFile = this.configMgr.stylesheetFile;
if (!cssFile || !production) {
cssFile = this.configMgr.defaultStylesheetFile;
}
let [success, contents] = cssFile.load_contents(null);
if (success) {
const cssContents = new TextDecoder().decode(contents);
this.cssAst = parse(cssContents);
}
}
/**
* Writes the AST back to stylesheet.css and reloads the theme
*/
_updateCss() {
if (!this.cssAst) {
return;
}
let cssFile = this.configMgr.stylesheetFile;
if (!cssFile || !production) {
cssFile = this.configMgr.defaultStylesheetFile;
}
const cssContents = stringify(this.cssAst);
const PERMISSIONS_MODE = 0o744;
if (GLib.mkdir_with_parents(cssFile.get_parent().get_path(), PERMISSIONS_MODE) === 0) {
let [success, _tag] = cssFile.replace_contents(
cssContents,
null,
false,
Gio.FileCreateFlags.REPLACE_DESTINATION,
null
);
if (success) {
this.reloadStylesheet();
}
}
}
/**
* BREAKING: Patches the CSS by overriding the $HOME/.config stylesheet
* at the moment.
*
* TODO: work needed to consolidate the existing config stylesheet and
* when the extension default stylesheet gets an update.
*/
patchCss() {
if (this._needUpdate()) {
let originalCss = this.configMgr.defaultStylesheetFile;
let configCss = this.configMgr.stylesheetFile;
let copyConfigCss = Gio.File.new_for_path(this.configMgr.stylesheetFileName + ".bak");
let backupFine = configCss.copy(copyConfigCss, Gio.FileCopyFlags.OVERWRITE, null, null);
let copyFine = originalCss.copy(configCss, Gio.FileCopyFlags.OVERWRITE, null, null);
if (backupFine && copyFine) {
this.settings.set_uint("css-last-update", this.cssTag);
return true;
}
}
return false;
}
/**
* Credits: ExtensionSystem.js:_callExtensionEnable()
*/
reloadStylesheet() {
throw new Error("Must implement reloadStylesheet");
}
_needUpdate() {
let cssTag = this.cssTag;
return this.settings.get_uint("css-last-update") !== cssTag;
}
}
/**
* Credits: Color Space conversion functions from CSS Tricks
* https://css-tricks.com/converting-color-spaces-in-javascript/
*/
export function RGBAToHexA(rgba) {
let sep = rgba.indexOf(",") > -1 ? "," : " ";
rgba = rgba.substr(5).split(")")[0].split(sep);
// Strip the slash if using space-separated syntax
if (rgba.indexOf("/") > -1) rgba.splice(3, 1);
for (let R in rgba) {
let r = rgba[R];
if (r.indexOf("%") > -1) {
let p = r.substr(0, r.length - 1) / 100;
if (R < 3) {
rgba[R] = Math.round(p * 255);
} else {
rgba[R] = p;
}
}
}
let r = (+rgba[0]).toString(16),
g = (+rgba[1]).toString(16),
b = (+rgba[2]).toString(16),
a = Math.round(+rgba[3] * 255).toString(16);
if (r.length == 1) r = "0" + r;
if (g.length == 1) g = "0" + g;
if (b.length == 1) b = "0" + b;
if (a.length == 1) a = "0" + a;
return "#" + r + g + b + a;
}
export function hexAToRGBA(h) {
let r = 0,
g = 0,
b = 0,
a = 1;
if (h.length == 5) {
r = "0x" + h[1] + h[1];
g = "0x" + h[2] + h[2];
b = "0x" + h[3] + h[3];
a = "0x" + h[4] + h[4];
} else if (h.length == 9) {
r = "0x" + h[1] + h[2];
g = "0x" + h[3] + h[4];
b = "0x" + h[5] + h[6];
a = "0x" + h[7] + h[8];
}
a = +(a / 255).toFixed(3);
return "rgba(" + +r + "," + +g + "," + +b + "," + a + ")";
}

View File

@ -1,21 +0,0 @@
{
"_generated": "Generated by SweetTooth, do not edit",
"description": "Tiling and window manager for GNOME\n- Please report bugs/issues on https://github.com/forge-ext/forge/issues\n- Needs a new maintainer.",
"gettext-domain": "forge",
"name": "Forge",
"session-modes": [
"unlock-dialog",
"user"
],
"settings-schema": "org.gnome.shell.extensions.forge",
"shell-version": [
"45",
"46",
"47",
"48",
"49"
],
"url": "https://github.com/forge-ext/forge",
"uuid": "forge@jmmaranan.com",
"version": 89
}

View File

@ -1,53 +0,0 @@
/*
* This file is part of the Forge GNOME extension
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Gnome imports
import Gdk from "gi://Gdk";
import Gtk from "gi://Gtk";
import { ExtensionPreferences } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js";
import { KeyboardPage } from "./lib/prefs/keyboard.js";
import { AppearancePage } from "./lib/prefs/appearance.js";
import { SettingsPage } from "./lib/prefs/settings.js";
import { FloatingPage } from "./lib/prefs/floating.js";
export default class ForgeExtensionPreferences extends ExtensionPreferences {
settings = this.getSettings();
kbdSettings = this.getSettings("org.gnome.shell.extensions.forge.keybindings");
constructor(...args) {
super(...args);
const iconPath = this.dir.get_child("resources").get_child("icons").get_path();
const iconTheme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default());
iconTheme.add_search_path(iconPath);
}
fillPreferencesWindow(window) {
this.window = window;
window._settings = this.settings;
window._kbdSettings = this.kbdSettings;
window.add(new SettingsPage(this));
window.add(new AppearancePage(this));
window.add(new KeyboardPage(this));
window.add(new FloatingPage(this));
window.search_enabled = true;
window.can_navigate_back = true;
}
}

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
<path d="m 4.996094 0 c -1.03125 0.00390625 -1.386719 1.371094 -0.484375 1.871094 l 0.488281 0.273437 v 2.683594 c -0.128906 0.207031 -0.25 0.390625 -0.441406 0.714844 c -0.269532 0.472656 -0.601563 1.0625 -0.964844 1.707031 c -0.722656 1.296875 -1.554688 2.910156 -2.203125 4.09375 c -0.574219 1.046875 -0.550781 2.453125 0.300781 3.511719 c 0.671875 0.902343 1.738282 1.140625 2.617188 1.140625 h 7.351562 c 0.878906 0 1.949219 -0.238282 2.621094 -1.140625 c 0.851562 -1.058594 0.867188 -2.464844 0.296875 -3.511719 c -1.164063 -2.371094 -2.472656 -4.316406 -3.5625 -6.496094 v -2.699218 l 0.488281 -0.277344 c 0.902344 -0.5 0.546875 -1.871094 -0.484375 -1.871094 z m 2.003906 2 h 2.015625 v 3.105469 c 0 0.152343 0.035156 0.304687 0.101563 0.441406 c 1.203124 2.457031 2.574218 4.441406 3.6875 6.714844 c 0.003906 0.011719 0.011718 0.027343 0.015624 0.039062 c 0.242188 0.441407 0.257813 0.882813 -0.097656 1.316407 c -0.011718 0.011718 -0.023437 0.027343 -0.035156 0.042968 c -0.144531 0.199219 -0.488281 0.335938 -1.027344 0.335938 h -7.351562 c -0.539063 0 -0.882813 -0.136719 -1.027344 -0.335938 c -0.011719 -0.015625 -0.023438 -0.027344 -0.035156 -0.042968 c -0.351563 -0.433594 -0.339844 -0.875 -0.097656 -1.316407 c 0.644531 -1.179687 1.472656 -2.789062 2.191406 -4.070312 c 0.359375 -0.644531 0.6875 -1.230469 0.953125 -1.683594 c 0.261719 -0.453125 0.488281 -0.8125 0.515625 -0.847656 c 0.125 -0.171875 0.191406 -0.378907 0.191406 -0.589844 z m 0 0" fill="#2e3436"/>
<path d="m 6.21875 9 l -2.21875 4 h 8 l -2.21875 -4 z m 0 0" fill="#2e3434" fill-opacity="0.34902"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M8 1a7 7 0 0 0-7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0-7-7zm0 2a5 5 0 0 1 5 5 5 5 0 0 1-5 5 5 5 0 0 1-5-5 5 5 0 0 1 5-5z" fill="#555555"/><path d="M10.49 4.996a.5.5 0 0 0-.344.15L8 7.293 6.354 5.646a.5.5 0 1 0-.708.708l2 2a.5.5 0 0 0 .708 0l2.5-2.5a.5.5 0 0 0-.364-.858z" fill="#555555"/></svg>

Before

Width:  |  Height:  |  Size: 368 B

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 6.78125 6.9375 c 0.066406 0.257812 0.230469 0.476562 0.460938 0.613281 c 0.476562 0.277344 1.089843 0.121094 1.371093 -0.355469 l 3.3125 -5.625 c 0.277344 -0.476562 0.121094 -1.089843 -0.355469 -1.371093 c -0.476562 -0.277344 -1.089843 -0.121094 -1.371093 0.355469 l -3.3125 5.625 c -0.132813 0.226562 -0.171875 0.5 -0.105469 0.757812 z m 0 0"/><path d="m 5.21875 5.09375 l 4.949219 3.054688 c 0.601562 0.3125 0.816406 1.113281 0.164062 1.597656 l -0.625 0.214844 l -6.015625 -3.519532 l 0.015625 -0.910156 c 0.289063 -0.585938 0.753907 -0.816406 1.511719 -0.4375 z m 0 0"/><path d="m 3.054688 7.488281 l 5.988281 3.476563 l -1.042969 1.539062 c -0.222656 0.246094 -0.132812 0.574219 0.085938 0.707032 l 0.953124 0.820312 h -5.371093 c -2.191407 0 -3.195313 -2.066406 -2.144531 -3.890625 z m 0 0"/></svg>

Before

Width:  |  Height:  |  Size: 942 B

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 5 0 c -0.550781 0 -1 0.449219 -1 1 c 0 0.691406 0.390625 1.285156 0.800781 1.605469 c -0.503906 0.671875 -0.800781 1.5 -0.800781 2.394531 h -1 v -1 h -2 v 1 c 0 0.832031 0.5625 1.523438 1.050781 1.769531 c 0.492188 0.246094 0.949219 0.230469 0.949219 0.230469 h 1 v 1 h -3 v 2 h 3 v 1 h -1 s -0.457031 -0.015625 -0.949219 0.230469 c -0.488281 0.246093 -1.050781 0.9375 -1.050781 1.769531 v 3 h 2 v -3 h 1.128906 c 0.449219 1.71875 2.015625 3 3.871094 3 s 3.421875 -1.28125 3.871094 -3 h 1.128906 v 3 h 2 v -3 c 0 -0.832031 -0.5625 -1.523438 -1.050781 -1.769531 c -0.492188 -0.246094 -0.949219 -0.230469 -0.949219 -0.230469 h -1 v -1 h 3 v -2 h -3 v -1 h 1 s 0.457031 0.015625 0.949219 -0.230469 c 0.488281 -0.246093 1.050781 -0.9375 1.050781 -1.769531 v -1 h -2 v 1 h -1 c 0 -0.894531 -0.296875 -1.722656 -0.800781 -2.394531 c 0.410156 -0.320313 0.800781 -0.914063 0.800781 -1.605469 c 0 -0.550781 -0.449219 -1 -1 -1 s -1 0.449219 -1 1 c -0.238281 0 -0.464844 0.085938 -0.644531 0.238281 c -0.425781 -0.152343 -0.882813 -0.238281 -1.355469 -0.238281 s -0.929688 0.085938 -1.355469 0.238281 c -0.179687 -0.152343 -0.40625 -0.238281 -0.644531 -0.238281 c 0 -0.550781 -0.449219 -1 -1 -1 z m 2.96875 5.03125 h 0.0625 c 0.535156 0 0.96875 0.433594 0.96875 0.96875 v 3.0625 c 0 0.535156 -0.433594 0.96875 -0.96875 0.96875 h -0.0625 c -0.535156 0 -0.96875 -0.433594 -0.96875 -0.96875 v -3.0625 c 0 -0.535156 0.433594 -0.96875 0.96875 -0.96875 z m 0 6 h 0.0625 c 0.535156 0 0.96875 0.433594 0.96875 0.96875 v 0.0625 c 0 0.535156 -0.433594 0.96875 -0.96875 0.96875 h -0.0625 c -0.535156 0 -0.96875 -0.433594 -0.96875 -0.96875 v -0.0625 c 0 -0.535156 0.433594 -0.96875 0.96875 -0.96875 z m 0 0"/></svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -1,8 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1" viewBox="0 0 16 16">
<defs>
<style id="current-color-scheme" type="text/css">
.ColorScheme-Text { color:#565656; } .ColorScheme-Highlight { color:#5294e2; }
</style>
</defs>
<path style="fill:currentColor" class="ColorScheme-Text" d="m 3,1.0097656 c -1.108,0 -2,0.892 -2,2 V 13.009766 c 0,1.108 0.892,2 2,2 h 10 c 1.108,0 2,-0.892 2,-2 V 3.0097656 c 0,-1.1082 -0.892,-2 -2,-2 z M 6.0816406,3 H 6.4 V 3.7558594 H 6.0464844 c -0.472,0 -0.7783219,0.079175 -0.9199219,0.234375 -0.145,0.1517 -0.21875,0.4776156 -0.21875,0.9785156 v 1.3125 c 0,0.5538 -0.074763,0.9546781 -0.2265625,1.2050781 -0.1517,0.2505 -0.4148625,0.4197125 -0.7890625,0.5078125 0.3742,0.0953 0.6373625,0.2690313 0.7890625,0.5195313 0.1518,0.2504 0.2265625,0.6509718 0.2265625,1.2011719 v 1.3125002 c 0,0.505 0.07375,0.830422 0.21875,0.982422 0.1416,0.151 0.4479219,0.228515 0.9199219,0.228515 H 6.4 V 13 H 6.0816406 c -0.8394,0 -1.3998875,-0.129625 -1.6796875,-0.390625 -0.2832,-0.261 -0.4238281,-0.7835 -0.4238281,-1.5625 V 9.7832031 c 0,-0.5326 -0.091438,-0.9008687 -0.2734375,-1.1054687 -0.1821,-0.2046 -1.4689344,-0.3066406 -0.9902344,-0.3066406 H 2.4 V 7.6132812 h 0.3144531 c 0.4787,0 0.8081344,-0.099681 0.9902344,-0.3007812 0.182,-0.2046 0.2734375,-0.5701031 0.2734375,-1.0957031 V 4.9472656 c 0,-0.7796 0.1406281,-1.2991406 0.4238281,-1.5566406 C 4.6817531,3.129625 5.2422406,3 6.0816406,3 Z M 9.6,3 h 0.3183594 c 0.8395996,0 1.3996876,0.129625 1.6796876,0.390625 0.283,0.2575 0.423828,0.7770406 0.423828,1.5566406 v 1.2695313 c 0,0.5256 0.09144,0.8911031 0.273437,1.0957031 0.182001,0.2011 1.469235,0.3007812 0.990235,0.3007812 H 13.6 v 0.7578126 h -0.314453 c -0.479,0 -0.808234,0.1020406 -0.990235,0.3066406 -0.182,0.2046 -0.273437,0.5728687 -0.273437,1.1054687 v 1.2636719 c 0,0.779 -0.140828,1.3015 -0.423828,1.5625 C 11.318047,12.870375 10.757959,13 9.9183594,13 H 9.6 v -0.761719 h 0.3535156 c 0.4720004,0 0.7789214,-0.07752 0.9199224,-0.228515 0.144999,-0.152 0.218749,-0.477422 0.21875,-0.982422 V 9.7148438 c 0,-0.5502001 0.07456,-0.9507719 0.226562,-1.2011719 0.151,-0.2505 0.415062,-0.4242313 0.789062,-0.5195313 -0.374,-0.0881 -0.638062,-0.2573125 -0.789062,-0.5078125 -0.152,-0.2504 -0.226562,-0.6512781 -0.226562,-1.2050781 v -1.3125 c 0,-0.5009 -0.07375,-0.8268156 -0.21875,-0.9785156 -0.141001,-0.1552 -0.447922,-0.234375 -0.9199224,-0.234375 H 9.6 Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -1,8 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<defs>
<style id="current-color-scheme" type="text/css">
.ColorScheme-Text { color:#565656; } .ColorScheme-Highlight { color:#5294e2; }
</style>
</defs>
<path style="fill:currentColor" class="ColorScheme-Text" d="M 8 1 C 7.79297 1.66364 7.5132275 2.3110656 7.2109375 2.9472656 C 5.6704375 6.0974656 3.2599437 8.2540875 3.0273438 10.242188 C 3.0213438 10.271888 3.0052 10.304384 3 10.333984 L 3.0195312 10.339844 C 3.0145313 10.408244 3 10.476722 3 10.544922 C 3 13.005122 5.2386 15 8 15 C 10.7614 15 13 13.005122 13 10.544922 C 13 10.476722 12.985469 10.408214 12.980469 10.339844 L 13 10.333984 C 12.995 10.304484 12.978956 10.271887 12.972656 10.242188 C 12.740106 8.2539875 10.329662 6.0973656 8.7890625 2.9472656 C 8.4867825 2.3110456 8.20702 1.6636 8 1 z"/>
</svg>

Before

Width:  |  Height:  |  Size: 864 B

View File

@ -1,8 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1" viewBox="0 0 16 16">
<defs>
<style id="current-color-scheme" type="text/css">
.ColorScheme-Text { color:#565656; } .ColorScheme-Highlight { color:#5294e2; }
</style>
</defs>
<path style="fill:currentColor" class="ColorScheme-Text" d="m 13.456086,1.0006868 c -0.38886,0.011288 -0.758096,0.1736868 -1.029397,0.4526607 l -2.353186,2.3550062 -0.0039,-0.00585 L 8.1355916,1.8669891 6.7240702,3.2796026 8.1609366,4.7175807 1.0000001,11.884057 v 3.115944 h 3.115479 L 11.274466,7.8354729 12.713282,9.273451 14.124804,7.8608375 12.190786,5.9272739 14.543971,3.5722677 C 15.521581,2.6194252 14.82011,0.96132714 13.456086,1.0006868 Z M 8.9973154,5.5468049 10.408838,6.9594183 3.5325442,13.841031 2.1210229,12.428418 Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 805 B

View File

@ -1,8 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1" viewBox="0 0 16 16">
<defs>
<style id="current-color-scheme" type="text/css">
.ColorScheme-Text { color:#565656; } .ColorScheme-Highlight { color:#5294e2; }
</style>
</defs>
<path style="fill:currentColor" class="ColorScheme-Text" d="M 7 0 L 7 2 L 9 2 L 9 0 L 8.5 0 L 7.5 0 L 7 0 z M 3.0507812 1.6367188 L 2.703125 1.984375 L 2.6875 1.96875 L 1.96875 2.6875 L 1.984375 2.703125 L 1.6367188 3.0507812 L 3.0507812 4.4648438 L 4.4648438 3.0507812 L 3.0507812 1.6367188 z M 12.949219 1.6367188 L 11.535156 3.0507812 L 12.949219 4.4648438 L 14.363281 3.0507812 L 14.015625 2.703125 L 14.03125 2.6875 L 13.3125 1.96875 L 13.296875 1.984375 L 12.949219 1.6367188 z M 8 3 C 5.2386 3 3 5.2386 3 8 C 3 10.7614 5.2386 13 8 13 C 10.7614 13 13 10.7614 13 8 C 13 5.2386 10.7614 3 8 3 z M 0 7 L 0 7.5 L 0 8.5 L 0 9 L 2 9 L 2 7 L 0 7 z M 14 7 L 14 9 L 16 9 L 16 8.5 L 16 7.5 L 16 7 L 14 7 z M 3.0507812 11.535156 L 1.6367188 12.949219 L 1.984375 13.296875 L 1.96875 13.3125 L 2.6875 14.03125 L 2.703125 14.015625 L 3.0507812 14.363281 L 4.4648438 12.949219 L 3.0507812 11.535156 z M 12.949219 11.535156 L 11.535156 12.949219 L 12.949219 14.363281 L 13.296875 14.015625 L 13.3125 14.03125 L 14.03125 13.3125 L 14.015625 13.296875 L 14.363281 12.949219 L 12.949219 11.535156 z M 7 14 L 7 16 L 7.5 16 L 8.5 16 L 9 16 L 9 14 L 7 14 z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="16"
height="16"
viewBox="0 0 16 16"
version="1.1"
id="svg432"
sodipodi:docname="forge-logo-symbolic.svg"
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview434"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="true"
inkscape:zoom="32"
inkscape:cx="20.5625"
inkscape:cy="3.421875"
inkscape:window-width="3440"
inkscape:window-height="1376"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg432">
<inkscape:grid
type="xygrid"
id="grid537" />
</sodipodi:namedview>
<defs
id="defs428">
<style
id="current-color-scheme"
type="text/css">
.ColorScheme-Text { color:#565656; } .ColorScheme-Highlight { color:#5294e2; }
</style>
</defs>
<path
id="path430"
style="fill:#b3b3b3"
d="m 3,1 c 0,0 -0.075642,0.00414 -0.1816406,0.023437 -0.204,0.0302 -0.3586563,0.103425 -0.4726563,0.203125 -0.022,0.016899 -0.043453,0.035087 -0.064453,0.054687 -0.019,0.021 -0.037688,0.042353 -0.054687,0.064453 -0.099999,0.114 -0.172125,0.2684563 -0.203125,0.4726563 C 2.0043975,1.923759 2,2 2,2 v 12 l 4,1 v -4 h 5 L 12,7 H 6 V 5 h 7 l 1,-4 z"
sodipodi:nodetypes="ccccccccccccccccc" />
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -1,3 +0,0 @@
<svg width="16" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg">
<path class="ColorScheme-Text" d="m8.5 1.4141c-0.25562 0-0.51116 0.0971-0.70703 0.29297l-5.6562 5.6562c-0.39174 0.39174-0.39174 1.0223 0 1.4141 0.23669 0.23669 0.55752 0.313 0.86328 0.26367v4.959h2v-6.6719l3.5-3.5 3.5 3.5v6.6719h2v-4.959c0.30576 0.04933 0.62659-0.026981 0.86328-0.26367 0.39174-0.39174 0.39174-1.0223 0-1.4141l-5.6562-5.6562c-0.19587-0.19587-0.45141-0.29297-0.70703-0.29297zm0 7.5859c-0.831 0-1.5 0.669-1.5 1.5v3.5h3v-3.5c0-0.831-0.669-1.5-1.5-1.5z" color="#aaaaaa" fill="currentColor"/>
</svg>

Before

Width:  |  Height:  |  Size: 591 B

View File

@ -1,8 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
<defs>
<style id="current-color-scheme" type="text/css">
.ColorScheme-Text { color:#555555; } .ColorScheme-Highlight { color:#5294e2; }
</style>
</defs>
<path class="ColorScheme-Text" style="fill:currentColor" d="M 2,9 H 10 L 6.5,12.5 8,14 14,8 8,2 6.5,3.5 10,7 H 2 Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 366 B

View File

@ -1 +0,0 @@
<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg" enable-background="new"><defs><filter id="a" color-interpolation-filters="sRGB"><feBlend in2="BackgroundImage" mode="darken"/></filter></defs><path d="M2 2.003s-2 0-2 2v8c0 2 2 2 2 2h11s2 0 2-2v-8c0-2-2-2-2-2H2zm.25 2h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5a.25.25 0 0 1 .25-.25zm3 0h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5a.25.25 0 0 1 .25-.25zm3 0h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5a.25.25 0 0 1 .25-.25zm3 0h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5a.25.25 0 0 1 .25-.25zm-9 3h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5a.25.25 0 0 1 .25-.25zm3 0h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5a.25.25 0 0 1 .25-.25zm3 0h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5a.25.25 0 0 1 .25-.25zm3 0h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5a.25.25 0 0 1 .25-.25zm-7 3h6.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-6.5a.25.25 0 0 1-.25-.25v-1.5a.25.25 0 0 1 .25-.25z" fill="#555"/></svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px">
<path fill="#2e3436" d="m 7.996094 0 c -1.109375 0 -2 0.890625 -2 2 v 3.003906 c 0 0.632813 -0.480469 0.996094 -1 0.996094 h -1 c -1.109375 0 -2 0.890625 -2 2 v 1 h 12 v -1 c 0 -1.109375 -0.894532 -2 -2 -2 h -0.976563 c -0.53125 0 -1.023437 -0.359375 -1.023437 -1 v -3 c 0 -1.109375 -0.894532 -2 -2 -2 z m 0 1.40625 c 0.324218 0 0.59375 0.265625 0.59375 0.59375 s -0.269532 0.59375 -0.59375 0.59375 c -0.328125 0 -0.59375 -0.265625 -0.59375 -0.59375 s 0.265625 -0.59375 0.59375 -0.59375 z m 0 0"/>
<path fill="#2e3436" d="m 2 10 h 12 l -0.800781 5.003906 c -0.199219 0.820313 -0.699219 0.996094 -1.246094 0.996094 h -1.953125 v -3 l -1.125 3 h -1.847656 l -0.027344 -3 l -1.035156 3 h -0.964844 v -1.5 l -1 1.5 h -3 l 0.210938 -1.046875 z m 0 0"/>
</svg>

Before

Width:  |  Height:  |  Size: 886 B

View File

@ -1,4 +0,0 @@
<svg width="16.006" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg">
<path d="m1 0c-0.554 0-1 0.446-1 1v5c0 0.554 0.446 1 1 1h5c0.554 0 1-0.446 1-1v-5c0-0.554-0.446-1-1-1z" fill="#555555" style="paint-order:stroke fill markers"/>
<path d="m9 0c-0.554 0-1 0.446-1 1v5c0 0.554 0.446 1 1 1h5c0.554 0 1-0.446 1-1v-5c0-0.554-0.446-1-1-1zm1 2h3v3h-3zm-9 6c-0.554 0-1 0.446-1 1v5c0 0.554 0.446 1 1 1h5c0.554 0 1-0.446 1-1v-5c0-0.554-0.446-1-1-1zm8 0c-0.554 0-1 0.446-1 1v5c0 0.554 0.446 1 1 1h5c0.554 0 1-0.446 1-1v-5c0-0.554-0.446-1-1-1zm-7 2h3v3h-3zm8 0h3v3h-3z" fill="#555555" opacity=".5" style="paint-order:stroke fill markers"/>
</svg>

Before

Width:  |  Height:  |  Size: 650 B

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M.5 1h6c.277 0 .5.223.5.5v5c0 .277-.223.5-.5.5h-6a.499.499 0 0 1-.5-.5v-5c0-.277.223-.5.5-.5z" opacity=".3" fill="none"/><path d="M9.5 0C8.669 0 8 .67 8 1.5v4C8 6.33 8.669 7 9.5 7h4c.831 0 1.5-.67 1.5-1.5v-4c0-.83-.669-1.5-1.5-1.5zm.06 1c1.291.13 2.589.12 3.88 0 .3-.03.56.26.56.56v2.88c0 .3-.26.52-.56.56-1.261.15-2.539.18-3.88 0-.3-.04-.56-.26-.56-.56V1.56c0-.3.26-.59.56-.56zM1.5 1C.669 1 0 1.67 0 2.5v3C0 6.33.669 7 1.5 7h4C6.33 7 7 6.33 7 5.5v-3C7 1.67 6.33 1 5.5 1zm.06 1c1.692.2 2.849.13 3.88 0 .3-.04.56.26.56.56v2.88c0 .3-.26.52-.56.56-1.221.16-2.499.18-3.88 0-.3-.04-.56-.26-.56-.56V2.56c0-.3.26-.6.56-.56zM1.49 8C.659 8 0 8.67 0 9.5v4c0 .83.659 1.5 1.49 1.5h9.01c.831 0 1.5-.67 1.5-1.5v-4c0-.995-.669-1.5-1.5-1.5zm.06 1c3.183.27 6.116.23 8.89 0 .3-.03.56.26.56.56v2.88c0 .3-.26.53-.56.56-3.004.34-5.967.33-8.89 0-.3-.03-.55-.26-.55-.56V9.56c0-.3.25-.59.55-.56z" fill="#555555"/></svg>

Before

Width:  |  Height:  |  Size: 967 B

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M7 3v5H3v2h10V3z" opacity=".3" fill="#555555"/><path d="M6 3L3 7h3z" fill="#555555"/><path d="M2 0C0 0 0 2 0 2v9s0 2 2 2h12s2 0 2-2V2s0-2-2-2zm0 2h12v9H2zm1 13v1h10v-1c0-1-1-1-1-1H4s-1 0-1 1z" fill="#555555"/></svg>

Before

Width:  |  Height:  |  Size: 287 B

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 7.5 1.019531 c -0.550781 0 -0.996094 0.445313 -0.996094 0.996094 v 0.453125 c -0.472656 0.128906 -0.929687 0.320312 -1.355468 0.566406 l -0.324219 -0.324218 c -0.390625 -0.390626 -1.019531 -0.390626 -1.410157 0 l -0.703124 0.707031 c -0.390626 0.390625 -0.390626 1.019531 0 1.410156 l 0.320312 0.320313 c -0.246094 0.425781 -0.433594 0.882812 -0.5625 1.355468 h -0.453125 c -0.550781 0 -0.996094 0.445313 -0.996094 0.996094 v 1 c 0 0.550781 0.445313 0.996094 0.996094 0.996094 h 0.449219 c 0.132812 0.472656 0.320312 0.929687 0.566406 1.355468 l -0.320312 0.320313 c -0.390626 0.390625 -0.390626 1.019531 0 1.410156 l 0.703124 0.707031 c 0.390626 0.390626 1.019532 0.390626 1.410157 0 l 0.320312 -0.320312 c 0.429688 0.242188 0.882813 0.433594 1.359375 0.558594 v 0.457031 c 0 0.550781 0.445313 0.996094 0.996094 0.996094 h 0.996094 c 0.554687 0 1 -0.445313 1 -0.996094 v -0.453125 c 0.472656 -0.128906 0.929687 -0.320312 1.355468 -0.566406 l 0.320313 0.324218 c 0.390625 0.390626 1.019531 0.390626 1.410156 0 l 0.707031 -0.707031 c 0.390626 -0.390625 0.390626 -1.019531 0 -1.410156 l -0.320312 -0.320313 c 0.242188 -0.425781 0.433594 -0.882812 0.558594 -1.355468 h 0.453125 c 0.554687 0 1 -0.445313 1 -0.996094 v -1 c 0 -0.550781 -0.445313 -0.996094 -1 -0.996094 h -0.449219 c -0.128906 -0.472656 -0.320312 -0.929687 -0.566406 -1.355468 l 0.324218 -0.320313 c 0.390626 -0.390625 0.390626 -1.019531 0 -1.410156 l -0.707031 -0.707031 c -0.390625 -0.390626 -1.019531 -0.390626 -1.410156 0 l -0.320313 0.320312 c -0.425781 -0.242188 -0.882812 -0.429688 -1.355468 -0.558594 v -0.457031 c 0 -0.550781 -0.445313 -0.996094 -1 -0.996094 z m 0.515625 3.976563 c 1.660156 0 3 1.34375 3 3 s -1.339844 3 -3 3 c -1.65625 0 -3 -1.34375 -3 -3 s 1.34375 -3 3 -3 z m 0 0"/></svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 3 1 c -1.644531 0 -3 1.355469 -3 3 v 5 c 0 1.644531 1.355469 3 3 3 h 10 c 1.644531 0 3 -1.355469 3 -3 v -5 c 0 -1.644531 -1.355469 -3 -3 -3 z m 0 2 h 10 c 0.570312 0 1 0.429688 1 1 v 5 c 0 0.570312 -0.429688 1 -1 1 h -10 c -0.570312 0 -1 -0.429688 -1 -1 v -5 c 0 -0.570312 0.429688 -1 1 -1 z m 0 0"/><path d="m 5.503906 14.503906 c 0 0.832032 -0.671875 1.503906 -1.503906 1.503906 s -1.503906 -0.671874 -1.503906 -1.503906 c 0 -0.832031 0.671875 -1.503906 1.503906 -1.503906 s 1.503906 0.671875 1.503906 1.503906 z m 0 0"/><path d="m 9.503906 14.503906 c 0 0.832032 -0.671875 1.503906 -1.503906 1.503906 s -1.503906 -0.671874 -1.503906 -1.503906 c 0 -0.832031 0.671875 -1.503906 1.503906 -1.503906 s 1.503906 0.671875 1.503906 1.503906 z m 0 0"/><path d="m 13.503906 14.503906 c 0 0.832032 -0.671875 1.503906 -1.503906 1.503906 s -1.503906 -0.671874 -1.503906 -1.503906 c 0 -0.832031 0.671875 -1.503906 1.503906 -1.503906 s 1.503906 0.671875 1.503906 1.503906 z m 0 0"/></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
<path style="fill:#555555" d="M 4,2 C 4,2 2,2 2,4 V 11 C 2,12 1,12 1,12 H 0 V 14 H 16 V 12 H 15 C 15,12 14,12 14,11 V 4 C 14,4 14,2 12,2 Z M 7,5 H 9 V 7 H 11 V 9 H 9 V 11 H 7 V 9 H 5 V 7 H 7 Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 282 B

View File

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
<path style="fill:#555555" d="M 8,1 C 7,1 7,2 7,2 V 6 C 7,6 5,6 5,7 V 9 H 12 V 7 C 12,6 10,6 10,6 V 2 C 10,2 10,1 9,1 Z M 5,10 C 5,12.761 4.1046,15 3,15 H 10 C 11.105,15 12,12.761 12,10 Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 277 B

View File

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
<path style="fill:#555555" d="M 1,1 V 15 H 15 V 1 Z M 3,3 H 13 V 13 H 3 Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 163 B

View File

@ -1,45 +0,0 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<svg xmlns:cc='http://creativecommons.org/ns#' xmlns:dc='http://purl.org/dc/elements/1.1/' height='16.003357' id='svg7384' xmlns:osb='http://www.openswatchbook.org/uri/2009/osb' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' style='enable-background:new' xmlns:svg='http://www.w3.org/2000/svg' version='1.1' width='16' xmlns='http://www.w3.org/2000/svg'>
<metadata id='metadata90'>
<rdf:RDF>
<cc:Work rdf:about=''>
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'/>
<dc:title>Pop Symbolic Icon Theme</dc:title>
<cc:license rdf:resource='http://creativecommons.org/licenses/by-sa/4.0/'/>
</cc:Work>
<cc:License rdf:about='http://creativecommons.org/licenses/by-sa/4.0/'>
<cc:permits rdf:resource='http://creativecommons.org/ns#Reproduction'/>
<cc:permits rdf:resource='http://creativecommons.org/ns#Distribution'/>
<cc:requires rdf:resource='http://creativecommons.org/ns#Notice'/>
<cc:requires rdf:resource='http://creativecommons.org/ns#Attribution'/>
<cc:permits rdf:resource='http://creativecommons.org/ns#DerivativeWorks'/>
<cc:requires rdf:resource='http://creativecommons.org/ns#ShareAlike'/>
</cc:License>
</rdf:RDF>
</metadata>
<title id='title8473'>Pop Symbolic Icon Theme</title>
<defs id='defs7386'>
<linearGradient id='linearGradient6882' osb:paint='solid'>
<stop id='stop6884' offset='0' style='stop-color:#555555;stop-opacity:1;'/>
</linearGradient>
<linearGradient id='linearGradient5606' osb:paint='solid'>
<stop id='stop5608' offset='0' style='stop-color:#000000;stop-opacity:1;'/>
</linearGradient>
<filter id='filter7554' style='color-interpolation-filters:sRGB'>
<feBlend id='feBlend7556' in2='BackgroundImage' mode='darken'/>
</filter>
</defs>
<g id='layer9' style='display:inline' transform='translate(-1185.0317,635.00336)'/>
<g id='layer10' style='display:inline;filter:url(#filter7554)' transform='translate(-1185.0317,635.00336)'/>
<g id='layer1' style='display:inline' transform='translate(-944.03145,18.003357)'/>
<g id='layer14' style='display:inline' transform='translate(-1185.0317,635.00336)'/>
<g id='layer15' style='display:inline' transform='translate(-1185.0317,635.00336)'/>
<g id='g71291' style='display:inline' transform='translate(-1185.0317,635.00336)'/>
<g id='layer2' style='display:inline' transform='translate(-944.03145,168.00336)'/>
<g id='layer3' transform='translate(-944.03145,-91.996643)'>
<path d='m 946.03145,92 c 0,0 -2,-0.0034 -2,2 v 12 c 0,1.99664 2,2 2,2 h 12 c 0.0948,-0.003 2,-0.003 2,-2 V 94 c 0,0 0,-2 -2,-2 z m 2.90625,3 h 6.1875 c 1.05606,0 1.90625,0.85019 1.90625,1.90625 v 0.1875 c 0,1.05606 -0.85019,1.90625 -1.90625,1.90625 h -6.1875 c -1.05606,0 -1.90625,-0.85019 -1.90625,-1.90625 v -0.1875 C 947.03145,95.85019 947.88164,95 948.9377,95 Z m 0.0937,1 c -0.55228,0 -1,0.447715 -1,1 0,0.552285 0.44772,1 1,1 0.55228,0 1,-0.447715 1,-1 0,-0.552285 -0.44772,-1 -1,-1 z m -0.0566,5 h 6.11328 c 1.07668,0 1.94336,0.86668 1.94336,1.94336 v 0.11328 c 0,1.07668 -0.86668,1.94336 -1.94336,1.94336 h -6.11328 c -1.07668,0 -1.94336,-0.86668 -1.94336,-1.94336 v -0.11328 C 947.03145,101.86668 947.89813,101 948.9748,101 Z m 6.05664,1 c -0.55228,0 -1,0.44772 -1,1 0,0.55228 0.44772,1 1,1 0.55228,0 1,-0.44772 1,-1 0,-0.55228 -0.44772,-1 -1,-1 z' id='rect4265-3' style='display:inline;fill:#4c5263;fill-opacity:1;stroke:none;enable-background:new'/>
</g>
<g id='layer12' style='display:inline' transform='translate(-1185.0317,635.00336)'/>
</svg>

Before

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -1,6 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
<path style="fill:#555555" d="M 3.25,3 H 6.75 C 6.8885,3 7,3.1115 7,3.25 V 6.75 C 7,6.8885 6.8885,7 6.75,7 H 3.25 C 3.1115,7 3,6.8885 3,6.75 V 3.25 C 3,3.1115 3.1115,3 3.25,3 Z"/>
<path style="fill:#555555" d="M 9.25,3 H 12.75 C 12.889,3 13,3.1115 13,3.25 V 6.75 C 13,6.8885 12.889,7 12.75,7 H 9.25 C 9.1115,7 9,6.8885 9,6.75 V 3.25 C 9,3.1115 9.1115,3 9.25,3 Z"/>
<path style="fill:#555555" d="M 3.25,9 H 6.75 C 6.8885,9 7,9.1115 7,9.25 V 12.75 C 7,12.889 6.8885,13 6.75,13 H 3.25 C 3.1115,13 3,12.889 3,12.75 V 9.25 C 3,9.1115 3.1115,9 3.25,9 Z"/>
<path style="fill:#555555" d="M 9.25,9 H 12.75 C 12.889,9 13,9.1115 13,9.25 V 12.75 C 13,12.889 12.889,13 12.75,13 H 9.25 C 9.1115,13 9,12.889 9,12.75 V 9.25 C 9,9.1115 9.1115,9 9.25,9 Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 829 B

View File

@ -1,8 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<defs>
<style id="current-color-scheme" type="text/css">
.ColorScheme-Text { color:#565656; } .ColorScheme-Highlight { color:#5294e2; }
</style>
</defs>
<path style="fill:currentColor" class="ColorScheme-Text" d="M 2 1 C 2 1 1.9237594 1.0041375 1.8183594 1.0234375 C 1.6141594 1.0536375 1.4597031 1.1268625 1.3457031 1.2265625 C 1.3237031 1.2434625 1.30225 1.26165 1.28125 1.28125 C 1.26165 1.30225 1.2434625 1.3236031 1.2265625 1.3457031 C 1.1268625 1.4597031 1.0535375 1.6141594 1.0234375 1.8183594 C 1.0040375 1.9237594 1 2 1 2 L 1 14 C 1 15 2 15 2 15 L 14 15 C 14 15 15 15 15 14 L 15 2 C 15 2 14.995563 1.9237594 14.976562 1.8183594 C 14.945562 1.6141594 14.873437 1.4597031 14.773438 1.3457031 C 14.756438 1.3236031 14.73775 1.30225 14.71875 1.28125 C 14.69775 1.26165 14.676297 1.2434625 14.654297 1.2265625 C 14.540297 1.1268625 14.385641 1.0536375 14.181641 1.0234375 C 14.075641 1.0041375 14 1 14 1 L 2 1 z M 3 6 L 13 6 L 13 13 L 3 13 L 3 6 z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -1,4 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
<path style="fill:#555555" d="M 1,14.5 V 6.5 C 1,6 1.52,6 1.52,6 H 5 V 9 H 3 V 13 H 9 V 11 H 11 V 14.5 C 11,14.98 10.5,15 10.5,15 H 1.5 C 1.5,15 1,15 1,14.5 Z"/>
<path style="fill:#555555" d="M 6.5,1 C 6,1 6,1.5 6,1.5 V 9.5 C 6,10 6.5,10 6.5,10 H 15.5 C 15.5,10 16,10 16,9.5 V 1.5 C 16,1 15.5,1 15.5,1 Z M 8,4 H 14 V 8 H 8 Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 415 B

View File

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" version="1.1">
<path style="fill:#555555" d="M 0,1 V 15 H 16 V 1 Z M 2,3 H 7 V 13 H 2 Z M 9,3 H 14 V 13 H 9 Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 184 B

View File

@ -1,8 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<defs>
<style id="current-color-scheme" type="text/css">
.ColorScheme-Text { color:#565656; } .ColorScheme-Highlight { color:#5294e2; }
</style>
</defs>
<path style="fill:currentColor" class="ColorScheme-Text" d="M 2 1 C 2 1 1.9237594 1.0041375 1.8183594 1.0234375 C 1.6141594 1.0536375 1.4597031 1.1268625 1.3457031 1.2265625 C 1.3236031 1.2434625 1.30225 1.26165 1.28125 1.28125 C 1.26165 1.30225 1.2434625 1.3236031 1.2265625 1.3457031 C 1.1268625 1.4597031 1.0536375 1.6141594 1.0234375 1.8183594 C 1.0041375 1.9237594 1 2 1 2 L 1 14 C 1 15 2 15 2 15 L 8 15 L 8 13 L 3 13 L 3 6 L 13 6 L 13 8 L 15 8 L 15 2 C 15 2 14.995563 1.9237594 14.976562 1.8183594 C 14.945562 1.6141594 14.873437 1.4597031 14.773438 1.3457031 C 14.756438 1.3236031 14.73775 1.30225 14.71875 1.28125 C 14.69775 1.26165 14.676297 1.2434625 14.654297 1.2265625 C 14.540297 1.1268625 14.385641 1.0536375 14.181641 1.0234375 C 14.075641 1.0041375 14 1 14 1 L 2 1 z M 9.5 9 C 9.5 9 9.4628562 9.0020187 9.4101562 9.0117188 C 9.3080562 9.0268188 9.2308281 9.0634812 9.1738281 9.1132812 C 9.1627281 9.1217812 9.151125 9.130825 9.140625 9.140625 C 9.130625 9.151125 9.1217813 9.1628281 9.1132812 9.1738281 C 9.0634813 9.2308281 9.0268187 9.3080562 9.0117188 9.4101562 C 9.0017188 9.4628562 9 9.5 9 9.5 L 9 15.5 C 9 16 9.5 16 9.5 16 L 15.5 16 C 15.5 16 16 16 16 15.5 L 16 9.5 C 16 9.5 15.998281 9.4628562 15.988281 9.4101562 C 15.973281 9.3080562 15.936719 9.2308281 15.886719 9.1738281 C 15.878719 9.1628281 15.869375 9.151125 15.859375 9.140625 C 15.849375 9.130825 15.837172 9.1217813 15.826172 9.1132812 C 15.769172 9.0634813 15.691844 9.0268187 15.589844 9.0117188 C 15.536844 9.0020187 15.5 9 15.5 9 L 9.5 9 z M 10 12 L 15 12 L 15 15 L 10 15 L 10 12 z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -1,354 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<schema id="org.gnome.shell.extensions.forge" path="/org/gnome/shell/extensions/forge/">
<!-- Main Settings -->
<key type="b" name="focus-border-toggle">
<default>true</default>
<summary>Show window border on focused window</summary>
</key>
<key type="u" name="focus-border-size">
<default>3</default>
<summary>The focused border's current thickness</summary>
</key>
<key type="s" name="focus-border-color">
<default>'rgba(236, 94, 94, 1)'</default>
<summary>The focused border's current color</summary>
</key>
<key type="b" name="split-border-toggle">
<default>true</default>
<summary>Show split direction border on focused window</summary>
</key>
<key type="s" name="split-border-color">
<default>'rgba(255, 246, 108, 1)'</default>
<summary>The focused border's current color</summary>
</key>
<key type="u" name="window-gap-size">
<default>4</default>
<summary>
The size of the gap between windows in the workarea
</summary>
</key>
<key type="u" name="resize-amount">
<default>15</default>
<summary>
The window resize increment/decrement in pixels
</summary>
</key>
<key type="u" name="window-gap-size-increment">
<default>1</default>
<summary>
The size increment of the gaps. size-increment * gap-size
</summary>
</key>
<key type="b" name="window-gap-hidden-on-single">
<default>false</default>
<summary>Hide gap when single window toggle</summary>
</key>
<key type="s" name="primary-layout-mode">
<default>'tiling'</default>
<summary>Layout modes: stacking, tiling</summary>
</key>
<key type="b" name="tiling-mode-enabled">
<default>true</default>
<summary>Tiling mode on/off</summary>
</key>
<key type="b" name="quick-settings-enabled">
<default>true</default>
<summary>Forge quick settings toggle</summary>
</key>
<key type="s" name="workspace-skip-tile">
<default>''</default>
<summary>Skips tiling on the provided workspace indices</summary>
</key>
<key type="b" name="stacked-tiling-mode-enabled">
<default>true</default>
<summary>Stacked tiling mode on/off</summary>
</key>
<key type="b" name="tabbed-tiling-mode-enabled">
<default>true</default>
<summary>Tabbed tiling mode on/off</summary>
</key>
<!-- Development Settings -->
<key type="u" name="log-level">
<default>0</default>
<summary>
Provide log4j-like logging levels:
0 - OFF
1 - FATAL
2 - ERROR
3 - WARN
4 - INFO
5 - DEBUG
6 - TRACE
7 - ALL
</summary>
</key>
<key type="b" name="logging-enabled">
<default>false</default>
<summary>Enable logging</summary>
</key>
<key type="s" name="css-updated">
<default>''</default>
<summary>Timestamp when css is last updated. Also triggers reload of St</summary>
</key>
<key type="u" name="css-last-update">
<default>1</default>
</key>
<key type="s" name="dnd-center-layout">
<default>'tabbed'</default>
<summary>
The default center layout when dragging/dropping a window.
The values are `tabbed` and `stacked`.
</summary>
</key>
<key type="b" name="move-pointer-focus-enabled">
<default>false</default>
<summary>Move the pointer when focusing or swapping via kbd</summary>
</key>
<key type="b" name="focus-on-hover-enabled">
<default>false</default>
<summary>Focus switches to the window under the pointer.</summary>
</key>
<key type="b" name="float-always-on-top-enabled">
<default>true</default>
<summary>Floating windows toggle always-on-top</summary>
</key>
<key type="b" name="auto-exit-tabbed">
<default>true</default>
<summary>Exit tabbed tiling mode when only a single tab remains</summary>
</key>
<key type="b" name="auto-split-enabled">
<default>true</default>
<summary>Enable auto split or quarter-tiling based based on smaller side</summary>
</key>
<key type="b" name="preview-hint-enabled">
<default>true</default>
<summary>Whether to show preview hint DND</summary>
</key>
<key type="b" name="showtab-decoration-enabled">
<default>true</default>
<summary>Whether to show the tab decoration or not</summary>
</key>
<key type="u" name="window-overrides-reload-trigger">
<default>0</default>
<summary>Timestamp to trigger window overrides reload</summary>
</key>
</schema>
<schema id="org.gnome.shell.extensions.forge.keybindings" path="/org/gnome/shell/extensions/forge/keybindings/">
<!-- Keybinding Settings -->
<key type="as" name="focus-border-toggle">
<default><![CDATA[['<Super>x']]]></default>
<summary>Toggle the focused window's border</summary>
</key>
<key type="as" name="window-gap-size-increase">
<default><![CDATA[['<Ctrl><Super>plus']]]></default>
<summary>Increase the size of gaps between windows/cons</summary>
</key>
<key type="as" name="window-gap-size-decrease">
<default><![CDATA[['<Ctrl><Super>minus']]]></default>
<summary>Decrease the size of gaps between windows/cons</summary>
</key>
<key type="as" name="con-split-layout-toggle">
<default><![CDATA[['<Super>g']]]></default>
<summary>Toggle split layout: horizontal or vertical</summary>
</key>
<key type="as" name="con-split-horizontal">
<default><![CDATA[['<Super>z']]]></default>
<summary>Split a container horizontally</summary>
</key>
<key type="as" name="con-split-vertical">
<default><![CDATA[['<Super>v']]]></default>
<summary>Split a container vertically</summary>
</key>
<key type="as" name="con-stacked-layout-toggle">
<default><![CDATA[['<Shift><Super>s']]]></default>
<summary>Toggle stacked layout</summary>
</key>
<key type="as" name="con-tabbed-layout-toggle">
<default><![CDATA[['<Shift><Super>t']]]></default>
<summary>Toggle tabbed layout</summary>
</key>
<key type="as" name="con-tabbed-showtab-decoration-toggle">
<default><![CDATA[['<Ctrl><Alt>y']]]></default>
<summary>Toggle showing the tab decoration layout</summary>
</key>
<key type="as" name="window-swap-left">
<default><![CDATA[['<Ctrl><Super>h']]]></default>
<summary>Swap window left</summary>
</key>
<key type="as" name="window-swap-down">
<default><![CDATA[['<Ctrl><Super>j']]]></default>
<summary>Swap window down</summary>
</key>
<key type="as" name="window-swap-up">
<default><![CDATA[['<Ctrl><Super>k']]]></default>
<summary>Swap window up</summary>
</key>
<key type="as" name="window-swap-right">
<default><![CDATA[['<Ctrl><Super>l']]]></default>
<summary>Swap window right</summary>
</key>
<key type="as" name="window-move-left">
<default><![CDATA[['<Shift><Super>h']]]></default>
<summary>Move window left</summary>
</key>
<key type="as" name="window-move-down">
<default><![CDATA[['<Shift><Super>j']]]></default>
<summary>Move window down</summary>
</key>
<key type="as" name="window-move-up">
<default><![CDATA[['<Shift><Super>k']]]></default>
<summary>Move window up</summary>
</key>
<key type="as" name="window-move-right">
<default><![CDATA[['<Shift><Super>l']]]></default>
<summary>Move window right</summary>
</key>
<key type="as" name="window-focus-left">
<default><![CDATA[['<Super>h']]]></default>
<summary>Move window left</summary>
</key>
<key type="as" name="window-focus-down">
<default><![CDATA[['<Super>j']]]></default>
<summary>Move window down</summary>
</key>
<key type="as" name="window-focus-up">
<default><![CDATA[['<Super>k']]]></default>
<summary>Move window up</summary>
</key>
<key type="as" name="window-focus-right">
<default><![CDATA[['<Super>l']]]></default>
<summary>Move window right</summary>
</key>
<key type="as" name="window-toggle-float">
<default><![CDATA[['<Super>c']]]></default>
<summary>Toggle window float</summary>
</key>
<key type="as" name="window-toggle-always-float">
<default><![CDATA[['<Shift><Super>c']]]></default>
</key>
<key type="as" name="workspace-active-tile-toggle">
<default><![CDATA[['<Shift><Super>w']]]></default>
<summary>Toggle active workspace tiling</summary>
</key>
<key type="as" name="prefs-open">
<default><![CDATA[['<Super>Period']]]></default>
<summary>Open the extension's preferences</summary>
</key>
<key type="as" name="prefs-tiling-toggle">
<default><![CDATA[['<Super>w']]]></default>
<summary>Toggle tiling mode on/off</summary>
</key>
<key type="s" name="mod-mask-mouse-tile">
<default>'None'</default>
<summary>
Mod mask to allow window tiling via drag-drop. None means it will tile immediately.
Options are Super, Ctrl, Shift, Alt, and None
</summary>
</key>
<key type="as" name="window-swap-last-active">
<default><![CDATA[['<Super>Return']]]></default>
<summary>Swap the last active window with the current one</summary>
</key>
<key type="as" name="window-snap-one-third-right">
<default><![CDATA[['<Ctrl><Alt>g']]]></default>
</key>
<key type="as" name="window-snap-two-third-right">
<default><![CDATA[['<Ctrl><Alt>t']]]></default>
</key>
<key type="as" name="window-snap-one-third-left">
<default><![CDATA[['<Ctrl><Alt>d']]]></default>
</key>
<key type="as" name="window-snap-two-third-left">
<default><![CDATA[['<Ctrl><Alt>e']]]></default>
</key>
<key type="as" name="window-snap-center">
<default><![CDATA[['<Ctrl><Alt>c']]]></default>
</key>
<key type="as" name="window-resize-left-increase">
<default><![CDATA[['<Ctrl><Super>y']]]></default>
</key>
<key type="as" name="window-resize-left-decrease">
<default><![CDATA[['<Ctrl><Shift><Super>o']]]></default>
</key>
<key type="as" name="window-resize-bottom-increase">
<default><![CDATA[['<Ctrl><Super>u']]]></default>
</key>
<key type="as" name="window-resize-bottom-decrease">
<default><![CDATA[['<Ctrl><Shift><Super>i']]]></default>
</key>
<key type="as" name="window-resize-top-increase">
<default><![CDATA[['<Ctrl><Super>i']]]></default>
</key>
<key type="as" name="window-resize-top-decrease">
<default><![CDATA[['<Ctrl><Shift><Super>u']]]></default>
</key>
<key type="as" name="window-resize-right-increase">
<default><![CDATA[['<Ctrl><Super>o']]]></default>
</key>
<key type="as" name="window-resize-right-decrease">
<default><![CDATA[['<Ctrl><Shift><Super>y']]]></default>
</key>
</schema>
</schemalist>

View File

@ -1,140 +0,0 @@
.tiled {
color: rgba(236, 94, 94, 1);
opacity: 1;
border-width: 3px;
}
.split {
color: rgba(255, 246, 108, 1);
opacity: 1;
border-width: 3px;
}
.stacked {
color: rgba(247, 162, 43, 1);
opacity: 1;
border-width: 3px;
}
.tabbed {
color: rgba(17, 199, 224, 1);
opacity: 1;
border-width: 3px;
}
.floated {
color: rgba(180, 167, 214, 1);
border-width: 3px;
opacity: 1;
}
.window-tiled-border {
border-width: 3px;
border-color: rgba(236, 94, 94, 1);
border-style: solid;
border-radius: 14px;
}
.window-split-border {
border-width: 3px;
border-color: rgba(255, 246, 108, 1);
border-style: solid;
border-radius: 14px;
}
.window-split-horizontal {
border-left-width: 0;
border-top-width: 0;
border-bottom-width: 0;
}
.window-split-vertical {
border-left-width: 0;
border-top-width: 0;
border-right-width: 0;
}
.window-stacked-border {
border-width: 3px;
border-color: rgba(247, 162, 43, 1);
border-style: solid;
border-radius: 14px;
}
.window-tabbed-border {
border-width: 3px;
border-color: rgba(17, 199, 224, 1);
border-style: solid;
border-radius: 14px;
}
.window-tabbed-bg {
border-radius: 8px;
}
.window-tabbed-tab {
background-color: rgba(54, 47, 45, 1);
border-color: rgba(17, 199, 224, 0.6);
border-width: 1px;
border-radius: 8px;
color: white;
margin: 1px;
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.window-tabbed-tab-active {
background-color: rgba(17, 199, 224, 1);
color: black;
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.window-tabbed-tab-close {
padding: 3px;
margin: 4px;
border-radius: 16px;
width: 16px;
background-color: #e06666;
}
.window-tabbed-tab-icon {
margin: 3px;
}
.window-floated-border {
border-width: 3px;
border-color: rgba(180, 167, 214, 1);
border-style: solid;
border-radius: 14px;
}
.window-tilepreview-tiled {
border-width: 1px;
border-color: rgba(236, 94, 94, 0.4);
border-style: solid;
border-radius: 14px;
background-color: rgba(236, 94, 94, 0.3);
}
.window-tilepreview-stacked {
border-width: 1px;
border-color: rgba(247, 162, 43, 0.4);
border-style: solid;
border-radius: 14px;
background-color: rgba(247, 162, 43, 0.3);
}
.window-tilepreview-swap {
border-width: 1px;
border-color: rgba(162, 247, 43, 0.4);
border-style: solid;
border-radius: 14px;
background-color: rgba(162, 247, 43, 0.4);
}
.window-tilepreview-tabbed {
border-width: 1px;
border-color: rgba(18, 199, 224, 0.4);
border-style: solid;
border-radius: 14px;
background-color: rgba(17, 199, 224, 0.3);
}

View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) 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
this service 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 make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. 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.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the 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 a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE 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.
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
convey 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 2 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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision 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, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This 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.

View File

@ -0,0 +1,74 @@
import GLib from 'gi://GLib';
import Gio from 'gi://Gio';
import Shell from 'gi://Shell';
var executables = null;
export var gnomeExecutables = null;
var sourceId = null;
/** Load executables accessible from path and
* desktop app names from Shell.AppSystem API
*
* @returns void
*/
export function loadExecutables() {
let path = GLib.getenv('PATH');
if (!path)
return;
let paths = path?.split(':');
if (executables === null)
executables = new Set();
if (gnomeExecutables === null)
gnomeExecutables = new Map();
paths.forEach(el => {
let dir = Gio.File.new_for_path(el);
dir.enumerate_children_async('standard::*', Gio.FileQueryInfoFlags.NONE, GLib.PRIORITY_LOW, null, (source, result) => {
try {
if (!source)
return;
let e = source.enumerate_children_finish(result);
let file;
while ((file = e.next_file(null)) !== null) {
let name = file.get_name();
if (!executables?.has(name))
executables?.add(name);
}
e.close(null);
} catch (e) {
}
});
});
if (sourceId !== null)
GLib.Source.remove(sourceId);
sourceId = GLib.idle_add(GLib.PRIORITY_LOW, () => {
Shell.AppSystem.get_default().get_installed().forEach(app => {
let name = app.get_display_name() ?? app.get_name();
let exe = app.get_commandline() ?? null;
if (!gnomeExecutables?.has(name) && exe)
gnomeExecutables?.set(name.toLowerCase(), app);
});
sourceId = null;
return GLib.SOURCE_REMOVE;
});
}
/** Returns a list of apps beginning with `word`
*
* @param {string} word
* @returns
*/
export function autocomplete(word) {
word = word.toLowerCase();
let matches = [];
gnomeExecutables?.forEach((e, w) => w.startsWith(word) && w !== word && e !== null ? matches.push(w) : -1);
executables?.forEach(w => w.startsWith(word) && w !== word ? matches.push(w) : -1);
matches.sort((a, b) => a.length < b.length ? -1 : 1);
return matches;
}
export function clear() {
if (sourceId !== null)
GLib.Source.remove(sourceId);
sourceId = null;
}
export function destroy() {
executables = null;
gnomeExecutables = null;
}

View File

@ -0,0 +1,100 @@
export class Shortcut {
static _shortcutList = [
'keybinding-rotation',
'keybinding-resize',
'keybinding-move',
'keybinding-close',
'keybinding-search',
'keybinding-open-settings',
'keybinding-maximize',
'keybinding-move-left',
'keybinding-move-right',
'keybinding-move-top',
'keybinding-move-bottom',
'keybinding-resize-left',
'keybinding-resize-right',
'keybinding-resize-top',
'keybinding-resize-bottom',
'keybinding-next-monitor',
'keybinding-next-workspace',
'keybinding-previous-workspace',
'keybinding-focus',
'keybinding-focus-left',
'keybinding-focus-right',
'keybinding-focus-top',
'keybinding-focus-bottom',
];
static getShortcuts() {
return Shortcut._shortcutList;
}
}
export class Switches {
static _switchList = [];
static getSwitches() {
return Switches._switchList;
}
}
export class Spin {
static _spinList = [
'tile-padding',
];
static getSpins() {
return Spin._spinList;
}
}
export class Combo {
static _comboList = [
{
key: 'keybinding-config',
rowNames: [
'None',
'i3',
'Grimble',
'Custom',
],
},
];
static getCombo() {
return Combo._comboList;
}
}
export class Radio {
static _radioButtons = [
// {
// key: 'tile-insertion-behavior',
// rowNames: [
// 'insertion_best_fit_row',
// 'insertion_focus_row'
// ]
// },
{
key: 'monitor-tile-insertion-behavior',
rowNames: [
'monitors_best_fit_row',
'monitors_focus_row',
],
},
{
key: 'search-entry-position',
rowNames: [
'search_entry_left',
'search_entry_center',
'search_entry_right',
],
},
{
key: 'fullscreen-switch',
rowNames: [
'keep_fullscreen',
'quit_fullscreen',
],
},
];
static getRadios() {
return Radio._radioButtons;
}
}

View File

@ -0,0 +1,25 @@
{
"keybinding-rotation": "",
"keybinding-resize": "",
"keybinding-move": "",
"keybinding-close": "",
"keybinding-search": "",
"keybinding-open-settings": "<Control><Super>g",
"keybinding-maximize": "",
"keybinding-move-left": "",
"keybinding-move-right": "",
"keybinding-move-top": "",
"keybinding-move-bottom": "",
"keybinding-resize-left": "",
"keybinding-resize-right": "",
"keybinding-resize-top": "",
"keybinding-resize-bottom": "",
"keybinding-next-monitor": "",
"keybinding-next-workspace": "",
"keybinding-previous-workspace": "",
"keybinding-focus": "",
"keybinding-focus-left": "",
"keybinding-focus-right": "",
"keybinding-focus-top": "",
"keybinding-focus-bottom": ""
}

View File

@ -0,0 +1,25 @@
{
"keybinding-rotation": "<Ctrl><Shift>r",
"keybinding-resize": "<Super>r",
"keybinding-move": "",
"keybinding-close": "<Ctrl><Shift>k",
"keybinding-search": "<Ctrl><Alt>b",
"keybinding-open-settings": "<Ctrl><Super>g",
"keybinding-maximize": "<Ctrl><Alt>k",
"keybinding-move-left": "<Ctrl><Super><Shift>Left",
"keybinding-move-right": "<Ctrl><Super><Shift>Right",
"keybinding-move-top": "<Ctrl><Super><Shift>Up",
"keybinding-move-bottom": "<Ctrl><Super><Shift>Down",
"keybinding-resize-left": "",
"keybinding-resize-right": "",
"keybinding-resize-top": "",
"keybinding-resize-bottom": "",
"keybinding-next-monitor": "<Ctrl><Alt>m",
"keybinding-next-workspace": "",
"keybinding-previous-workspace": "",
"keybinding-focus": "",
"keybinding-focus-left": "<Ctrl><Super>Left",
"keybinding-focus-right": "<Ctrl><Super>Right",
"keybinding-focus-top": "<Ctrl><Super>Up",
"keybinding-focus-bottom": "<Ctrl><Super>Down"
}

View File

@ -0,0 +1,25 @@
{
"keybinding-rotation": "",
"keybinding-resize": "<Super>r",
"keybinding-move": "",
"keybinding-close": "<Super><Shift>q",
"keybinding-search": "<Control><Alt>b",
"keybinding-open-settings": "<Control><Super>g",
"keybinding-maximize": "<Super>f",
"keybinding-move-left": "<Super><Shift>j",
"keybinding-move-right": "<Super><Shift>semicolon",
"keybinding-move-top": "<Super><Shift>l",
"keybinding-move-bottom": "<Super><Shift>k",
"keybinding-resize-left": "",
"keybinding-resize-right": "",
"keybinding-resize-top": "",
"keybinding-resize-bottom": "",
"keybinding-next-monitor": "",
"keybinding-next-workspace": "",
"keybinding-previous-workspace": "",
"keybinding-focus": "<Super>space",
"keybinding-focus-left": "<Super>j",
"keybinding-focus-right": "<Super>semicolon",
"keybinding-focus-top": "<Super>l",
"keybinding-focus-bottom": "<Super>k"
}

View File

@ -0,0 +1,72 @@
import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js';
import * as ExtensionTheme from './theme.js';
import {TileWindowManager} from './tileWindowManager.js';
import KeybindingHandler from './settingsHandlers/keybindingHandler.js';
import SwitchHandler from './settingsHandlers/switchHandler.js';
import SpinHandler from './settingsHandlers/spinHandler.js';
import ComboRowHandler from './settingsHandlers/comboRowHandler.js';
import {Tile} from './tile.js';
import {destroyController} from './keybindingController.js';
import {loadExecutables, destroy as unloadExecutables} from './autocomplete.js';
import GLib from 'gi://GLib';
export default class Grimble extends Extension {
_tileWindowManager = null;
_settings = null;
_keybindingHandler = null;
_switchHandler = null;
_spinHandler = null;
_comboHandler = null;
_timeoutId = null;
enable() {
this._settings = this.getSettings();
ExtensionTheme.enableWindowTheme();
Tile.padding = this._settings.get_int('tile-padding');
/**
* When we unlock the session (after a lock, not when starting the system),
* there is a period of time during which the Gnome settings used for the
* extension are not set. If we don't wait, it leads the windows to be
* organized in an undefined way when using multiple monitors (because
* of the workspaces-only-on-primary setting). In order to fix it we
* wait 2 seconds to be sure everything is set up. It is applied ONLY when using
* multiple monitors.
* -> Could problably be improved by waiting for the setting changed signal.
*/
if (global.display.get_n_monitors() > 1 && TileWindowManager.locked) {
this._timeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 2, () => {
this._tileWindowManager = new TileWindowManager(this);
this._keybindingHandler = new KeybindingHandler(this._tileWindowManager, this);
this._switchHandler = new SwitchHandler(this._tileWindowManager, this);
this._spinHandler = new SpinHandler(this._tileWindowManager, this);
this._comboHandler = new ComboRowHandler(this._tileWindowManager, this);
return GLib.SOURCE_REMOVE;
});
} else {
this._tileWindowManager = new TileWindowManager(this);
this._keybindingHandler = new KeybindingHandler(this._tileWindowManager, this);
this._switchHandler = new SwitchHandler(this._tileWindowManager, this);
this._spinHandler = new SpinHandler(this._tileWindowManager, this);
this._comboHandler = new ComboRowHandler(this._tileWindowManager, this);
}
loadExecutables();
}
disable() {
unloadExecutables();
this._tileWindowManager?._saveBeforeSessionLock();
// Restore theme
ExtensionTheme.disableWindowTheme();
if (this._timeoutId) {
GLib.Source.remove(this._timeoutId);
this._timeoutId = null;
}
destroyController();
this._tileWindowManager?.destroy();
this._tileWindowManager = null;
this._keybindingHandler?.destroy();
this._keybindingHandler = null;
this._spinHandler = null;
this._switchHandler = null;
this._comboHandler = null;
this._settings = null;
}
}

View File

@ -0,0 +1,24 @@
import GObject from 'gi://GObject';
export const KeybindingController = GObject.registerClass({
Signals: {
'keybinding-changed': {
param_types: [GObject.TYPE_STRING],
},
},
}, class KeybindingController extends GObject.Object {
update(key) {
this.emit('keybinding-changed', key);
}
});
var keybindingController = null;
/**
*
*/
export function getKeybindingController() {
if (keybindingController === null)
keybindingController = new KeybindingController();
return keybindingController;
}
export function destroyController() {
keybindingController = null;
}

View File

@ -0,0 +1,16 @@
{
"_generated": "Generated by SweetTooth, do not edit",
"description": "You like GNOME? You like Tiling Window Managers? You can now have the best of both worlds with Grimble, the GNOME tiling window manager extension.",
"gettext-domain": "grimble@lmt.github.io",
"name": "Grimble Tiling WM",
"settings-schema": "org.gnome.shell.extensions.grimble",
"shell-version": [
"46",
"47",
"48",
"49"
],
"url": "https://github.com/erwanlem/grimble-tiling-wm",
"uuid": "grimble@lmt.github.io",
"version": 5
}

View File

@ -0,0 +1,287 @@
import {Tile, TileState} from './tile.js';
import {Direction} from './tileWindowManager.js';
import {Position} from './position.js';
export class Monitor {
_root;
_index;
_fullscreenState = false;
constructor(index) {
this._index = index;
this._root = null;
}
set root(root) {
this._root = root;
}
get root() {
return this._root;
}
get index() {
return this._index;
}
get fullscreen() {
return this._fullscreenState;
}
set fullscreen(b) {
this._fullscreenState = b;
}
size() {
return this._root ? this._root._nr_tiles : 0;
}
updateSize() {
if (this._root) {
const area = global.workspace_manager.get_active_workspace().get_work_area_for_monitor(this.index);
if (area) {
let pos = new Position(1.0, 0, 0, area.width, area.height);
pos.splitProportion = this._root.position.splitProportion;
this._root.resize(pos);
}
}
}
static bestFitMonitor(monitors) {
return monitors.reduce((acc, val) => val.size() < acc.size() ? val : acc, monitors[0]);
}
static tileDistance(t1, t2) {
let vector = [t1.position.x - t2.position.x, t1.position.y - t2.position.y];
return Math.sqrt(vector[0] * vector[0] + vector[1] * vector[1]);
}
closestTile(source, dir) {
// Class to store the result
class BestTile {
tile = null;
distance = null;
constructor(tile = null, distance = null) {
this.tile = tile;
this.distance = distance;
}
}
;
// We search for the closest tile in a Direction. We recursively iterate the tree
let findClosest = tile => {
switch (dir) {
case Direction.East:
if (tile.leaf && tile.position.x > source.position.x) {
return new BestTile(tile, Monitor.tileDistance(tile, source));
} else if (tile.leaf) {
return new BestTile();
} else if (tile.child1 && tile.child2) {
let res1 = findClosest(tile.child1);
let res2 = findClosest(tile.child2);
if ((res1.distance && res2.distance && res1.distance > res2.distance) ||
(res2.distance && !res1.distance))
return res2;
else if ((res1.distance && res2.distance && res1.distance < res2.distance) ||
(res1.distance && !res2.distance))
return res1;
else
return new BestTile();
}
return new BestTile();
case Direction.West:
if (tile.leaf && tile.position.x < source.position.x) {
return new BestTile(tile, Monitor.tileDistance(tile, source));
} else if (tile.leaf) {
return new BestTile();
} else if (tile.child1 && tile.child2) {
let res1 = findClosest(tile.child1);
let res2 = findClosest(tile.child2);
if ((res1.distance && res2.distance && res1.distance > res2.distance) ||
(res2.distance && !res1.distance))
return res2;
else if ((res1.distance && res2.distance && res1.distance < res2.distance) ||
(res1.distance && !res2.distance))
return res1;
else
return new BestTile();
}
return new BestTile();
case Direction.North:
if (tile.leaf && tile.position.y < source.position.y) {
return new BestTile(tile, Monitor.tileDistance(tile, source));
} else if (tile.leaf) {
return new BestTile();
} else if (tile.child1 && tile.child2) {
let res1 = findClosest(tile.child1);
let res2 = findClosest(tile.child2);
if ((res1.distance && res2.distance && res1.distance > res2.distance) ||
(res2.distance && !res1.distance))
return res2;
else if ((res1.distance && res2.distance && res1.distance < res2.distance) ||
(res1.distance && !res2.distance))
return res1;
else
return new BestTile();
}
return new BestTile();
case Direction.South:
if (tile.leaf && tile.position.y > source.position.y) {
return new BestTile(tile, Monitor.tileDistance(tile, source));
} else if (tile.leaf) {
return new BestTile();
} else if (tile.child1 && tile.child2) {
let res1 = findClosest(tile.child1);
let res2 = findClosest(tile.child2);
if ((res1.distance && res2.distance && res1.distance > res2.distance) ||
(res2.distance && !res1.distance))
return res2;
else if ((res1.distance && res2.distance && res1.distance < res2.distance) ||
(res1.distance && !res2.distance))
return res1;
else
return new BestTile();
}
return new BestTile();
default:
return new BestTile();
}
};
if (this.root) {
let res = findClosest(this.root);
return res.tile;
}
return null;
}
destroy() {
this._index = -1;
this._root = null;
}
static fromObject(obj) {
let monitor = new Monitor(obj._index);
monitor.fullscreen = obj._fullscreenState;
if (!obj._root)
monitor.root = null;
else
monitor.root = Tile.fromObject(obj._root);
return monitor;
}
closestMonitor(dir) {
let nMonitors = global.display.get_n_monitors();
let _currGeo = global.display.get_monitor_geometry(this.index);
let min;
let best = null;
switch (dir) {
case Direction.North:
for (let i = 0; i < nMonitors; i++) {
if (this.index !== i) {
let _geometry = global.display.get_monitor_geometry(i);
if (_geometry.y < _currGeo.y && (min === undefined || _geometry.y > min)) {
min = _geometry.y;
best = i;
}
}
}
return best;
case Direction.South:
for (let i = 0; i < nMonitors; i++) {
if (this.index !== i) {
let _geometry = global.display.get_monitor_geometry(i);
if (_geometry.y > _currGeo.y && (min === undefined || _geometry.y < min)) {
min = _geometry.y;
best = i;
}
}
}
return best;
case Direction.East:
for (let i = 0; i < nMonitors; i++) {
if (this.index !== i) {
let _geometry = global.display.get_monitor_geometry(i);
if (_geometry.x > _currGeo.x && (min === undefined || _geometry.x < min)) {
min = _geometry.x;
best = i;
}
}
}
return best;
case Direction.West:
for (let i = 0; i < nMonitors; i++) {
if (this.index !== i) {
let _geometry = global.display.get_monitor_geometry(i);
if (_geometry.x < _currGeo.x && (!min || _geometry.x > min)) {
min = _geometry.x;
best = i;
}
}
}
return best;
default:
return null;
}
}
/** Returns tile closest to the edge on a monitor
* - If the monitor is in fullscreen it returns the maximized window
*
* @param {Direction} dir
* @returns {Tile | null}
*/
getTile(dir) {
if (this.root === null)
return null;
if (this.fullscreen)
return this.root.find(t => t.state === TileState.MAXIMIZED);
let getTileBis = t => {
switch (dir) {
case Direction.East:
if (t.child2 !== null && t.child1 !== null)
return t.child1.position.x > t.child2.position.x ? getTileBis(t.child1) : getTileBis(t.child2);
else if (t.child1 !== null)
return getTileBis(t.child1);
else if (t.child2 !== null)
return getTileBis(t.child2);
else
return t;
case Direction.West:
if (t.child2 !== null && t.child1 !== null)
return t.child1.position.x < t.child2.position.x ? getTileBis(t.child1) : getTileBis(t.child2);
else if (t.child1 !== null)
return getTileBis(t.child1);
else if (t.child2 !== null)
return getTileBis(t.child2);
else
return t;
case Direction.North:
if (t.child2 !== null && t.child1 !== null)
return t.child1.position.y < t.child2.position.y ? getTileBis(t.child1) : getTileBis(t.child2);
else if (t.child1 !== null)
return getTileBis(t.child1);
else if (t.child2 !== null)
return getTileBis(t.child2);
else
return t;
case Direction.South:
if (t.child2 !== null && t.child1 !== null)
return t.child1.position.y > t.child2.position.y ? getTileBis(t.child1) : getTileBis(t.child2);
else if (t.child1 !== null)
return getTileBis(t.child1);
else if (t.child2 !== null)
return getTileBis(t.child2);
else
return t;
default:
return t;
}
};
return getTileBis(this.root);
}
}

View File

@ -0,0 +1,60 @@
import {Orientation} from './tile.js';
export class Position {
proportion;
x;
y;
width;
height;
index;
splitProportion;
constructor(proportion = 1.0, x = 0, y = 0, width = 0, height = 0, index = 0) {
this.proportion = proportion;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.index = index;
this.splitProportion = 0.5;
}
split(orientation = null) {
let vertical;
let newPosition1 = new Position();
newPosition1.proportion = this.proportion * this.splitProportion;
newPosition1.x = this.x;
newPosition1.y = this.y;
newPosition1.index = 0;
switch (orientation) {
case null:
case Orientation.None:
if (this.width > this.height) {
vertical = true;
newPosition1.width = this.width * this.splitProportion;
newPosition1.height = this.height;
} else {
vertical = false;
newPosition1.width = this.width;
newPosition1.height = this.height * this.splitProportion;
}
break;
case Orientation.Horizontal:
vertical = true;
newPosition1.width = this.width * this.splitProportion;
newPosition1.height = this.height;
break;
case Orientation.Vertical:
vertical = false;
newPosition1.width = this.width;
newPosition1.height = this.height * this.splitProportion;
break;
}
let newPosition2 = new Position(this.proportion * (1 - this.splitProportion), vertical ? this.x + this.width * this.splitProportion : this.x, vertical ? this.y : this.y + this.height * this.splitProportion, vertical ? this.width * (1 - this.splitProportion) : this.width, vertical ? this.height : this.height * (1 - this.splitProportion), 1);
return [newPosition1, newPosition2];
}
static fromObject(obj) {
let pos = new Position(obj.proportion, obj.x, obj.y, obj.width, obj.height, obj.index);
pos.splitProportion = obj.splitProportion;
return pos;
}
}

View File

@ -0,0 +1,90 @@
import Gio from 'gi://Gio';
import Gtk from 'gi://Gtk';
import './prefs/shortcutListener.js';
import {Shortcut, Switches, Radio, Spin, Combo} from './common.js';
import {getKeybindingController} from './keybindingController.js';
import {saveConfiguration} from './utils.js';
import {ExtensionPreferences} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
export default class GrimblePreferences extends ExtensionPreferences {
fillPreferencesWindow(window) {
const settings = this.getSettings();
const builder = Gtk.Builder.new_from_file(`${this.path}/ui/prefs.ui`);
const page1 = this.createGeneralSettingsPage(builder, settings);
const page2 = this.createKeybindingsPage(builder, settings);
window.add(page1);
window.add(page2);
return Promise.resolve();
}
createGeneralSettingsPage(builder, settings) {
const page1 = builder.get_object('general');
this._bindRadioButtons(builder, settings);
this._bindSwitches(builder, settings);
this._bindSpinbuttons(builder, settings);
return page1;
}
createKeybindingsPage(builder, settings) {
const page2 = builder.get_object('keybindings');
const comboRow = Combo.getCombo();
comboRow.forEach(({key, rowNames}) => {
const combo = builder.get_object(key.replaceAll('-', '_'));
let lastValue = settings.get_string(key);
let row = rowNames.findIndex(item => lastValue === item);
if (row === -1)
row = 0;
combo.set_selected(row);
combo.connect('notify::selected-item', widget => {
settings.set_string(key, rowNames[widget.get_selected()]);
});
getKeybindingController().connect('keybinding-changed', () => {
combo.set_selected(rowNames.findIndex(item => item === 'Custom'));
const shortcuts = Shortcut.getShortcuts();
let o = {};
for (const p of shortcuts)
o[p] = settings.get_strv(p) ?? [];
saveConfiguration('custom.json', o);
});
});
let keys = Shortcut.getShortcuts();
keys.forEach(key => {
const shortcut = builder.get_object(key.replaceAll('-', '_'));
shortcut.initialize(key, settings);
});
return page2;
}
_bindRadioButtons(builder, settings) {
const radioButtons = Radio.getRadios();
radioButtons.forEach(({key, rowNames}) => {
const currActive = settings.get_int(key);
rowNames.forEach((name, idx) => {
const row = builder.get_object(name.replaceAll('-', '_'));
const checkButton = row.activatable_widget;
checkButton.connect('toggled', () => {
settings.set_int(key, idx);
});
// Set initial state
if (idx === currActive)
checkButton.activate();
});
});
}
_bindSwitches(builder, settings) {
const switches = Switches.getSwitches();
switches.forEach(key => {
const widget = builder.get_object(key.replaceAll('-', '_'));
settings.bind(key, widget, 'active', Gio.SettingsBindFlags.DEFAULT);
});
}
_bindSpinbuttons(builder, settings) {
const spinButtons = Spin.getSpins();
spinButtons.forEach(key => {
const widget = builder.get_object(key.replaceAll('-', '_'));
settings.bind(key, widget, 'value', Gio.SettingsBindFlags.DEFAULT);
});
}
}

View File

@ -0,0 +1,201 @@
/**
* © gnome-shell-extension-tiling-assistant
* Source: https://git.launchpad.net/ubuntu/+source/gnome-shell-extension-tiling-assistant/tree/tiling-assistant@leleat-on-github/src/prefs/shortcutListener.js
*
* This code is copy from Ubuntu tiling assistant extension (GPL-2.0).
*/
// @ts-nocheck
import Adw from 'gi://Adw';
import Gtk from 'gi://Gtk';
import Gdk from 'gi://Gdk';
import GObject from 'gi://GObject';
import {gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
import {getKeybindingController} from '../keybindingController.js';
/**
* A Widget to implement the shortcuts in the preference window.
* It's an AdwActionRow, which contains a label showing the keybinding(s)
* and a shortcut-clear-button.
*
* Some parts are from https://extensions.gnome.org/extension/2236/night-theme-switcher/.
* _isBindingValid & _isKeyvalForbidden are straight up copied from its util.js
* https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension/-/blob/main/src/utils.js
*/
export const ShortcutListener = GObject.registerClass({
GTypeName: 'ShortcutListener',
Template: import.meta.url.replace(/prefs\/(.*)\.js$/, 'ui/$1.ui'),
InternalChildren: ['keybindingLabel', 'clearButton', 'eventKeyController'],
Properties: {
keybinding: GObject.ParamSpec.string('keybinding', 'Keybinding', 'Key sequence', GObject.ParamFlags.READWRITE, null),
},
}, class ShortcutListener extends Adw.ActionRow {
/**
* Only allow 1 active ShortcutListener at a time
*/
static isListening = false;
static isAppendingShortcut = false;
static listener = null;
static listeningText = 'Press a shortcut...';
static appendingText = 'Append a new shortcut...';
/**
* Starts listening for a keyboard shortcut.
*
* @param {ShortcutListener} shortcutListener the new active ShortcutListener
*/
static listen(shortcutListener) {
if (shortcutListener === ShortcutListener.listener)
return;
ShortcutListener.stopListening();
shortcutListener.isActive = true;
shortcutListener.setKeybindingLabel(ShortcutListener.listeningText);
ShortcutListener.listener = shortcutListener;
ShortcutListener.isListening = true;
}
/**
* Stops listening for a keyboard shortcut.
*/
static stopListening() {
if (!ShortcutListener.isListening)
return;
ShortcutListener.isListening = false;
ShortcutListener.isAppendingShortcut = false;
ShortcutListener.listener.isActive = false;
ShortcutListener.listener.setKeybindingLabel(ShortcutListener.listener.getKeybindingLabel());
ShortcutListener.listener = null;
}
initialize(key, setting) {
this._key = key;
this._setting = setting;
this.isActive = false;
this.connect('realize', () => this.get_root().add_controller(this._eventKeyController));
this.keybinding = this._setting.get_strv(key) ?? [];
this._settingChangedId = this._setting.connect(`changed::${key}`, () => {
this.keybinding = this._setting.get_strv(key) ?? [];
this.setKeybindingLabel(this.getKeybindingLabel());
this._clearButton.set_sensitive(this.keybinding.length);
});
}
/*
* Sets the label of the keybinding.
*/
setKeybindingLabel(label) {
this._keybindingLabel.set_label(label);
}
/**
* Gets the keybinding in a more pleasant to read format.
* For example: [<Control><Super>e,<Super>a] will become
* 'Ctrl+Super+E / Super+A' or 'Disabled'
*
* @returns {string}
*/
getKeybindingLabel() {
const kbLabel = this.keybinding.reduce((label, kb) => {
const [, keyval, mask] = Gtk.accelerator_parse(kb);
const l = Gtk.accelerator_get_label(keyval, mask);
if (!label)
return l;
return l ? `${label} / ${l}` : label;
}, '');
return kbLabel || _('Disabled');
}
_onActivated() {
this.isActive ? ShortcutListener.stopListening() : ShortcutListener.listen(this);
}
_onKeybindingChanged() {
this._setting.set_strv(this._key, this.keybinding);
this._clearButton.set_sensitive(this.keybinding.length);
this.setKeybindingLabel(this.getKeybindingLabel());
}
_onClearButtonClicked() {
this.keybinding = [];
this._setting.set_string('keybinding-config', 'Custom');
getKeybindingController().update('');
ShortcutListener.stopListening();
}
_onKeyPressed(eventControllerKey, keyval, keycode, state) {
if (this !== ShortcutListener.listener)
return Gdk.EVENT_PROPAGATE;
let mask = state & Gtk.accelerator_get_default_mod_mask();
mask &= ~Gdk.ModifierType.LOCK_MASK;
if (mask === 0) {
switch (keyval) {
case Gdk.KEY_BackSpace:
this.keybinding = [];
// falls through
case Gdk.KEY_Escape:
ShortcutListener.stopListening();
return Gdk.EVENT_STOP;
case Gdk.KEY_KP_Enter:
case Gdk.KEY_Return:
case Gdk.KEY_space:
ShortcutListener.isAppendingShortcut = !ShortcutListener.isAppendingShortcut;
this.setKeybindingLabel(ShortcutListener.isAppendingShortcut
? ShortcutListener.appendingText
: ShortcutListener.listeningText);
return Gdk.EVENT_STOP;
}
}
if (!this._isBindingValid({mask, keycode, keyval}) ||
!Gtk.accelerator_valid(keyval, mask))
return Gdk.EVENT_STOP;
const sc = Gtk.accelerator_name_with_keycode(null, keyval, keycode, mask);
this.keybinding = ShortcutListener.isAppendingShortcut ? [...this.keybinding, sc] : [sc];
this._setting.set_string('keybinding-config', 'Custom');
getKeybindingController().update('');
ShortcutListener.stopListening();
return Gdk.EVENT_STOP;
}
/**
* Checks, if the given key combo is a valid binding.
*
* @param {{mask: number, keycode: number, keyval:number}} combo An object
* representing the key combo.
* @returns {boolean} `true` if the key combo is a valid binding.
*/
_isBindingValid({mask, keycode, keyval}) {
if ((mask === 0 || mask === Gdk.ModifierType.SHIFT_MASK) && keycode !== 0) {
if ((keyval >= Gdk.KEY_a && keyval <= Gdk.KEY_z) ||
(keyval >= Gdk.KEY_A && keyval <= Gdk.KEY_Z) ||
(keyval >= Gdk.KEY_0 && keyval <= Gdk.KEY_9) ||
(keyval >= Gdk.KEY_kana_fullstop && keyval <= Gdk.KEY_semivoicedsound) ||
(keyval >= Gdk.KEY_Arabic_comma && keyval <= Gdk.KEY_Arabic_sukun) ||
(keyval >= Gdk.KEY_Serbian_dje && keyval <= Gdk.KEY_Cyrillic_HARDSIGN) ||
(keyval >= Gdk.KEY_Greek_ALPHAaccent && keyval <= Gdk.KEY_Greek_omega) ||
(keyval >= Gdk.KEY_hebrew_doublelowline && keyval <= Gdk.KEY_hebrew_taf) ||
(keyval >= Gdk.KEY_Thai_kokai && keyval <= Gdk.KEY_Thai_lekkao) ||
(keyval >= Gdk.KEY_Hangul_Kiyeog && keyval <= Gdk.KEY_Hangul_J_YeorinHieuh) ||
(keyval === Gdk.KEY_space && mask === 0) ||
this._isKeyvalForbidden(keyval))
return false;
}
return true;
}
/**
* Checks, if the given keyval is forbidden.
*
* @param {number} keyval The keyval number.
* @returns {boolean} `true` if the keyval is forbidden.
*/
_isKeyvalForbidden(keyval) {
const forbiddenKeyvals = [
Gdk.KEY_Home,
Gdk.KEY_Page_Up,
Gdk.KEY_Page_Down,
Gdk.KEY_End,
Gdk.KEY_Tab,
Gdk.KEY_KP_Enter,
Gdk.KEY_Return,
Gdk.KEY_Mode_switch,
];
return forbiddenKeyvals.includes(keyval);
}
});

View File

@ -0,0 +1,147 @@
import GLib from 'gi://GLib';
import {TileWindowManager} from './tileWindowManager.js';
export var resizeSourceId = null;
/** Resize Tile with size of rect in the East
*
* @param {Tile} tile
* @param {Mtk.Rectangle} rect
* @returns
*/
export function resizeE(tile, rect) {
if (!tile.adjacents[1]) {
if (resizeSourceId !== null)
GLib.Source.remove(resizeSourceId);
resizeSourceId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
TileWindowManager.getMonitors()[tile.monitor].root?.update();
resizeSourceId = null;
return GLib.SOURCE_REMOVE;
});
return;
}
let p = tile.findParent(el => el.position.x + el.position.width === tile.position.x + tile.position.width);
if (p) {
let pos = p.position;
let diff = rect.width - tile.position.width;
pos.width += diff;
p.resize(pos);
p.update();
let sibling = p.getSibling();
if (sibling) {
let posSib = sibling.position;
posSib.width -= diff;
posSib.x += diff;
sibling.resize(posSib);
sibling.update();
}
if (p.parent && p.parent.child2)
p.parent.position.splitProportion = 0.5 * (p.parent.position.width - p.parent.child2.position.width) / p.parent.child2.position.width;
}
}
/** Resize Tile with size of rect in the West
*
* @param {Tile} tile
* @param {Mtk.Rectangle} rect
* @returns
*/
export function resizeW(tile, rect) {
if (!tile.adjacents[0]) {
if (resizeSourceId !== null)
GLib.Source.remove(resizeSourceId);
resizeSourceId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
TileWindowManager.getMonitors()[tile.monitor].root?.update();
resizeSourceId = null;
return GLib.SOURCE_REMOVE;
});
return;
}
let p = tile.findParent(el => el.position.x === tile.position.x);
if (p) {
let pos = p.position;
let diff = rect.width - tile.position.width;
pos.width += diff;
pos.x -= diff;
p.resize(pos);
p.update();
let sibling = p.getSibling();
if (sibling) {
let posSib = sibling.position;
posSib.width -= diff;
sibling.resize(posSib);
sibling.update();
}
if (p.parent && p.parent.child2)
p.parent.position.splitProportion = 0.5 * (p.parent.position.width - p.parent.child2.position.width) / p.parent.child2.position.width;
}
}
/** Resize Tile with size of rect in the South
*
* @param {Tile} tile
* @param {Mtk.Rectangle} rect
* @returns
*/
export function resizeS(tile, rect) {
if (!tile.adjacents[3]) {
if (resizeSourceId !== null)
GLib.Source.remove(resizeSourceId);
resizeSourceId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
TileWindowManager.getMonitors()[tile.monitor].root?.update();
resizeSourceId = null;
return GLib.SOURCE_REMOVE;
});
return;
}
let p = tile.findParent(el => el.position.y + el.position.height === tile.position.y + tile.position.height);
if (p) {
let pos = p.position;
let diff = rect.height - pos.height;
pos.height = rect.height;
p.resize(pos);
p.update();
let sibling = p.getSibling();
if (sibling) {
let posSib = sibling.position;
posSib.height -= diff;
posSib.y += diff;
sibling.resize(posSib);
sibling.update();
}
if (p.parent && p.parent.child2)
p.parent.position.splitProportion = 0.5 * (p.parent.position.height - p.parent.child2.position.height) / p.parent.child2.position.height;
}
}
/** Resize Tile with size of rect in the North
*
* @param {Tile} tile
* @param {Mtk.Rectangle} rect
* @returns
*/
export function resizeN(tile, rect) {
if (!tile.adjacents[2]) {
if (resizeSourceId !== null)
GLib.Source.remove(resizeSourceId);
resizeSourceId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
TileWindowManager.getMonitors()[tile.monitor].root?.update();
resizeSourceId = null;
return GLib.SOURCE_REMOVE;
});
return;
}
let p = tile.findParent(el => el.position.y === tile.position.y);
if (p) {
let pos = p.position;
let diff = rect.height - pos.height;
pos.height += diff;
pos.y -= diff;
p.resize(pos);
p.update();
let sibling = p.getSibling();
if (sibling) {
let posSib = sibling.position;
posSib.height -= diff;
sibling.resize(posSib);
sibling.update();
}
if (p.parent && p.parent.child2)
p.parent.position.splitProportion = 0.5 * (p.parent.position.height - p.parent.child2.position.height) / p.parent.child2.position.height;
}
}

View File

@ -0,0 +1,194 @@
<?xml version="1.0" encoding="utf-8"?>
<schemalist>
<schema id="org.gnome.shell.extensions.grimble" path="/org/gnome/shell/extensions/grimble/">
<key name="header-bar" type="b">
<default>false</default>
<summary>Header bar</summary>
<description>Whether to show or hide window header bar</description>
</key>
<key name="tile-padding" type="i">
<default>0</default>
<summary>Tile padding</summary>
<description>Set tile padding</description>
</key>
<key name="tile-insertion-behavior" type="i">
<!-- 0: best-fit, 1: Focus -->
<default>0</default>
</key>
<key name="monitor-tile-insertion-behavior" type="i">
<!-- 0: best-fit, 1: Focus -->
<default>0</default>
</key>
<key name="search-entry-position" type="i">
<!-- 0: left, 1: center, 2: right -->
<default>0</default>
</key>
<key name="fullscreen-switch" type="i">
<!-- 0: keep fullscreen, 1: quit fullscrenn -->
<default>0</default>
</key>
<key name="keybinding-config" type="s">
<default>'None'</default>
<summary>Window manager configuration</summary>
<description>Stores which configuration to use (None, i3, Grimble, Custom).</description>
</key>
<key name="keybinding-rotation" type="as">
<default>[]</default>
<summary>Tile roration</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-resize" type="as">
<default>[]</default>
<summary>Resize tile</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-close" type="as">
<default>[]</default>
<summary>Close tile</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-search" type="as">
<default>[]</default>
<summary>Search bar</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-open-settings" type="as">
<default><![CDATA[['<Control><Super>g']]]></default>
<summary>Grimble settings</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-maximize" type="as">
<default>[]</default>
<summary>Maximize</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-refresh" type="as">
<default>[]</default>
<summary>Refresh</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-move-left" type="as">
<default>[]</default>
<summary>Move Left</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-move-right" type="as">
<default>[]</default>
<summary>Move Right</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-move-top" type="as">
<default>[]</default>
<summary>Move Top</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-move-bottom" type="as">
<default>[]</default>
<summary>Move Bottom</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-move" type="as">
<default>[]</default>
<summary>Move</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-focus" type="as">
<default>[]</default>
<summary>Change focus</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-focus-left" type="as">
<default>[]</default>
<summary>Change focus left</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-focus-right" type="as">
<default>[]</default>
<summary>Change focus right</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-focus-top" type="as">
<default>[]</default>
<summary>Change focus top</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-focus-bottom" type="as">
<default>[]</default>
<summary>Change focus bottom</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-resize-left" type="as">
<default>[]</default>
<summary>Resize</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-resize-right" type="as">
<default>[]</default>
<summary>Resize</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-resize-top" type="as">
<default>[]</default>
<summary>Resize</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-resize-bottom" type="as">
<default>[]</default>
<summary>Resize</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-next-monitor" type="as">
<default>[]</default>
<summary>Next monitor</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-next-workspace" type="as">
<default>[]</default>
<summary>Next Workspace</summary>
<description>Custom shortcut</description>
</key>
<key name="keybinding-previous-workspace" type="as">
<default>[]</default>
<summary>Previous Workspace</summary>
<description>Custom shortcut</description>
</key>
<!-- Default keybindings -->
<key name="arrow-up" type="as">
<default><![CDATA[['Up']]]></default>
<summary>Arrow Up action</summary>
<description>Triggered when pressing Super+Up</description>
</key>
<key name="arrow-down" type="as">
<default><![CDATA[['Down']]]></default>
<summary>Arrow Down action</summary>
<description>Triggered when pressing Super+Down</description>
</key>
<key name="arrow-right" type="as">
<default><![CDATA[['Right']]]></default>
<summary>Arrow Up action</summary>
<description>Triggered when pressing Super+Up</description>
</key>
<key name="arrow-left" type="as">
<default><![CDATA[['Left']]]></default>
<summary>Arrow Down action</summary>
<description>Triggered when pressing Super+Down</description>
</key>
<key name="key-escape" type="as">
<default><![CDATA[['Escape']]]></default>
<summary>Escape action</summary>
<description>Triggered when pressing Super+Down</description>
</key>
</schema>
</schemalist>

View File

@ -0,0 +1,83 @@
import {Combo, Shortcut} from '../common.js';
import {loadConfiguration, saveConfiguration} from '../utils.js';
import GLib from 'gi://GLib';
export default class ComboRowHandler {
_combos;
_windowManager;
constructor(windowManager, extension) {
this._windowManager = windowManager;
this._combos = Combo.getCombo();
this._combos.forEach(({key}) => {
extension._settings?.connect(`changed::${key}`, () => this._onComboChanged(key, extension));
});
}
_onComboChanged(key, extension) {
const shortcuts = Shortcut.getShortcuts();
switch (key) {
case 'keybinding-config':
if (extension.metadata && extension._settings?.get_string('keybinding-config')) {
let conf = extension._settings?.get_string('keybinding-config');
if (conf === 'i3') {
loadConfiguration(`${extension.path}/configs/i3.json`, c => {
if (extension._settings) {
for (const p of shortcuts) {
if (c[p])
extension._settings.set_strv(p, [c[p]]);
else
extension._settings.set_strv(p, []);
}
}
}, () => { });
} else if (conf === 'Grimble') {
loadConfiguration(`${extension.path}/configs/grimble.json`, c => {
if (extension._settings) {
for (const p of shortcuts) {
if (c[p])
extension._settings.set_strv(p, [c[p]]);
else
extension._settings.set_strv(p, []);
}
}
}, () => { });
} else if (conf === 'None') {
loadConfiguration(`${extension.path}/configs/default.json`, c => {
if (extension._settings) {
for (const p of shortcuts) {
if (c[p])
extension._settings.set_strv(p, [c[p]]);
else
extension._settings.set_strv(p, []);
}
}
}, () => { });
} else if (conf === 'Custom') {
const userPath = GLib.get_user_config_dir();
let o = {};
for (const p of shortcuts)
o[p] = extension._settings.get_strv(p) ?? [];
loadConfiguration(`${userPath}/grimble/config/custom.json`, c => {
if (extension._settings) {
for (const p of shortcuts) {
if (c[p])
extension._settings.set_strv(p, c[p]);
else
extension._settings.set_strv(p, []);
}
}
}, () => {
saveConfiguration('custom.json', o);
});
}
}
break;
default:
break;
}
}
}

View File

@ -0,0 +1,197 @@
/**
* © gnome-shell-extension-tiling-assistant
* Source: https://git.launchpad.net/ubuntu/+source/gnome-shell-extension-tiling-assistant/tree/tiling-assistant@leleat-on-github/src/prefs/shortcutListener.js
*
* This code is partially reused from Ubuntu tiling assistant extension (GPL-2.0).
*
* enableArrowBinding and disableArrowBinding are new methods.
* Other methods are modified for our use case.
*/
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import Meta from 'gi://Meta';
import Shell from 'gi://Shell';
import GLib from 'gi://GLib';
import {Shortcut} from '../common.js';
import {Direction} from '../tileWindowManager.js';
const MAX_RESIZE_GAP = 50;
const MIN_RESIZE_GAP = 10;
/**
* Class to handle the keyboard shortcuts (on the extension side) except the
* ones related to the Layouts. For those, see layoutsManager.js.
*/
export default class KeybindingHandler {
_keyBindings;
_windowManager;
_extensionObject = null;
_settings;
_waitingAction;
_enableArrow = false;
_prevArrowTyped;
constructor(windowManager, extension) {
this._extensionObject = extension;
this._settings = extension.getSettings();
this._windowManager = windowManager;
this._prevArrowTyped = [Direction.North, 0];
this._keyBindings = Shortcut.getShortcuts();
this._keyBindings.forEach(key => {
Main.wm.addKeybinding(key, this._settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, Shell.ActionMode.NORMAL, this._onCustomKeybindingPressed.bind(this, key));
});
}
destroy() {
this._keyBindings.forEach(key => Main.wm.removeKeybinding(key));
this.disableArrowBinding();
}
enableArrowBinding() {
let bindings = ['arrow-up', 'arrow-down', 'arrow-left', 'arrow-right', 'key-escape'];
bindings.forEach(key => {
Main.wm.addKeybinding(key, this._settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, Shell.ActionMode.NORMAL, this._onCustomKeybindingPressed.bind(this, key));
});
}
disableArrowBinding() {
let bindings = ['arrow-up', 'arrow-down', 'arrow-left', 'arrow-right', 'key-escape'];
bindings.forEach(key => Main.wm.removeKeybinding(key));
}
compute_gap(direction) {
const t = GLib.get_real_time();
const dir = this._prevArrowTyped[0];
const time = Math.min(Math.max(t - this._prevArrowTyped[1], 150000), 300000) - 150000;
this._prevArrowTyped = [direction, t];
let gap = dir === direction
? MAX_RESIZE_GAP - ((time * (MAX_RESIZE_GAP - MIN_RESIZE_GAP) / 150000))
: MIN_RESIZE_GAP;
return gap;
}
/**
* @param {string} shortcutName
*/
_onCustomKeybindingPressed(shortcutName) {
switch (shortcutName) {
case 'keybinding-close':
global.display.get_focus_window().delete(global.get_current_time());
break;
case 'keybinding-open-settings':
this._extensionObject?.openPreferences();
break;
case 'keybinding-rotation':
this._windowManager.rotateWindow(global.display.get_focus_window());
break;
case 'keybinding-maximize':
this._windowManager.maximizeTile(global.display.get_focus_window());
break;
case 'keybinding-search':
this._windowManager.createSearchBar();
break;
case 'keybinding-refresh':
// Unused
this._windowManager.refresh();
break;
case 'keybinding-move-left':
this._windowManager.moveTile(Direction.West);
break;
case 'keybinding-move-right':
this._windowManager.moveTile(Direction.East);
break;
case 'keybinding-move-top':
this._windowManager.moveTile(Direction.North);
break;
case 'keybinding-move-bottom':
this._windowManager.moveTile(Direction.South);
break;
case 'keybinding-move':
this._waitingAction = shortcutName;
this.enableArrowBinding();
break;
case 'keybinding-resize':
this._waitingAction = shortcutName;
this.enableArrowBinding();
break;
case 'keybinding-resize-left':
this._windowManager.resizeFocusedWindow(Meta.GrabOp.RESIZING_W);
break;
case 'keybinding-resize-right':
this._windowManager.resizeFocusedWindow(Meta.GrabOp.RESIZING_E);
break;
case 'keybinding-resize-top':
this._windowManager.resizeFocusedWindow(Meta.GrabOp.RESIZING_N);
break;
case 'keybinding-resize-bottom':
this._windowManager.resizeFocusedWindow(Meta.GrabOp.RESIZING_S);
break;
case 'keybinding-focus':
this._waitingAction = shortcutName;
this.enableArrowBinding();
break;
case 'keybinding-focus-left':
this._windowManager.changeFocus(Direction.West);
break;
case 'keybinding-focus-right':
this._windowManager.changeFocus(Direction.East);
break;
case 'keybinding-focus-top':
this._windowManager.changeFocus(Direction.North);
break;
case 'keybinding-focus-bottom':
this._windowManager.changeFocus(Direction.South);
break;
case 'keybinding-next-workspace':
this._windowManager.moveToWorkspace(true);
break;
case 'keybinding-previous-workspace':
this._windowManager.moveToWorkspace(false);
break;
case 'keybinding-next-monitor':
this._windowManager.moveToNextMonitor();
break;
case 'arrow-up':
if (this._waitingAction === 'keybinding-move') {
this._windowManager.moveTile(Direction.North);
this.disableArrowBinding();
} else if (this._waitingAction === 'keybinding-resize') {
this._windowManager.resizeFocusedWindow(Meta.GrabOp.RESIZING_N, this.compute_gap(Direction.North));
} else if (this._waitingAction === 'keybinding-focus') {
this._windowManager.changeFocus(Direction.North);
}
break;
case 'arrow-down':
if (this._waitingAction === 'keybinding-move') {
this._windowManager.moveTile(Direction.South);
this.disableArrowBinding();
} else if (this._waitingAction === 'keybinding-resize') {
this._windowManager.resizeFocusedWindow(Meta.GrabOp.RESIZING_S, this.compute_gap(Direction.South));
} else if (this._waitingAction === 'keybinding-focus') {
this._windowManager.changeFocus(Direction.South);
}
break;
case 'arrow-left':
if (this._waitingAction === 'keybinding-move') {
this._windowManager.moveTile(Direction.West);
this.disableArrowBinding();
} else if (this._waitingAction === 'keybinding-resize') {
this._windowManager.resizeFocusedWindow(Meta.GrabOp.RESIZING_W, this.compute_gap(Direction.West));
} else if (this._waitingAction === 'keybinding-focus') {
this._windowManager.changeFocus(Direction.West);
}
break;
case 'arrow-right':
if (this._waitingAction === 'keybinding-move') {
this._windowManager.moveTile(Direction.East);
this.disableArrowBinding();
} else if (this._waitingAction === 'keybinding-resize') {
this._windowManager.resizeFocusedWindow(Meta.GrabOp.RESIZING_E, this.compute_gap(Direction.East));
} else if (this._waitingAction === 'keybinding-focus') {
this._windowManager.changeFocus(Direction.East);
}
break;
case 'key-escape':
this.disableArrowBinding();
break;
default:
break;
}
}
}

View File

@ -0,0 +1,26 @@
import {Spin} from '../common.js';
import {Tile} from '../tile.js';
export default class SpinHandler {
_spins;
_windowManager;
constructor(windowManager, extension) {
this._windowManager = windowManager;
this._spins = Spin.getSpins();
this._spins.forEach(key => {
extension._settings?.connect(`changed::${key}`, () => this._onSwitchChanged(key, extension));
});
}
_onSwitchChanged(key, extension) {
switch (key) {
case 'tile-padding':
if (extension.metadata && extension._settings?.get_int('tile-padding')) {
Tile.padding = extension._settings.get_int('tile-padding');
this._windowManager.updateMonitors();
}
break;
default:
break;
}
}
}

View File

@ -0,0 +1,28 @@
import {Switches} from '../common.js';
import {enableWindowTheme} from '../theme.js';
export default class SwitchHandler {
_switchs;
_windowManager;
constructor(windowManager, extension) {
this._windowManager = windowManager;
this._switchs = Switches.getSwitches();
this._switchs.forEach(key => {
extension._settings?.connect(`changed::${key}`, () => this._onSwitchChanged(key, extension));
});
}
_onSwitchChanged(key, extension) {
switch (key) {
case 'header-bar':
if (extension.metadata && extension._settings?.get_boolean('header-bar'))
enableWindowTheme();
else if (extension.metadata)
enableWindowTheme();
break;
default:
break;
}
}
}

View File

@ -0,0 +1,19 @@
.custom-search-entry {
min-width: 180px;
border-radius: 6px;
padding-top: 0;
padding-bottom: 0;
margin: 0;
border-width: 0;
background-color: rgba(255,255,255,0.15);
color: white;
}
.suggestion {
min-width: 180px;
border-radius: 6px;
padding-top: 0;
padding-bottom: 0;
margin: 0;
border-width: 0;
}

View File

@ -0,0 +1,29 @@
import Gio from 'gi://Gio';
export var originalLayout;
export var originalTiling;
export var originalTheme;
/** Modify gnome settings for Grimble
*
*/
export function enableWindowTheme() {
let settings = new Gio.Settings({schema: 'org.gnome.desktop.wm.preferences'});
// originalLayout = settings.get_string('button-layout');
settings.set_string('button-layout', ':');
settings = new Gio.Settings({schema: 'org.gnome.mutter'});
// originalTiling = settings.get_boolean('edge-tiling');
settings.set_boolean('edge-tiling', false);
settings = new Gio.Settings({schema: 'org.gnome.mutter'});
// originalTiling = settings.get_boolean('workspaces-only-on-primary');
settings.set_boolean('workspaces-only-on-primary', false);
}
/** Reset Gnome settings
*
*/
export function disableWindowTheme() {
let settings = new Gio.Settings({schema: 'org.gnome.desktop.wm.preferences'});
settings.reset('button-layout');
settings = new Gio.Settings({schema: 'org.gnome.mutter'});
settings.reset('edge-tiling');
settings = new Gio.Settings({schema: 'org.gnome.mutter'});
settings.reset('workspaces-only-on-primary');
}

View File

@ -0,0 +1,411 @@
import {Position} from './position.js';
import Meta from 'gi://Meta';
import {Direction, TileWindowManager} from './tileWindowManager.js';
import GLib from 'gi://GLib';
export var Orientation;
(function (Orientation) {
Orientation[Orientation['Vertical'] = 1] = 'Vertical';
Orientation[Orientation['Horizontal'] = 2] = 'Horizontal';
Orientation[Orientation['None'] = 3] = 'None';
})(Orientation || (Orientation = {}));
export var TileState;
(function (TileState) {
TileState[TileState['DEFAULT'] = 0] = 'DEFAULT';
TileState[TileState['MINIMIZED'] = 1] = 'MINIMIZED';
TileState[TileState['MAXIMIZED'] = 2] = 'MAXIMIZED';
TileState[TileState['ALONE_MAXIMIZED'] = 3] = 'ALONE_MAXIMIZED';
})(TileState || (TileState = {}));
export class Tile {
id;
_leaf;
_parent;
_child1;
_child2;
_position;
_window;
_state;
_orientation;
_updateSource;
_workspace;
_nr_tiles;
_monitor;
_adjacents;
static padding = 0;
static id_count = 0;
static fullscreen;
constructor() {
this.id = Tile.id_count++;
this._position = new Position();
this._window = null;
this._state = TileState.DEFAULT;
this._leaf = true;
this._parent = null;
this._child1 = null;
this._child2 = null;
this._orientation = Orientation.None;
this._nr_tiles = 0;
this._workspace = 0;
this._updateSource = null;
// west / east / north / south
this._adjacents = [false, false, false, false];
}
/** Tile factory
*
* @param {Meta.Window} window
* @param {Position} position
* @param {number} monitor
* @param {Tile | null} parent
* @returns
*/
static createTileLeaf(window, position, monitor, parent = null) {
let tile = new Tile();
tile._window = window;
tile._position = position;
tile._monitor = monitor;
tile._parent = parent;
tile._leaf = true;
tile._nr_tiles = 1;
tile._workspace = 0;
tile.findAdjacents();
return tile;
}
decrementTiles() {
this._nr_tiles--;
if (this._parent)
this._parent.decrementTiles();
}
addWindowOnBlock(window) {
if (this.leaf) {
if (!this._window)
throw new Error('A leaf must have a window');
let newPositions = this._position.split();
let c1 = Tile.createTileLeaf(this._window, newPositions[0], this.monitor, this);
c1._state = this._state;
this._window.tile = c1;
let c2 = Tile.createTileLeaf(window, newPositions[1], this.monitor, this);
window.tile = c2;
this._window = null;
this._leaf = false;
this._child1 = c1;
this._child2 = c2;
this._nr_tiles++;
this._orientation = this._position.width > this._position.height
? Orientation.Horizontal : Orientation.Vertical;
c1.findAdjacents();
c2.findAdjacents();
} else if (this._child1 && this._child2) {
if (this._child1?._nr_tiles > this._child2?._nr_tiles)
this._child2.addWindowOnBlock(window);
else
this._child1.addWindowOnBlock(window);
this._nr_tiles++;
} else {
throw new Error('Unexpected state to add window');
}
}
removeTile() {
if (this._window == null || this._child1 || this._child2 || !this._leaf)
throw new Error('Invalid remove state');
let parent = this._parent;
if (!parent)
return null;
if (parent._child1 === this && parent._child2) {
parent._leaf = parent._child2._leaf;
parent._orientation = parent._child2._orientation;
parent._window = parent._child2._window;
parent._child1 = parent._child2._child1;
parent._child2 = parent._child2._child2;
} else if (parent._child2 === this && parent._child1) {
parent._leaf = parent._child1._leaf;
parent._orientation = parent._child1._orientation;
parent._window = parent._child1._window;
parent._child2 = parent._child1._child2;
parent._child1 = parent._child1._child1;
} else {
return this;
}
if (parent._child1)
parent._child1._parent = parent;
if (parent._child2)
parent._child2._parent = parent;
if (parent._window)
parent._window.tile = parent;
parent.resize(parent._position);
parent.decrementTiles();
return parent;
}
/** Update tile position and its children size
*
* @param {Position} position
*/
resize(position) {
this._position = position;
if (!this._window) {
let newPositions = this._position.split(this._orientation);
this._child1?.resize(newPositions[this._child1.position.index]);
this._child2?.resize(newPositions[this._child2.position.index]);
}
}
forEach(fn) {
fn(this);
this._child1?.forEach(fn);
this._child2?.forEach(fn);
}
update() {
if (this._window) {
if (!this._window.isAlive)
return;
if (this._state === TileState.MAXIMIZED) {
this._window?._originalMaximize(Meta.MaximizeFlags.BOTH);
return;
} else if (this._state === TileState.MINIMIZED) {
this._window?._originalMinimize();
return;
}
if (this._window.minimized)
this._window.unminimize();
if (this._position.proportion === 1) {
this.state = TileState.ALONE_MAXIMIZED;
if (this._window.maximized_horizontally || this._window.maximized_vertically)
this._window.unmaximize(Meta.MaximizeFlags.BOTH);
const workspc = this._window.get_workspace();
const area = workspc?.get_work_area_for_monitor(this._monitor ? this._monitor : 0);
if (!area)
return;
this._position.x = 0;
this._position.y = 0;
this._position.width = area.width;
this._position.height = area.height;
this._window?.move_resize_frame(true, area.x + this._position.x + (this._adjacents[0] ? Tile.padding / 2 : Tile.padding), area.y + this._position.y + (this._adjacents[2] ? Tile.padding / 2 : Tile.padding), this._position.width - (this._adjacents[1] ? Tile.padding * 1.5 : Tile.padding * 2), this._position.height - (this._adjacents[3] ? Tile.padding * 1.5 : Tile.padding * 2));
if (this._updateSource !== null)
GLib.Source.remove(this._updateSource);
this._updateSource = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
this._window?.move_frame(true, area.x + this._position.x + (this._adjacents[0] ? Tile.padding / 2 : Tile.padding), area.y + this._position.y + (this._adjacents[2] ? Tile.padding / 2 : Tile.padding));
this._updateSource = null;
return GLib.SOURCE_REMOVE;
});
} else {
this.state = TileState.DEFAULT;
if (this._window.maximized_horizontally || this._window.maximized_vertically)
this._window.unmaximize(Meta.MaximizeFlags.BOTH);
const workspc = this._window.get_workspace();
const area = workspc?.get_work_area_for_monitor(this._monitor ? this._monitor : 0);
if (!area)
return;
this._window?.move_resize_frame(true, area.x + this._position.x + (this._adjacents[0] ? Tile.padding / 2 : Tile.padding), area.y + this._position.y + (this._adjacents[2] ? Tile.padding / 2 : Tile.padding), this._position.width - (this._adjacents[1] ? Tile.padding * 1.5 : Tile.padding * 2), this._position.height - (this._adjacents[3] ? Tile.padding * 1.5 : Tile.padding * 2));
if (this._updateSource !== null)
GLib.Source.remove(this._updateSource);
this._updateSource = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
this._window?.move_frame(true, area.x + this._position.x + (this._adjacents[0] ? Tile.padding / 2 : Tile.padding), area.y + this._position.y + (this._adjacents[2] ? Tile.padding / 2 : Tile.padding));
this._updateSource = null;
return GLib.SOURCE_REMOVE;
});
}
} else {
this._child1?.update();
this._child2?.update();
}
}
/** Leaf to root research
*
* @param {(el : Tile) => boolean} fn
* @returns
*/
findParent(fn) {
if (fn(this)) {
if (!this._parent)
return this;
let res = this._parent.findParent(fn);
if (res)
return res;
else
return this;
} else {
return null;
}
}
/** Classic recursive traversal on tree
*
* @param {(el : Tile) => boolean} fn
* @returns
*/
find(fn) {
if (fn(this)) {
return this;
} else {
let r1 = this.child1?.find(fn);
if (r1)
return r1;
let r2 = this.child2?.find(fn);
if (r2)
return r2;
return null;
}
}
getSibling() {
if (this === this?._parent?._child1)
return this?._parent?._child2;
else if (this === this?._parent?._child2)
return this?._parent?._child1;
else
return null;
}
contains(window) {
if (this._window?.get_id() === window.get_id())
return true;
return !!(this.child1?.contains(window) || this.child2?.contains(window));
}
addToChild() {
if (this._child1 && this._child2) {
this._child1.parent = this;
this._child2.parent = this;
this._child1.addToChild();
this._child2.addToChild();
}
}
static fromObject(obj, parent = null) {
let tile = new Tile();
if (obj._child1 && obj._child2)
tile.setChild(Tile.fromObject(obj._child1, tile), Tile.fromObject(obj._child2, tile));
tile.position = Position.fromObject(obj._position);
tile.state = obj._state;
tile.leaf = obj._leaf;
tile.orientation = obj._orientation;
tile.monitor = obj._monitor;
tile.nr_tiles = obj._nr_tiles;
tile.window = obj._window;
tile.adjacents = obj._adjacents;
tile.workspace = obj._workspace;
if (parent)
tile.parent = parent;
if (tile.window)
tile.window.tile = tile;
return tile;
}
findAdjacents() {
let _monitor = TileWindowManager.getMonitors()[this.monitor];
let w = _monitor.closestTile(this, Direction.West);
let e = _monitor.closestTile(this, Direction.East);
let n = _monitor.closestTile(this, Direction.North);
let s = _monitor.closestTile(this, Direction.South);
this._adjacents = [w !== null, e !== null, n !== null, s !== null];
}
setChild(child1, child2) {
this._child1 = child1;
this._child2 = child2;
}
destroy() {
if (this._updateSource !== null)
GLib.Source.remove(this._updateSource);
this._updateSource = null;
this._window = null;
}
/** *********************/
/* GETTERS AND SETTERS */
set orientation(o) {
this._orientation = o;
}
get orientation() {
return this._orientation;
}
set parent(p) {
this._parent = p;
}
get parent() {
return this._parent;
}
get nr_tiles() {
return this._nr_tiles;
}
set nr_tiles(n) {
this._nr_tiles = n;
}
get child1() {
return this._child1;
}
get child2() {
return this._child2;
}
set position(pos) {
this._position = pos;
}
get position() {
return this._position;
}
set window(w) {
this._window = w;
}
get window() {
return this._window;
}
set state(value) {
this._state = value;
}
get state() {
return this._state;
}
set monitor(m) {
this._monitor = m;
}
get monitor() {
return this._monitor ? this._monitor : 0;
}
get adjacents() {
return this._adjacents;
}
set adjacents(adj) {
this._adjacents = adj;
}
set workspace(w) {
this._workspace = w;
}
get workspace() {
return this._workspace;
}
get leaf() {
return this._leaf;
}
set leaf(b) {
this._leaf = b;
}
}

View File

@ -0,0 +1,931 @@
import Meta from 'gi://Meta';
import GLib from 'gi://GLib';
import {Orientation, Tile, TileState} from './tile.js';
import {Position} from './position.js';
import * as Resize from './resize.js';
import Gio from 'gi://Gio';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import {Monitor} from './monitor.js';
import Shell from 'gi://Shell';
import Mtk from 'gi://Mtk';
import {TopBarSearchEntry} from './topBarSearchEntry.js';
export var Direction;
(function (Direction) {
Direction[Direction['North'] = 1] = 'North';
Direction[Direction['South'] = 2] = 'South';
Direction[Direction['West'] = 3] = 'West';
Direction[Direction['East'] = 4] = 'East';
})(Direction || (Direction = {}));
export class TileWindowManager {
/** ************************************************/
// Store all signals to be restored when extension is disabled
_wrappedWindows;
_nMonitors;
_windowCreatedSignal;
_windowGrabSignal;
_workspaceAddedSignal;
_workspaceRemovedSignal;
_activeWorkspaceSignal;
_grabBeginSignal;
_monitorChangedSignal;
_workareasChangedSignal;
/** ************************************************/
_settings;
_userResize;
static locked = false;
// Alternate windows rotation
static rotateEven = [0, 0];
// Search bar widgets
_topBarSearchEntry;
_modalSearchEntry;
_sourceId;
// Tiles structures
static _workspaces = new Map();
static _main_monitor;
constructor(extension) {
if (!TileWindowManager._workspaces)
TileWindowManager._workspaces = new Map();
TileWindowManager._main_monitor = global.display.get_primary_monitor();
this._settings = extension._settings;
this._nMonitors = global.display.get_n_monitors();
for (let i = 0; i < global.workspace_manager.n_workspaces; i++) {
let _monitors = new Array(this._nMonitors);
for (let j = 0; j < _monitors.length; j++)
_monitors[j] = new Monitor(j);
TileWindowManager._workspaces.set(i, _monitors);
}
this._wrappedWindows = new Map();
this._userResize = new Set();
this._sourceId = null;
if (TileWindowManager.locked)
this._loadAfterSessionLock();
global.get_window_actors().forEach(actor => {
if (actor.meta_window &&
actor.meta_window.get_window_type() === Meta.WindowType.NORMAL)
this._addNewWindow(actor.meta_window);
});
this.updateMonitors();
this._windowCreatedSignal = global.display.connect('window-created', (display, obj) => this._onWindowCreated(display, obj));
this._workareasChangedSignal = global.display.connect('workareas-changed', () => {
TileWindowManager._workspaces.forEach(val => {
val.forEach(m => m.updateSize());
});
this.updateMonitors();
});
this._grabBeginSignal = global.display.connect('grab-op-begin', (_, w) => this._userResize.add(w));
this._windowGrabSignal = global.display.connect('grab-op-end', (_, window, op) => {
this._onGrab(window, op);
this._userResize.delete(window);
});
this._workspaceAddedSignal = global.workspace_manager.connect('workspace-added', (_, index) => {
this._onWorkspaceCreated(index);
});
this._workspaceRemovedSignal = global.workspace_manager.connect('workspace-removed', (_, index) => {
this._onWorkspaceRemoved(index);
});
this._activeWorkspaceSignal = global.workspace_manager.connect('active-workspace-changed', () => {
this.updateMonitors();
this.updateAdjacents();
});
this._monitorChangedSignal = global.backend.get_monitor_manager().connect('monitors-changed', () => {
const n = global.display.get_n_monitors();
if (n !== this._nMonitors) {
let diff = n - this._nMonitors;
this._nMonitors = n;
if (diff > 0)
this._addMonitors();
else
this._removeMonitors();
}
});
}
static getMonitors(workspaceIndex = undefined) {
let wk;
if (!workspaceIndex)
wk = TileWindowManager._workspaces.get(global.workspace_manager.get_active_workspace_index());
else
wk = TileWindowManager._workspaces.get(workspaceIndex);
if (wk)
return wk;
else
return [];
}
_addMonitors() {
let newPrimMonitor = global.display.get_primary_monitor();
TileWindowManager._workspaces.forEach((val, _, __) => {
let currPrim = null;
if (newPrimMonitor !== TileWindowManager._main_monitor)
currPrim = val.filter(e => e.index === TileWindowManager._main_monitor)[0];
while (val.length !== this._nMonitors) {
const index = val.length;
val.push(new Monitor(index));
// Move content on the new primary screen
if (index === newPrimMonitor) {
val[index].fullscreen = currPrim?.fullscreen ?? false;
val[index].root = currPrim?.root ?? null;
val[index].root?.forEach(el => {
el.monitor = index;
});
if (currPrim?.fullscreen)
currPrim.fullscreen = false;
if (currPrim?.root)
currPrim.root = null;
}
}
});
TileWindowManager._main_monitor = newPrimMonitor;
}
_removeMonitors() {
TileWindowManager._workspaces.forEach((val, _, __) => {
let windows = [];
while (val.length !== this._nMonitors)
windows.push(val.pop());
for (let i = 0; i < windows.length; i++) {
windows[i]?.root?.forEach(t => {
if (t.window)
this._insertWindow(t.window, null, 0);
});
}
});
TileWindowManager._main_monitor = global.display.get_primary_monitor();
this.updateMonitors();
this.updateAdjacents();
}
/**
* Refresh **ALL** existing tiles.
*/
updateMonitors() {
TileWindowManager._workspaces.forEach((value, _) => {
value.forEach(el => el.root?.update());
});
}
updateAdjacents() {
TileWindowManager._workspaces.forEach((value, _) => {
value.forEach(el => el.root?.forEach(t => t.findAdjacents()));
});
}
destroy() {
global.display.disconnect(this._windowCreatedSignal);
global.display.disconnect(this._windowGrabSignal);
global.display.disconnect(this._grabBeginSignal);
global.display.disconnect(this._workareasChangedSignal);
global.workspace_manager.disconnect(this._workspaceAddedSignal);
global.workspace_manager.disconnect(this._workspaceRemovedSignal);
global.workspace_manager.disconnect(this._activeWorkspaceSignal);
global.backend.disconnect(this._monitorChangedSignal);
if (Resize.resizeSourceId !== null)
GLib.Source.remove(Resize.resizeSourceId);
// Disconnect each window
this._wrappedWindows.forEach((value, key) => {
key.minimize = value[0];
key.maximize = value[1];
key.disconnect(value[2]);
key.disconnect(value[3]);
key.disconnect(value[4]);
key.disconnect(value[5]);
key.disconnect(value[6]);
key.disconnect(value[7]);
this._wrappedWindows.delete(key);
});
this._wrappedWindows.clear();
this._topBarSearchEntry?.destroy();
TileWindowManager._main_monitor = null;
TileWindowManager._workspaces = null;
}
/** Check if the window is a `valid` window.
* A `valid` window is a window created by user and
* running an app.
* It is tricky to filter windows correctly. Here we exclude
* windows that don't have app id (the id is just the app number).
* This method must be called when we're sure the window is **fully**
* created (basically when wait for first-frame signal). Otherwise
* we may badly filter some windows.
*
* @param {Meta.Window} window
* @returns boolean
*/
_isValidWindow(window) {
if (!window)
return false;
if (window.get_window_type() !== Meta.WindowType.NORMAL)
return false;
let app = Shell.WindowTracker.get_default().get_window_app(window);
if (!app)
return false;
if (app.get_id().startsWith('window:'))
return false;
for (var [_, value] of TileWindowManager._workspaces) {
let containsWindow = value.reduce((acc, val) => val.root ? acc || val.root.contains(window) : acc, false);
if (containsWindow)
return false;
}
return true;
}
_onWorkspaceCreated(index) {
let _monitors = new Array(global.display.get_n_monitors());
for (let i = 0; i < _monitors.length; i++)
_monitors[i] = new Monitor(i);
if (!TileWindowManager._workspaces.has(index))
TileWindowManager._workspaces.set(index, _monitors);
}
_onWorkspaceRemoved(index) {
TileWindowManager._workspaces.delete(index);
let newMap = new Map();
TileWindowManager._workspaces.forEach((value, key) => {
if (key > index) {
value.forEach(el => el.root?.forEach(t => {
t.workspace = key - 1;
}));
newMap.set(key - 1, value);
} else {
newMap.set(key, value);
}
});
TileWindowManager._workspaces = newMap;
this.updateMonitors();
this.updateAdjacents();
}
_onWindowCreated(_, window) {
// Wait for first frame to be sure window is fully created
window.get_compositor_private().connect('first-frame', () => {
this._addNewWindow(window);
});
}
_windowWorkspaceChanged(window) {
let tile = window.tile;
if (tile) {
let w = window.get_workspace()?.index();
if (w !== null) {
window.change_workspace_by_index(w, false);
if (w !== window.tile.workspace) {
this._removeWindow(window);
this._insertWindow(window, w);
tile.workspace = w;
}
this.updateMonitors();
this.updateAdjacents();
}
}
}
/** Connect to signals and remove some functions
*
* @param {Meta.Window} window
*/
configureWindowSignals(window) {
let minimizeSignal = window.connect('notify::minimized', () => {
if (!window.minimized) {
let tile = window.tile;
if (tile.state === TileState.MINIMIZED) {
if (TileWindowManager.getMonitors()[tile.monitor].fullscreen) {
if (this._settings?.get_int('fullscreen-switch') === 0)
this.maximizeTile(window, true);
else
this.maximizeTile(window);
}
}
} else {
if (window.tile.state === TileState.MINIMIZED)
return;
window.unminimize();
}
});
let maximizeSignal1 = window.connect('notify::maximized-horizontally', () => {
if (window.tile.state === TileState.MAXIMIZED)
return;
if (window.maximized_horizontally || window.maximized_vertically)
window.unmaximize(Meta.MaximizeFlags.BOTH);
});
let maximizeSignal2 = window.connect('notify::maximized-vertically', () => {
if (window.tile.state === TileState.MAXIMIZED)
return;
if (window.maximized_horizontally || window.maximized_vertically)
window.unmaximize(Meta.MaximizeFlags.BOTH);
});
let unmanagedSignal = window.connect('unmanaged', () => {
this._removeWindow(window);
this._removeWindowSignals(window);
});
let workspaceChangedSignal = window.connect('workspace-changed', w => this._windowWorkspaceChanged(w));
let sizeChangedSignal = window.connect('size-changed', w => {
let tile = w.tile;
if (!this._userResize.has(w) &&
(tile.position.width !== w.get_frame_rect().width ||
tile.position.height !== w.get_frame_rect().height))
tile.update();
});
window._originalMaximize = window.maximize;
window._originalMinimize = window.minimize;
this._wrappedWindows.set(window, [window.minimize, window.maximize, minimizeSignal,
maximizeSignal1, maximizeSignal2,
unmanagedSignal, workspaceChangedSignal, sizeChangedSignal]);
window.minimize = () => { };
window.maximize = () => { };
}
_addNewWindow(window) {
if (!this._isValidWindow(window))
return;
this.configureWindowSignals(window);
this._insertWindow(window);
}
_insertWindow(window, workspace = null, monitor = null) {
let _monitors = TileWindowManager._workspaces.get(workspace != null ? workspace : window.get_workspace()?.index());
if (!_monitors)
return;
let selectedMonitor;
// Select monitor
if (monitor !== null) {
selectedMonitor = _monitors[monitor];
} else if (this._settings?.get_int('monitor-tile-insertion-behavior') === 0) {
selectedMonitor = Monitor.bestFitMonitor(_monitors);
} else {
let m = global.display.get_current_monitor();
selectedMonitor = _monitors[m];
}
// Selected monitor index
let index = selectedMonitor.index;
// Now insert tile on selected monitor
if (selectedMonitor.size() === 0) {
let tile = Tile.createTileLeaf(window, new Position(1.0, 0, 0, 0, 0), index);
tile.workspace = window.get_workspace().index();
window.tile = tile;
_monitors[index].root = tile;
_monitors[index].root?.update();
} else {
_monitors[index].root?.addWindowOnBlock(window);
window.tile.workspace = window.get_workspace().index();
if (_monitors[index].fullscreen)
window.tile.state = TileState.MINIMIZED;
_monitors[index].root?.update();
}
}
_removeWindowSignals(window) {
window.tile?.destroy();
// Disconnect signals
let s = this._wrappedWindows.get(window);
if (s) {
window.minimize = s[0];
window.maximize = s[1];
window.disconnect(s[2]);
window.disconnect(s[3]);
window.disconnect(s[4]);
window.disconnect(s[5]);
window.disconnect(s[6]);
window.disconnect(s[7]);
}
this._wrappedWindows.delete(window);
}
_removeWindow(window) {
// get Tile from window
let tile = window.tile;
// Not found
if (!tile)
return;
let m = tile.monitor;
if (TileWindowManager.getMonitors()[m].fullscreen) {
TileWindowManager.getMonitors()[m].fullscreen = false;
let focus = null;
TileWindowManager.getMonitors()[m].root?.forEach(el => {
el.state = TileState.DEFAULT;
el.window?.unminimize();
if (!focus && el.window && el.window !== window) {
el.window?.focus(0);
focus = el;
}
});
}
if (tile.removeTile() === null)
TileWindowManager.getMonitors(tile.workspace)[m].root = null;
else
TileWindowManager.getMonitors()[m].root?.update();
}
_onGrab(window, op) {
if (!window)
return;
let tile = window.tile;
if (!tile)
return;
let m = tile.monitor;
let rect;
switch (op) {
case Meta.GrabOp.MOVING:
if (this._sourceId !== null)
GLib.Source.remove(this._sourceId);
this._sourceId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
TileWindowManager.getMonitors()[m].root?.update();
this._sourceId = null;
return GLib.SOURCE_REMOVE;
});
break;
case Meta.GrabOp.RESIZING_E:
rect = window.get_frame_rect();
if (this._sourceId !== null)
GLib.Source.remove(this._sourceId);
this._sourceId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
Resize.resizeE(tile, rect);
this._sourceId = null;
return GLib.SOURCE_REMOVE;
});
break;
case Meta.GrabOp.RESIZING_W:
rect = window.get_frame_rect();
if (this._sourceId !== null)
GLib.Source.remove(this._sourceId);
this._sourceId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
Resize.resizeW(tile, rect);
this._sourceId = null;
return GLib.SOURCE_REMOVE;
});
break;
case Meta.GrabOp.RESIZING_N:
rect = window.get_frame_rect();
if (this._sourceId !== null)
GLib.Source.remove(this._sourceId);
this._sourceId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
Resize.resizeN(tile, rect);
this._sourceId = null;
return GLib.SOURCE_REMOVE;
});
break;
case Meta.GrabOp.RESIZING_S:
rect = window.get_frame_rect();
if (this._sourceId !== null)
GLib.Source.remove(this._sourceId);
this._sourceId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
Resize.resizeS(tile, rect);
this._sourceId = null;
return GLib.SOURCE_REMOVE;
});
break;
case Meta.GrabOp.RESIZING_NE:
rect = window.get_frame_rect();
if (this._sourceId !== null)
GLib.Source.remove(this._sourceId);
this._sourceId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
Resize.resizeN(tile, rect);
Resize.resizeE(tile, rect);
this._sourceId = null;
return GLib.SOURCE_REMOVE;
});
break;
case Meta.GrabOp.RESIZING_NW:
rect = window.get_frame_rect();
if (this._sourceId !== null)
GLib.Source.remove(this._sourceId);
this._sourceId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
Resize.resizeN(tile, rect);
Resize.resizeW(tile, rect);
this._sourceId = null;
return GLib.SOURCE_REMOVE;
});
break;
case Meta.GrabOp.RESIZING_SE:
rect = window.get_frame_rect();
if (this._sourceId !== null)
GLib.Source.remove(this._sourceId);
this._sourceId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
Resize.resizeS(tile, rect);
Resize.resizeE(tile, rect);
this._sourceId = null;
return GLib.SOURCE_REMOVE;
});
break;
case Meta.GrabOp.RESIZING_SW:
rect = window.get_frame_rect();
if (this._sourceId !== null)
GLib.Source.remove(this._sourceId);
this._sourceId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
Resize.resizeS(tile, rect);
Resize.resizeW(tile, rect);
this._sourceId = null;
return GLib.SOURCE_REMOVE;
});
break;
default:
break;
}
}
/** Resize operation with keyboard. This operation is
* different from the one operated with the mouse (grab operation)
* because we handle left/right resize differently.
*
* @param {Meta.GrabOp} op
* @param {number} resizeGap
* @returns void
*/
resizeFocusedWindow(op, resizeGap = 10) {
let window = global.display.focusWindow;
if (!window)
return;
let tile = window.tile;
if (op === Meta.GrabOp.RESIZING_E) {
if (tile.adjacents[1]) {
let r = new Mtk.Rectangle({
x: tile.position.x,
y: tile.position.y,
width: tile.position.width + resizeGap,
height: tile.position.height,
});
Resize.resizeE(tile, r);
} else if (tile.adjacents[0]) {
let r = new Mtk.Rectangle({
x: tile.position.x + resizeGap,
y: tile.position.y,
width: tile.position.width - resizeGap,
height: tile.position.height,
});
Resize.resizeW(tile, r);
}
} else if (op === Meta.GrabOp.RESIZING_W) {
if (tile.adjacents[0]) {
let r = new Mtk.Rectangle({
x: tile.position.x - resizeGap,
y: tile.position.y,
width: tile.position.width + resizeGap,
height: tile.position.height,
});
Resize.resizeW(tile, r);
} else if (tile.adjacents[1]) {
let r = new Mtk.Rectangle({
x: tile.position.x,
y: tile.position.y,
width: tile.position.width - resizeGap,
height: tile.position.height,
});
Resize.resizeE(tile, r);
}
} else if (op === Meta.GrabOp.RESIZING_N) {
if (tile.adjacents[2]) {
let r = new Mtk.Rectangle({
x: tile.position.x,
y: tile.position.y - resizeGap,
width: tile.position.width,
height: tile.position.height + resizeGap,
});
Resize.resizeN(tile, r);
} else if (tile.adjacents[3]) {
let r = new Mtk.Rectangle({
x: tile.position.x,
y: tile.position.y,
width: tile.position.width,
height: tile.position.height - resizeGap,
});
Resize.resizeS(tile, r);
}
} else if (op === Meta.GrabOp.RESIZING_S) {
if (tile.adjacents[3]) {
let r = new Mtk.Rectangle({
x: tile.position.x,
y: tile.position.y,
width: tile.position.width,
height: tile.position.height + resizeGap,
});
Resize.resizeS(tile, r);
} else if (tile.adjacents[2]) {
let r = new Mtk.Rectangle({
x: tile.position.x,
y: tile.position.y + resizeGap,
width: tile.position.width,
height: tile.position.height - resizeGap,
});
Resize.resizeN(tile, r);
}
}
}
/** Clock wise windows rotation.
* Rotates the parent tile (if existing).
*
* @param {Meta.Window} window
* @returns
*/
rotateWindow(window) {
let tile = window.tile;
if (!tile)
return;
let parent = tile.parent;
if (!parent)
return;
let newPositions;
if (parent.orientation === Orientation.Horizontal) {
newPositions = parent.position.split(Orientation.Vertical);
if (parent.child1 && parent.child2) {
newPositions[TileWindowManager.rotateEven[0] === 0 ? 0 : 1].splitProportion = parent.child1.position.splitProportion;
newPositions[TileWindowManager.rotateEven[0] === 0 ? 1 : 0].splitProportion = parent.child2.position.splitProportion;
parent.child1.resize(newPositions[TileWindowManager.rotateEven[0] === 0 ? 0 : 1]);
parent.child2.resize(newPositions[TileWindowManager.rotateEven[0] === 0 ? 1 : 0]);
parent.forEach(el => el.findAdjacents());
TileWindowManager.rotateEven[0] = (TileWindowManager.rotateEven[0] + 1) % 2;
parent.update();
} else {
return;
}
parent.orientation = Orientation.Vertical;
} else if (parent.orientation === Orientation.Vertical) {
newPositions = parent.position.split(Orientation.Horizontal);
if (parent.child1 && parent.child2) {
newPositions[TileWindowManager.rotateEven[1] === 0 ? 1 : 0].splitProportion = parent.child1.position.splitProportion;
newPositions[TileWindowManager.rotateEven[1] === 0 ? 0 : 1].splitProportion = parent.child2.position.splitProportion;
parent.child1.resize(newPositions[TileWindowManager.rotateEven[1] === 0 ? 1 : 0]);
parent.child2.resize(newPositions[TileWindowManager.rotateEven[1] === 0 ? 0 : 1]);
parent.forEach(el => el.findAdjacents());
TileWindowManager.rotateEven[1] = (TileWindowManager.rotateEven[1] + 1) % 2;
parent.update();
} else {
return;
}
parent.orientation = Orientation.Horizontal;
}
}
/** Maximize the currently focused window.
* Others windows are reduced using tile specific state.
*
* @param {Meta.Window} window
* @param {boolean} replace true to stay in fullscreen and just replace the window otherwise false
* @returns
*/
maximizeTile(window, replace = false) {
let tile = window.tile;
if (!tile)
return;
let m = tile.monitor;
if (TileWindowManager.getMonitors()[tile.monitor].fullscreen) {
TileWindowManager.getMonitors()[tile.monitor].fullscreen = false;
TileWindowManager.getMonitors()[m].root?.forEach(el => {
el.state = TileState.DEFAULT;
if (el.window?.minimized)
el.window?.unminimize();
});
if (replace) {
TileWindowManager.getMonitors()[m].fullscreen = true;
TileWindowManager.getMonitors()[m].root?.forEach(el => {
if (el.id === tile.id)
el.state = TileState.MAXIMIZED;
else
el.state = TileState.MINIMIZED;
});
}
} else {
TileWindowManager.getMonitors()[tile.monitor].fullscreen = true;
TileWindowManager.getMonitors()[m].root?.forEach(el => {
if (el.id === tile.id)
el.state = TileState.MAXIMIZED;
else
el.state = TileState.MINIMIZED;
});
}
TileWindowManager.getMonitors()[m].root?.update();
}
moveTile(dir) {
let window = global.display.get_focus_window();
if (!window)
return;
let tile = window.tile;
if (!tile.window)
return;
let exchangeTile = TileWindowManager.getMonitors()[tile.monitor].closestTile(tile, dir);
if (!exchangeTile || !exchangeTile.window)
return;
let tmpWindow = exchangeTile.window;
exchangeTile.window = tile.window;
tile.window = tmpWindow;
tile.window.tile = tile;
exchangeTile.window.tile = exchangeTile;
TileWindowManager.getMonitors()[tile.monitor].root?.update();
}
changeFocus(dir) {
let window = global.display.get_focus_window();
if (!window)
return;
let tile = window.tile;
if (!tile.window)
return;
if (TileWindowManager.getMonitors()[tile.monitor].fullscreen === true) {
let mon = TileWindowManager.getMonitors()[tile.monitor].closestMonitor(dir);
if (mon === null)
return;
let newFocus;
switch (dir) {
case Direction.North:
newFocus = TileWindowManager.getMonitors()[mon].getTile(Direction.South);
if (newFocus)
newFocus?.window?.focus(0);
break;
case Direction.South:
newFocus = TileWindowManager.getMonitors()[mon].getTile(Direction.North);
if (newFocus)
newFocus?.window?.focus(0);
break;
case Direction.East:
newFocus = TileWindowManager.getMonitors()[mon].getTile(Direction.West);
if (newFocus)
newFocus?.window?.focus(0);
break;
case Direction.West:
newFocus = TileWindowManager.getMonitors()[mon].getTile(Direction.East);
if (newFocus)
newFocus?.window?.focus(0);
break;
}
} else {
let newFocus = TileWindowManager.getMonitors()[tile.monitor].closestTile(tile, dir);
if (newFocus === null) {
let mon = TileWindowManager.getMonitors()[tile.monitor].closestMonitor(dir);
if (mon === null)
return;
switch (dir) {
case Direction.North:
newFocus = TileWindowManager.getMonitors()[mon].getTile(Direction.South);
if (newFocus)
newFocus?.window?.focus(0);
break;
case Direction.South:
newFocus = TileWindowManager.getMonitors()[mon].getTile(Direction.North);
if (newFocus)
newFocus?.window?.focus(0);
break;
case Direction.East:
newFocus = TileWindowManager.getMonitors()[mon].getTile(Direction.West);
if (newFocus)
newFocus?.window?.focus(0);
break;
case Direction.West:
newFocus = TileWindowManager.getMonitors()[mon].getTile(Direction.East);
if (newFocus)
newFocus?.window?.focus(0);
break;
default:
}
} else {
newFocus?.window?.focus(0);
}
}
}
createSearchBar() {
if (this._topBarSearchEntry && this._topBarSearchEntry.isAlive()) {
this._topBarSearchEntry.destroy();
this._topBarSearchEntry = undefined;
return;
}
if (this._settings)
this._topBarSearchEntry = new TopBarSearchEntry(this._settings);
}
refresh() {
TileWindowManager.getMonitors().forEach(el => el.root ? el.root.update() : null);
}
moveToWorkspace(next) {
let window = global.display.get_focus_window();
let tile = window.tile;
let current = tile.workspace;
if (next) {
if (current < global.workspaceManager.get_n_workspaces() - 1) {
tile.workspace = current + 1;
window.change_workspace_by_index(tile.workspace, false);
this._removeWindow(window);
this._insertWindow(window, current + 1);
}
} else if (current > 0) {
tile.workspace = current - 1;
window.change_workspace_by_index(tile.workspace, false);
this._removeWindow(window);
this._insertWindow(window, current - 1);
}
this.updateMonitors();
this.updateAdjacents();
}
moveToNextMonitor() {
let window = global.display.get_focus_window();
this._removeWindow(window);
let tile = window.tile;
let monitors = TileWindowManager.getMonitors();
let newMonitorIndex = (tile.monitor + 1) % monitors.length;
let newMonitor = monitors[newMonitorIndex];
if (newMonitor.size() === 0) {
let newTile = Tile.createTileLeaf(window, new Position(1.0, 0, 0, 0, 0), newMonitorIndex);
newTile.workspace = window.get_workspace().index();
window.tile = newTile;
newMonitor.root = newTile;
newMonitor.root?.update();
} else {
// Easier to create a new tile for insertion
newMonitor.root?.addWindowOnBlock(window);
window.tile.workspace = window.get_workspace().index();
if (newMonitor.fullscreen)
window.tile.state = TileState.MINIMIZED;
newMonitor.root?.update();
}
}
/** Extension is disabled on screen lock.
* We save the state of the Monitors before we quit.
*
* @returns
*/
_saveBeforeSessionLock() {
if (!Main.sessionMode.isLocked)
return;
TileWindowManager.locked = true;
const userPath = GLib.get_user_config_dir();
const parentPath = GLib.build_filenamev([userPath, '/grimble']);
const parent = Gio.File.new_for_path(parentPath);
try {
parent.make_directory_with_parents(null);
} catch (e) {
if (e.code !== Gio.IOErrorEnum.EXISTS)
throw e;
}
const path = GLib.build_filenamev([parentPath, '/tilingWmSession2.json']);
const file = Gio.File.new_for_path(path);
try {
file.create(Gio.FileCreateFlags.NONE, null);
} catch (e) {
if (e.code !== Gio.IOErrorEnum.EXISTS)
throw e;
}
file.replace_contents(JSON.stringify({
windows: Array.from(TileWindowManager._workspaces.entries()),
}, (key, value) => {
if (value instanceof Meta.Window)
return value.get_id();
else if (key === '_parent') // remove cyclic references
return undefined;
else
return value;
}), null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, null);
}
_loadAfterSessionLock() {
if (!TileWindowManager.locked)
return;
TileWindowManager.locked = false;
const userPath = GLib.get_user_config_dir();
const path = GLib.build_filenamev([userPath, '/grimble/tilingWmSession2.json']);
const file = Gio.File.new_for_path(path);
if (!file.query_exists(null))
return;
try {
file.create(Gio.FileCreateFlags.NONE, null);
} catch (e) {
if (e.code !== Gio.IOErrorEnum.EXISTS)
throw e;
}
const [success, contents] = file.load_contents(null);
if (!success || !contents.length)
return;
const openWindows = global.display.list_all_windows();
const states = JSON.parse(new TextDecoder().decode(contents), (key, value) => key === '_window' && typeof value === 'number'
? openWindows.find(val => val.get_id() === value)
: value);
let map = new Map(states.windows);
map.forEach((mapValue, mapKey, _) => {
mapValue.forEach((value, index, array) => {
// We have to rebuild correct types of each object
array[index] = Monitor.fromObject(value);
array[index].root?.forEach(el => {
if (el.window) {
this.configureWindowSignals(el.window);
el.window.change_workspace_by_index(mapKey, false);
}
});
});
TileWindowManager._workspaces.set(mapKey, mapValue);
});
this.updateMonitors();
}
}

View File

@ -0,0 +1,131 @@
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import St from 'gi://St';
import {Button as PanelButton} from 'resource:///org/gnome/shell/ui/panelMenu.js';
import Clutter from 'gi://Clutter';
import {gnomeExecutables, autocomplete, clear} from './autocomplete.js';
import {launchApp} from './utils.js';
export class TopBarSearchEntry {
_searchButton;
_searchContainer;
_searchEntry;
_searchSuggestion;
_alive;
constructor(settings) {
this._alive = true;
this._searchButton = new PanelButton(0.0, 'searchEntry', false);
this._searchContainer = new St.Bin({
x_expand: true,
});
this._searchEntry = new St.Entry({
style_class: 'custom-search-entry',
can_focus: true,
hint_text: 'Type to search…',
track_hover: true,
x_expand: true,
});
this._searchSuggestion = new St.Label({
style_class: 'suggestion',
text: '',
x_expand: true,
});
this._searchEntry.clutter_text.connect('notify::mapped', actor => {
if (actor.mapped)
actor.grab_key_focus();
});
this._searchContainer.add_child(this._searchSuggestion);
this._searchContainer.add_child(this._searchEntry);
this._searchEntry.clutter_text.connect('text-changed', actor => {
let current = actor.get_text();
if (current.length > 1 && this._searchSuggestion) {
let matches = autocomplete(current);
if (matches.length > 0 && this._searchEntry) {
let match = matches[0];
const ct = this._searchEntry.get_clutter_text();
const layout = ct.get_layout();
const [textW] = layout.get_pixel_size();
const themeNode = this._searchEntry.get_theme_node();
const leftPad = themeNode.get_padding(St.Side.LEFT);
const x = leftPad + textW;
this._searchSuggestion.set_style(`color: rgba(255,255,255,0.35); margin-left: ${x + 4}px;`);
this._searchSuggestion.set_text(match.slice(current.length));
} else {
this._searchSuggestion.set_text('');
}
} else if (this._searchSuggestion) {
this._searchSuggestion.set_text('');
}
});
let completeText = () => {
const typed = this._searchEntry?.get_text();
const ct = this._searchEntry?.get_clutter_text();
if (!typed || !ct)
return;
let full = typed + this._searchSuggestion?.get_text();
this._searchEntry?.set_text(full);
ct.set_cursor_position(full.length);
this._searchSuggestion?.set_text('');
};
this._searchEntry.clutter_text.connect('key-press-event', (ct, event) => {
const key = event.get_key_symbol();
if (key === Clutter.KEY_KP_Right || key === Clutter.KEY_Right) {
// Only accept if cursor is at end and a suggestion exists
const typed = this._searchEntry?.get_text();
if (typed) {
completeText();
return Clutter.EVENT_STOP;
}
}
return Clutter.EVENT_PROPAGATE;
});
this._searchEntry.connect('captured-event', (actor, event) => {
if (event.type() !== Clutter.EventType.KEY_PRESS)
return Clutter.EVENT_PROPAGATE;
const sym = event.get_key_symbol();
if (sym === Clutter.KEY_Tab || sym === Clutter.KEY_ISO_Left_Tab) {
completeText();
return Clutter.EVENT_STOP;
}
return Clutter.EVENT_PROPAGATE;
});
this._searchEntry.clutter_text.connect('activate', actor => {
let query = actor.get_text().trim().toLowerCase();
if (query === '') {
this.destroy();
} else if (gnomeExecutables?.get(query)) {
gnomeExecutables.get(query)?.launch([], null);
this.destroy();
} else if (launchApp([query])) {
this.destroy();
} else {
actor.set_text('');
this._searchEntry?.set_style('border: 2px solid red;');
}
});
this._searchButton.add_child(this._searchContainer);
let positionInt = settings.get_int('search-entry-position');
let position;
if (positionInt === 0)
position = 'left';
else if (positionInt === 1)
position = 'center';
else
position = 'right';
Main.panel.addToStatusArea('SearchEntry', this._searchButton, 0, position);
}
isAlive() {
return this._alive;
}
destroy() {
this._alive = false;
if (this._searchButton) {
this._searchButton?.destroy();
this._searchContainer = undefined;
this._searchEntry = undefined;
this._searchButton = undefined;
this._searchSuggestion = undefined;
}
clear();
}
}

View File

@ -0,0 +1,358 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="grimble@lmt.github.io">
<object class="AdwPreferencesPage" id="general">
<property name="title" translatable="yes"
comments="Translators: This is the name of a tab in the prefs window">General</property>
<property name="icon-name">view-app-grid-symbolic</property>
<!-- ======================================================================================== -->
<!-- = Group: General ======================================================================= -->
<!-- ======================================================================================== -->
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes"
comments="Translators: This is the header for a preference group in the 'General' tab">Appearance</property>
<!-- <child>
<object class="AdwSwitchRow" id="header_bar">
<property name="title" translatable="yes" comments="Translators: This is the name of setting to
enable/disable window header bar in the 'General' tab">Hide window header bar</property>
</object>
</child> -->
<child>
<object class="AdwSpinRow" id="tile_padding">
<property name="title" translatable="yes"
comments="Translators: This is the name of setting to set tile padding in the 'General' tab">Tile padding</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="upper">30</property>
<property name="step-increment">1</property>
<property name="page-increment">2</property>
</object>
</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes"
comments="Translators: This is the header for the insertion group in the 'General' tab">Search bar position</property>
<child>
<object class="AdwActionRow" id="search_entry_left">
<property name="title" translatable="yes"
comments="Translators: This setting is under the preference group 'Tile insertion' in the 'General' tab">Left</property>
<property name="activatable-widget">search_bar_position</property>
<child type="prefix">
<object class="GtkCheckButton" id="search_bar_position" />
</child>
</object>
</child>
<child>
<object class="AdwActionRow" id="search_entry_center">
<property name="title" translatable="yes"
comments="Translators: This setting is under the preference group 'Tile insertion' in the 'General' tab">Center</property>
<property name="activatable-widget">search_entry_center_button</property>
<child type="prefix">
<object class="GtkCheckButton" id="search_entry_center_button">
<property name="group">search_bar_position</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow" id="search_entry_right">
<property name="title" translatable="yes"
comments="Translators: This setting is under the preference group 'Tile insertion' in the 'General' tab">Right</property>
<property name="activatable-widget">search_entry_right_button</property>
<child type="prefix">
<object class="GtkCheckButton" id="search_entry_right_button">
<property name="group">search_bar_position</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes" comments="Translators: This is the header for the insertion group in the 'General' tab">Multiple monitors</property>
<property name="description" translatable="yes" comments="Translators: This is the explanation for the preference group 'Multiple monitors' in the 'General' tab">Defines tile insertion behavior while using multiple monitors.</property>
<child>
<object class="AdwActionRow" id="monitors_best_fit_row">
<property name="title" translatable="yes" comments="Translators: This setting is under the preference group 'Multiple monitors' in the 'General' tab">Best fit</property>
<property name="subtitle" translatable="yes" comments="Translators: This is an explanation for the 'Best fit' option for the 'Multiple monitors' in the 'General' tab">Selects the least filled monitor.</property>
<property name="activatable-widget">monitors_best_fit_button</property>
<child type="prefix">
<object class="GtkCheckButton" id="monitors_best_fit_button"/>
</child>
</object>
</child>
<child>
<object class="AdwActionRow" id="monitors_focus_row">
<property name="title" translatable="yes" comments="Translators: This setting is under the preference group 'Multiple monitors' in the 'General' tab">Focus</property>
<property name="subtitle" translatable="yes" comments="Translators: This is an explanation for the 'Focus' option for the 'Multiple monitors' in the 'General' tab">Selects the focused monitor.</property>
<property name="activatable-widget">monitors_focus_button</property>
<child type="prefix">
<object class="GtkCheckButton" id="monitors_focus_button">
<property name="group">monitors_best_fit_button</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes" comments="Translators: This is the header for the fullscreen group in the 'General' tab">Fullscreen behavior</property>
<property name="description" translatable="yes" comments="Translators: This is the explanation for the preference group 'Fullscreen behavior' in the 'General' tab">You can either stay in fullscreen when switching between two windows (default) or quit the fullscreen mode.</property>
<child>
<object class="AdwActionRow" id="keep_fullscreen">
<property name="title" translatable="yes" comments="Translators: This setting is under the preference group 'Multiple monitors' in the 'General' tab">Keep fullscreen</property>
<property name="activatable-widget">fullscreen_keep_button</property>
<child type="prefix">
<object class="GtkCheckButton" id="fullscreen_keep_button"/>
</child>
</object>
</child>
<child>
<object class="AdwActionRow" id="quit_fullscreen">
<property name="title" translatable="yes" comments="Translators: This setting is under the preference group 'Multiple monitors' in the 'General' tab">Quit fullscreen</property>
<property name="activatable-widget">fullscreen_quit_button</property>
<child type="prefix">
<object class="GtkCheckButton" id="fullscreen_quit_button">
<property name="group">fullscreen_keep_button</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
<!-- ======================================================================================== -->
<!-- = Page: Keybindings ==================================================================== -->
<!-- ======================================================================================== -->
<object class="AdwPreferencesPage" id="keybindings">
<property name="title" translatable="yes"
comments="Translators: This is the name of a tab in the prefs window">Keybindings</property>
<property name="icon-name">preferences-desktop-keyboard-symbolic</property>
<!-- ======================================================================================== -->
<!-- = Group: General ======================================================================= -->
<!-- ======================================================================================== -->
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwComboRow" id="keybinding_config">
<property name="title" translatable="yes">Configuration</property>
<property name="model">
<object class="GtkStringList">
<items>
<item translatable="yes">None</item>
<item translatable="yes">i3</item>
<item translatable="yes">Grimble</item>
<item translatable="yes">Custom</item>
</items>
</object>
</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes"
comments="Translators: This is a header for a preference group in the 'Keybindings' tab">General</property>
<child>
<object class="ShortcutListener" id="keybinding_close">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut to close tile">Close tile</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_search">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut to open search bar">Search bar</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_open_settings">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut to open settings">Grimble settings</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_maximize">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut to maximize">Maximize tile</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes"
comments="Translators: This is a header for a preference group in the 'Keybindings' tab">Tile Focus</property>
<child>
<object class="ShortcutListener" id="keybinding_focus">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut change focus">Change focus</property>
<property name="subtitle" translatable="yes" comments="Translators: This is the explanation for the keybinding 'Move tile' in the 'Tile movement' preference group in the 'Keybindings' tab">Press this shortcut, then use directional arrows to change the focus. Press `Escape` to abort.</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_focus_left">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut change focus left">Focus left</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_focus_right">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut change focus right">Focus right</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_focus_top">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut change focus top">Focus Up</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_focus_bottom">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut change focus bottom">Focus Down</property>
</object>
</child>
</object>
</child>
<!-- Tile movement -->
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes"
comments="Translators: This is a header for a preference group in the 'Keybindings' tab">Tile movement</property>
<child>
<object class="ShortcutListener" id="keybinding_move">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut move tile">Move tile</property>
<property name="subtitle" translatable="yes" comments="Translators: This is the explanation for the keybinding 'Move tile' in the 'Tile movement' preference group in the 'Keybindings' tab">Press this shortcut, then use a directional arrow to move a tile. Press `Escape` to abort.</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_move_left">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut to move left">Move Left</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_move_right">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut to move right">Move Right</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_move_top">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut to move top">Move Up</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_move_bottom">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut to move bottom">Move Down</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_rotation">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut tile rotation">Tile Rotation</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_next_workspace">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut tile rotation">Switch to next workspace</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_previous_workspace">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut tile rotation">Switch to previous workspace</property>
</object>
</child>
</object>
</child>
<!-- Tile resizing -->
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes"
comments="Translators: This is a header for a preference group in the 'Keybindings' tab">Tile resizing</property>
<child>
<object class="ShortcutListener" id="keybinding_resize">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut tile resizing">Resize tile</property>
<property name="subtitle" translatable="yes" comments="Translators: This is the explanation for the keybinding 'Move tile' in the 'Tile movement' preference group in the 'Keybindings' tab">Press this shortcut, then use directional arrows to resize a tile. Press `Escape` to abort.</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_resize_left">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut to move left">Resize Left</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_resize_right">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut to move right">Resize Right</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_resize_top">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut to move top">Resize Top</property>
</object>
</child>
<child>
<object class="ShortcutListener" id="keybinding_resize_bottom">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut to move bottom">Resize Bottom</property>
</object>
</child>
</object>
</child>
<!-- Multiple monitors bindings -->
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes"
comments="Translators: This is a header for a preference group in the 'Keybindings' tab">Multiple monitors</property>
<property name="description" translatable="yes"
comments="Translators: This is a header for a preference group in the 'Keybindings' tab">Keybindings related to multiple monitors actions.</property>
<child>
<object class="ShortcutListener" id="keybinding_next_monitor">
<property name="title" translatable="yes"
comments="Translators: This is a keybinding in the 'General' preference group in the 'Keybindings' tab that set shortcut to move bottom">Move tile to next monitor</property>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="grimble@lmt.github.io">
<object class="GtkEventControllerKey" id="eventKeyController">
<signal name="key-pressed" handler="_onKeyPressed" swapped="no"/>
</object>
<template class="ShortcutListener" parent="AdwActionRow">
<signal name="notify::keybinding" handler="_onKeybindingChanged" swapped="no"/>
<signal name="activated" handler="_onActivated" swapped="no"/>
<property name="activatable">True</property>
<property name="tooltip-text" translatable="yes">Replace the keyboard shortcuts. Press 'space' or 'return' when listening for a shortcut to append a new one to the existing shortcuts instead.</property>
<child>
<object class="GtkLabel" id="keybindingLabel">
<property name="label" translatable="yes">Disabled</property>
</object>
</child>
<child>
<object class="GtkButton" id="clearButton">
<property name="sensitive">0</property>
<property name="focus-on-click">0</property>
<property name="valign">center</property>
<property name="icon-name">edit-undo-symbolic</property>
<property name="tooltip-text" translatable="yes">Clear the keyboard shortcuts</property>
<signal name="clicked" handler="_onClearButtonClicked" swapped="no"/>
<style>
<class name="flat"/>
</style>
</object>
</child>
</template>
</interface>

View File

@ -0,0 +1,76 @@
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
/** Launch the given app
*
* @param {string[]} command
* @returns
*/
export function launchApp(command) {
try {
Gio.Subprocess.new(command, Gio.SubprocessFlags.NONE);
return true;
} catch (e) {
console.warn(`Failed launch : ${e}`);
return false;
}
}
/** Load the configuration stored at `name`.
*
* @param {string} name configuration file path
* @param {(a: any) => void} callback a function called when the result is returned
* @param {() => void} errorCallback function called to handle errors
* @returns
*/
export function loadConfiguration(name, callback, errorCallback) {
const f = Gio.File.new_for_path(name);
f.load_contents_async(null, (file, res) => {
try {
let r = file?.load_contents_finish(res);
if (!r || !r[0] || !r[1].length) {
errorCallback();
return;
}
const conf = JSON.parse(new TextDecoder().decode(r[1]));
callback(conf);
} catch (e) {
if (e instanceof Gio.IOErrorEnum ||
e.matches?.(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND))
errorCallback?.();
else
logError(e);
}
});
}
/** Save the keybinding configuration stored in `obj` in the file `name`.
*
* @param {string} name configuration file name
* @param {object} obj Object to save
*/
export function saveConfiguration(name, obj) {
const userPath = GLib.get_user_config_dir();
const parentPath = GLib.build_filenamev([userPath, '/grimble/config']);
const parent = Gio.File.new_for_path(parentPath);
try {
parent.make_directory_with_parents(null);
} catch (e) {
if (e.code !== Gio.IOErrorEnum.EXISTS)
throw e;
}
const path = GLib.build_filenamev([parentPath, `/${name}`]);
const f = Gio.File.new_for_path(path);
try {
f.create(Gio.FileCreateFlags.NONE, null);
} catch (e) {
if (e.code !== Gio.IOErrorEnum.EXISTS)
throw e;
}
const data = new TextEncoder().encode(JSON.stringify(obj));
f.replace_contents_async(data, null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, null, (file, res) => {
try {
file?.replace_contents_finish(res);
} catch (e) {
logError(e);
}
});
}