diff --git a/.hgignore b/.hgignore
new file mode 100644
--- /dev/null
+++ b/.hgignore
@@ -0,0 +1,20 @@
+syntax: glob
+swindle
+smsg/smsg
+*.o
+*-protocol.c
+*-protocol.h
+smsg/*-protocol.c
+smsg/*-protocol.h
+result
+result-*
+.direnv/
+.vscode/
+.idea/
+.cache/
+compile_commands.json
+tags
+*.swp
+*.swo
+*~
+include/lua5.4/*
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,693 @@
+swindle - wayland compositor base wlroots
+
+Copyright © 2026 kantiankant
+
+See also the files licenses/LICENSE.dwl, licenses/LICENSE.tinywl,
+licenses/LICENSE.dwm, licenses/LICENSE.sway, and licenses/LICENSE.mangowm
+
+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.
+
+----
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 1. 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.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/Makefile b/Makefile
new file mode 100644
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,99 @@
+.POSIX:
+.SUFFIXES:
+
+include config.mk
+
+DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(WLR_INCS) \
+ -I. -Iinclude -Isrc -Iparser -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" \
+ $(XWAYLAND) -g -Wall -Wextra -Wno-unused-parameter -O1 -std=c11 $(CFLAGS)
+LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(WLR_LIBS) -lm $(LIBS)
+
+SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner`
+PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols`
+
+SMSG_CFLAGS = `$(PKG_CONFIG) --cflags wayland-client` -Wall -Wextra -Wno-unused-parameter
+SMSG_LDLIBS = `$(PKG_CONFIG) --libs wayland-client`
+
+all: swindle smsg/smsg
+
+swindle: src/dwl.o src/util.o parser/parser.o dwl-ipc-unstable-v2-protocol.o src/wlr_ext_workspace_v1.o ext-workspace-v1-protocol.o
+ $(CC) $^ $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@
+
+src/dwl.o: src/swindle.c include/client.h config.h include/dwl-ipc.h dwl-ipc-unstable-v2-protocol.h \
+ include/ext-workspace.h src/wlr_ext_workspace_v1.h ext-workspace-v1-protocol.h \
+ cursor-shape-v1-protocol.h pointer-constraints-unstable-v1-protocol.h \
+ wlr-layer-shell-unstable-v1-protocol.h \
+ wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h \
+ parser/parser.h
+ $(CC) $(DWLCFLAGS) -o $@ -c $<
+
+src/util.o: src/util.c src/util.h
+ $(CC) $(DWLCFLAGS) -o $@ -c $<
+
+src/wlr_ext_workspace_v1.o: src/wlr_ext_workspace_v1.c src/wlr_ext_workspace_v1.h ext-workspace-v1-protocol.h
+ $(CC) $(DWLCFLAGS) -o $@ -c $<
+
+parser/parser.o: parser/parser.c parser/parser.h
+ $(CC) $(DWLCFLAGS) -o $@ -c $<
+
+dwl-ipc-unstable-v2-protocol.o: dwl-ipc-unstable-v2-protocol.c
+
+ext-workspace-v1-protocol.o: ext-workspace-v1-protocol.c
+
+# protocol headers and glue
+cursor-shape-v1-protocol.h:
+ $(SCANNER) enum-header $(PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@
+pointer-constraints-unstable-v1-protocol.h:
+ $(SCANNER) enum-header $(PROTOCOLS)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@
+wlr-layer-shell-unstable-v1-protocol.h:
+ $(SCANNER) enum-header protocols/wlr-layer-shell-unstable-v1.xml $@
+wlr-output-power-management-unstable-v1-protocol.h:
+ $(SCANNER) server-header protocols/wlr-output-power-management-unstable-v1.xml $@
+xdg-shell-protocol.h:
+ $(SCANNER) server-header $(PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
+dwl-ipc-unstable-v2-protocol.h:
+ $(SCANNER) server-header protocols/dwl-ipc-unstable-v2.xml $@
+dwl-ipc-unstable-v2-protocol.c:
+ $(SCANNER) private-code protocols/dwl-ipc-unstable-v2.xml $@
+
+# smsg
+smsg/dwl-ipc-unstable-v2-protocol.h:
+ $(SCANNER) client-header protocols/dwl-ipc-unstable-v2.xml $@
+
+smsg/dwl-ipc-unstable-v2-protocol.c:
+ $(SCANNER) private-code protocols/dwl-ipc-unstable-v2.xml $@
+
+smsg/dwl-ipc-unstable-v2-protocol.o: smsg/dwl-ipc-unstable-v2-protocol.c
+ $(CC) $(SMSG_CFLAGS) -o $@ -c $<
+
+smsg/smsg.o: smsg/smsg.c smsg/dwl-ipc-unstable-v2-protocol.h
+ $(CC) $(SMSG_CFLAGS) -o $@ -c $<
+
+smsg/smsg: smsg/smsg.o smsg/dwl-ipc-unstable-v2-protocol.o
+ $(CC) $^ $(SMSG_CFLAGS) $(SMSG_LDLIBS) -o $@
+
+ext-workspace-v1-protocol.h:
+ $(SCANNER) server-header protocols/ext-workspace-v1.xml $@
+ext-workspace-v1-protocol.c:
+ $(SCANNER) private-code protocols/ext-workspace-v1.xml $@
+
+clean:
+ rm -f swindle smsg/smsg src/*.o parser/*.o smsg/*.o smsg/*-protocol.h smsg/*-protocol.c *.o *-protocol.h *-protocol.c
+
+install: swindle smsg/smsg
+ mkdir -p $(DESTDIR)$(PREFIX)/bin
+ cp -f swindle $(DESTDIR)$(PREFIX)/bin
+ chmod 755 $(DESTDIR)$(PREFIX)/bin/swindle
+ cp -f smsg/smsg $(DESTDIR)$(PREFIX)/bin
+ chmod 755 $(DESTDIR)$(PREFIX)/bin/smsg
+ mkdir -p $(DESTDIR)/etc/swindle
+ cp -r example/* $(DESTDIR)/etc/swindle
+
+uninstall:
+ rm -f $(DESTDIR)$(PREFIX)/bin/swindle
+ rm -f $(DESTDIR)$(PREFIX)/bin/smsg
+ rm -rf $(DESTDIR)/etc/swindle
+
+.SUFFIXES: .c .o
+.c.o:
+ $(CC) $(DWLCFLAGS) -o $@ -c $<
diff --git a/README.md b/README.md
new file mode 100644
--- /dev/null
+++ b/README.md
@@ -0,0 +1,56 @@
+## Swindle
+
+
+
+> "It's so bad it's not even funny!" -kantiankant, 2026
+
+
+Swindle is a fork of [dwl](https://codeberg.org/dwl/dwl) that was designed from the start with one goal: to make it feel like the poor man's Hyprland. It has the following:
+
+* NO cool vfx
+* nearly NO documentation
+* ZERO good original code
+* only ONE tiling layout (dwindle)
+
+> Fun fact: I actually took some parts of [MangoWM](https://github.com/mangowm/mango) (such as the ext-workspaces implementation). hence why the LICENSE.mangowm exists
+
+## Dependencies
+
+* libinput
+* wayland
+* wlroots-0.20 (compiled with the libinput backend)
+* xkbcommon
+* wayland-protocols (compile-time only)
+* pkg-config (compile-time only)
+
+Install these (and their `-devel` versions if your distro has separate
+development packages) and run `make` followed by `doas/sudo make install`, if you wish to install it (installs to /usr/local/bin/ by default).
+
+## Things that are good to have
+
+* [foot](https://codeberg.org/dnkl/foot)
+
+
+## Known Issues
+
+N/A
+
+## Configuration
+
+read example/config.lua. It should give you a basic idea of how configuring swindle works.
+
+> note: it's best to copy /etc/swindle/config.lua into XDG_HOME_DIR/.config/swindle/ before you attempt to
+start swindle because it (swindle) won't start without it
+
+## Checklist
+
+- [ ] separate the trackpad scroll from the mousee scroll
+- [x] Add ability to change your keymap
+- [ ] Add animations via [scenefx](https://github.com/wlrfx/scenefx) when 0.5 drops (in another branch)
+- [ ] Add the ability for the compositor to read a custom path for configs
+- [ ] Add /etc/swindle/config.lua as a fallback path if $HOME/.config/swindle/config.lua is not found
+
+
+## License
+
+GPL-v3, probably
diff --git a/assets/log.txt b/assets/log.txt
new file mode 100644
--- /dev/null
+++ b/assets/log.txt
@@ -0,0 +1,4 @@
+ ████████ ██ ██
+ ██ ██ ██ ██
+ ██ ██ ██ ██
+████ ██████████
diff --git a/config.h b/config.h
new file mode 100644
--- /dev/null
+++ b/config.h
@@ -0,0 +1,6 @@
+static void dwindle(Monitor *m);
+
+static const Layout layouts[] = {
+ {"><>", NULL},
+ {"[T]", dwindle},
+};
diff --git a/config.mk b/config.mk
new file mode 100644
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,31 @@
+_VERSION = 0.1
+VERSION = `git describe --tags --dirty 2>/dev/null || echo $(_VERSION)`
+
+PKG_CONFIG = pkg-config
+
+# paths
+PREFIX = /usr/local
+MANDIR = $(PREFIX)/share/man
+DATDIR = $(PREFIX)/share
+
+WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.20`
+WLR_LIBS = `$(PKG_CONFIG) --libs wlroots-0.20`
+
+# Allow using an alternative wlroots installation
+#WLR_INCS = -I/usr/include/pixman-1 -I/usr/include/elogind -I/usr/include/libdrm \
+# -I$(PWD)/wlroots/include
+#WLR_LIBS = -Wl,-rpath,$(PWD)/wlroots/build -L$(PWD)/wlroots/build -lwlroots-0.19
+
+#XWAYLAND =
+#XLIBS =
+# Uncomment to build XWayland support
+XWAYLAND = -DXWAYLAND
+XLIBS = xcb xcb-icccm
+
+# lua
+LUA_PKG = lua5.4
+
+PKGS = wayland-server xkbcommon libinput $(LUA_PKG) $(XLIBS)
+
+# Requires C11: _Alignas and anonymous unions in wlroots headers.
+CC = cc
diff --git a/example/config.lua b/example/config.lua
new file mode 100644
--- /dev/null
+++ b/example/config.lua
@@ -0,0 +1,101 @@
+sloppy_focus = true
+bypass_surface_visibility = false
+log_level = "error" -- "silent", "error", "info", "debug"
+
+appearance = {
+ border_px = 2,
+ gaps = 10, -- 0 = no gaps. simple as.
+ smart_gaps = false,
+
+ root_color = 0x222222ff,
+ border_color = 0x00000000,
+ focus_color = 0xe8e8e8ff,
+ urgent_color = 0xff0000ff,
+
+ fullscreen_bg = 0x000000ff,
+}
+
+
+-- Note: the entire input section requires you to restart
+-- the compositor once changed
+input = {
+ repeat_rate = 50,
+ repeat_delay = 150,
+ tap_to_click = true,
+ tap_and_drag = true,
+ drag_lock = true,
+ natural_scrolling = false,
+ disable_while_typing = true,
+ left_handed = false,
+ middle_button_emulation = false,
+ scroll_method = "2fg", -- "2fg", "edge", "button"
+ click_method = "button_areas", -- "button_areas", "clickfinger"
+ accel_profile = "adaptive", -- "adaptive", "flat"
+ accel_speed = 0.0,
+
+ layout = "us", -- "us", "de", "de,us", ...
+ -- variant = "nodeadkeys",
+ -- options = "grp:alt_shift_toggle",
+}
+
+rules = {
+-- { app_id = "Gimp", floating = true, monitor = -1 },
+-- { app_id = "firefox", tags = 1 << 8, floating = false, monitor = -1 },
+}
+
+monitors = {
+ -- catch-all rule; name = nil means match anything
+ { name = nil, mfact = 0.55, nmaster = 1, scale = 1.0,
+ layout = "dwindle", x = -1, y = -1 },
+
+ -- HiDPI laptop example:
+ -- { name = "eDP-1", mfact = 0.5, nmaster = 1, scale = 2.0,
+ -- layout = "dwindle", x = -1, y = -1 },
+}
+
+-- autostart: it starts stuff in sequence
+autostart = {
+ "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_SESSION_TYPE XDG_CURRENT_DESKTOP",
+ "systemctl --user import-environment WAYLAND_DISPLAY XDG_SESSION_TYPE XDG_CURRENT_DESKTOP",
+ "waybar",
+}
+
+
+keybinds = {
+ { mods = {"logo"}, key = "q", action = "spawn", args = {"alacritty"} },
+ { mods = {"logo"}, key = "space", action = "spawn", args = {"wofi", "--show", "drun"} },
+ { mods = {"logo"}, key = "w", action = "killclient" },
+ { mods = {"logo"}, key = "v", action = "togglefloating" },
+ { mods = {"logo"}, key = "f", action = "togglefullscreen" },
+ { mods = {"logo"}, key = "g", action = "togglegaps" },
+ { mods = {"logo"}, key = "h", action = "focusdir", args = {"left"} },
+ { mods = {"logo"}, key = "j", action = "focusdir", args = {"down"} },
+ { mods = {"logo"}, key = "k", action = "focusdir", args = {"up"} },
+ { mods = {"logo"}, key = "l", action = "focusdir", args = {"right"} },
+ { mods = {"logo", "shift"}, key = "H", action = "swapdir", args = {"left"} },
+ { mods = {"logo", "shift"}, key = "J", action = "swapdir", args = {"down"} },
+ { mods = {"logo", "shift"}, key = "K", action = "swapdir", args = {"up"} },
+ { mods = {"logo", "shift"}, key = "L", action = "swapdir", args = {"right"} },
+ { mods = {"logo"}, key = "Tab", action = "view" },
+ { mods = {"logo"}, key = "0", action = "view", args = {"all"} },
+ { mods = {"logo"}, key = "comma", action = "focusmon", args = {"left"} },
+ { mods = {"logo"}, key = "period", action = "focusmon", args = {"right"} },
+ { mods = {"logo", "shift"}, key = "less", action = "tagmon", args = {"left"} },
+ { mods = {"logo", "shift"}, key = "greater", action = "tagmon", args = {"right"} },
+ { mods = {"logo", "shift"}, key = "e", action = "quit" },
+}
+
+for i = 1, 9 do
+ local key = tostring(i)
+ local mask = 1 << (i - 1)
+ table.insert(keybinds, { mods = {"logo"}, key = key, action = "view", args = {tostring(mask)} })
+ table.insert(keybinds, { mods = {"logo", "ctrl"}, key = key, action = "toggleview", args = {tostring(mask)} })
+ table.insert(keybinds, { mods = {"logo", "shift"}, key = key, action = "tag", args = {tostring(mask)} })
+ table.insert(keybinds, { mods = {"logo", "ctrl", "shift"}, key = key, action = "toggletag", args = {tostring(mask)} })
+end
+
+buttons = {
+ { mods = {"logo"}, button = "left", action = "moveresize", args = {"move"} },
+ { mods = {"logo"}, button = "middle", action = "togglefloating" },
+ { mods = {"logo"}, button = "right", action = "moveresize", args = {"resize"} },
+}
diff --git a/flake.lock b/flake.lock
new file mode 100644
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,61 @@
+{
+ "nodes": {
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1731533236,
+ "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1786106723,
+ "narHash": "sha256-zDSUbpoeo/9ZmD2+wXnzxoo1+uhL8vxc0b8yuYMKYq0=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "f13ff45afd1bb73e640eaa08a7066dbed07e3238",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,65 @@
+{
+ description = "swindle: a dwl fork with Lua config, IPC, and ext-workspace support, plus its smsg client";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ flake-utils.url = "github:numtide/flake-utils";
+ };
+
+ outputs = { self, nixpkgs, flake-utils }:
+ flake-utils.lib.eachDefaultSystem (system:
+ let
+ pkgs = nixpkgs.legacyPackages.${system};
+ in
+ {
+ packages.default = pkgs.stdenv.mkDerivation rec {
+ pname = "swindle";
+ version = "0.1";
+
+ src = self;
+
+ nativeBuildInputs = with pkgs; [
+ pkg-config
+ wayland-scanner
+ wayland-protocols
+ ];
+
+ buildInputs = with pkgs; [
+ wayland
+ wlroots_0_20
+ pixman
+ libxkbcommon
+ libinput
+ lua5_4
+ libxcb
+ libxcb-wm
+ ];
+
+ enableParallelBuilding = true;
+
+ postPatch = ''
+ substituteInPlace Makefile \
+ --replace '$(DESTDIR)/etc/swindle' '$(DESTDIR)$(PREFIX)/etc/swindle'
+ '';
+
+ makeFlags = [ "PREFIX=${placeholder "out"}" ];
+
+ meta = with pkgs.lib; {
+ description = "A dwl fork with Lua configuration, IPC support, and ext-workspace-v1";
+ license = with licenses; [ gpl3Only mit isc ];
+ platforms = platforms.linux;
+ mainProgram = "swindle";
+ };
+ };
+
+ devShells.default = pkgs.mkShell {
+ inputsFrom = [ self.packages.${system}.default ];
+ packages = with pkgs; [ pkg-config gdb ];
+ };
+
+ apps.default = flake-utils.lib.mkApp {
+ drv = self.packages.${system}.default;
+ };
+ });
+}
+
diff --git a/include/client.h b/include/client.h
new file mode 100644
--- /dev/null
+++ b/include/client.h
@@ -0,0 +1,447 @@
+/*
+ * Attempt to consolidate unavoidable suck into one file, away from src/swindle.c. This
+ * file is not meant to be pretty. We use a .h file with static inline
+ * functions instead of a separate .c module, or function pointers like sway, so
+ * that they will simply compile out if the chosen #defines leave them unused.
+ */
+
+/* Leave these functions first; they're used in the others */
+static inline int
+client_is_x11(Client *c)
+{
+#ifdef XWAYLAND
+ return c->type == X11;
+#endif
+ return 0;
+}
+
+static inline struct wlr_surface *
+client_surface(Client *c)
+{
+#ifdef XWAYLAND
+ if (client_is_x11(c))
+ return c->surface.xwayland->surface;
+#endif
+ return c->surface.xdg->surface;
+}
+
+static inline int
+toplevel_from_wlr_surface(struct wlr_surface *s, Client **pc, LayerSurface **pl)
+{
+ struct wlr_xdg_surface *xdg_surface, *tmp_xdg_surface;
+ struct wlr_surface *root_surface;
+ struct wlr_layer_surface_v1 *layer_surface;
+ Client *c = NULL;
+ LayerSurface *l = NULL;
+ int type = -1;
+#ifdef XWAYLAND
+ struct wlr_xwayland_surface *xsurface;
+#endif
+
+ if (!s)
+ return -1;
+ root_surface = wlr_surface_get_root_surface(s);
+
+#ifdef XWAYLAND
+ if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(root_surface))) {
+ c = xsurface->data;
+ type = c->type;
+ goto end;
+ }
+#endif
+
+ if ((layer_surface = wlr_layer_surface_v1_try_from_wlr_surface(root_surface))) {
+ l = layer_surface->data;
+ type = LayerShell;
+ goto end;
+ }
+
+ xdg_surface = wlr_xdg_surface_try_from_wlr_surface(root_surface);
+ while (xdg_surface) {
+ tmp_xdg_surface = NULL;
+ switch (xdg_surface->role) {
+ case WLR_XDG_SURFACE_ROLE_POPUP:
+ if (!xdg_surface->popup || !xdg_surface->popup->parent)
+ return -1;
+
+ tmp_xdg_surface = wlr_xdg_surface_try_from_wlr_surface(xdg_surface->popup->parent);
+
+ if (!tmp_xdg_surface)
+ return toplevel_from_wlr_surface(xdg_surface->popup->parent, pc, pl);
+
+ xdg_surface = tmp_xdg_surface;
+ break;
+ case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
+ c = xdg_surface->data;
+ type = c->type;
+ goto end;
+ case WLR_XDG_SURFACE_ROLE_NONE:
+ return -1;
+ }
+ }
+
+end:
+ if (pl)
+ *pl = l;
+ if (pc)
+ *pc = c;
+ return type;
+}
+
+/* The others */
+static inline void
+client_activate_surface(struct wlr_surface *s, int activated)
+{
+ struct wlr_xdg_toplevel *toplevel;
+#ifdef XWAYLAND
+ struct wlr_xwayland_surface *xsurface;
+ if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(s))) {
+ wlr_xwayland_surface_activate(xsurface, activated);
+ return;
+ }
+#endif
+ if ((toplevel = wlr_xdg_toplevel_try_from_wlr_surface(s)))
+ wlr_xdg_toplevel_set_activated(toplevel, activated);
+}
+
+static inline uint32_t
+client_set_bounds(Client *c, int32_t width, int32_t height)
+{
+#ifdef XWAYLAND
+ if (client_is_x11(c))
+ return 0;
+#endif
+ if (wl_resource_get_version(c->surface.xdg->toplevel->resource) >=
+ XDG_TOPLEVEL_STATE_TILED_BOTTOM_SINCE_VERSION && width >= 0 && height >= 0
+ && (c->bounds.width != width || c->bounds.height != height)) {
+ c->bounds.width = width;
+ c->bounds.height = height;
+ return wlr_xdg_toplevel_set_bounds(c->surface.xdg->toplevel, width, height);
+ }
+ return 0;
+}
+
+static inline const char *
+client_get_appid(Client *c)
+{
+#ifdef XWAYLAND
+ if (client_is_x11(c))
+ return c->surface.xwayland->class ? c->surface.xwayland->class : "broken";
+#endif
+ return c->surface.xdg->toplevel->app_id ? c->surface.xdg->toplevel->app_id : "broken";
+}
+
+static inline void
+client_get_clip(Client *c, struct wlr_box *clip)
+{
+ *clip = (struct wlr_box){
+ .x = 0,
+ .y = 0,
+ .width = c->geom.width - c->bw,
+ .height = c->geom.height - c->bw,
+ };
+
+#ifdef XWAYLAND
+ if (client_is_x11(c))
+ return;
+#endif
+
+ clip->x = c->surface.xdg->geometry.x;
+ clip->y = c->surface.xdg->geometry.y;
+}
+
+static inline void
+client_get_geometry(Client *c, struct wlr_box *geom)
+{
+#ifdef XWAYLAND
+ if (client_is_x11(c)) {
+ geom->x = c->surface.xwayland->x;
+ geom->y = c->surface.xwayland->y;
+ geom->width = c->surface.xwayland->width;
+ geom->height = c->surface.xwayland->height;
+ return;
+ }
+#endif
+ *geom = c->surface.xdg->geometry;
+}
+
+static inline Client *
+client_get_parent(Client *c)
+{
+ Client *p = NULL;
+#ifdef XWAYLAND
+ if (client_is_x11(c)) {
+ if (c->surface.xwayland->parent)
+ toplevel_from_wlr_surface(c->surface.xwayland->parent->surface, &p, NULL);
+ return p;
+ }
+#endif
+ if (c->surface.xdg->toplevel->parent)
+ toplevel_from_wlr_surface(c->surface.xdg->toplevel->parent->base->surface, &p, NULL);
+ return p;
+}
+
+static inline int
+client_has_children(Client *c)
+{
+#ifdef XWAYLAND
+ if (client_is_x11(c))
+ return !wl_list_empty(&c->surface.xwayland->children);
+#endif
+ /* surface.xdg->link is never empty because it always contains at least the
+ * surface itself. */
+ return wl_list_length(&c->surface.xdg->link) > 1;
+}
+
+static inline const char *
+client_get_title(Client *c)
+{
+#ifdef XWAYLAND
+ if (client_is_x11(c))
+ return c->surface.xwayland->title ? c->surface.xwayland->title : "broken";
+#endif
+ return c->surface.xdg->toplevel->title ? c->surface.xdg->toplevel->title : "broken";
+}
+
+static inline int
+client_is_float_type(Client *c)
+{
+ struct wlr_xdg_toplevel *toplevel;
+ struct wlr_xdg_toplevel_state state;
+
+#ifdef XWAYLAND
+ if (client_is_x11(c)) {
+ struct wlr_xwayland_surface *surface = c->surface.xwayland;
+ xcb_size_hints_t *size_hints = surface->size_hints;
+ if (surface->modal)
+ return 1;
+
+ if (wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DIALOG)
+ || wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_SPLASH)
+ || wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLBAR)
+ || wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_UTILITY)) {
+ return 1;
+ }
+
+ return size_hints && size_hints->min_width > 0 && size_hints->min_height > 0
+ && (size_hints->max_width == size_hints->min_width
+ || size_hints->max_height == size_hints->min_height);
+ }
+#endif
+
+ toplevel = c->surface.xdg->toplevel;
+ state = toplevel->current;
+ return toplevel->parent || (state.min_width != 0 && state.min_height != 0
+ && (state.min_width == state.max_width
+ || state.min_height == state.max_height));
+}
+
+static inline int
+client_is_rendered_on_mon(Client *c, Monitor *m)
+{
+ /* This is needed for when you don't want to check formal assignment,
+ * but rather actual displaying of the pixels.
+ * Usually VISIBLEON suffices and is also faster. */
+ struct wlr_surface_output *s;
+ int unused_lx, unused_ly;
+ if (!wlr_scene_node_coords(&c->scene->node, &unused_lx, &unused_ly))
+ return 0;
+ wl_list_for_each(s, &client_surface(c)->current_outputs, link)
+ if (s->output == m->wlr_output)
+ return 1;
+ return 0;
+}
+
+static inline int
+client_is_stopped(Client *c)
+{
+ int pid;
+ siginfo_t in = {0};
+#ifdef XWAYLAND
+ if (client_is_x11(c))
+ return 0;
+#endif
+
+ wl_client_get_credentials(c->surface.xdg->client->client, &pid, NULL, NULL);
+ if (waitid(P_PID, pid, &in, WNOHANG|WCONTINUED|WSTOPPED|WNOWAIT) < 0) {
+ /* This process is not our child process, while is very unlikely that
+ * it is stopped, in order to do not skip frames, assume that it is. */
+ if (errno == ECHILD)
+ return 1;
+ } else if (in.si_pid) {
+ if (in.si_code == CLD_STOPPED || in.si_code == CLD_TRAPPED)
+ return 1;
+ if (in.si_code == CLD_CONTINUED)
+ return 0;
+ }
+
+ return 0;
+}
+
+static inline int
+client_is_unmanaged(Client *c)
+{
+#ifdef XWAYLAND
+ if (client_is_x11(c))
+ return c->surface.xwayland->override_redirect;
+#endif
+ return 0;
+}
+
+static inline void
+client_notify_enter(struct wlr_surface *s, struct wlr_keyboard *kb)
+{
+ if (kb)
+ wlr_seat_keyboard_notify_enter(seat, s, kb->keycodes,
+ kb->num_keycodes, &kb->modifiers);
+ else
+ wlr_seat_keyboard_notify_enter(seat, s, NULL, 0, NULL);
+}
+
+static inline void
+client_send_close(Client *c)
+{
+#ifdef XWAYLAND
+ if (client_is_x11(c)) {
+ wlr_xwayland_surface_close(c->surface.xwayland);
+ return;
+ }
+#endif
+ wlr_xdg_toplevel_send_close(c->surface.xdg->toplevel);
+}
+
+static inline void
+client_set_border_color(Client *c, const float inner[static 4], const float outer[static 4])
+{
+ int i;
+ for (i = 0; i < 4; i++) {
+ wlr_scene_rect_set_color(c->inner_border[i], inner);
+ wlr_scene_rect_set_color(c->outer_border[i], outer);
+ }
+}
+
+
+/* Opacity black magic I cooked up half asleep. Idk how this works so uhm
+ * baii */
+
+static inline void
+client_node_apply_opacity(struct wlr_scene_node *node, float opacity)
+{
+ struct wlr_scene_tree *tree;
+ struct wlr_scene_node *child;
+
+ if (!node->enabled && node->type != WLR_SCENE_NODE_TREE)
+ return;
+
+ switch (node->type) {
+ case WLR_SCENE_NODE_BUFFER:
+ wlr_scene_buffer_set_opacity(wlr_scene_buffer_from_node(node), opacity);
+ break;
+ case WLR_SCENE_NODE_TREE:
+ tree = wlr_scene_tree_from_node(node);
+ wl_list_for_each(child, &tree->children, link)
+ client_node_apply_opacity(child, opacity);
+ break;
+ case WLR_SCENE_NODE_RECT:
+ default:
+ break;
+ }
+}
+
+static inline void
+client_apply_opacity(Client *c)
+{
+ client_node_apply_opacity(&c->scene_surface->node, c->isfullscreen ? 1.0f : c->opacity);
+}
+
+static inline void
+client_set_opacity(Client *c, float opacity)
+{
+ c->opacity = opacity;
+ client_apply_opacity(c);
+}
+
+static inline void
+client_set_fullscreen(Client *c, int fullscreen)
+{
+#ifdef XWAYLAND
+ if (client_is_x11(c)) {
+ wlr_xwayland_surface_set_fullscreen(c->surface.xwayland, fullscreen);
+ return;
+ }
+#endif
+ wlr_xdg_toplevel_set_fullscreen(c->surface.xdg->toplevel, fullscreen);
+}
+
+static inline void
+client_set_scale(struct wlr_surface *s, float scale)
+{
+ wlr_fractional_scale_v1_notify_scale(s, scale);
+ wlr_surface_set_preferred_buffer_scale(s, (int32_t)ceilf(scale));
+}
+
+static inline uint32_t
+client_set_size(Client *c, uint32_t width, uint32_t height)
+{
+#ifdef XWAYLAND
+ if (client_is_x11(c)) {
+ wlr_xwayland_surface_configure(c->surface.xwayland,
+ c->geom.x + c->bw, c->geom.y + c->bw, width, height);
+ return 0;
+ }
+#endif
+ if ((int32_t)width == c->surface.xdg->toplevel->current.width
+ && (int32_t)height == c->surface.xdg->toplevel->current.height)
+ return 0;
+ return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, (int32_t)width, (int32_t)height);
+}
+
+static inline void
+client_set_tiled(Client *c, uint32_t edges)
+{
+#ifdef XWAYLAND
+ if (client_is_x11(c)) {
+ wlr_xwayland_surface_set_maximized(c->surface.xwayland,
+ edges != WLR_EDGE_NONE, edges != WLR_EDGE_NONE);
+ return;
+ }
+#endif
+ if (wl_resource_get_version(c->surface.xdg->toplevel->resource)
+ >= XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION) {
+ wlr_xdg_toplevel_set_tiled(c->surface.xdg->toplevel, edges);
+ } else {
+ wlr_xdg_toplevel_set_maximized(c->surface.xdg->toplevel, edges != WLR_EDGE_NONE);
+ }
+}
+
+static inline void
+client_set_suspended(Client *c, int suspended)
+{
+#ifdef XWAYLAND
+ if (client_is_x11(c))
+ return;
+#endif
+
+ wlr_xdg_toplevel_set_suspended(c->surface.xdg->toplevel, suspended);
+}
+
+static inline int
+client_wants_focus(Client *c)
+{
+#ifdef XWAYLAND
+ return client_is_unmanaged(c)
+ && wlr_xwayland_surface_override_redirect_wants_focus(c->surface.xwayland)
+ && wlr_xwayland_surface_icccm_input_model(c->surface.xwayland) != WLR_ICCCM_INPUT_MODEL_NONE;
+#endif
+ return 0;
+}
+
+static inline int
+client_wants_fullscreen(Client *c)
+{
+#ifdef XWAYLAND
+ if (client_is_x11(c))
+ return c->surface.xwayland->fullscreen;
+#endif
+ return c->surface.xdg->toplevel->requested.fullscreen;
+}
diff --git a/include/dwl-ipc.h b/include/dwl-ipc.h
new file mode 100644
--- /dev/null
+++ b/include/dwl-ipc.h
@@ -0,0 +1,284 @@
+#include "dwl-ipc-unstable-v2-protocol.h"
+
+/* Forward declarations for dwl.c static functions */
+
+static void arrange(Monitor *m);
+static void focusclient(Client *c, int lift);
+static Client *focustop(Monitor *m);
+static void printstatus(void);
+
+/* globals */
+
+static struct wl_global *ipc_global = NULL;
+/* All bound manager objects */
+static struct wl_list ipc_managers; /* IpcManager.link */
+
+typedef struct {
+ struct wl_resource *resource;
+ struct wl_list link; /* ipc_managers */
+ struct wl_list outputs; /* IpcOutput.link */
+} IpcManager;
+
+typedef struct {
+ struct wl_resource *resource;
+ Monitor *mon;
+ struct wl_list link; /* IpcManager.outputs */
+} IpcOutput;
+
+/* helpers */
+
+static IpcOutput *
+ipc_output_for_mon(IpcManager *mgr, Monitor *m)
+{
+ IpcOutput *o;
+ wl_list_for_each(o, &mgr->outputs, link)
+ if (o->mon == m)
+ return o;
+ return NULL;
+}
+
+/* Send the full state of monitor m to one IpcOutput resource */
+static void
+ipc_send_output_state(IpcOutput *ipc_out)
+{
+ Monitor *m = ipc_out->mon;
+ struct wl_resource *res = ipc_out->resource;
+ Client *c;
+ uint32_t occ = 0, urg = 0, sel_tags = 0;
+ int tag, focused;
+
+ /* Compute occupancy/urgency (same logic as printstatus, I think) */
+ wl_list_for_each(c, &clients, link) {
+ if (c->mon != m)
+ continue;
+ occ |= c->tags;
+ if (c->isurgent)
+ urg |= c->tags;
+ }
+
+ c = focustop(m);
+ sel_tags = c ? c->tags : 0;
+
+ /* active */
+ zdwl_ipc_output_v2_send_active(res, m == selmon ? 1 : 0);
+
+ /* per-tag state */
+ for (tag = 0; tag < TAGCOUNT; tag++) {
+ uint32_t mask = 1u << tag;
+ uint32_t state = ZDWL_IPC_OUTPUT_V2_TAG_STATE_NONE;
+ uint32_t clients_on_tag = 0;
+
+ if (m->tagset[m->seltags] & mask)
+ state = ZDWL_IPC_OUTPUT_V2_TAG_STATE_ACTIVE;
+ if (urg & mask)
+ state = ZDWL_IPC_OUTPUT_V2_TAG_STATE_URGENT;
+ if (occ & mask)
+ clients_on_tag = 1; /* report ≥1, not exact count */
+
+ focused = (sel_tags & mask) ? 1 : 0;
+ zdwl_ipc_output_v2_send_tag(res, tag, state, clients_on_tag, focused);
+ }
+
+ /* layout index */
+ {
+ uint32_t i;
+ for (i = 0; i < LENGTH(layouts); i++)
+ if (&layouts[i] == m->lt[m->sellt])
+ break;
+ zdwl_ipc_output_v2_send_layout(res, i);
+ }
+
+ /* layout symbol */
+ zdwl_ipc_output_v2_send_layout_symbol(res, m->ltsymbol);
+
+ /* title/appid/fullscreen/floating */
+ if (c) {
+ zdwl_ipc_output_v2_send_title(res, client_get_title(c));
+ zdwl_ipc_output_v2_send_appid(res, client_get_appid(c));
+ if (wl_resource_get_version(res) >= 2) {
+ zdwl_ipc_output_v2_send_fullscreen(res, c->isfullscreen ? 1 : 0);
+ zdwl_ipc_output_v2_send_floating(res, c->isfloating ? 1 : 0);
+ }
+ } else {
+ zdwl_ipc_output_v2_send_title(res, "");
+ zdwl_ipc_output_v2_send_appid(res, "");
+ if (wl_resource_get_version(res) >= 2) {
+ zdwl_ipc_output_v2_send_fullscreen(res, 0);
+ zdwl_ipc_output_v2_send_floating(res, 0);
+ }
+ }
+
+ /* frame — signals end of this batch of events */
+ zdwl_ipc_output_v2_send_frame(res);
+}
+
+/* Called instead of (or alongside) the old printstatus() */
+static void
+ipc_printstatus(void)
+{
+ IpcManager *mgr;
+ Monitor *m;
+
+ wl_list_for_each(mgr, &ipc_managers, link) {
+ wl_list_for_each(m, &mons, link) {
+ IpcOutput *out = ipc_output_for_mon(mgr, m);
+ if (out)
+ ipc_send_output_state(out);
+ }
+ }
+}
+
+/* zdwl_ipc_output_v2 requests */
+
+static void
+ipc_output_handle_release(struct wl_client *client, struct wl_resource *resource)
+{
+ wl_resource_destroy(resource);
+}
+
+static void
+ipc_output_handle_set_tags(struct wl_client *client, struct wl_resource *resource,
+ uint32_t tagmask, uint32_t toggle_tagset)
+{
+ IpcOutput *out = wl_resource_get_user_data(resource);
+ Monitor *m = out->mon;
+ if (!m) return;
+
+ if (toggle_tagset)
+ m->seltags ^= 1;
+ m->tagset[m->seltags] = tagmask & TAGMASK;
+ focusclient(focustop(m), 1);
+ arrange(m);
+ printstatus();
+}
+
+static void
+ipc_output_handle_set_client_tags(struct wl_client *client,
+ struct wl_resource *resource, uint32_t and_tags, uint32_t xor_tags)
+{
+ IpcOutput *out = wl_resource_get_user_data(resource);
+ Monitor *m = out->mon;
+ Client *sel;
+ uint32_t newtags;
+ if (!m) return;
+
+ sel = focustop(m);
+ if (!sel) return;
+
+ newtags = (sel->tags & and_tags) ^ xor_tags;
+ if (!newtags) return;
+ sel->tags = newtags;
+ focusclient(focustop(m), 1);
+ arrange(m);
+ printstatus();
+}
+
+static void
+ipc_output_handle_set_layout(struct wl_client *client,
+ struct wl_resource *resource, uint32_t idx)
+{
+ IpcOutput *out = wl_resource_get_user_data(resource);
+ Monitor *m = out->mon;
+ if (!m || idx >= LENGTH(layouts)) return;
+
+ m->lt[m->sellt] = &layouts[idx];
+ strncpy(m->ltsymbol, layouts[idx].symbol, LENGTH(m->ltsymbol));
+ arrange(m);
+ printstatus();
+}
+
+static const struct zdwl_ipc_output_v2_interface ipc_output_impl = {
+ .release = ipc_output_handle_release,
+ .set_tags = ipc_output_handle_set_tags,
+ .set_client_tags = ipc_output_handle_set_client_tags,
+ .set_layout = ipc_output_handle_set_layout,
+};
+
+static void
+ipc_output_destroy(struct wl_resource *resource)
+{
+ IpcOutput *out = wl_resource_get_user_data(resource);
+ wl_list_remove(&out->link);
+ free(out);
+}
+
+/* zdwl_ipc_manager_v2 requests */
+
+static void
+ipc_manager_handle_release(struct wl_client *client, struct wl_resource *resource)
+{
+ wl_resource_destroy(resource);
+}
+
+static void
+ipc_manager_handle_get_output(struct wl_client *client, struct wl_resource *resource,
+ uint32_t id, struct wl_resource *output_resource)
+{
+ IpcManager *mgr = wl_resource_get_user_data(resource);
+ struct wlr_output *wlr_out = wlr_output_from_resource(output_resource);
+ Monitor *m = (wlr_out && wlr_out->data) ? wlr_out->data : NULL;
+
+ IpcOutput *out = ecalloc(1, sizeof(*out));
+ out->mon = m;
+ out->resource = wl_resource_create(client, &zdwl_ipc_output_v2_interface,
+ wl_resource_get_version(resource), id);
+ if (!out->resource) {
+ free(out);
+ wl_client_post_no_memory(client);
+ return;
+ }
+ wl_resource_set_implementation(out->resource, &ipc_output_impl,
+ out, ipc_output_destroy);
+ wl_list_insert(&mgr->outputs, &out->link);
+
+ if (m)
+ ipc_send_output_state(out);
+}
+
+static const struct zdwl_ipc_manager_v2_interface ipc_manager_impl = {
+ .release = ipc_manager_handle_release,
+ .get_output = ipc_manager_handle_get_output,
+};
+
+static void
+ipc_manager_destroy(struct wl_resource *resource)
+{
+ IpcManager *mgr = wl_resource_get_user_data(resource);
+ IpcOutput *out, *tmp;
+ wl_list_for_each_safe(out, tmp, &mgr->outputs, link)
+ wl_resource_destroy(out->resource);
+ wl_list_remove(&mgr->link);
+ free(mgr);
+}
+
+/* global bind */
+
+static void
+ipc_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
+{
+ IpcManager *mgr = ecalloc(1, sizeof(*mgr));
+ wl_list_init(&mgr->outputs);
+ mgr->resource = wl_resource_create(client, &zdwl_ipc_manager_v2_interface,
+ version, id);
+ if (!mgr->resource) {
+ free(mgr);
+ wl_client_post_no_memory(client);
+ return;
+ }
+ wl_resource_set_implementation(mgr->resource, &ipc_manager_impl,
+ mgr, ipc_manager_destroy);
+ wl_list_insert(&ipc_managers, &mgr->link);
+
+ /* Announce tags and layouts */
+ zdwl_ipc_manager_v2_send_tags(mgr->resource, TAGCOUNT);
+ for (uint32_t i = 0; i < LENGTH(layouts); i++)
+ zdwl_ipc_manager_v2_send_layout(mgr->resource, layouts[i].symbol);
+}
+
+static void
+ipc_init(void)
+{
+ wl_list_init(&ipc_managers);
+ ipc_global = wl_global_create(dpy, &zdwl_ipc_manager_v2_interface,
+ 2, NULL, ipc_bind);
+}
diff --git a/include/ext-workspace.h b/include/ext-workspace.h
new file mode 100644
--- /dev/null
+++ b/include/ext-workspace.h
@@ -0,0 +1,210 @@
+/* My shitty port of Mango's ext-workspace.h for my compositor;
+ * thanks DreamMaoMao for doing most of the heavy lifting
+ * by actually writing the thing, it didn't work the first
+ * few tries and I barely have any idea how this code works anyway.
+ * To say that it's the eighth wonder of the world
+ * would be an understatement
+*/
+
+#include "wlr_ext_workspace_v1.h"
+
+#define EXT_WORKSPACE_CAPS \
+ (EXT_WORKSPACE_HANDLE_V1_WORKSPACE_CAPABILITIES_ACTIVATE | \
+ EXT_WORKSPACE_HANDLE_V1_WORKSPACE_CAPABILITIES_DEACTIVATE)
+
+/* types */
+
+struct ext_workspace {
+ struct wl_list link;
+ uint32_t tag;
+ Monitor *m;
+ struct wlr_ext_workspace_handle_v1 *handle;
+};
+
+/* global */
+
+static struct wlr_ext_workspace_manager_v1 *ext_workspace_manager;
+static struct wl_list ext_workspaces;
+static struct wl_listener ext_commit_listener;
+static struct wl_listener ext_destroy_listener;
+
+/* helpers */
+
+
+static int
+get_tag_status(uint32_t tag, Monitor *m)
+{
+ Client *c;
+ uint32_t mask = 1 << (tag - 1);
+
+ wl_list_for_each(c, &clients, link) {
+ if (c->mon != m)
+ continue;
+ if (!(c->tags & mask))
+ continue;
+ if (c->isurgent)
+ return 2;
+ return 1;
+ }
+ return 0;
+}
+
+static const char *
+tag_name(uint32_t tag)
+{
+ static const char *names[] = {
+ "1", "2", "3", "4", "5", "6", "7", "8", "9",
+ };
+ if (tag >= 1 && tag <= LENGTH(names))
+ return names[tag - 1];
+ return "?";
+}
+
+/* workspace lifecycle */
+
+static void
+ext_workspace_destroy(struct ext_workspace *ws)
+{
+ wlr_ext_workspace_handle_v1_destroy(ws->handle);
+ wl_list_remove(&ws->link);
+ free(ws);
+}
+
+static void
+ext_workspace_create(uint32_t tag, Monitor *m)
+{
+ const char *name = tag_name(tag);
+
+ struct ext_workspace *ws = ecalloc(1, sizeof(*ws));
+ ws->tag = tag;
+ ws->m = m;
+ ws->handle = wlr_ext_workspace_handle_v1_create(
+ ext_workspace_manager, name, EXT_WORKSPACE_CAPS);
+ ws->handle->data = ws;
+
+ wlr_ext_workspace_handle_v1_set_group(ws->handle, m->ext_group);
+ wlr_ext_workspace_handle_v1_set_name(ws->handle, name);
+
+ wl_list_insert(ext_workspaces.prev, &ws->link);
+}
+
+/* monitor integration */
+
+static void
+ext_workspace_createmon(Monitor *m)
+{
+ uint32_t i;
+
+ m->ext_group = wlr_ext_workspace_group_handle_v1_create(
+ ext_workspace_manager, 0);
+ wlr_ext_workspace_group_handle_v1_output_enter(
+ m->ext_group, m->wlr_output);
+
+ for (i = 1; i <= TAGCOUNT; i++)
+ ext_workspace_create(i, m);
+}
+
+static void
+ext_workspace_cleanupmon(Monitor *m)
+{
+ struct ext_workspace *ws, *tmp;
+ wl_list_for_each_safe(ws, tmp, &ext_workspaces, link)
+ if (ws->m == m)
+ ext_workspace_destroy(ws);
+
+ wlr_ext_workspace_group_handle_v1_output_leave(
+ m->ext_group, m->wlr_output);
+ wlr_ext_workspace_group_handle_v1_destroy(m->ext_group);
+ m->ext_group = NULL;
+}
+
+/* status */
+
+static void
+ext_workspace_printstatus(Monitor *m)
+{
+ struct ext_workspace *ws;
+
+ wl_list_for_each(ws, &ext_workspaces, link) {
+ if (ws->m != m)
+ continue;
+
+ int status = get_tag_status(ws->tag, m);
+ int active = !!(m->tagset[m->seltags] & (1 << (ws->tag - 1)) & TAGMASK);
+
+ wlr_ext_workspace_handle_v1_set_urgent(ws->handle, status == 2);
+ wlr_ext_workspace_handle_v1_set_hidden(ws->handle, 0);
+ wlr_ext_workspace_handle_v1_set_active(ws->handle, active);
+ }
+}
+
+/* commit handler */
+
+static void
+handle_ext_commit(struct wl_listener *listener, void *data)
+{
+ struct wlr_ext_workspace_v1_commit_event *event = data;
+ struct wlr_ext_workspace_v1_request *req;
+
+ wl_list_for_each(req, event->requests, link) {
+ struct ext_workspace *ws = NULL;
+ struct ext_workspace *w;
+
+ switch (req->type) {
+ case WLR_EXT_WORKSPACE_V1_REQUEST_ACTIVATE:
+ if (!req->activate.workspace)
+ break;
+ wl_list_for_each(w, &ext_workspaces, link) {
+ if (w->handle == req->activate.workspace) {
+ ws = w;
+ break;
+ }
+ }
+ if (!ws)
+ break;
+ view(&(Arg){.ui = 1 << (ws->tag - 1)});
+ break;
+
+ case WLR_EXT_WORKSPACE_V1_REQUEST_DEACTIVATE:
+ if (!req->deactivate.workspace)
+ break;
+ wl_list_for_each(w, &ext_workspaces, link) {
+ if (w->handle == req->deactivate.workspace) {
+ ws = w;
+ break;
+ }
+ }
+ if (!ws)
+ break;
+ toggleview(&(Arg){.ui = 1 << (ws->tag - 1)});
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+/* init */
+
+static void
+handle_ext_destroy(struct wl_listener *listener, void *data)
+{
+ wl_list_remove(&ext_commit_listener.link);
+ wl_list_remove(&ext_destroy_listener.link);
+}
+
+static void
+workspaces_init(void)
+{
+ ext_workspace_manager = wlr_ext_workspace_manager_v1_create(dpy, 1);
+ wl_list_init(&ext_workspaces);
+
+ ext_commit_listener.notify = handle_ext_commit;
+ wl_signal_add(&ext_workspace_manager->events.commit,
+ &ext_commit_listener);
+
+ ext_destroy_listener.notify = handle_ext_destroy;
+ wl_signal_add(&ext_workspace_manager->events.destroy,
+ &ext_destroy_listener);
+}
diff --git a/licenses/LICENSE b/licenses/LICENSE
new file mode 100644
--- /dev/null
+++ b/licenses/LICENSE
@@ -0,0 +1,351 @@
+swindle - wayland compositor
+
+Copyright © 2026 kantiankant
+
+See also the files LICENSE.dwl, LICENSE.dwm,
+LICENSE.tinywl, LICENSE.sway, LICENSE.wlroots, LICENSE.mangowm.
+
+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, version 2 of the License.
+
+----
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The 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.
+
+
+ Copyright (C)
+
+ 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, see .
+
+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.
+
+ , 1 April 1989
+ Moe Ghoul, 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.
diff --git a/licenses/LICENSE.dwl b/licenses/LICENSE.dwl
new file mode 100644
--- /dev/null
+++ b/licenses/LICENSE.dwl
@@ -0,0 +1,692 @@
+dwl - dwm for Wayland
+
+Copyright © 2020 dwl team
+
+See also the files LICENSE.tinywl, LICENSE.dwm and LICENSE.sway.
+
+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.
+
+----
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/licenses/LICENSE.dwlmsg b/licenses/LICENSE.dwlmsg
new file mode 100644
--- /dev/null
+++ b/licenses/LICENSE.dwlmsg
@@ -0,0 +1,12 @@
+Copyright (C) 2025 by notchoc
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/licenses/LICENSE.dwm b/licenses/LICENSE.dwm
new file mode 100644
--- /dev/null
+++ b/licenses/LICENSE.dwm
@@ -0,0 +1,39 @@
+Portions of dwl based on dwm code are used under the following license:
+
+MIT/X Consortium License
+
+© 2006-2019 Anselm R Garbe
+© 2006-2009 Jukka Salmi
+© 2006-2007 Sander van Dijk
+© 2007-2011 Peter Hartlich
+© 2007-2009 Szabolcs Nagy
+© 2007-2009 Christof Musik
+© 2007-2009 Premysl Hruby
+© 2007-2008 Enno Gottox Boland
+© 2008 Martin Hurton
+© 2008 Neale Pickett
+© 2009 Mate Nagy
+© 2010-2016 Hiltjo Posthuma
+© 2010-2012 Connor Lane Smith
+© 2011 Christoph Lohmann <20h@r-36.net>
+© 2015-2016 Quentin Rameau
+© 2015-2016 Eric Pruitt
+© 2016-2017 Markus Teich
+
+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.
diff --git a/licenses/LICENSE.mangowm b/licenses/LICENSE.mangowm
new file mode 100644
--- /dev/null
+++ b/licenses/LICENSE.mangowm
@@ -0,0 +1,692 @@
+mango - wayland compositor base wlroots
+
+Copyright © 2025 DreamMaoMao
+
+See also the files LICENSE.dwl, LICENSE.tinywl, LICENSE.dwm and LICENSE.sway.
+
+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.
+
+----
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 1. 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.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
\ No newline at end of file
diff --git a/licenses/LICENSE.sway b/licenses/LICENSE.sway
new file mode 100644
--- /dev/null
+++ b/licenses/LICENSE.sway
@@ -0,0 +1,19 @@
+Copyright (c) 2016-2017 Drew DeVault
+
+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.
diff --git a/licenses/LICENSE.tinywl b/licenses/LICENSE.tinywl
new file mode 100644
--- /dev/null
+++ b/licenses/LICENSE.tinywl
@@ -0,0 +1,127 @@
+dwl is originally based on TinyWL, which is used under the following license:
+
+This work is licensed under CC0, which effectively puts it in the public domain.
+
+---
+
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+ HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display,
+ communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+ likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+ v. rights protecting the extraction, dissemination, use and reuse of data
+ in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation
+ thereof, including any amended or successor version of such
+ directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+ world based on applicable law or treaty, and any national
+ implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal or
+equitable action to disrupt the quiet enjoyment of the Work by the public
+as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason
+be judged legally invalid or ineffective under applicable law, then the
+Waiver shall be preserved to the maximum extent permitted taking into
+account Affirmer's express Statement of Purpose. In addition, to the
+extent the Waiver is so judged Affirmer hereby grants to each affected
+person a royalty-free, non transferable, non sublicensable, non exclusive,
+irrevocable and unconditional license to exercise Affirmer's Copyright and
+Related Rights in the Work (i) in all territories worldwide, (ii) for the
+maximum duration provided by applicable law or treaty (including future
+time extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"License"). The License shall be deemed effective as of the date CC0 was
+applied by Affirmer to the Work. Should any part of the License for any
+reason be judged legally invalid or ineffective under applicable law, such
+partial invalidity or ineffectiveness shall not invalidate the remainder
+of the License, and in such case Affirmer hereby affirms that he or she
+will not (i) exercise any of his or her remaining Copyright and Related
+Rights in the Work or (ii) assert any associated claims and causes of
+action with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or
+ warranties of any kind concerning the Work, express, implied,
+ statutory or otherwise, including without limitation warranties of
+ title, merchantability, fitness for a particular purpose, non
+ infringement, or the absence of latent or other defects, accuracy, or
+ the present or absence of errors, whether or not discoverable, all to
+ the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without
+ limitation any person's Copyright and Related Rights in the Work.
+ Further, Affirmer disclaims responsibility for obtaining any necessary
+ consents, permissions or other rights required for any use of the
+ Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to
+ this CC0 or use of the Work.
diff --git a/licenses/LICENSE.wlroots b/licenses/LICENSE.wlroots
new file mode 100644
--- /dev/null
+++ b/licenses/LICENSE.wlroots
@@ -0,0 +1,21 @@
+Copyright (c) 2017, 2018 Drew DeVault
+Copyright (c) 2014 Jari Vetoniemi
+Copyright (c) 2023 The wlroots contributors
+
+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.
diff --git a/parser/parser.c b/parser/parser.c
new file mode 100644
--- /dev/null
+++ b/parser/parser.c
@@ -0,0 +1,757 @@
+/* Here be a small dragon.
+ * Not as large as the monster
+ * in src/swindle.c
+ * but you get the idea */
+
+#include "parser.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+/* Lua */
+#include
+#include
+#include
+
+/* wlroots */
+#include
+#include
+#include
+
+/* Forward declarations from src/swindle.c */
+extern struct wl_list mons;
+extern struct wl_list clients;
+void arrange(void *m);
+
+/* Internal watcher state */
+
+typedef struct {
+ int inotify_fd;
+ int watch_fd;
+ char path[1024];
+ config_reload_cb cb;
+ void *userdata;
+ struct wl_event_source *event_src;
+} WatchState;
+
+/* Helpers */
+
+static void
+lua_log_error(lua_State *L, const char *context)
+{
+ fprintf(stderr, "swindle config [%s]: %s\n",
+ context, lua_tostring(L, -1));
+ lua_pop(L, 1);
+}
+
+/* Get a string field from the table at the top of the stack
+ * Writes into buf and returns false and leaves buf untouched on failure
+ */
+
+static bool
+lua_get_string(lua_State *L, const char *key, char *buf, size_t bufsz)
+{
+ lua_getfield(L, -1, key);
+ bool ok = lua_isstring(L, -1);
+ if (ok)
+ strncpy(buf, lua_tostring(L, -1), bufsz - 1);
+ lua_pop(L, 1);
+ return ok;
+}
+
+/* Get an integer field. It falls back to `def` if missing or wrong type */
+
+static int
+lua_get_int(lua_State *L, const char *key, int def)
+{
+ lua_getfield(L, -1, key);
+ int val = lua_isnumber(L, -1) ? (int)lua_tointeger(L, -1) : def;
+ lua_pop(L, 1);
+ return val;
+}
+
+static double
+lua_get_double(lua_State *L, const char *key, double def)
+{
+ lua_getfield(L, -1, key);
+ double val = lua_isnumber(L, -1) ? lua_tonumber(L, -1) : def;
+ lua_pop(L, 1);
+ return val;
+}
+
+static bool
+lua_get_bool(lua_State *L, const char *key, bool def)
+{
+ lua_getfield(L, -1, key);
+ bool val = lua_isboolean(L, -1) ? lua_toboolean(L, -1) : def;
+ lua_pop(L, 1);
+ return val;
+}
+
+/* wlroots hard-asserts opacity is in [0,1] and takes the whole thing
+ * down with it if it isn't (as it should), so it might as well clamp anything
+ * a user's config throws at it because users are kinda unwise */
+
+static float
+lua_get_opacity(lua_State *L, const char *key, float def)
+{
+ double v = lua_get_double(L, key, (double)def);
+ if (v < 0.0) {
+ fprintf(stderr, "swindle config: '%s' below 0, clamping to 0\n", key);
+ v = 0.0;
+ } else if (v > 1.0) {
+ fprintf(stderr, "swindle config: '%s' above 1, clamping to 1\n", key);
+ v = 1.0;
+ }
+ return (float)v;
+}
+
+static void
+parse_color_hex(uint32_t hex, float out[4])
+{
+ out[0] = ((hex >> 24) & 0xFF) / 255.0f;
+ out[1] = ((hex >> 16) & 0xFF) / 255.0f;
+ out[2] = ((hex >> 8) & 0xFF) / 255.0f;
+ out[3] = ( hex & 0xFF) / 255.0f;
+}
+
+static void
+lua_get_color(lua_State *L, const char *key, float out[4],
+ float r, float g, float b, float a)
+{
+ lua_getfield(L, -1, key);
+ if (lua_isnumber(L, -1))
+ parse_color_hex((uint32_t)lua_tointeger(L, -1), out);
+ else {
+ out[0] = r; out[1] = g; out[2] = b; out[3] = a;
+ }
+ lua_pop(L, 1);
+}
+
+static uint32_t
+parse_modifier(const char *name)
+{
+ if (!strcmp(name, "shift")) return WLR_MODIFIER_SHIFT;
+ if (!strcmp(name, "ctrl")) return WLR_MODIFIER_CTRL;
+ if (!strcmp(name, "alt")) return WLR_MODIFIER_ALT;
+ if (!strcmp(name, "logo")) return WLR_MODIFIER_LOGO;
+ if (!strcmp(name, "mod2")) return WLR_MODIFIER_MOD2;
+ if (!strcmp(name, "mod3")) return WLR_MODIFIER_MOD3;
+ if (!strcmp(name, "mod5")) return WLR_MODIFIER_MOD5;
+ fprintf(stderr, "swindle config: unknown modifier '%s', ignoring\n", name);
+ return 0;
+}
+
+/* Section parsers */
+
+static void
+parse_appearance(lua_State *L, CfgAppearance *a)
+{
+ lua_getglobal(L, "appearance");
+ if (!lua_istable(L, -1)) {
+ fprintf(stderr, "swindle config: 'appearance' table missing' \n");
+ lua_pop(L, 1);
+ /* defaults */
+ a->inner_border_px = 1;
+ a->outer_border_px = 1;
+ a->gaps = 10;
+ a->smart_gaps = false;
+ parse_color_hex(0x222222ff, a->root_color);
+ parse_color_hex(0x00000000, a->inner_border_color);
+ parse_color_hex(0x00000000, a->outer_border_color);
+ parse_color_hex(0xe8e8e8ff, a->inner_focus_color);
+ parse_color_hex(0xe8e8e8ff, a->outer_focus_color);
+ parse_color_hex(0xff0000ff, a->inner_urgent_color);
+ parse_color_hex(0xff0000ff, a->outer_urgent_color);
+ a->fullscreen_bg[3] = 1.0f;
+ a->active_opacity = 1.0f;
+ a->inactive_opacity = 1.0f;
+ return;
+ }
+
+ a->inner_border_px = (unsigned int)lua_get_int(L, "inner_border_px", 1);
+ a->outer_border_px = (unsigned int)lua_get_int(L, "outer_border_px", 1);
+ a->gaps = (unsigned int)lua_get_int(L, "gaps", 10);
+ a->smart_gaps = lua_get_bool(L, "smart_gaps", false);
+
+ lua_get_color(L, "root_color", a->root_color, 0.133f,0.133f,0.133f,1.f);
+ lua_get_color(L, "inner_border_color", a->inner_border_color, 0.f,0.f,0.f,0.f);
+ lua_get_color(L, "outer_border_color", a->outer_border_color, 0.f,0.f,0.f,0.f);
+ lua_get_color(L, "inner_focus_color", a->inner_focus_color, 0.91f,0.91f,0.91f,1.f);
+ lua_get_color(L, "outer_focus_color", a->outer_focus_color, 0.91f,0.91f,0.91f,1.f);
+ lua_get_color(L, "inner_urgent_color", a->inner_urgent_color, 1.f,0.f,0.f,1.f);
+ lua_get_color(L, "outer_urgent_color", a->outer_urgent_color, 1.f,0.f,0.f,1.f);
+
+ a->active_opacity = lua_get_opacity(L, "active_opacity", 1.0f);
+ a->inactive_opacity = lua_get_opacity(L, "inactive_opacity", 1.0f);
+
+ lua_getfield(L, -1, "fullscreen_bg");
+ if (lua_isnumber(L, -1))
+ parse_color_hex((uint32_t)lua_tointeger(L, -1), a->fullscreen_bg);
+ else {
+ a->fullscreen_bg[0] = 0.f;
+ a->fullscreen_bg[1] = 0.f;
+ a->fullscreen_bg[2] = 0.f;
+ a->fullscreen_bg[3] = 1.f;
+ }
+ lua_pop(L, 1);
+
+ lua_pop(L, 1); /* pop appearance table */
+}
+
+static void
+parse_input(lua_State *L, CfgInput *inp)
+{
+ lua_getglobal(L, "input");
+ if (!lua_istable(L, -1)) {
+ fprintf(stderr, "swindle config: 'input' table missing, "
+ "using defaults. You'll feel the repeat delay.\n");
+ lua_pop(L, 1);
+ inp->repeat_rate = 50;
+ inp->repeat_delay = 150;
+ inp->tap_to_click = true;
+ inp->accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
+ strcpy(inp->layout, "us");
+ return;
+ }
+
+ inp->repeat_rate = lua_get_int (L, "repeat_rate", 50);
+ inp->repeat_delay = lua_get_int (L, "repeat_delay", 150);
+ inp->tap_to_click = lua_get_bool(L, "tap_to_click", true);
+ inp->tap_and_drag = lua_get_bool(L, "tap_and_drag", true);
+ inp->drag_lock = lua_get_bool(L, "drag_lock", true);
+ inp->natural_scrolling = lua_get_bool(L, "natural_scrolling", false);
+ inp->disable_while_typing = lua_get_bool(L, "disable_while_typing", true);
+ inp->left_handed = lua_get_bool(L, "left_handed", false);
+ inp->middle_button_emulation= lua_get_bool(L, "middle_button_emulation",false);
+ inp->accel_speed = lua_get_double(L, "accel_speed", 0.0);
+
+ lua_get_string(L, "layout", inp->layout, sizeof(inp->layout));
+ lua_get_string(L, "variant", inp->variant, sizeof(inp->variant));
+ lua_get_string(L, "model", inp->model, sizeof(inp->model));
+ lua_get_string(L, "options", inp->options, sizeof(inp->options));
+ if (!inp->layout[0]) strcpy(inp->layout, "us");
+
+ char scratch[CFG_MAX_STRLEN] = {0};
+
+ lua_get_string(L, "scroll_method", scratch, sizeof(scratch));
+ if (!strcmp(scratch, "2fg")) inp->scroll_method = LIBINPUT_CONFIG_SCROLL_2FG;
+ else if (!strcmp(scratch, "edge")) inp->scroll_method = LIBINPUT_CONFIG_SCROLL_EDGE;
+ else if (!strcmp(scratch, "button")) inp->scroll_method = LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN;
+ else inp->scroll_method = LIBINPUT_CONFIG_SCROLL_2FG;
+
+ lua_get_string(L, "accel_profile", scratch, sizeof(scratch));
+ if (!strcmp(scratch, "flat")) inp->accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
+ else inp->accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
+
+ lua_get_string(L, "click_method", scratch, sizeof(scratch));
+ if (!strcmp(scratch, "clickfinger")) inp->click_method = LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER;
+ else if (!strcmp(scratch, "button_areas")) inp->click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
+ else inp->click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
+
+ lua_get_string(L, "send_events_mode", scratch, sizeof(scratch));
+ if (!strcmp(scratch, "disabled")) inp->send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED;
+ else if (!strcmp(scratch, "disabled_on_external")) inp->send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE;
+ else inp->send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
+
+ lua_get_string(L, "tap_button_map", scratch, sizeof(scratch));
+ if (!strcmp(scratch, "lmr")) inp->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LMR;
+ else inp->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
+
+ lua_pop(L, 1);
+}
+
+static void
+parse_rules(lua_State *L, Config *cfg)
+{
+ lua_getglobal(L, "rules");
+ if (!lua_istable(L, -1)) {
+ lua_pop(L, 1);
+ return;
+ }
+
+ cfg->nrules = 0;
+ int n = (int)lua_rawlen(L, -1);
+ for (int i = 1; i <= n && cfg->nrules < CFG_MAX_RULES; i++) {
+ lua_rawgeti(L, -1, i);
+ if (!lua_istable(L, -1)) { lua_pop(L, 1); continue; }
+
+ CfgRule *r = &cfg->rules[cfg->nrules++];
+ memset(r, 0, sizeof(*r));
+ lua_get_string(L, "app_id", r->app_id, sizeof(r->app_id));
+ lua_get_string(L, "title", r->title, sizeof(r->title));
+ r->tags = (uint32_t)lua_get_int(L, "tags", 0);
+ r->floating = lua_get_bool(L, "floating", false);
+ r->monitor = lua_get_int(L, "monitor", -1);
+
+ lua_pop(L, 1);
+ }
+ lua_pop(L, 1);
+}
+
+static void
+parse_monitors(lua_State *L, Config *cfg)
+{
+ lua_getglobal(L, "monitors");
+ if (!lua_istable(L, -1)) {
+ lua_pop(L, 1);
+ cfg->nmonitors = 1;
+ CfgMonitorRule *m = &cfg->monitors[0];
+ memset(m, 0, sizeof(*m));
+ m->mfact = 0.55f;
+ m->nmaster = 1;
+ m->scale = 1.0f;
+ strcpy(m->layout, "dwindle");
+ m->x = m->y = -1;
+ return;
+ }
+
+ cfg->nmonitors = 0;
+ int n = (int)lua_rawlen(L, -1);
+ for (int i = 1; i <= n && cfg->nmonitors < CFG_MAX_MONITORS; i++) {
+ lua_rawgeti(L, -1, i);
+ if (!lua_istable(L, -1)) { lua_pop(L, 1); continue; }
+
+ CfgMonitorRule *m = &cfg->monitors[cfg->nmonitors++];
+ memset(m, 0, sizeof(*m));
+
+ lua_getfield(L, -1, "name");
+ if (lua_isstring(L, -1))
+ strncpy(m->name, lua_tostring(L, -1), sizeof(m->name)-1);
+ lua_pop(L, 1);
+
+ m->mfact = (float)lua_get_double(L, "mfact", 0.55);
+ m->nmaster = lua_get_int (L, "nmaster", 1);
+ m->scale = (float)lua_get_double(L, "scale", 1.0);
+ m->x = lua_get_int (L, "x", -1);
+ m->y = lua_get_int (L, "y", -1);
+ m->transform = lua_get_int (L, "transform", 0);
+ lua_get_string(L, "layout", m->layout, sizeof(m->layout));
+ if (!m->layout[0]) strcpy(m->layout, "dwindle");
+
+ lua_pop(L, 1);
+ }
+ lua_pop(L, 1);
+}
+
+static void
+parse_keybinds(lua_State *L, Config *cfg)
+{
+ lua_getglobal(L, "keybinds");
+ if (!lua_istable(L, -1)) {
+ lua_pop(L, 1);
+ return;
+ }
+
+ cfg->nkeybinds = 0;
+ struct xkb_context *xkb_ctx = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
+
+ int n = (int)lua_rawlen(L, -1);
+ for (int i = 1; i <= n && cfg->nkeybinds < CFG_MAX_KEYBINDS; i++) {
+ lua_rawgeti(L, -1, i);
+ if (!lua_istable(L, -1)) { lua_pop(L, 1); continue; }
+
+ CfgKeybind *kb = &cfg->keybinds[cfg->nkeybinds];
+ memset(kb, 0, sizeof(*kb));
+
+ /* mods: array of strings */
+ kb->mods = 0;
+ lua_getfield(L, -1, "mods");
+ if (lua_istable(L, -1)) {
+ int nm = (int)lua_rawlen(L, -1);
+ for (int m = 1; m <= nm; m++) {
+ lua_rawgeti(L, -1, m);
+ if (lua_isstring(L, -1))
+ kb->mods |= parse_modifier(lua_tostring(L, -1));
+ lua_pop(L, 1);
+ }
+ }
+ lua_pop(L, 1);
+
+ /* key: string keysym name, e.g. "q", "Return", "XF86AudioMute" */
+ char keyname[CFG_MAX_STRLEN] = {0};
+ lua_get_string(L, "key", keyname, sizeof(keyname));
+ kb->key = xkb_keysym_from_name(keyname, XKB_KEYSYM_CASE_INSENSITIVE);
+ if (kb->key == XKB_KEY_NoSymbol) {
+ fprintf(stderr, "swindle config: unknown key '%s', skipping bind\n",
+ keyname);
+ lua_pop(L, 1); /* keybind entry table */
+ continue;
+ }
+
+ lua_get_string(L, "action", kb->action, sizeof(kb->action));
+
+ /* args: optional array of strings */
+ kb->nargs = 0;
+ lua_getfield(L, -1, "args");
+ if (lua_istable(L, -1)) {
+ int na = (int)lua_rawlen(L, -1);
+ for (int a = 1; a <= na && kb->nargs < CFG_MAX_ARGS; a++) {
+ lua_rawgeti(L, -1, a);
+ if (lua_isstring(L, -1))
+ strncpy(kb->args[kb->nargs++],
+ lua_tostring(L, -1),
+ CFG_MAX_STRLEN - 1);
+ lua_pop(L, 1);
+ }
+ }
+ lua_pop(L, 1); /* args */
+
+ cfg->nkeybinds++;
+ lua_pop(L, 1); /* keybind entry */
+ }
+
+ xkb_context_unref(xkb_ctx);
+ lua_pop(L, 1); /* keybinds table */
+}
+
+static void
+parse_buttons(lua_State *L, Config *cfg)
+{
+ lua_getglobal(L, "buttons");
+ if (!lua_istable(L, -1)) {
+ lua_pop(L, 1);
+ return;
+ }
+
+ cfg->nbuttons = 0;
+ int n = (int)lua_rawlen(L, -1);
+ for (int i = 1; i <= n && cfg->nbuttons < CFG_MAX_KEYBINDS; i++) {
+ lua_rawgeti(L, -1, i);
+ if (!lua_istable(L, -1)) { lua_pop(L, 1); continue; }
+
+ CfgButton *b = &cfg->buttons[cfg->nbuttons++];
+ memset(b, 0, sizeof(*b));
+
+ b->mods = 0;
+ lua_getfield(L, -1, "mods");
+ if (lua_istable(L, -1)) {
+ int nm = (int)lua_rawlen(L, -1);
+ for (int m = 1; m <= nm; m++) {
+ lua_rawgeti(L, -1, m);
+ if (lua_isstring(L, -1))
+ b->mods |= parse_modifier(lua_tostring(L, -1));
+ lua_pop(L, 1);
+ }
+ }
+ lua_pop(L, 1);
+
+ char btnname[CFG_MAX_STRLEN] = {0};
+ lua_get_string(L, "button", btnname, sizeof(btnname));
+ if (!strcmp(btnname, "left")) b->button = BTN_LEFT;
+ else if (!strcmp(btnname, "right")) b->button = BTN_RIGHT;
+ else if (!strcmp(btnname, "middle")) b->button = BTN_MIDDLE;
+ else b->button = (uint32_t)atoi(btnname);
+
+ lua_get_string(L, "action", b->action, sizeof(b->action));
+
+ b->nargs = 0;
+ lua_getfield(L, -1, "args");
+ if (lua_istable(L, -1)) {
+ int na = (int)lua_rawlen(L, -1);
+ for (int a = 1; a <= na && b->nargs < CFG_MAX_ARGS; a++) {
+ lua_rawgeti(L, -1, a);
+ if (lua_isstring(L, -1))
+ strncpy(b->args[b->nargs++],
+ lua_tostring(L, -1),
+ CFG_MAX_STRLEN - 1);
+ lua_pop(L, 1);
+ }
+ }
+ lua_pop(L, 1); /* args */
+
+ lua_pop(L, 1);
+ }
+ lua_pop(L, 1);
+}
+
+static void
+parse_autostart(lua_State *L, Config *cfg)
+{
+ lua_getglobal(L, "autostart");
+ if (!lua_istable(L, -1)) {
+ lua_pop(L, 1);
+ return;
+ }
+
+ cfg->nautostart = 0;
+ int n = (int)lua_rawlen(L, -1);
+ for (int i = 1; i <= n && cfg->nautostart < CFG_MAX_AUTOSTART; i++) {
+ lua_rawgeti(L, -1, i);
+ if (!lua_isstring(L, -1)) {
+ lua_pop(L, 1);
+ continue;
+ }
+ strncpy(cfg->autostart[cfg->nautostart].cmd,
+ lua_tostring(L, -1),
+ CFG_MAX_AUTOSTART_CMD - 1);
+ cfg->nautostart++;
+ lua_pop(L, 1);
+ }
+ lua_pop(L, 1);
+}
+
+/* Public API */
+
+char *
+config_get_path(char *buf, size_t bufsz)
+{
+ const char *xdg = getenv("XDG_CONFIG_HOME");
+ if (xdg && *xdg)
+ snprintf(buf, bufsz, "%s/swindle/config.lua", xdg);
+ else {
+ const char *home = getenv("HOME");
+ if (!home) home = "/root"; /* you're probably root, aren't you */
+ snprintf(buf, bufsz, "%s/.config/swindle/config.lua", home);
+ }
+ return buf;
+}
+
+int
+config_load(const char *path, Config *cfg)
+{
+ memset(cfg, 0, sizeof(*cfg));
+
+ lua_State *L = luaL_newstate();
+ if (!L) {
+ fprintf(stderr, "swindle config: failed to create Lua state. "
+ "Truly rock bottom.\n");
+ return -1;
+ }
+ luaL_openlibs(L);
+
+ if (luaL_dofile(L, path) != LUA_OK) {
+ lua_log_error(L, "load");
+ lua_close(L);
+ return -1;
+ }
+
+ /* Top-level booleans */
+ lua_getglobal(L, "sloppy_focus");
+ cfg->sloppyfocus = lua_isboolean(L, -1) ? lua_toboolean(L, -1) : true;
+ lua_pop(L, 1);
+
+ lua_getglobal(L, "bypass_surface_visibility");
+ cfg->bypass_surface_visibility = lua_isboolean(L, -1)
+ ? lua_toboolean(L, -1) : false;
+ lua_pop(L, 1);
+
+ lua_getglobal(L, "log_level");
+ if (lua_isstring(L, -1)) {
+ const char *ll = lua_tostring(L, -1);
+ if (!strcmp(ll, "silent")) cfg->log_level = WLR_SILENT;
+ else if (!strcmp(ll, "info")) cfg->log_level = WLR_INFO;
+ else if (!strcmp(ll, "debug")) cfg->log_level = WLR_DEBUG;
+ else cfg->log_level = WLR_ERROR;
+ } else {
+ cfg->log_level = WLR_ERROR;
+ }
+ lua_pop(L, 1);
+
+ parse_appearance(L, &cfg->appearance);
+ parse_input (L, &cfg->input);
+ parse_rules (L, cfg);
+ parse_monitors (L, cfg);
+ parse_keybinds (L, cfg);
+ parse_buttons (L, cfg);
+ parse_autostart (L, cfg);
+
+ lua_close(L);
+ return 0;
+}
+
+/* Apply functions */
+
+void
+config_apply_appearance(const Config *cfg)
+{
+ (void)cfg;
+}
+
+void
+config_apply_input(const Config *cfg)
+{
+ (void)cfg;
+}
+
+void
+config_apply_keybinds(const Config *cfg)
+{
+ (void)cfg;
+}
+
+void
+config_autostart_run(const Config *cfg)
+{
+ if (cfg->nautostart == 0)
+ return;
+
+ pid_t pid = fork();
+ if (pid < 0) {
+ perror("swindle autostart: fork");
+ return;
+ }
+ if (pid != 0)
+ return; /* compositor continues (sequencer runs in child) */
+
+ /* The sequencer child resets any inherited signal handlers and becomes
+ * a new session so the compositor's SIGCHLD handling doesn't
+ * interfere with our waitpid calls. */
+ signal(SIGCHLD, SIG_DFL);
+ setsid();
+
+ for (int i = 0; i < cfg->nautostart; i++) {
+ const char *cmd = cfg->autostart[i].cmd;
+
+ pid_t cpid = fork();
+ if (cpid < 0) {
+ fprintf(stderr, "swindle autostart: fork for '%s': %s\n",
+ cmd, strerror(errno));
+ continue;
+ }
+ if (cpid == 0) {
+ execl("/bin/sh", "sh", "-c", cmd, NULL);
+ fprintf(stderr, "swindle autostart: exec '%s': %s\n",
+ cmd, strerror(errno));
+ _exit(1);
+ }
+
+ /* wait a second because one shotters will fly past, but
+ * daemon processes (some, like swaybg) won't because of
+ * daemon black magic. To say the least, it's good for the soul */
+ struct timespec deadline, now;
+ clock_gettime(CLOCK_MONOTONIC, &deadline);
+ deadline.tv_sec += 0.5;
+
+ int status;
+ int done = 0;
+ while (!done) {
+ pid_t r = waitpid(cpid, &status, WNOHANG);
+ if (r == cpid) {
+ done = 1;
+ if (WIFEXITED(status) && WEXITSTATUS(status) != 0)
+ fprintf(stderr, "swindle autostart: '%s' exited with status %d\n",
+ cmd, WEXITSTATUS(status));
+ } else {
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ if (now.tv_sec > deadline.tv_sec ||
+ (now.tv_sec == deadline.tv_sec &&
+ now.tv_nsec >= deadline.tv_nsec))
+ break; /* looks like a daemon, move on */
+ struct timespec sl = { .tv_sec = 0, .tv_nsec = 50 * 1000 * 1000 };
+ nanosleep(&sl, NULL);
+ }
+ }
+ }
+
+ _exit(0);
+}
+
+/* inotify watcher */
+
+static int
+watch_dispatch(int fd, uint32_t mask, void *data)
+{
+ WatchState *ws = data;
+
+ /* Drain the inotify events */
+ _Alignas(struct inotify_event) char buf[4096];
+ ssize_t len = read(fd, buf, sizeof(buf));
+ if (len < 0) {
+ if (errno != EAGAIN)
+ perror("swindle config: inotify read");
+ return 0;
+ }
+
+ /* Re-parse */
+ Config *fresh = calloc(1, sizeof(Config));
+ if (!fresh) return 0;
+
+ if (config_load(ws->path, fresh) == 0) {
+ fprintf(stderr, "swindle config: reloaded '%s'\n", ws->path);
+ if (ws->cb)
+ ws->cb(fresh, ws->userdata);
+ } else {
+ fprintf(stderr, "swindle config: reload failed, keeping old config. "
+ "Story of my life.\n");
+ }
+
+ free(fresh);
+
+ /*
+ * Some editors (vim, nano) delete-and-recreate files on save,
+ * which removes our watch (which is a pain in the ass.
+ * Hence, re-add it defensively. It's good for the soul)
+ */
+ inotify_rm_watch(ws->inotify_fd, ws->watch_fd);
+ ws->watch_fd = inotify_add_watch(ws->inotify_fd, ws->path,
+ IN_CLOSE_WRITE | IN_MOVED_TO | IN_CREATE);
+
+ return 0;
+}
+
+struct wl_event_source *
+config_watch_start(struct wl_event_loop *loop, const char *path,
+ config_reload_cb cb, void *userdata)
+{
+ WatchState *ws = calloc(1, sizeof(*ws));
+ if (!ws) return NULL;
+
+ ws->inotify_fd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
+ if (ws->inotify_fd < 0) {
+ perror("swindle config: inotify_init1");
+ free(ws);
+ return NULL;
+ }
+
+ ws->watch_fd = inotify_add_watch(ws->inotify_fd, path,
+ IN_CLOSE_WRITE | IN_MOVED_TO | IN_CREATE);
+ if (ws->watch_fd < 0) {
+ perror("swindle config: inotify_add_watch");
+ close(ws->inotify_fd);
+ free(ws);
+ return NULL;
+ }
+
+ strncpy(ws->path, path, sizeof(ws->path) - 1);
+ ws->cb = cb;
+ ws->userdata = userdata;
+
+ struct wl_event_source *src = wl_event_loop_add_fd(
+ loop, ws->inotify_fd,
+ WL_EVENT_READABLE,
+ watch_dispatch, ws
+ );
+
+ if (!src) {
+ fprintf(stderr, "swindle config: failed to add inotify to event loop. "
+ "Classic.\n");
+ close(ws->inotify_fd);
+ free(ws);
+ return NULL;
+ }
+
+ ws->event_src = src;
+ fprintf(stderr, "swindle config: watching '%s'\n", path);
+ return (struct wl_event_source *)ws;
+}
+
+void
+config_watch_stop(struct wl_event_source *src)
+{
+ if (!src) return;
+ WatchState *ws = (WatchState *)src;
+ wl_event_source_remove(ws->event_src);
+ close(ws->inotify_fd);
+ free(ws);
+}
diff --git a/parser/parser.h b/parser/parser.h
new file mode 100644
--- /dev/null
+++ b/parser/parser.h
@@ -0,0 +1,160 @@
+#ifndef SWINDLE_PARSER_H
+#define SWINDLE_PARSER_H
+
+#include
+#include
+#include
+
+/* Maximum lengths. Good for the soul, they say */
+#define CFG_MAX_RULES 64
+#define CFG_MAX_MONITORS 16
+#define CFG_MAX_KEYBINDS 256
+#define CFG_MAX_ARGS 16
+#define CFG_MAX_STRLEN 256
+#define CFG_MAX_AUTOSTART 32
+#define CFG_MAX_AUTOSTART_CMD 512
+
+/* Appearance */
+
+typedef struct {
+ unsigned int inner_border_px;
+ unsigned int outer_border_px;
+ unsigned int gaps;
+ bool smart_gaps;
+ float inner_border_color[4];
+ float outer_border_color[4];
+ float inner_focus_color[4];
+ float outer_focus_color[4];
+ float inner_urgent_color[4];
+ float outer_urgent_color[4];
+ float root_color[4];
+ float fullscreen_bg[4];
+ float active_opacity;
+ float inactive_opacity;
+} CfgAppearance;
+
+/* Input */
+
+typedef struct {
+ int repeat_rate;
+ int repeat_delay;
+ bool tap_to_click;
+ bool tap_and_drag;
+ bool drag_lock;
+ bool natural_scrolling;
+ bool disable_while_typing;
+ bool left_handed;
+ bool middle_button_emulation;
+ int scroll_method; /* libinput enum value */
+ int click_method; /* libinput enum value */
+ int send_events_mode;
+ int accel_profile; /* libinput enum value */
+ double accel_speed;
+ int tap_button_map; /* libinput enum value */
+ char layout[CFG_MAX_STRLEN]; /* "us", "de", "de,us", ... */
+ char variant[CFG_MAX_STRLEN]; /* "nodeadkeys", "colemak", ... */
+ char model[CFG_MAX_STRLEN]; /* "pc105", ... */
+ char options[CFG_MAX_STRLEN]; /* "grp:alt_shift_toggle", ... */
+} CfgInput;
+
+/* Window Rules */
+
+typedef struct {
+ char app_id[CFG_MAX_STRLEN];
+ char title[CFG_MAX_STRLEN]; /* empty string = wildcard */
+ uint32_t tags;
+ bool floating;
+ int monitor; /* -1 = current */
+} CfgRule;
+
+/* Monitor Rules */
+
+typedef struct {
+ char name[CFG_MAX_STRLEN]; /* empty = catch-all */
+ float mfact;
+ int nmaster;
+ float scale;
+ char layout[CFG_MAX_STRLEN]; /* "dwindle", "floating", etc. */
+ int transform; /* WL_OUTPUT_TRANSFORM_* */
+ int x, y; /* -1,-1 = autoconfigure */
+} CfgMonitorRule;
+
+/* keybinds */
+
+typedef struct {
+ uint32_t mods; /* WLR_MODIFIER_* bitmask */
+ uint32_t key; /* XKB keysym */
+ char action[CFG_MAX_STRLEN]; /* "spawn", "killclient", etc. */
+ char args[CFG_MAX_ARGS][CFG_MAX_STRLEN];
+ int nargs;
+} CfgKeybind;
+
+/* mouse buttons */
+
+typedef struct {
+ uint32_t mods;
+ uint32_t button;
+ char action[CFG_MAX_STRLEN];
+ char args[CFG_MAX_ARGS][CFG_MAX_STRLEN];
+ int nargs;
+} CfgButton;
+
+/* Autostart */
+
+typedef struct {
+ char cmd[CFG_MAX_AUTOSTART_CMD];
+} CfgAutostart;
+
+/* the whole shebang */
+
+typedef struct {
+ CfgAppearance appearance;
+
+ CfgInput input;
+
+ CfgRule rules[CFG_MAX_RULES];
+ int nrules;
+
+ CfgMonitorRule monitors[CFG_MAX_MONITORS];
+ int nmonitors;
+
+ CfgKeybind keybinds[CFG_MAX_KEYBINDS];
+ int nkeybinds;
+
+ CfgButton buttons[CFG_MAX_KEYBINDS];
+ int nbuttons;
+
+ bool sloppyfocus;
+ bool bypass_surface_visibility;
+ int log_level; /* WLR_* log level */
+
+ CfgAutostart autostart[CFG_MAX_AUTOSTART];
+ int nautostart;
+} Config;
+
+/* Public API */
+
+int config_load(const char *path, Config *cfg);
+
+char *config_get_path(char *buf, size_t bufsz);
+
+void config_apply_appearance(const Config *cfg);
+
+void config_apply_input(const Config *cfg);
+
+void config_apply_keybinds(const Config *cfg);
+
+void config_autostart_run(const Config *cfg);
+
+typedef void (*config_reload_cb)(const Config *cfg, void *userdata);
+
+struct wl_event_source *config_watch_start(
+ struct wl_event_loop *loop,
+ const char *path,
+ config_reload_cb cb,
+ void *userdata
+);
+
+void config_watch_stop(struct wl_event_source *src);
+
+#endif
diff --git a/protocols/dwl-ipc-unstable-v2.xml b/protocols/dwl-ipc-unstable-v2.xml
new file mode 100644
--- /dev/null
+++ b/protocols/dwl-ipc-unstable-v2.xml
@@ -0,0 +1,184 @@
+
+
+
+ Copyright (C) 2022 Russell Newcomb
+
+ 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 (including the next
+ paragraph) 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.
+
+
+
+
+ This interface is exposed as a global in the Wayland registry and allows
+ clients to query and set dwl state.
+
+ Warning! The protocol described in this file is experimental and
+ backward incompatible changes may be made. Backward compatible changes
+ may be added together with the corresponding interface version bump.
+ Backward incompatible changes are done by bumping the version number in
+ the protocol and interface names and resetting the interface version.
+ Once the protocol is to be declared stable, the 'z' prefix and the
+ version number in the protocol and interface names are removed and the
+ interface version is reset.
+
+
+
+
+ Indicates that the client will not use the manager object anymore.
+ Objects created through this interface remain valid.
+
+
+
+
+
+ Get a dwl_ipc_output for the given wl_output.
+
+
+
+
+
+
+
+ This event is sent after binding and announces the number of tags.
+
+
+
+
+
+
+ This event is sent after binding and announces a layout.
+ Layouts are announced in order.
+
+
+
+
+
+
+
+ Observe and control a dwl output.
+
+
+
+
+
+
+
+
+
+
+ Indicates that the client will not use the dwl_ipc_output object
+ anymore. Objects created through this interface remain valid.
+
+
+
+
+
+ set the active tags of this output.
+
+
+
+
+
+
+
+ Set the tags of the focused client.
+
+
+
+
+
+
+
+ Set the layout of this output.
+
+
+
+
+
+
+ Indicates that dwl visibility has been toggled.
+
+
+
+
+
+ Indicates the output is active (selected monitor).
+
+
+
+
+
+
+ Indicates a tag state change.
+
+
+
+
+
+
+
+
+
+ Indicates the layout changed.
+
+
+
+
+
+
+ Indicates the focused client title changed.
+
+
+
+
+
+
+ Indicates the focused client appid changed.
+
+
+
+
+
+
+ Indicates the layout symbol changed.
+
+
+
+
+
+
+ Sent after all state events have been sent for a given state change.
+
+
+
+
+
+ Indicates the fullscreen state changed.
+
+
+
+
+
+
+ Indicates the floating state changed.
+
+
+
+
+
diff --git a/protocols/ext-workspace-v1.xml b/protocols/ext-workspace-v1.xml
new file mode 100644
--- /dev/null
+++ b/protocols/ext-workspace-v1.xml
@@ -0,0 +1,422 @@
+
+
+
+ Copyright © 2019 Christopher Billington
+ Copyright © 2020 Ilia Bozhinov
+ Copyright © 2022 Victoria Brekenfeld
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that copyright notice and this permission
+ notice appear in supporting documentation, and that the name of
+ the copyright holders not be used in advertising or publicity
+ pertaining to distribution of the software without specific,
+ written prior permission. The copyright holders make no
+ representations about the suitability of this software for any
+ purpose. It is provided "as is" without express or implied
+ warranty.
+
+ THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ THIS SOFTWARE.
+
+
+
+
+ Workspaces, also called virtual desktops, are groups of surfaces. A
+ compositor with a concept of workspaces may only show some such groups of
+ surfaces (those of 'active' workspaces) at a time. 'Activating' a
+ workspace is a request for the compositor to display that workspace's
+ surfaces as normal, whereas the compositor may hide or otherwise
+ de-emphasise surfaces that are associated only with 'inactive' workspaces.
+ Workspaces are grouped by which sets of outputs they correspond to, and
+ may contain surfaces only from those outputs. In this way, it is possible
+ for each output to have its own set of workspaces, or for all outputs (or
+ any other arbitrary grouping) to share workspaces. Compositors may
+ optionally conceptually arrange each group of workspaces in an
+ N-dimensional grid.
+
+ The purpose of this protocol is to enable the creation of taskbars and
+ docks by providing them with a list of workspaces and their properties,
+ and allowing them to activate and deactivate workspaces.
+
+ After a client binds the ext_workspace_manager_v1, each workspace will be
+ sent via the workspace event.
+
+
+
+
+ This event is emitted whenever a new workspace group has been created.
+
+ All initial details of the workspace group (outputs) will be
+ sent immediately after this event via the corresponding events in
+ ext_workspace_group_handle_v1 and ext_workspace_handle_v1.
+
+
+
+
+
+
+ This event is emitted whenever a new workspace has been created.
+
+ All initial details of the workspace (name, coordinates, state) will
+ be sent immediately after this event via the corresponding events in
+ ext_workspace_handle_v1.
+
+ Workspaces start off unassigned to any workspace group.
+
+
+
+
+
+
+ The client must send this request after it has finished sending other
+ requests. The compositor must process a series of requests preceding a
+ commit request atomically.
+
+ This allows changes to the workspace properties to be seen as atomic,
+ even if they happen via multiple events, and even if they involve
+ multiple ext_workspace_handle_v1 objects, for example, deactivating one
+ workspace and activating another.
+
+
+
+
+
+ This event is sent after all changes in all workspaces and workspace groups have been
+ sent.
+
+ This allows changes to one or more ext_workspace_group_handle_v1
+ properties and ext_workspace_handle_v1 properties
+ to be seen as atomic, even if they happen via multiple events.
+ In particular, an output moving from one workspace group to
+ another sends an output_enter event and an output_leave event to the two
+ ext_workspace_group_handle_v1 objects in question. The compositor sends
+ the done event only after updating the output information in both
+ workspace groups.
+
+
+
+
+
+ This event indicates that the compositor is done sending events to the
+ ext_workspace_manager_v1. The server will destroy the object
+ immediately after sending this request.
+
+
+
+
+
+ Indicates the client no longer wishes to receive events for new
+ workspace groups. However the compositor may emit further workspace
+ events, until the finished event is emitted. The compositor is expected
+ to send the finished event eventually once the stop request has been processed.
+
+ The client must not send any requests after this one, doing so will raise a wl_display
+ invalid_object error.
+
+
+
+
+
+
+
+ A ext_workspace_group_handle_v1 object represents a workspace group
+ that is assigned a set of outputs and contains a number of workspaces.
+
+ The set of outputs assigned to the workspace group is conveyed to the client via
+ output_enter and output_leave events, and its workspaces are conveyed with
+ workspace events.
+
+ For example, a compositor which has a set of workspaces for each output may
+ advertise a workspace group (and its workspaces) per output, whereas a compositor
+ where a workspace spans all outputs may advertise a single workspace group for all
+ outputs.
+
+
+
+
+
+
+
+
+ This event advertises the capabilities supported by the compositor. If
+ a capability isn't supported, clients should hide or disable the UI
+ elements that expose this functionality. For instance, if the
+ compositor doesn't advertise support for creating workspaces, a button
+ triggering the create_workspace request should not be displayed.
+
+ The compositor will ignore requests it doesn't support. For instance,
+ a compositor which doesn't advertise support for creating workspaces will ignore
+ create_workspace requests.
+
+ Compositors must send this event once after creation of an
+ ext_workspace_group_handle_v1. When the capabilities change, compositors
+ must send this event again.
+
+
+
+
+
+
+ This event is emitted whenever an output is assigned to the workspace
+ group or a new `wl_output` object is bound by the client, which was already
+ assigned to this workspace_group.
+
+
+
+
+
+
+ This event is emitted whenever an output is removed from the workspace
+ group.
+
+
+
+
+
+
+ This event is emitted whenever a workspace is assigned to this group.
+ A workspace may only ever be assigned to a single group at a single point
+ in time, but can be re-assigned during its lifetime.
+
+
+
+
+
+
+ This event is emitted whenever a workspace is removed from this group.
+
+
+
+
+
+
+ This event is send when the group associated with the ext_workspace_group_handle_v1
+ has been removed. After sending this request the compositor will immediately consider
+ the object inert. Any requests will be ignored except the destroy request.
+ It is guaranteed there won't be any more events referencing this
+ ext_workspace_group_handle_v1.
+
+ The compositor must remove all workspaces belonging to a workspace group
+ via a workspace_leave event before removing the workspace group.
+
+
+
+
+
+ Request that the compositor create a new workspace with the given name
+ and assign it to this group.
+
+ There is no guarantee that the compositor will create a new workspace,
+ or that the created workspace will have the provided name.
+
+
+
+
+
+
+ Destroys the ext_workspace_group_handle_v1 object.
+
+ This request should be send either when the client does not want to
+ use the workspace group object any more or after the removed event to finalize
+ the destruction of the object.
+
+
+
+
+
+
+ A ext_workspace_handle_v1 object represents a workspace that handles a
+ group of surfaces.
+
+ Each workspace has:
+ - a name, conveyed to the client with the name event
+ - potentially an id conveyed with the id event
+ - a list of states, conveyed to the client with the state event
+ - and optionally a set of coordinates, conveyed to the client with the
+ coordinates event
+
+ The client may request that the compositor activate or deactivate the workspace.
+
+ Each workspace can belong to only a single workspace group.
+ Depending on the compositor policy, there might be workspaces with
+ the same name in different workspace groups, but these workspaces are still
+ separate (e.g. one of them might be active while the other is not).
+
+
+
+
+ If this event is emitted, it will be send immediately after the
+ ext_workspace_handle_v1 is created or when an id is assigned to
+ a workspace (at most once during its lifetime).
+
+ An id will never change during the lifetime of the `ext_workspace_handle_v1`
+ and is guaranteed to be unique during its lifetime.
+
+ Ids are not human-readable and shouldn't be displayed, use `name` for that purpose.
+
+ Compositors are expected to only send ids for workspaces likely stable across multiple
+ sessions and can be used by clients to store preferences for workspaces. Workspaces without
+ ids should be considered temporary and any data associated with them should be deleted once
+ the respective object is lost.
+
+
+
+
+
+
+ This event is emitted immediately after the ext_workspace_handle_v1 is
+ created and whenever the name of the workspace changes.
+
+ A name is meant to be human-readable and can be displayed to a user.
+ Unlike the id it is neither stable nor unique.
+
+
+
+
+
+
+ This event is used to organize workspaces into an N-dimensional grid
+ within a workspace group, and if supported, is emitted immediately after
+ the ext_workspace_handle_v1 is created and whenever the coordinates of
+ the workspace change. Compositors may not send this event if they do not
+ conceptually arrange workspaces in this way. If compositors simply
+ number workspaces, without any geometric interpretation, they may send
+ 1D coordinates, which clients should not interpret as implying any
+ geometry. Sending an empty array means that the compositor no longer
+ orders the workspace geometrically.
+
+ Coordinates have an arbitrary number of dimensions N with an uint32
+ position along each dimension. By convention if N > 1, the first
+ dimension is X, the second Y, the third Z, and so on. The compositor may
+ chose to utilize these events for a more novel workspace layout
+ convention, however. No guarantee is made about the grid being filled or
+ bounded; there may be a workspace at coordinate 1 and another at
+ coordinate 1000 and none in between. Within a workspace group, however,
+ workspaces must have unique coordinates of equal dimensionality.
+
+
+
+
+
+
+ The different states that a workspace can have.
+
+
+
+
+
+
+ The workspace is not visible in its workspace group, and clients
+ attempting to visualize the compositor workspace state should not
+ display such workspaces.
+
+
+
+
+
+
+ This event is emitted immediately after the ext_workspace_handle_v1 is
+ created and each time the workspace state changes, either because of a
+ compositor action or because of a request in this protocol.
+
+ Missing states convey the opposite meaning, e.g. an unset active bit
+ means the workspace is currently inactive.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This event advertises the capabilities supported by the compositor. If
+ a capability isn't supported, clients should hide or disable the UI
+ elements that expose this functionality. For instance, if the
+ compositor doesn't advertise support for removing workspaces, a button
+ triggering the remove request should not be displayed.
+
+ The compositor will ignore requests it doesn't support. For instance,
+ a compositor which doesn't advertise support for remove will ignore
+ remove requests.
+
+ Compositors must send this event once after creation of an
+ ext_workspace_handle_v1 . When the capabilities change, compositors
+ must send this event again.
+
+
+
+
+
+
+ This event is send when the workspace associated with the ext_workspace_handle_v1
+ has been removed. After sending this request, the compositor will immediately consider
+ the object inert. Any requests will be ignored except the destroy request.
+
+ It is guaranteed there won't be any more events referencing this
+ ext_workspace_handle_v1.
+
+ The compositor must only remove a workspaces not currently belonging to any
+ workspace_group.
+
+
+
+
+
+ Destroys the ext_workspace_handle_v1 object.
+
+ This request should be made either when the client does not want to
+ use the workspace object any more or after the remove event to finalize
+ the destruction of the object.
+
+
+
+
+
+ Request that this workspace be activated.
+
+ There is no guarantee the workspace will be actually activated, and
+ behaviour may be compositor-dependent. For example, activating a
+ workspace may or may not deactivate all other workspaces in the same
+ group.
+
+
+
+
+
+ Request that this workspace be deactivated.
+
+ There is no guarantee the workspace will be actually deactivated.
+
+
+
+
+
+ Requests that this workspace is assigned to the given workspace group.
+
+ There is no guarantee the workspace will be assigned.
+
+
+
+
+
+
+ Request that this workspace be removed.
+
+ There is no guarantee the workspace will be actually removed.
+
+
+
+
diff --git a/protocols/wlr-layer-shell-unstable-v1.xml b/protocols/wlr-layer-shell-unstable-v1.xml
new file mode 100644
--- /dev/null
+++ b/protocols/wlr-layer-shell-unstable-v1.xml
@@ -0,0 +1,390 @@
+
+
+
+ Copyright © 2017 Drew DeVault
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that copyright notice and this permission
+ notice appear in supporting documentation, and that the name of
+ the copyright holders not be used in advertising or publicity
+ pertaining to distribution of the software without specific,
+ written prior permission. The copyright holders make no
+ representations about the suitability of this software for any
+ purpose. It is provided "as is" without express or implied
+ warranty.
+
+ THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ THIS SOFTWARE.
+
+
+
+
+ Clients can use this interface to assign the surface_layer role to
+ wl_surfaces. Such surfaces are assigned to a "layer" of the output and
+ rendered with a defined z-depth respective to each other. They may also be
+ anchored to the edges and corners of a screen and specify input handling
+ semantics. This interface should be suitable for the implementation of
+ many desktop shell components, and a broad number of other applications
+ that interact with the desktop.
+
+
+
+
+ Create a layer surface for an existing surface. This assigns the role of
+ layer_surface, or raises a protocol error if another role is already
+ assigned.
+
+ Creating a layer surface from a wl_surface which has a buffer attached
+ or committed is a client error, and any attempts by a client to attach
+ or manipulate a buffer prior to the first layer_surface.configure call
+ must also be treated as errors.
+
+ After creating a layer_surface object and setting it up, the client
+ must perform an initial commit without any buffer attached.
+ The compositor will reply with a layer_surface.configure event.
+ The client must acknowledge it and is then allowed to attach a buffer
+ to map the surface.
+
+ You may pass NULL for output to allow the compositor to decide which
+ output to use. Generally this will be the one that the user most
+ recently interacted with.
+
+ Clients can specify a namespace that defines the purpose of the layer
+ surface.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ These values indicate which layers a surface can be rendered in. They
+ are ordered by z depth, bottom-most first. Traditional shell surfaces
+ will typically be rendered between the bottom and top layers.
+ Fullscreen shell surfaces are typically rendered at the top layer.
+ Multiple surfaces can share a single layer, and ordering within a
+ single layer is undefined.
+
+
+
+
+
+
+
+
+
+
+
+
+ This request indicates that the client will not use the layer_shell
+ object any more. Objects that have been created through this instance
+ are not affected.
+
+
+
+
+
+
+ An interface that may be implemented by a wl_surface, for surfaces that
+ are designed to be rendered as a layer of a stacked desktop-like
+ environment.
+
+ Layer surface state (layer, size, anchor, exclusive zone,
+ margin, interactivity) is double-buffered, and will be applied at the
+ time wl_surface.commit of the corresponding wl_surface is called.
+
+ Attaching a null buffer to a layer surface unmaps it.
+
+ Unmapping a layer_surface means that the surface cannot be shown by the
+ compositor until it is explicitly mapped again. The layer_surface
+ returns to the state it had right after layer_shell.get_layer_surface.
+ The client can re-map the surface by performing a commit without any
+ buffer attached, waiting for a configure event and handling it as usual.
+
+
+
+
+ Sets the size of the surface in surface-local coordinates. The
+ compositor will display the surface centered with respect to its
+ anchors.
+
+ If you pass 0 for either value, the compositor will assign it and
+ inform you of the assignment in the configure event. You must set your
+ anchor to opposite edges in the dimensions you omit; not doing so is a
+ protocol error. Both values are 0 by default.
+
+ Size is double-buffered, see wl_surface.commit.
+
+
+
+
+
+
+
+ Requests that the compositor anchor the surface to the specified edges
+ and corners. If two orthogonal edges are specified (e.g. 'top' and
+ 'left'), then the anchor point will be the intersection of the edges
+ (e.g. the top left corner of the output); otherwise the anchor point
+ will be centered on that edge, or in the center if none is specified.
+
+ Anchor is double-buffered, see wl_surface.commit.
+
+
+
+
+
+
+ Requests that the compositor avoids occluding an area with other
+ surfaces. The compositor's use of this information is
+ implementation-dependent - do not assume that this region will not
+ actually be occluded.
+
+ A positive value is only meaningful if the surface is anchored to one
+ edge or an edge and both perpendicular edges. If the surface is not
+ anchored, anchored to only two perpendicular edges (a corner), anchored
+ to only two parallel edges or anchored to all edges, a positive value
+ will be treated the same as zero.
+
+ A positive zone is the distance from the edge in surface-local
+ coordinates to consider exclusive.
+
+ Surfaces that do not wish to have an exclusive zone may instead specify
+ how they should interact with surfaces that do. If set to zero, the
+ surface indicates that it would like to be moved to avoid occluding
+ surfaces with a positive exclusive zone. If set to -1, the surface
+ indicates that it would not like to be moved to accommodate for other
+ surfaces, and the compositor should extend it all the way to the edges
+ it is anchored to.
+
+ For example, a panel might set its exclusive zone to 10, so that
+ maximized shell surfaces are not shown on top of it. A notification
+ might set its exclusive zone to 0, so that it is moved to avoid
+ occluding the panel, but shell surfaces are shown underneath it. A
+ wallpaper or lock screen might set their exclusive zone to -1, so that
+ they stretch below or over the panel.
+
+ The default value is 0.
+
+ Exclusive zone is double-buffered, see wl_surface.commit.
+
+
+
+
+
+
+ Requests that the surface be placed some distance away from the anchor
+ point on the output, in surface-local coordinates. Setting this value
+ for edges you are not anchored to has no effect.
+
+ The exclusive zone includes the margin.
+
+ Margin is double-buffered, see wl_surface.commit.
+
+
+
+
+
+
+
+
+
+ Types of keyboard interaction possible for layer shell surfaces. The
+ rationale for this is twofold: (1) some applications are not interested
+ in keyboard events and not allowing them to be focused can improve the
+ desktop experience; (2) some applications will want to take exclusive
+ keyboard focus.
+
+
+
+
+ This value indicates that this surface is not interested in keyboard
+ events and the compositor should never assign it the keyboard focus.
+
+ This is the default value, set for newly created layer shell surfaces.
+
+ This is useful for e.g. desktop widgets that display information or
+ only have interaction with non-keyboard input devices.
+
+
+
+
+ Request exclusive keyboard focus if this surface is above the shell surface layer.
+
+ For the top and overlay layers, the seat will always give
+ exclusive keyboard focus to the top-most layer which has keyboard
+ interactivity set to exclusive. If this layer contains multiple
+ surfaces with keyboard interactivity set to exclusive, the compositor
+ determines the one receiving keyboard events in an implementation-
+ defined manner. In this case, no guarantee is made when this surface
+ will receive keyboard focus (if ever).
+
+ For the bottom and background layers, the compositor is allowed to use
+ normal focus semantics.
+
+ This setting is mainly intended for applications that need to ensure
+ they receive all keyboard events, such as a lock screen or a password
+ prompt.
+
+
+
+
+ This requests the compositor to allow this surface to be focused and
+ unfocused by the user in an implementation-defined manner. The user
+ should be able to unfocus this surface even regardless of the layer
+ it is on.
+
+ Typically, the compositor will want to use its normal mechanism to
+ manage keyboard focus between layer shell surfaces with this setting
+ and regular toplevels on the desktop layer (e.g. click to focus).
+ Nevertheless, it is possible for a compositor to require a special
+ interaction to focus or unfocus layer shell surfaces (e.g. requiring
+ a click even if focus follows the mouse normally, or providing a
+ keybinding to switch focus between layers).
+
+ This setting is mainly intended for desktop shell components (e.g.
+ panels) that allow keyboard interaction. Using this option can allow
+ implementing a desktop shell that can be fully usable without the
+ mouse.
+
+
+
+
+
+
+ Set how keyboard events are delivered to this surface. By default,
+ layer shell surfaces do not receive keyboard events; this request can
+ be used to change this.
+
+ This setting is inherited by child surfaces set by the get_popup
+ request.
+
+ Layer surfaces receive pointer, touch, and tablet events normally. If
+ you do not want to receive them, set the input region on your surface
+ to an empty region.
+
+ Keyboard interactivity is double-buffered, see wl_surface.commit.
+
+
+
+
+
+
+ This assigns an xdg_popup's parent to this layer_surface. This popup
+ should have been created via xdg_surface::get_popup with the parent set
+ to NULL, and this request must be invoked before committing the popup's
+ initial state.
+
+ See the documentation of xdg_popup for more details about what an
+ xdg_popup is and how it is used.
+
+
+
+
+
+
+ When a configure event is received, if a client commits the
+ surface in response to the configure event, then the client
+ must make an ack_configure request sometime before the commit
+ request, passing along the serial of the configure event.
+
+ If the client receives multiple configure events before it
+ can respond to one, it only has to ack the last configure event.
+
+ A client is not required to commit immediately after sending
+ an ack_configure request - it may even ack_configure several times
+ before its next surface commit.
+
+ A client may send multiple ack_configure requests before committing, but
+ only the last request sent before a commit indicates which configure
+ event the client really is responding to.
+
+
+
+
+
+
+ This request destroys the layer surface.
+
+
+
+
+
+ The configure event asks the client to resize its surface.
+
+ Clients should arrange their surface for the new states, and then send
+ an ack_configure request with the serial sent in this configure event at
+ some point before committing the new surface.
+
+ The client is free to dismiss all but the last configure event it
+ received.
+
+ The width and height arguments specify the size of the window in
+ surface-local coordinates.
+
+ The size is a hint, in the sense that the client is free to ignore it if
+ it doesn't resize, pick a smaller size (to satisfy aspect ratio or
+ resize in steps of NxM pixels). If the client picks a smaller size and
+ is anchored to two opposite anchors (e.g. 'top' and 'bottom'), the
+ surface will be centered on this axis.
+
+ If the width or height arguments are zero, it means the client should
+ decide its own window dimension.
+
+
+
+
+
+
+
+
+ The closed event is sent by the compositor when the surface will no
+ longer be shown. The output may have been destroyed or the user may
+ have asked for it to be removed. Further changes to the surface will be
+ ignored. The client should destroy the resource after receiving this
+ event, and create a new surface if they so choose.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Change the layer that the surface is rendered on.
+
+ Layer is double-buffered, see wl_surface.commit.
+
+
+
+
+
diff --git a/protocols/wlr-output-power-management-unstable-v1.xml b/protocols/wlr-output-power-management-unstable-v1.xml
new file mode 100644
--- /dev/null
+++ b/protocols/wlr-output-power-management-unstable-v1.xml
@@ -0,0 +1,128 @@
+
+
+
+ Copyright © 2019 Purism SPC
+
+ 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 (including the next
+ paragraph) 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.
+
+
+
+ This protocol allows clients to control power management modes
+ of outputs that are currently part of the compositor space. The
+ intent is to allow special clients like desktop shells to power
+ down outputs when the system is idle.
+
+ To modify outputs not currently part of the compositor space see
+ wlr-output-management.
+
+ Warning! The protocol described in this file is experimental and
+ backward incompatible changes may be made. Backward compatible changes
+ may be added together with the corresponding interface version bump.
+ Backward incompatible changes are done by bumping the version number in
+ the protocol and interface names and resetting the interface version.
+ Once the protocol is to be declared stable, the 'z' prefix and the
+ version number in the protocol and interface names are removed and the
+ interface version number is reset.
+
+
+
+
+ This interface is a manager that allows creating per-output power
+ management mode controls.
+
+
+
+
+ Create a output power management mode control that can be used to
+ adjust the power management mode for a given output.
+
+
+
+
+
+
+
+ All objects created by the manager will still remain valid, until their
+ appropriate destroy request has been called.
+
+
+
+
+
+
+ This object offers requests to set the power management mode of
+ an output.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Set an output's power save mode to the given mode. The mode change
+ is effective immediately. If the output does not support the given
+ mode a failed event is sent.
+
+
+
+
+
+
+ Report the power management mode change of an output.
+
+ The mode event is sent after an output changed its power
+ management mode. The reason can be a client using set_mode or the
+ compositor deciding to change an output's mode.
+ This event is also sent immediately when the object is created
+ so the client is informed about the current power management mode.
+
+
+
+
+
+
+ This event indicates that the output power management mode control
+ is no longer valid. This can happen for a number of reasons,
+ including:
+ - The output doesn't support power management
+ - Another client already has exclusive power management mode control
+ for this output
+ - The output disappeared
+
+ Upon receiving this event, the client should destroy this object.
+
+
+
+
+
+ Destroys the output power management mode control object.
+
+
+
+
diff --git a/smsg/README.md b/smsg/README.md
new file mode 100644
--- /dev/null
+++ b/smsg/README.md
@@ -0,0 +1,55 @@
+**smsg** - send ipc messages to swindle (forked from [this repository](https://codeberg.org/notchoc/dwlmsg))
+
+```
+usage: smsg [-OTLPF]
+ smsg [-o