mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2026-06-19 06:22:39 +00:00
Compare commits
248 Commits
6770813364
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 493dc4c408 | |||
| 33acb045a8 | |||
| bbe1199e40 | |||
| 1f0e82bf5d | |||
| 5483e1d437 | |||
| 30c33ed26c | |||
| 03de6e2ada | |||
| 7f06b4c1a3 | |||
| d7471ef29e | |||
| 5d2f27a9f9 | |||
| 2bfdd50f98 | |||
| ea5c2c7439 | |||
| 39f54a89fa | |||
| 1587a40514 | |||
| 4e3a344e8d | |||
| 8a67e8712a | |||
| e55349448e | |||
| f584a2dead | |||
| dbb6a3aa22 | |||
| 726164473f | |||
| 872b565e85 | |||
| 8809817422 | |||
| 4e2adff067 | |||
| c0c3761b30 | |||
| e3bf9a3d04 | |||
| 2d4463dd83 | |||
| 8a58a7c1c4 | |||
| b2c87f505f | |||
| 998808b303 | |||
| 24fa6e04ce | |||
| 039be1a6cf | |||
| ee75e70f79 | |||
| 6d4b7d3a57 | |||
| 8ac41e9d73 | |||
| 50651a80d2 | |||
| 79de70e29e | |||
| 6abdb9f50c | |||
| 05895bbe1b | |||
| 36439e54ba | |||
| 870a322831 | |||
| 5ccc71e0b5 | |||
| 52a7559a87 | |||
| ca06146655 | |||
| abba4e9ad0 | |||
| ee54a3413c | |||
| 000aa7d15c | |||
| 722f0573eb | |||
| 3ade6519ac | |||
| 1b490e51a9 | |||
| 4774631436 | |||
| 16ae2a3a87 | |||
| 6882f753c5 | |||
| 585f636ea1 | |||
| f46616216f | |||
| 341d6d1fd3 | |||
| a20a103242 | |||
| e1ad73d51c | |||
| 0f2cd0555a | |||
| 99c3aeb1ed | |||
| 9481ea7ea3 | |||
| 58e371fcb3 | |||
| 898bc7a946 | |||
| 507f76f981 | |||
| 97b9dbc1e6 | |||
| f8d1cfad11 | |||
| 0ddfff3376 | |||
| cca388a012 | |||
| c5b24427c7 | |||
| 77df1eb16e | |||
| f4039c0252 | |||
| 1b063e68bb | |||
| 1988d629ec | |||
| d36b83b31e | |||
| e1fa126693 | |||
| 3e627686a3 | |||
| 47d7e4d5ac | |||
| 32701fc108 | |||
| c916b773fd | |||
| a34e01519d | |||
| 43f5416503 | |||
| 59212b702c | |||
| 2e03d8ec91 | |||
| 76074da43e | |||
| 4530d00908 | |||
| 8c860178df | |||
| 1578f75740 | |||
| d2f3e1b77a | |||
| 06e9b2f651 | |||
| 0395bbbb8f | |||
| de70628d0a | |||
| e9916e4319 | |||
| 7f261214e1 | |||
| 17f0bd9db4 | |||
| 8e7aeec9c6 | |||
| 0870c51872 | |||
| 56dd65b30d | |||
| 14f48c24e8 | |||
| c0406e3c63 | |||
| a9c57d0698 | |||
| 613d9c8639 | |||
| e547aa64b9 | |||
| 955529b809 | |||
| e85e01efd3 | |||
| e4130ff865 | |||
| e240c8bf84 | |||
| 03e6e72b41 | |||
| 010b4b70be | |||
| 7c70e204b8 | |||
| 46021333a1 | |||
| 5493b6dd94 | |||
| 973df560ec | |||
| e104ef3495 | |||
| 6b9258972f | |||
| ca2a322d20 | |||
| d181bd4f4b | |||
| 7be608e4ed | |||
| 10a056e882 | |||
| 945c1de501 | |||
| b74ed046e6 | |||
| 0a6759e881 | |||
| 3f25b6c7d4 | |||
| 4263f5be4d | |||
| c13663c38f | |||
| e11f687751 | |||
| 3348962148 | |||
| 419d3a44e3 | |||
| 1742d5febc | |||
| 770aad7716 | |||
| be8b24ad2c | |||
| 7ffea896fa | |||
| 214d0e400d | |||
| be0f7b5674 | |||
| 161c62ae6c | |||
| adda83d5c4 | |||
| 1b14ce7fc6 | |||
| a88f72efa9 | |||
| c552c48146 | |||
| 07ad746a6f | |||
| 12747d1fc6 | |||
| 348dc2ed33 | |||
| f85897237a | |||
| 49aba1d42b | |||
| 2aa9de3394 | |||
| 7dd8eef128 | |||
| 1d16e63d46 | |||
| 927ed93711 | |||
| 938cd817a4 | |||
| eae3d7ec62 | |||
| 739b1df535 | |||
| a8e93dcc1b | |||
| eccf2288de | |||
| 3af96163a7 | |||
| 5ba8f3ced8 | |||
| 609c4d63a7 | |||
| 585949952f | |||
| cd083aa858 | |||
| 8f5f22eb4f | |||
| 9be77b2925 | |||
| 50c6a46c35 | |||
| 83b68bee53 | |||
| 61d5f3c503 | |||
| 1c3bb1cae6 | |||
| 94b8bb3666 | |||
| fd664f946d | |||
| 38d814e1b0 | |||
| 285921afe4 | |||
| 3b4043eb14 | |||
| 7f227a0fac | |||
| 2003c92c16 | |||
| daa3981969 | |||
| 9f5193c17a | |||
| 8ba6ccd823 | |||
| 93523c00fb | |||
| 9137f21d74 | |||
| 7d54a01970 | |||
| 4df7dc7376 | |||
| ca28e6d2d8 | |||
| 955e7dec32 | |||
| 667c0fbdbe | |||
| 4f98041841 | |||
| 77b45273bf | |||
| e0999c504b | |||
| b0de2fb715 | |||
| 5cf233eb6f | |||
| 6526ab79a4 | |||
| e3476de87f | |||
| dd4dfcb71e | |||
| 9356baf802 | |||
| 06571a92bf | |||
| a90f5b63ad | |||
| 813b425117 | |||
| 8d27630729 | |||
| 2aa64763fb | |||
| 7e3e98dd7a | |||
| da47561153 | |||
| 2b67e1111d | |||
| d14cf82c6e | |||
| 2e5748edfe | |||
| 4d0bfa66b4 | |||
| 27b00008cb | |||
| 7d0de9d9a8 | |||
| 9397519870 | |||
| f1ed83eaeb | |||
| 07fe3cf50e | |||
| edf971c08c | |||
| 0ccbc9b73b | |||
| c01728c629 | |||
| 268bee3cee | |||
| 9cce9a2ca5 | |||
| 5e6df4bdb2 | |||
| 97be2a869d | |||
| 75ddb1b2c2 | |||
| e4b2e9112c | |||
| 2eda9f1f5f | |||
| dfb7ae3bbd | |||
| 28e8282191 | |||
| 5f6ffb8161 | |||
| 2d590d0ecd | |||
| 48c0f85947 | |||
| 32a21e2261 | |||
| 919741ee19 | |||
| f24e98a304 | |||
| be20c2de0e | |||
| a727409aca | |||
| 4a869141fa | |||
| 9d5c84d2b0 | |||
| ff8105d1d2 | |||
| e92e2ebbe0 | |||
| a87342897a | |||
| 9d90b0ac9d | |||
| 7d997b2b83 | |||
| 078d201431 | |||
| e85e1a7af7 | |||
| 9ac9bad1af | |||
| fb94ea5fd4 | |||
| 481477cbe5 | |||
| d4dc85dbe8 | |||
| bfdd644ffe | |||
| 6b4729e357 | |||
| 9963c556ef | |||
| 9e12e39f66 | |||
| d8c1f707cc | |||
| af8902cb15 | |||
| 6bbc99d458 | |||
| e930381da3 | |||
| 5a4093475b | |||
| 2c4ea1e4aa | |||
| da2f40c982 |
@@ -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. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
+39
@@ -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 <anselm@garbe.ca>
|
||||||
|
© 2006-2009 Jukka Salmi <jukka at salmi dot ch>
|
||||||
|
© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
||||||
|
© 2007-2011 Peter Hartlich <sgkkr at hartlich dot com>
|
||||||
|
© 2007-2009 Szabolcs Nagy <nszabolcs at gmail dot com>
|
||||||
|
© 2007-2009 Christof Musik <christof at sendfax dot de>
|
||||||
|
© 2007-2009 Premysl Hruby <dfenze at gmail dot com>
|
||||||
|
© 2007-2008 Enno Gottox Boland <gottox at s01 dot de>
|
||||||
|
© 2008 Martin Hurton <martin dot hurton at gmail dot com>
|
||||||
|
© 2008 Neale Pickett <neale dot woozle dot org>
|
||||||
|
© 2009 Mate Nagy <mnagy at port70 dot net>
|
||||||
|
© 2010-2016 Hiltjo Posthuma <hiltjo@codemadness.org>
|
||||||
|
© 2010-2012 Connor Lane Smith <cls@lubutu.com>
|
||||||
|
© 2011 Christoph Lohmann <20h@r-36.net>
|
||||||
|
© 2015-2016 Quentin Rameau <quinq@fifth.space>
|
||||||
|
© 2015-2016 Eric Pruitt <eric.pruitt@gmail.com>
|
||||||
|
© 2016-2017 Markus Teich <markus.teich@stusta.mhn.de>
|
||||||
|
|
||||||
|
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.
|
||||||
@@ -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.
|
||||||
+127
@@ -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.
|
||||||
@@ -37,8 +37,9 @@ If you target the unstable `main` branch, specify that in the `Download` link on
|
|||||||
^^^ "0.7" is an example. Use the release that your patch targets
|
^^^ "0.7" is an example. Use the release that your patch targets
|
||||||
- [main YYYY-MM-DD](/dwl/dwl-patches/raw/branch/main/patches/PATCHNAME/PATCHNAME.patch)
|
- [main YYYY-MM-DD](/dwl/dwl-patches/raw/branch/main/patches/PATCHNAME/PATCHNAME.patch)
|
||||||
^^^^^^^^^^ Patches targeting the unstable "main" branch include a YYYY-MM-DD indicator
|
^^^^^^^^^^ Patches targeting the unstable "main" branch include a YYYY-MM-DD indicator
|
||||||
### Authors - latest at top [Codeberg nick is mandatory; other contact methods optional]
|
### Authors - latest at top
|
||||||
- [YOUR_NICK](https://codeberg.org/USERNAME)
|
- [YOUR_NICK](https://codeberg.org/USERNAME)
|
||||||
|
^^^^^^^^^ Codeberg nick is mandatory; other contact methods optional
|
||||||
your_email@if_you_wish_to.share.it
|
your_email@if_you_wish_to.share.it
|
||||||
your_irc_nick at [Libera IRC dwl channel](https://web.libera.chat/?channels=#dwl)
|
your_irc_nick at [Libera IRC dwl channel](https://web.libera.chat/?channels=#dwl)
|
||||||
your_discord_handle at [dwl Discord](https://discord.gg/jJxZnrGPWN)
|
your_discord_handle at [dwl Discord](https://discord.gg/jJxZnrGPWN)
|
||||||
@@ -46,7 +47,11 @@ If you target the unstable `main` branch, specify that in the `Download` link on
|
|||||||
You may choose to include screenshots (hosted in your patch's subdirectory) in your `README.md`. The process is described [here](https://docs.codeberg.org/markdown/using-images/).
|
You may choose to include screenshots (hosted in your patch's subdirectory) in your `README.md`. The process is described [here](https://docs.codeberg.org/markdown/using-images/).
|
||||||
|
|
||||||
8. Use the Codeberg web interface to send a pull request to [dwl-patches] (NOT to [dwl])
|
8. Use the Codeberg web interface to send a pull request to [dwl-patches] (NOT to [dwl])
|
||||||
9. WHEN YOUR PULL REQUEST IS APPROVED, your Codeberg account will also be granted commit access to [dwl-patches]. Once you have write access, you can make direct modifications/upates to your patches instead of pull requests.
|
9. WHEN YOUR PULL REQUEST IS APPROVED, your Codeberg account will also be granted commit access to [dwl-patches]. Once you have write access, you can make direct modifications/updates to your patches and you are free to create new patches rather than creating pull requests.
|
||||||
|
|
||||||
|
Individuals who have made known that they no longer intend to maintain their patches will have commit access to the [dwl-patches] repository removed.
|
||||||
|
|
||||||
|
A returning user who formerly had commit access is welcome to open an issue on [dwl-patches] requesting commit access be reinstated. When doing so, please link to the original issue opened that granted commit access.
|
||||||
|
|
||||||
## Updating/Modifying/Adopting Existing Patches
|
## Updating/Modifying/Adopting Existing Patches
|
||||||
- If the existing patch is already being maintained by another author, do not make modifications to it.
|
- If the existing patch is already being maintained by another author, do not make modifications to it.
|
||||||
@@ -61,21 +66,23 @@ If you target the unstable `main` branch, specify that in the `Download` link on
|
|||||||
- Please do not open issues or contact maintainers to request deprecation of a patch.
|
- Please do not open issues or contact maintainers to request deprecation of a patch.
|
||||||
- Deprecation of a patch will only occur if *all* authors or current maintainers of the patch agree to the decision to deprecate.
|
- Deprecation of a patch will only occur if *all* authors or current maintainers of the patch agree to the decision to deprecate.
|
||||||
- In such a circumstance the author(s)/maintainer(s):
|
- In such a circumstance the author(s)/maintainer(s):
|
||||||
- Will create a commit moving the patch to the `_STALE_PATCHES` directory
|
- Will create a commit moving the patch to the `stale-patches` directory
|
||||||
- May explain in the associated `README.md` any relevant details of the decision to deprecate the patch.
|
- May explain in the associated `README.md` any relevant details of the decision to deprecate the patch.
|
||||||
- This process allows current or future users of the patch the option to adopt, modify, or integrate stale/historical code or portions thereof.
|
- This process allows current or future users of the patch the option to adopt, modify, or integrate stale/historical code or portions thereof.
|
||||||
|
|
||||||
## _STALE_PATCHES
|
## stale-patches
|
||||||
Deprecated or unmaintained patches are held in the _STALE_PATCHES directory.
|
Deprecated or unmaintained patches are held in the [stale-patches] directory.
|
||||||
Currently, this directory also contains `.md` description files from ancient patches predating the move to Codeberg.
|
Currently, this directory also contains `.md` description files from ancient patches predating the move to Codeberg.
|
||||||
|
|
||||||
If you have the inclination to revive one of these, please follow the same procedures outlined below for contributing new patches.
|
If you have the inclination to revive one of these, please follow the same procedures outlined below for contributing new patches.
|
||||||
|
|
||||||
In your initial pull request (or in the commit that revives the stale patch if you already have write access), remove the corresponding `.md` file or the patch directory from [_STALE_PATCHES].
|
In your initial pull request (or in the commit that revives the stale patch if you already have write access), remove the corresponding `.md` file or the patch directory from [stale-patches].
|
||||||
|
|
||||||
[_STALE_PATCHES]:https://codeberg.org/dwl/dwl-patches/src/branch/main/_STALE_PATCHES
|
[stale-patches]: https://codeberg.org/dwl/dwl-patches/src/branch/main/stale-patches
|
||||||
[dwl]: https://codeberg.org/dwl/dwl
|
[dwl]: https://codeberg.org/dwl/dwl
|
||||||
[dwl-patches]: https://codeberg.org/dwl/dwl-patches
|
[dwl-patches]: https://codeberg.org/dwl/dwl-patches
|
||||||
[issues]: https://codeberg.org/dwl/dwl-patches/issues
|
[issues]: https://codeberg.org/dwl/dwl-patches/issues
|
||||||
[release]: https://codeberg.org/dwl/dwl/releases
|
[release]: https://codeberg.org/dwl/dwl/releases
|
||||||
[Codeberg]: https://codeberg.org
|
[Codeberg]: https://codeberg.org
|
||||||
|
|
||||||
|
##
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
### Description
|
|
||||||
This implements the DRM lease protocol, which is needed to use devices such as VR headsets.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2023-05-26](https://github.com/djpohly/dwl/compare/main...minego:drm_lease_patch.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Micah N Gorrell](https://github.com/minego)
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
### Description
|
|
||||||
Utilizing the [/usr/include/X11/XF86keysym.h](https://cgit.freedesktop.org/xorg/proto/x11proto/tree/XF86keysym.h) header file to change the volume via the appropriate keys.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2023-10-15](https://github.com/djpohly/dwl/compare/main...nakibrayan3:dwl:update-XF86keysym-patch.patch)
|
|
||||||
- [2021-05-06](https://github.com/djpohly/dwl/compare/main...917Wolf:vol.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [917Wolf](https://github.com/917Wolf)
|
|
||||||
- [Rayan Nakib](https://nakibrayan2.pages.dev)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
### Description
|
|
||||||
Adds configurable transparency for focused and unfocused windows.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2021-12-03](https://github.com/djpohly/dwl/compare/main...juliag2:alphafocus.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Julia](https://github.com/juliag2)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
### Description
|
|
||||||
Newly created windows are placed above the currently selected window in the stack.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2021-01-16](https://github.com/djpohly/dwl/compare/main...ss7m:attachabove.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [sam-barr](https://github.com/ss7m)
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
### Description
|
|
||||||
|
|
||||||
This is a port of attachtop patch for dwm: https://dwm.suckless.org/patches/attachtop
|
|
||||||
|
|
||||||
New client attaches below the last master/on top of the stack.
|
|
||||||
|
|
||||||
Behavior feels very intuitive as it doesn't disrupt existing masters no matter the amount of them, it only pushes the clients in stack down.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2023-07-15](https://github.com/djpohly/dwl/compare/main...NikitaIvanovV:attachtop.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Nikita Ivanov](https://github.com/NikitaIvanovV)
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
### Description
|
|
||||||
Adds keybindings for screen rotation and auto rotation from an accelerometer.
|
|
||||||
|
|
||||||
### Setup
|
|
||||||
Find an accelerometer device in sysfs (`cat /sys/bus/iio/devices/iio*/name`,
|
|
||||||
or using a script: [monitor-iio.sh](https://github.com/Unprex/dotfiles/blob/main/scripts/monitor-iio.sh)) \
|
|
||||||
Find the raw output file of the accelerometer
|
|
||||||
(e.g. `cat /sys/bus/iio/devices/iio:device0/in_accel_x_raw` should output an integer). \
|
|
||||||
Add the raw output file names to the dwl configuration **accel_\***.
|
|
||||||
|
|
||||||
Add a udev rule to uniquely identify the device, for example:
|
|
||||||
```
|
|
||||||
sudo echo 'SUBSYSTEM=="iio", KERNEL=="iio*", ATTR{name}=="accel_3d", GROUP="input", SYMLINK+="input/accel"' >> /etc/udev/rules.d/99-accel.rules
|
|
||||||
sudo udevadm control --reload-rules && sudo udevadm trigger
|
|
||||||
```
|
|
||||||
(the device is probably already in /dev/ e.g. `/dev/iio:device0` but on my computer the number changes after a reboot)
|
|
||||||
|
|
||||||
A symlink to the device should now be available in `/dev/input/` and accessible to input group members. \
|
|
||||||
Add the device path to the dwl configuration **accel_path**.
|
|
||||||
|
|
||||||
### Config
|
|
||||||
* `rotation_enabled`: If the auto rotation is enabled on startup.
|
|
||||||
* `rotation_delay`: How often to check the accelerometer values in milliseconds.
|
|
||||||
* `rotation_flat`: Threshold on the normalized Z axis to consider the device flat and stop the auto rotation.
|
|
||||||
* `rotation_thresh`: Rotation threshold after which the screen flips (values less than 0.5 will cause a back and forth).
|
|
||||||
|
|
||||||
+ `accel_path`: The path to the accelerometer device file (e.g. "/dev/input/accel").
|
|
||||||
+ `accel_x`: The name of the sysfs file for the accelerometer x axis.
|
|
||||||
+ `accel_y`: The name of the sysfs file for the accelerometer y axis.
|
|
||||||
+ `accel_z`: The name of the sysfs file for the accelerometer z axis.
|
|
||||||
|
|
||||||
Default keybindings:
|
|
||||||
* `<Modkey>` + `<Shift>` + `<Arrows>`: Change the screen rotation manually (doesn't disable the auto rotation).
|
|
||||||
* `<Modkey>` + `<Shift>` + `<R>`: Enable/disable the auto rotation.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2022-10-25](https://github.com/djpohly/dwl/compare/main...Unprex:rotation.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Unprex](https://github.com/Unprex)
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
### Description
|
|
||||||
Adds a rule to automatically center clients on the current monitor.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [v0.4](https://github.com/djpohly/dwl/compare/main...dm1tz:04-center.patch)
|
|
||||||
- [v0.4-r1](https://github.com/djpohly/dwl/compare/main...dm1tz:04rc1-iscenter.patch)
|
|
||||||
- [2022-08-27](https://github.com/djpohly/dwl/compare/main...dm1tz:iscenter.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Dmitry Zakharchenko](https://github.com/dm1tz)
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
### Description
|
|
||||||
Store your clipboard history using `clipman` clipboard manager without your KeePassXC passwords leaking into clipman.
|
|
||||||
|
|
||||||
Ensure these dependencies are installed (instructions for debian, other distros are left as an exercise...):
|
|
||||||
|
|
||||||
apt install clipman libmodern-perl-perl moreutils wl-clipboard
|
|
||||||
|
|
||||||
Change your command to launch `dwl` to something like the following:
|
|
||||||
|
|
||||||
dwl -s 'pee somebar dwl-getwindowtitle'
|
|
||||||
|
|
||||||
Ensure the following command is running in the background of your `dwl` session. Put it whereever your auto-started stuff is.
|
|
||||||
|
|
||||||
exec wl-paste -t text --watch dwl-clipman
|
|
||||||
|
|
||||||
This solution is based on the following reddit post, modified to support `dwl`. https://www.reddit.com/r/swaywm/comments/ljl0dh/keeping_secrets_secret_with_keepassxc_clipman_and/
|
|
||||||
|
|
||||||
Feel free to use this code however you want, but I can't guarantee it will work for what you are trying to do. Licenced under the same license as `dwl`, "WITHOUT WARRANTY OF ANY KIND".
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2022-12-21](https://github.com/djpohly/dwl/compare/main...bencollerson:clipboard-manager.patch)
|
|
||||||
- [2022-12-01](https://github.com/djpohly/dwl/compare/main...bencollerson:94d0a21.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Ben Collerson](https://github.com/bencollerson)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
### Description
|
|
||||||
Adds clipboard functionality. Requires the [ipc](https://github.com/djpohly/dwl/wiki/ipc) patch for dwl and `wl-clipboard` to be installed. By default, requires [clipman](https://github.com/yory8/clipman) for the clipboard and [dwl-state](https://github.com/MadcowOG/dwl-state) for getting the appid of the focused application, but you can change these in the script if you have alternatives. You may change which applications to not record by modifying the `excludes` array in `dwl-cliboard-watcher`. Make sure `wl-paste -t text -w dwl-clipboard-watcher` is running after dwl.
|
|
||||||
|
|
||||||
### Downloads
|
|
||||||
- [2023-3-01](https://github.com/djpohly/dwl/compare/main...MadcowOG:ipc-clipboard.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [MadcowOG](https://github.com/MadcowOG)
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
### Description
|
|
||||||
Adds function to cycle through available layouts.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [v0.4](https://github.com/djpohly/dwl/compare/main...dm1tz:04-cyclelayouts.patch)
|
|
||||||
- [2021-07-27](https://github.com/djpohly/dwl/compare/main...vnepogodin:cyclelayouts.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Vladislav Nepogodin](https://github.com/vnepogodin)
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
### Description
|
|
||||||
Arranges windows in a Fibonacci spiral or dwindle.
|
|
||||||
|
|
||||||
### Scheme
|
|
||||||
```
|
|
||||||
+-----------+-----------+ +-----------+-----------+
|
|
||||||
| | | | | |
|
|
||||||
| | 2 | | | 2 |
|
|
||||||
| | | | | |
|
|
||||||
| 1 +--+--+-----+ | 1 +-----+-----+
|
|
||||||
| | 5|-.| | | | | 4 |
|
|
||||||
| +--+--+ 3 | | | 3 +--+--+
|
|
||||||
| | 4 | | | | | 5|-.|
|
|
||||||
+-----------+-----+-----+ +-----------+-----+-----+
|
|
||||||
spiral dwindle
|
|
||||||
```
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2023-06-21](https://github.com/djpohly/dwl/compare/main...Abanoub8:fibonacci.patch)
|
|
||||||
- [2022-09-22](http://0x0.st/oVlu.patch)
|
|
||||||
- [2021-05-06](https://github.com/djpohly/dwl/compare/main...917Wolf:fib.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Abanoub8](https://github.com/Abanoub8)
|
|
||||||
- [medanisjbara](https://github.com/medanisjbara)
|
|
||||||
- [917Wolf](https://github.com/917Wolf)
|
|
||||||
- Niki Yoshiuchi
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
### Description
|
|
||||||
Implements `focusmon()` function that moves the cursor to the focused monitor.
|
|
||||||
### Download
|
|
||||||
- [2020-10-15](https://github.com/djpohly/dwl/compare/main...Stivvo:focusMonPointer.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Stivvo](https://github.com/Stivvo)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
### Description
|
|
||||||
Focus the window left, right, above or below the current focused window
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2023-19-15](https://github.com/djpohly/dwl/compare/main...XGames123:focusdir.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [ldev](https://github.com/Xgames123)
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
### Description
|
|
||||||
Focus the master regardless of the current focus.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2022-09-02](https://github.com/djpohly/dwl/compare/main...dm1tz:fmaster.patch)
|
|
||||||
- [2022-08-18](https://github.com/djpohly/dwl/compare/main...PalanixYT:focusmaster.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Palanix](https://github.com/PalanixYT)
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
### Description
|
|
||||||
This patch is a modified version of [vanitygaps][vanitygaps] that adds gaps around clients regardless of a layout.
|
|
||||||
It means you can apply any layout patch and the gaps will be shown properly as long as the layout does not add any gaps on its own.
|
|
||||||
|
|
||||||
This works by allowing a layout to place clients normally without gaps,
|
|
||||||
and then correcting positions and dimensions of clients afterwards to add gaps around them.
|
|
||||||
To make it work, I had to modify `resize()` function,
|
|
||||||
and, as a side effect, this change fixed some flickering I experienced when using [snail][snail] layout.
|
|
||||||
|
|
||||||
[snail]: https://github.com/djpohly/dwl/wiki/snail
|
|
||||||
[vanitygaps]: https://github.com/djpohly/dwl/wiki/vanitygaps
|
|
||||||
|
|
||||||
### Changelog
|
|
||||||
|
|
||||||
2023-11-24:
|
|
||||||
- Refactor, it does exactly the same, just using less code.
|
|
||||||
- Replace `gappih`, `gappiv`, `gappoh` and `gappov` with only `gappx`. They don't do anything anyways.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2023-11-24](https://github.com/djpohly/dwl/compare/main...wochap:genericgaps.patch)
|
|
||||||
- [2023-05-20](https://github.com/djpohly/dwl/compare/main...NikitaIvanovV:genericgaps.patch) generic gaps
|
|
||||||
- [2023-05-20](https://github.com/djpohly/dwl/compare/main...NikitaIvanovV:genericgaps-rule.patch) generic gaps + monitor rule to enable gaps on certain monitors by default
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Nikita Ivanov](https://github.com/NikitaIvanovV)
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
### Description
|
|
||||||
Arranges windows in a grid of equal sizes.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2023-06-21](https://github.com/djpohly/dwl/compare/main...Abanoub8:gridmode.patch)
|
|
||||||
- [2021-07-24](https://github.com/djpohly/dwl/compare/main...vnepogodin:gridmode.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Vladislav Nepogodin](https://github.com/vnepogodin)
|
|
||||||
- [Abanoub8](https://github.com/Abanoub8)
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
### Description
|
|
||||||
Hide the cursor when typing
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2023-10-25](https://github.com/djpohly/dwl/compare/main...apprehensions:hidecursor.patch)
|
|
||||||
- [2023-02-19](https://github.com/djpohly/dwl/compare/main...PalanixYT:type_hide.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Palanix](https://github.com/PalanixYT)
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
### Description
|
|
||||||
Allow for keyboard rules to be used; This allows for keyboard-specific options or layouts.
|
|
||||||
|
|
||||||
The keyboard's names can be retrieved from `libinput list-devices | grep Device`, example:
|
|
||||||
```c
|
|
||||||
static const KeyboardRule kbrules[] = {
|
|
||||||
{ "AT Translated Set 2 keyboard", { .options = "altwin:swap_alt_win,caps:swapescape" } },
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2023-09-20](https://github.com/djpohly/dwl/compare/main...apprehensions:dwl:kbrules.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [sewn](https://github.com/apprehensions)
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
### Description
|
|
||||||
|
|
||||||
This patch implements sequences for chained keybindings (like the dwm [keychord](https://dwm.suckless.org/patches/keychord/) patch).
|
|
||||||
|
|
||||||
_Notes_:
|
|
||||||
- The maximum number of sequences is set to `5` in the `Keychord` struct for a given keybinding
|
|
||||||
- This original motivation was better support for [stumpwm](https://stumpwm.github.io/) style of keybindings, however this is not a limitation
|
|
||||||
|
|
||||||
### Example
|
|
||||||
|
|
||||||
The default values for `MODKEY` and `PREFIXKEY` can be changed in `config.def.h` and/or `config.h`.
|
|
||||||
|
|
||||||
#### emacs-like
|
|
||||||
|
|
||||||
In the example below, the `firefox` command is bound to the key sequence `alt-s alt-u f`.
|
|
||||||
|
|
||||||
```C
|
|
||||||
static const Keychord keychords[] = {
|
|
||||||
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
|
|
||||||
/* count key_sequences function argument */
|
|
||||||
{ 3, {{MODKEY, XKB_KEY_s}, {MODKEY, XKB_KEY_u}, {MOD_NONE, XKB_KEY_f}}, spawn, SHCMD("firefox") },
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
#### vim-like
|
|
||||||
|
|
||||||
In the example below, the `firefox` command is bound to the key sequence `alt-s u f`.
|
|
||||||
|
|
||||||
```C
|
|
||||||
static const Keychord keychords[] = {
|
|
||||||
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
|
|
||||||
/* count key_sequences function argument */
|
|
||||||
{ 3, {{MODKEY, XKB_KEY_s}, {MOD_NONE, XKB_KEY_u}, {MOD_NONE, XKB_KEY_f}}, spawn,SHCMD("firefox") },
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
### Download
|
|
||||||
|
|
||||||
- [2023-03-12](https://github.com/djpohly/dwl/compare/main...yveszoundi:dwl-customization:keychord-2023-03-12.patch)
|
|
||||||
- [2023-02-15](https://github.com/djpohly/dwl/compare/main...yveszoundi:dwl-customization:v0.4-keychord-2023-02-15.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
|
|
||||||
- [Yves Zoundi](https://github.com/yveszoundi)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
### Description
|
|
||||||
Print current keyboard layout to stdout
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2022-09-10](https://github.com/djpohly/dwl/compare/main...GospodinHoroshiy:keymap.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Gospodin](https://github.com/GospodinHoroshiy)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
### Description
|
|
||||||
This patch adds the option to let the cursor jump to the center of new clients, as well as move the cursor to the center of clients that gains focus.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2023-03-17](https://github.com/djpohly/dwl/compare/main...0undefined:mouse-follows-focus.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [0undefined](https://github.com/0undefined)
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
### Description
|
|
||||||
Extend the [movestack](https://github.com/djpohly/dwl/wiki/movestack) patch to let you also focus, or move, a client to the top or bottom of the stack.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2023-03-12](https://github.com/djpohly/dwl/compare/main...0undefined:dwl:move-client-top.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [0undefined](https://github.com/0undefined)
|
|
||||||
- Original movestack patch: [sam-barr](https://github.com/ss7m)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
### Description
|
|
||||||
Prevent focus on mouseover.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2023-02-05](https://github.com/djpohly/dwl/compare/main...jjjt-git:nomousefocus.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [JJJT](https://github.com/jjjt-git)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
### Description
|
|
||||||
Only exit when no windows are open
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2022-09-11](https://github.com/djpohly/dwl/compare/main...GospodinHoroshiy:onlyquitonempty.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Gospodin](https://github.com/GospodinHoroshiy)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
### Description
|
|
||||||
Adds the -u option that allows users to pass a desired uid to drop to after becoming DRM master.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2021-09-06](https://github.com/djpohly/dwl/compare/main...DanielMowitz:privilege-drop.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Daniel Mowitz](https://github.com/DanielMowitz)
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
### Description
|
|
||||||
This patch allows you to restart dwl with a keybinding.
|
|
||||||
**NOTE:** that all of your applications are gonna get killed on dwl restart.
|
|
||||||
|
|
||||||
The function creates a file at **/tmp/restart_dwl** and exits dwl.
|
|
||||||
You have to modify your dwl launch script in order for this patch to work.
|
|
||||||
Example dwl launch script:
|
|
||||||
```sh
|
|
||||||
do=true
|
|
||||||
while $do || [ -f /tmp/restart_dwl ]; do
|
|
||||||
do=false
|
|
||||||
rm -rf /tmp/restart_dwl > /dev/null 2>&1
|
|
||||||
dwl
|
|
||||||
done
|
|
||||||
```
|
|
||||||
It's a do-while that checks if **/tmp/restart_dwl** exists after the first run of dwl.
|
|
||||||
If this file exists delete it and start dwl again.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2022-10-27](https://github.com/djpohly/dwl/compare/main...krypciak:patch-restartdwl.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [krypciak](https://github.com/krypciak)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
### Description
|
|
||||||
All floating windows become tiling when switching to a different layout.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2020-08-28](https://github.com/djpohly/dwl/compare/main...Stivvo:restoreTiling.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Stivvo](https://github.com/Stivvo)
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
### Description
|
|
||||||
Add a rule to clients to spawn them [sticky](sticky) on start up.
|
|
||||||
I personally use it to make [dragon](https://github.com/mwh/dragon) show up on all tags.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
Apply on top of [sticky patch](sticky).
|
|
||||||
|
|
||||||
- [2023-05-27](https://github.com/dm1tz/dwl/compare/04-sticky...NikitaIvanovV:stickyrule.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Nikita Ivanov](https://github.com/NikitaIvanovV)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
### Description
|
|
||||||
Implements just enough of the `sway-ipc` protocol to facilitate status bars. Tested with `waybar` and `rootbar`.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2022-06-08](https://github.com/djpohly/dwl/compare/main...StratusFearMe21:main.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Isaac Mills](https://github.com/StratusFearMe21)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
### Description
|
|
||||||
Switch between multiple keyboard layouts, variants, and options at runtime.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2024-03-15](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/togglekblayoutandoptions/togglekblayoutandoptions.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [dev-gm](https://codeberg.org/dev-gm)
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
From 4ba551f0f3837ccc2241f99665f0566c5af6dab9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Gavin M <github@gavinm.us>
|
|
||||||
Date: Fri, 15 Mar 2024 16:56:53 -0500
|
|
||||||
Subject: [PATCH] Togglekblayoutandoptions patch
|
|
||||||
|
|
||||||
---
|
|
||||||
config.def.h | 16 ++++++++++------
|
|
||||||
dwl.c | 23 ++++++++++++++++++++++-
|
|
||||||
2 files changed, 32 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
|
||||||
index 9009517..1583932 100644
|
|
||||||
--- a/config.def.h
|
|
||||||
+++ b/config.def.h
|
|
||||||
@@ -48,12 +48,15 @@ static const MonitorRule monrules[] = {
|
|
||||||
};
|
|
||||||
|
|
||||||
/* keyboard */
|
|
||||||
-static const struct xkb_rule_names xkb_rules = {
|
|
||||||
- /* can specify fields: rules, model, layout, variant, options */
|
|
||||||
- /* example:
|
|
||||||
- .options = "ctrl:nocaps",
|
|
||||||
- */
|
|
||||||
- .options = NULL,
|
|
||||||
+static const struct xkb_rule_names xkb_rules[] = {
|
|
||||||
+ {
|
|
||||||
+ .layout = "us"
|
|
||||||
+ },
|
|
||||||
+ /*{
|
|
||||||
+ .layout = "us",
|
|
||||||
+ .variant = "dvp",
|
|
||||||
+ .options = "compose:102,numpad:shift3,kpdl:semi,keypad:atm,caps:super"
|
|
||||||
+ }*/
|
|
||||||
};
|
|
||||||
|
|
||||||
static const int repeat_rate = 25;
|
|
||||||
@@ -143,6 +146,7 @@ static const Key keys[] = {
|
|
||||||
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
|
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
|
||||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_A, incxkbrules, {.i = +1} },
|
|
||||||
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
|
||||||
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
|
||||||
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
|
||||||
diff --git a/dwl.c b/dwl.c
|
|
||||||
index 5867b0c..ef4e605 100644
|
|
||||||
--- a/dwl.c
|
|
||||||
+++ b/dwl.c
|
|
||||||
@@ -327,6 +327,7 @@ static void setsel(struct wl_listener *listener, void *data);
|
|
||||||
static void setup(void);
|
|
||||||
static void spawn(const Arg *arg);
|
|
||||||
static void startdrag(struct wl_listener *listener, void *data);
|
|
||||||
+static void incxkbrules(const Arg *arg);
|
|
||||||
static void tag(const Arg *arg);
|
|
||||||
static void tagmon(const Arg *arg);
|
|
||||||
static void tile(Monitor *m);
|
|
||||||
@@ -395,6 +396,7 @@ static struct wl_listener lock_listener = {.notify = locksession};
|
|
||||||
static struct wlr_seat *seat;
|
|
||||||
static KeyboardGroup kb_group = {0};
|
|
||||||
static KeyboardGroup vkb_group = {0};
|
|
||||||
+static unsigned int kblayout = 0;
|
|
||||||
static struct wlr_surface *held_grab;
|
|
||||||
static unsigned int cursor_mode;
|
|
||||||
static Client *grabc;
|
|
||||||
@@ -2470,7 +2472,7 @@ setup(void)
|
|
||||||
|
|
||||||
/* Prepare an XKB keymap and assign it to the keyboard group. */
|
|
||||||
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
|
||||||
- if (!(keymap = xkb_keymap_new_from_names(context, &xkb_rules,
|
|
||||||
+ if (!(keymap = xkb_keymap_new_from_names(context, &xkb_rules[kblayout],
|
|
||||||
XKB_KEYMAP_COMPILE_NO_FLAGS)))
|
|
||||||
die("failed to compile keymap");
|
|
||||||
|
|
||||||
@@ -2548,6 +2550,25 @@ startdrag(struct wl_listener *listener, void *data)
|
|
||||||
LISTEN_STATIC(&drag->icon->events.destroy, destroydragicon);
|
|
||||||
}
|
|
||||||
|
|
||||||
+void
|
|
||||||
+incxkbrules(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ KeyboardGroup *group;
|
|
||||||
+ struct wlr_keyboard_group *wlr_group;
|
|
||||||
+ const struct xkb_rule_names newrule = xkb_rules[(kblayout + 1) % LENGTH(xkb_rules)];
|
|
||||||
+
|
|
||||||
+ wl_list_for_each(group, &kb_group.link, link) {
|
|
||||||
+ wl_list_for_each(wlr_group, &group->wlr_group->keys, keys) {
|
|
||||||
+ struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
|
||||||
+ struct xkb_keymap *keymap = xkb_map_new_from_names(context, &newrule,
|
|
||||||
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
|
|
||||||
+ wlr_keyboard_set_keymap(&wlr_group->keyboard, keymap);
|
|
||||||
+ xkb_keymap_unref(keymap);
|
|
||||||
+ xkb_context_unref(context);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void
|
|
||||||
tag(const Arg *arg)
|
|
||||||
{
|
|
||||||
--
|
|
||||||
2.44.0
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
### Description
|
|
||||||
Adds SIMPLE touchscreen functionality.<br>
|
|
||||||
Currently emulates mouse movement and button presses.<br>
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2023-03-31](https://github.com/djpohly/dwl/compare/main...fauxmight:dwl:simple_touch_input.patch)
|
|
||||||
- [2022-10-16](https://github.com/djpohly/dwl/compare/main...Unprex:touch-screen.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [fauxmight](https://github.com/fauxmight)
|
|
||||||
- [Unprex](https://github.com/Unprex)
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
### Description
|
|
||||||
A tiled layout optimized for wide vertical monitors.
|
|
||||||
### Scheme
|
|
||||||
```
|
|
||||||
|---------------------------|
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
| M |
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
|---------------------------|
|
|
||||||
| t1 |
|
|
||||||
|---------------------------|
|
|
||||||
| t2 |
|
|
||||||
|---------------------------|
|
|
||||||
| t3 |
|
|
||||||
|---------------------------|
|
|
||||||
```
|
|
||||||
### Download
|
|
||||||
- [2023-06-21](https://github.com/djpohly/dwl/compare/main...Abanoub8:vertile.patch)
|
|
||||||
- [2021-08-15](https://github.com/djpohly/dwl/compare/main...ChausseBenjamin:vertile.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Benjamin Chausse](https://github.com/ChausseBenjamin)
|
|
||||||
- [Abanoub8](https://github.com/Abanoub8)
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
### Description
|
|
||||||
|
|
||||||
Set cursor theme and size via `XCURSOR_THEME` and `XCURSOR_SIZE` environmental variables.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2023-07-18](https://github.com/djpohly/dwl/compare/main...NikitaIvanovV:xcursor.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Nikita Ivanov](https://github.com/NikitaIvanovV)
|
|
||||||
@@ -3,7 +3,7 @@ Automatically center floating windows.
|
|||||||
|
|
||||||
### Download
|
### Download
|
||||||
- [git branch](https://codeberg.org/guidocella/dwl/src/branch/alwayscenter)
|
- [git branch](https://codeberg.org/guidocella/dwl/src/branch/alwayscenter)
|
||||||
- [2024-06-05](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/alwayscenter/alwayscenter.patch)
|
- [2026-01-15](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/alwayscenter/alwayscenter.patch)
|
||||||
|
|
||||||
### Authors
|
### Authors
|
||||||
- [Guido Cella](https://codeberg.org/guidocella)
|
- [Guido Cella](https://codeberg.org/guidocella)
|
||||||
|
|||||||
@@ -1,38 +1,25 @@
|
|||||||
From 6616470ef135019ef4c767003a66df76df45f53e Mon Sep 17 00:00:00 2001
|
From 48110f0443c8e1ddcd56b6fed5da46535024919c Mon Sep 17 00:00:00 2001
|
||||||
From: Guido Cella <guido@guidocella.xyz>
|
From: Guido Cella <guido@guidocella.xyz>
|
||||||
Date: Wed, 5 Jun 2024 12:05:16 +0200
|
Date: Tue, 13 Jan 2026 21:17:22 +0100
|
||||||
Subject: [PATCH] center floating windows
|
Subject: [PATCH] center floating windows
|
||||||
|
|
||||||
---
|
---
|
||||||
dwl.c | 8 ++++++++
|
dwl.c | 2 ++
|
||||||
1 file changed, 8 insertions(+)
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
diff --git a/dwl.c b/dwl.c
|
diff --git a/dwl.c b/dwl.c
|
||||||
index 6f041a0..79ace52 100644
|
index 44f3ad9..72714f8 100644
|
||||||
--- a/dwl.c
|
--- a/dwl.c
|
||||||
+++ b/dwl.c
|
+++ b/dwl.c
|
||||||
@@ -472,6 +472,10 @@ applyrules(Client *c)
|
@@ -2414,6 +2414,8 @@ setmon(Client *c, Monitor *m, uint32_t newtags)
|
||||||
}
|
/* Make sure window actually overlaps with the monitor */
|
||||||
}
|
resize(c, c->geom, 0);
|
||||||
|
c->tags = newtags ? newtags : m->tagset[m->seltags]; /* assign tags of target monitor */
|
||||||
|
+ c->prev.x = (m->w.width - c->prev.width) / 2 + m->m.x;
|
||||||
|
+ c->prev.y = (m->w.height - c->prev.height) / 2 + m->m.y;
|
||||||
|
setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */
|
||||||
|
setfloating(c, c->isfloating);
|
||||||
}
|
}
|
||||||
+ if (mon) {
|
|
||||||
+ c->geom.x = (mon->w.width - c->geom.width) / 2 + mon->m.x;
|
|
||||||
+ c->geom.y = (mon->w.height - c->geom.height) / 2 + mon->m.y;
|
|
||||||
+ }
|
|
||||||
setmon(c, mon, newtags);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1677,6 +1681,10 @@ mapnotify(struct wl_listener *listener, void *data)
|
|
||||||
* try to apply rules for them */
|
|
||||||
if ((p = client_get_parent(c))) {
|
|
||||||
c->isfloating = 1;
|
|
||||||
+ if (p->mon) {
|
|
||||||
+ c->geom.x = (p->mon->w.width - c->geom.width) / 2 + p->mon->m.x;
|
|
||||||
+ c->geom.y = (p->mon->w.height - c->geom.height) / 2 + p->mon->m.y;
|
|
||||||
+ }
|
|
||||||
setmon(c, p->mon, p->tags);
|
|
||||||
} else {
|
|
||||||
applyrules(c);
|
|
||||||
--
|
--
|
||||||
2.45.1
|
2.52.0
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
### Description
|
||||||
|
Makes windows attach below the currently active window.
|
||||||
|
|
||||||
|
KNOWN ISSUES: Upon closing the last client when using multiple monitors, the last client will briefly flash on all
|
||||||
|
monitors before closing.
|
||||||
|
|
||||||
|
### Download
|
||||||
|
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/attachfocused/attachfocused.patch)
|
||||||
|
|
||||||
|
### Authors
|
||||||
|
- [MayOrMayNotBeACat](https://codeberg.org/MayOrMayNotBeACat)
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
From d03851c14073874f5b3d19a095e184dc24d219cd Mon Sep 17 00:00:00 2001
|
||||||
|
From: MayOrMayNotBeACat <maybeacat804@gmail.com>
|
||||||
|
Date: Sun, 11 May 2025 20:24:51 -0400
|
||||||
|
Subject: [PATCH] Make new windows attach to active client
|
||||||
|
|
||||||
|
---
|
||||||
|
dwl.c | 6 +++++-
|
||||||
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index cf3ef70..1907c5f 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -1726,7 +1726,11 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||||
|
c->geom.height += 2 * c->bw;
|
||||||
|
|
||||||
|
/* Insert this client into client lists. */
|
||||||
|
- wl_list_insert(&clients, &c->link);
|
||||||
|
+ Client* focused = focustop(selmon);
|
||||||
|
+ if (focused)
|
||||||
|
+ wl_list_insert(&focused->link, &c->link);
|
||||||
|
+ else
|
||||||
|
+ wl_list_insert(&clients, &c->link);
|
||||||
|
wl_list_insert(&fstack, &c->flink);
|
||||||
|
|
||||||
|
/* Set initial monitor, tags, floating status, and focus:
|
||||||
|
--
|
||||||
|
2.49.0
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ Behavior feels very intuitive as it doesn't disrupt existing masters no matter t
|
|||||||
|
|
||||||
### Download
|
### Download
|
||||||
- [git branch](https://codeberg.org/nikitaivanov/dwl/src/branch/attachtop)
|
- [git branch](https://codeberg.org/nikitaivanov/dwl/src/branch/attachtop)
|
||||||
- [2024-04-23](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/attachtop/attachtop.patch)
|
- [2025-06-16](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/attachtop/attachtop.patch)
|
||||||
|
|
||||||
### Authors
|
### Authors
|
||||||
- [Nikita Ivanov](https://codeberg.org/nikitaivanov)
|
- [Nikita Ivanov](https://codeberg.org/nikitaivanov)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
From 42a66d6e06c38e913766ce625f049fdbc3dd0d12 Mon Sep 17 00:00:00 2001
|
From 29e6a4bef02c473cc5bd04804fe508bda265077d Mon Sep 17 00:00:00 2001
|
||||||
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
|
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
|
||||||
Date: Sun, 7 Apr 2024 21:10:17 +0200
|
Date: Sun, 7 Apr 2024 21:10:17 +0200
|
||||||
Subject: [PATCH] New client are attached on top of the stack
|
Subject: [PATCH] New client are attached on top of the stack
|
||||||
@@ -8,7 +8,7 @@ Subject: [PATCH] New client are attached on top of the stack
|
|||||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/dwl.c b/dwl.c
|
diff --git a/dwl.c b/dwl.c
|
||||||
index bf763df..c0a3d74 100644
|
index bf763df..02e3d07 100644
|
||||||
--- a/dwl.c
|
--- a/dwl.c
|
||||||
+++ b/dwl.c
|
+++ b/dwl.c
|
||||||
@@ -1605,7 +1605,18 @@ mapnotify(struct wl_listener *listener, void *data)
|
@@ -1605,7 +1605,18 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||||
@@ -18,7 +18,7 @@ index bf763df..c0a3d74 100644
|
|||||||
- wl_list_insert(&clients, &c->link);
|
- wl_list_insert(&clients, &c->link);
|
||||||
+ i = 0;
|
+ i = 0;
|
||||||
+ wl_list_for_each(w, &clients, link) {
|
+ wl_list_for_each(w, &clients, link) {
|
||||||
+ if (!VISIBLEON(w, selmon) || c->isfloating)
|
+ if (!VISIBLEON(w, selmon) || w->isfloating)
|
||||||
+ continue;
|
+ continue;
|
||||||
+ p = w;
|
+ p = w;
|
||||||
+ if (++i >= selmon->nmaster)
|
+ if (++i >= selmon->nmaster)
|
||||||
@@ -32,5 +32,5 @@ index bf763df..c0a3d74 100644
|
|||||||
|
|
||||||
/* Set initial monitor, tags, floating status, and focus:
|
/* Set initial monitor, tags, floating status, and focus:
|
||||||
--
|
--
|
||||||
2.44.0
|
2.49.0
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ Note: Commands from array are executed using execvp(). So if you need to execute
|
|||||||
|
|
||||||
### Download
|
### Download
|
||||||
- [git branch](https://codeberg.org/sevz/dwl/src/branch/autostart)
|
- [git branch](https://codeberg.org/sevz/dwl/src/branch/autostart)
|
||||||
- [2024-06-07](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/autostart/autostart.patch)
|
- [autostart-wlroots-next-f4249db.patch](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/autostart/autostart-wlroots-next-f4249db.patch)
|
||||||
- [0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/autostart/autostart-0.7.patch)
|
- [autostart-0.8.patch](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/autostart/autostart-0.8.patch)
|
||||||
|
|
||||||
### Authors
|
### Authors
|
||||||
|
- [fauxmight](https://codeberg.org/fauxmight)
|
||||||
- [sevz](https://codeberg.org/sevz)
|
- [sevz](https://codeberg.org/sevz)
|
||||||
- [Rayan Nakib](https://nakibrayan2.pages.dev/)
|
- [Rayan Nakib](https://nakibrayan2.pages.dev/)
|
||||||
- [NFVblog](https://github.com/nf02)
|
- [NFVblog](https://github.com/nf02)
|
||||||
|
|||||||
@@ -1,24 +1,18 @@
|
|||||||
From 787f7252d63945996f009828aff3c44afd0f7781 Mon Sep 17 00:00:00 2001
|
From d2e2e61aeb25ad71c2c559994968ba64e0974503 Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
|
From: A Frederick Christensen <dwl@ivories.org>
|
||||||
<leohdz172@proton.me>
|
Date: Fri, 27 Feb 2026 12:23:04 -0600
|
||||||
Date: Sat, 8 Jul 2023 17:11:36 -0600
|
Subject: [PATCH] Applied autostart patch
|
||||||
Subject: [PATCH] port autostart patch from dwm
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
https://dwm.suckless.org/patches/cool_autostart/
|
|
||||||
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
|
|
||||||
---
|
---
|
||||||
config.def.h | 7 +++++++
|
config.def.h | 6 ++++++
|
||||||
dwl.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++-----
|
dwl.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++---
|
||||||
2 files changed, 61 insertions(+), 5 deletions(-)
|
2 files changed, 61 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
diff --git a/config.def.h b/config.def.h
|
||||||
index 22d2171..8dc6502 100644
|
index 8a6eda0..6eb0db4 100644
|
||||||
--- a/config.def.h
|
--- a/config.def.h
|
||||||
+++ b/config.def.h
|
+++ b/config.def.h
|
||||||
@@ -20,6 +20,13 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
@@ -20,6 +20,12 @@ static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You ca
|
||||||
/* logging */
|
/* logging */
|
||||||
static int log_level = WLR_ERROR;
|
static int log_level = WLR_ERROR;
|
||||||
|
|
||||||
@@ -28,15 +22,14 @@ index 22d2171..8dc6502 100644
|
|||||||
+ NULL /* terminate */
|
+ NULL /* terminate */
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
+
|
|
||||||
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
|
|
||||||
static const Rule rules[] = {
|
static const Rule rules[] = {
|
||||||
/* app_id title tags mask isfloating monitor */
|
/* app_id title tags mask isfloating monitor */
|
||||||
|
{ "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
|
||||||
diff --git a/dwl.c b/dwl.c
|
diff --git a/dwl.c b/dwl.c
|
||||||
index 5bf995e..e8b8727 100644
|
index 44f3ad9..e7b6199 100644
|
||||||
--- a/dwl.c
|
--- a/dwl.c
|
||||||
+++ b/dwl.c
|
+++ b/dwl.c
|
||||||
@@ -249,6 +249,7 @@ static void arrange(Monitor *m);
|
@@ -246,6 +246,7 @@ static void arrange(Monitor *m);
|
||||||
static void arrangelayer(Monitor *m, struct wl_list *list,
|
static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||||
struct wlr_box *usable_area, int exclusive);
|
struct wlr_box *usable_area, int exclusive);
|
||||||
static void arrangelayers(Monitor *m);
|
static void arrangelayers(Monitor *m);
|
||||||
@@ -44,17 +37,17 @@ index 5bf995e..e8b8727 100644
|
|||||||
static void axisnotify(struct wl_listener *listener, void *data);
|
static void axisnotify(struct wl_listener *listener, void *data);
|
||||||
static void buttonpress(struct wl_listener *listener, void *data);
|
static void buttonpress(struct wl_listener *listener, void *data);
|
||||||
static void chvt(const Arg *arg);
|
static void chvt(const Arg *arg);
|
||||||
@@ -432,6 +433,9 @@ static xcb_atom_t netatom[NetLast];
|
@@ -449,6 +450,9 @@ static struct wl_listener xwayland_ready = {.notify = xwaylandready};
|
||||||
/* attempt to encapsulate suck into one file */
|
static struct wlr_xwayland *xwayland;
|
||||||
#include "client.h"
|
#endif
|
||||||
|
|
||||||
+static pid_t *autostart_pids;
|
+static pid_t *autostart_pids;
|
||||||
+static size_t autostart_len;
|
+static size_t autostart_len;
|
||||||
+
|
+
|
||||||
/* function implementations */
|
/* configuration, allows nested code to access above variables */
|
||||||
void
|
#include "config.h"
|
||||||
applybounds(Client *c, struct wlr_box *bbox)
|
|
||||||
@@ -580,6 +584,27 @@ arrangelayers(Monitor *m)
|
@@ -603,6 +607,27 @@ arrangelayers(Monitor *m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,11 +75,13 @@ index 5bf995e..e8b8727 100644
|
|||||||
void
|
void
|
||||||
axisnotify(struct wl_listener *listener, void *data)
|
axisnotify(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
@@ -676,11 +701,21 @@ checkidleinhibitor(struct wlr_surface *exclude)
|
@@ -699,12 +724,23 @@ checkidleinhibitor(struct wlr_surface *exclude)
|
||||||
void
|
void
|
||||||
cleanup(void)
|
cleanup(void)
|
||||||
{
|
{
|
||||||
+ size_t i;
|
+ size_t i;
|
||||||
|
+
|
||||||
|
cleanuplisteners();
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
wlr_xwayland_destroy(xwayland);
|
wlr_xwayland_destroy(xwayland);
|
||||||
xwayland = NULL;
|
xwayland = NULL;
|
||||||
@@ -104,44 +99,36 @@ index 5bf995e..e8b8727 100644
|
|||||||
if (child_pid > 0) {
|
if (child_pid > 0) {
|
||||||
kill(-child_pid, SIGTERM);
|
kill(-child_pid, SIGTERM);
|
||||||
waitpid(child_pid, NULL, 0);
|
waitpid(child_pid, NULL, 0);
|
||||||
@@ -1497,18 +1532,31 @@ void
|
@@ -1560,10 +1596,25 @@ gpureset(struct wl_listener *listener, void *data)
|
||||||
|
void
|
||||||
handlesig(int signo)
|
handlesig(int signo)
|
||||||
{
|
{
|
||||||
if (signo == SIGCHLD) {
|
- if (signo == SIGCHLD)
|
||||||
-#ifdef XWAYLAND
|
|
||||||
siginfo_t in;
|
|
||||||
/* wlroots expects to reap the XWayland process itself, so we
|
|
||||||
* use WNOWAIT to keep the child waitable until we know it's not
|
|
||||||
* XWayland.
|
|
||||||
*/
|
|
||||||
while (!waitid(P_ALL, 0, &in, WEXITED|WNOHANG|WNOWAIT) && in.si_pid
|
|
||||||
- && (!xwayland || in.si_pid != xwayland->server->pid))
|
|
||||||
- waitpid(in.si_pid, NULL, 0);
|
|
||||||
-#else
|
|
||||||
- while (waitpid(-1, NULL, WNOHANG) > 0);
|
- while (waitpid(-1, NULL, WNOHANG) > 0);
|
||||||
+#ifdef XWAYLAND
|
- else if (signo == SIGINT || signo == SIGTERM)
|
||||||
+ && (!xwayland || in.si_pid != xwayland->server->pid)
|
+ if (signo == SIGCHLD) {
|
||||||
#endif
|
+ pid_t pid, *p, *lim;
|
||||||
+ ) {
|
+ while ((pid = waitpid(-1, NULL, WNOHANG)) > 0) {
|
||||||
+ pid_t *p, *lim;
|
+ if (pid == child_pid)
|
||||||
+ waitpid(in.si_pid, NULL, 0);
|
|
||||||
+ if (in.si_pid == child_pid)
|
|
||||||
+ child_pid = -1;
|
+ child_pid = -1;
|
||||||
+ if (!(p = autostart_pids))
|
+ if (!(p = autostart_pids))
|
||||||
+ continue;
|
+ continue;
|
||||||
+ lim = &p[autostart_len];
|
+ lim = &p[autostart_len];
|
||||||
+
|
+
|
||||||
+ for (; p < lim; p++) {
|
+ for (; p < lim; p++) {
|
||||||
+ if (*p == in.si_pid) {
|
+ if (*p == pid) {
|
||||||
+ *p = -1;
|
+ *p = -1;
|
||||||
+ break;
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
} else if (signo == SIGINT || signo == SIGTERM) {
|
+ } else if (signo == SIGINT || signo == SIGTERM) {
|
||||||
quit(NULL);
|
quit(NULL);
|
||||||
}
|
+ }
|
||||||
@@ -2224,6 +2272,7 @@ run(char *startup_cmd)
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@@ -2250,6 +2301,7 @@ run(char *startup_cmd)
|
||||||
die("startup: backend_start");
|
die("startup: backend_start");
|
||||||
|
|
||||||
/* Now that the socket exists and the backend is started, run the startup command */
|
/* Now that the socket exists and the backend is started, run the startup command */
|
||||||
@@ -150,5 +137,5 @@ index 5bf995e..e8b8727 100644
|
|||||||
int piperw[2];
|
int piperw[2];
|
||||||
if (pipe(piperw) < 0)
|
if (pipe(piperw) < 0)
|
||||||
--
|
--
|
||||||
2.45.2
|
2.52.0
|
||||||
|
|
||||||
+38
-51
@@ -1,24 +1,18 @@
|
|||||||
From d2829ed5c970c7e7692e39c451526b3860dabb2f Mon Sep 17 00:00:00 2001
|
From e8932f159793012a54047c48b3710703a63c07fb Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
|
From: A Frederick Christensen <dwl@ivories.org>
|
||||||
<leohdz172@proton.me>
|
Date: Fri, 27 Feb 2026 12:29:02 -0600
|
||||||
Date: Sat, 8 Jul 2023 17:11:36 -0600
|
Subject: [PATCH] Applied autostart patch
|
||||||
Subject: [PATCH] port autostart patch from dwm
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
https://dwm.suckless.org/patches/cool_autostart/
|
|
||||||
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
|
|
||||||
---
|
---
|
||||||
config.def.h | 7 +++++++
|
config.def.h | 6 ++++++
|
||||||
dwl.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++-----
|
dwl.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++---
|
||||||
2 files changed, 61 insertions(+), 5 deletions(-)
|
2 files changed, 61 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
diff --git a/config.def.h b/config.def.h
|
||||||
index 22d2171..1d0f935 100644
|
index 8a6eda0..6eb0db4 100644
|
||||||
--- a/config.def.h
|
--- a/config.def.h
|
||||||
+++ b/config.def.h
|
+++ b/config.def.h
|
||||||
@@ -20,6 +20,13 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
@@ -20,6 +20,12 @@ static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You ca
|
||||||
/* logging */
|
/* logging */
|
||||||
static int log_level = WLR_ERROR;
|
static int log_level = WLR_ERROR;
|
||||||
|
|
||||||
@@ -28,15 +22,14 @@ index 22d2171..1d0f935 100644
|
|||||||
+ NULL /* terminate */
|
+ NULL /* terminate */
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
+
|
|
||||||
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
|
|
||||||
static const Rule rules[] = {
|
static const Rule rules[] = {
|
||||||
/* app_id title tags mask isfloating monitor */
|
/* app_id title tags mask isfloating monitor */
|
||||||
|
{ "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
|
||||||
diff --git a/dwl.c b/dwl.c
|
diff --git a/dwl.c b/dwl.c
|
||||||
index 00e9cc1e..5de32831 100644
|
index 8a9715d..3450817 100644
|
||||||
--- a/dwl.c
|
--- a/dwl.c
|
||||||
+++ b/dwl.c
|
+++ b/dwl.c
|
||||||
@@ -249,6 +249,7 @@ static void arrange(Monitor *m);
|
@@ -248,6 +248,7 @@ static void arrange(Monitor *m);
|
||||||
static void arrangelayer(Monitor *m, struct wl_list *list,
|
static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||||
struct wlr_box *usable_area, int exclusive);
|
struct wlr_box *usable_area, int exclusive);
|
||||||
static void arrangelayers(Monitor *m);
|
static void arrangelayers(Monitor *m);
|
||||||
@@ -44,17 +37,17 @@ index 00e9cc1e..5de32831 100644
|
|||||||
static void axisnotify(struct wl_listener *listener, void *data);
|
static void axisnotify(struct wl_listener *listener, void *data);
|
||||||
static void buttonpress(struct wl_listener *listener, void *data);
|
static void buttonpress(struct wl_listener *listener, void *data);
|
||||||
static void chvt(const Arg *arg);
|
static void chvt(const Arg *arg);
|
||||||
@@ -429,6 +430,9 @@ static xcb_atom_t netatom[NetLast];
|
@@ -451,6 +452,9 @@ static struct wl_listener xwayland_ready = {.notify = xwaylandready};
|
||||||
/* attempt to encapsulate suck into one file */
|
static struct wlr_xwayland *xwayland;
|
||||||
#include "client.h"
|
#endif
|
||||||
|
|
||||||
+static pid_t *autostart_pids;
|
+static pid_t *autostart_pids;
|
||||||
+static size_t autostart_len;
|
+static size_t autostart_len;
|
||||||
+
|
+
|
||||||
/* function implementations */
|
/* configuration, allows nested code to access above variables */
|
||||||
void
|
#include "config.h"
|
||||||
applybounds(Client *c, struct wlr_box *bbox)
|
|
||||||
@@ -577,6 +581,27 @@ arrangelayers(Monitor *m)
|
@@ -605,6 +609,27 @@ arrangelayers(Monitor *m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,11 +75,13 @@ index 00e9cc1e..5de32831 100644
|
|||||||
void
|
void
|
||||||
axisnotify(struct wl_listener *listener, void *data)
|
axisnotify(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
@@ -672,11 +697,21 @@ checkidleinhibitor(struct wlr_surface *exclude)
|
@@ -701,12 +726,23 @@ checkidleinhibitor(struct wlr_surface *exclude)
|
||||||
void
|
void
|
||||||
cleanup(void)
|
cleanup(void)
|
||||||
{
|
{
|
||||||
+ size_t i;
|
+ size_t i;
|
||||||
|
+
|
||||||
|
cleanuplisteners();
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
wlr_xwayland_destroy(xwayland);
|
wlr_xwayland_destroy(xwayland);
|
||||||
xwayland = NULL;
|
xwayland = NULL;
|
||||||
@@ -104,44 +99,36 @@ index 00e9cc1e..5de32831 100644
|
|||||||
if (child_pid > 0) {
|
if (child_pid > 0) {
|
||||||
kill(-child_pid, SIGTERM);
|
kill(-child_pid, SIGTERM);
|
||||||
waitpid(child_pid, NULL, 0);
|
waitpid(child_pid, NULL, 0);
|
||||||
@@ -1438,18 +1473,31 @@ void
|
@@ -1562,10 +1598,25 @@ gpureset(struct wl_listener *listener, void *data)
|
||||||
|
void
|
||||||
handlesig(int signo)
|
handlesig(int signo)
|
||||||
{
|
{
|
||||||
if (signo == SIGCHLD) {
|
- if (signo == SIGCHLD)
|
||||||
-#ifdef XWAYLAND
|
|
||||||
siginfo_t in;
|
|
||||||
/* wlroots expects to reap the XWayland process itself, so we
|
|
||||||
* use WNOWAIT to keep the child waitable until we know it's not
|
|
||||||
* XWayland.
|
|
||||||
*/
|
|
||||||
while (!waitid(P_ALL, 0, &in, WEXITED|WNOHANG|WNOWAIT) && in.si_pid
|
|
||||||
- && (!xwayland || in.si_pid != xwayland->server->pid))
|
|
||||||
- waitpid(in.si_pid, NULL, 0);
|
|
||||||
-#else
|
|
||||||
- while (waitpid(-1, NULL, WNOHANG) > 0);
|
- while (waitpid(-1, NULL, WNOHANG) > 0);
|
||||||
+#ifdef XWAYLAND
|
- else if (signo == SIGINT || signo == SIGTERM)
|
||||||
+ && (!xwayland || in.si_pid != xwayland->server->pid)
|
+ if (signo == SIGCHLD) {
|
||||||
#endif
|
+ pid_t pid, *p, *lim;
|
||||||
+ ) {
|
+ while ((pid = waitpid(-1, NULL, WNOHANG)) > 0) {
|
||||||
+ pid_t *p, *lim;
|
+ if (pid == child_pid)
|
||||||
+ waitpid(in.si_pid, NULL, 0);
|
|
||||||
+ if (in.si_pid == child_pid)
|
|
||||||
+ child_pid = -1;
|
+ child_pid = -1;
|
||||||
+ if (!(p = autostart_pids))
|
+ if (!(p = autostart_pids))
|
||||||
+ continue;
|
+ continue;
|
||||||
+ lim = &p[autostart_len];
|
+ lim = &p[autostart_len];
|
||||||
+
|
+
|
||||||
+ for (; p < lim; p++) {
|
+ for (; p < lim; p++) {
|
||||||
+ if (*p == in.si_pid) {
|
+ if (*p == pid) {
|
||||||
+ *p = -1;
|
+ *p = -1;
|
||||||
+ break;
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
} else if (signo == SIGINT || signo == SIGTERM) {
|
+ } else if (signo == SIGINT || signo == SIGTERM) {
|
||||||
quit(NULL);
|
quit(NULL);
|
||||||
}
|
+ }
|
||||||
@@ -2169,6 +2217,7 @@ run(char *startup_cmd)
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@@ -2252,6 +2303,7 @@ run(char *startup_cmd)
|
||||||
die("startup: backend_start");
|
die("startup: backend_start");
|
||||||
|
|
||||||
/* Now that the socket exists and the backend is started, run the startup command */
|
/* Now that the socket exists and the backend is started, run the startup command */
|
||||||
@@ -150,5 +137,5 @@ index 00e9cc1e..5de32831 100644
|
|||||||
int piperw[2];
|
int piperw[2];
|
||||||
if (pipe(piperw) < 0)
|
if (pipe(piperw) < 0)
|
||||||
--
|
--
|
||||||
2.45.2
|
2.52.0
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|

|
||||||
|
|
||||||
|
### Description
|
||||||
|
Adds support for app icons that can replace the tag indicator and tag name.
|
||||||
|
This feature is configurable through an additional option in `rules`.
|
||||||
|
|
||||||
|
Icons should work out of the box. Emojis require a special font like
|
||||||
|
[Noto Color Emoji](https://fonts.google.com/noto/specimen/Noto+Color+Emoji).
|
||||||
|
|
||||||
|
When one or more app icons are present in a tag, the tag name will be enclosed
|
||||||
|
by the outer separators (`outer_separator_beg` and `outer_separator_end`).
|
||||||
|
Additionally, the icons within the tag will be separated by `inner_separator`.
|
||||||
|
|
||||||
|
Each tag can display a maximum of `truncate_icons_after` icons, after which the
|
||||||
|
`truncate_symbol` will be shown.
|
||||||
|
|
||||||
|
**Inspiration:** [XMonad's DynamicIcons](https://hackage.haskell.org/package/xmonad-contrib-0.18.1/docs/XMonad-Hooks-DynamicIcons.html)
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
Make sure you have the [bar](/dwl/dwl-patches/raw/branch/main/patches/bar) patch.
|
||||||
|
|
||||||
|
### Download
|
||||||
|
- [main_2025-10-24](/dwl/dwl-patches/raw/branch/main/patches/bar-appicons/appicons.patch)
|
||||||
|
### Authors
|
||||||
|
- [rumenmitov](https://codeberg.org/rumenmitov)
|
||||||
@@ -0,0 +1,282 @@
|
|||||||
|
From f5d1206f7f467cafd5a0217a46c31928316ba2fe Mon Sep 17 00:00:00 2001
|
||||||
|
From: Rumen <rumenmitov@protonmail.com>
|
||||||
|
Date: Mon, 1 Dec 2025 20:29:49 +0100
|
||||||
|
Subject: [PATCH] fix(bar-appicons): fixed various compiler warnings
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 14 +++--
|
||||||
|
dwl.c | 143 +++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||||
|
2 files changed, 150 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 1b7472d..a48b78d 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -26,12 +26,20 @@ static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||||
|
/* logging */
|
||||||
|
static int log_level = WLR_ERROR;
|
||||||
|
|
||||||
|
+/* appicons */
|
||||||
|
+/* NOTE: set to 0 to set to default (whitespace) */
|
||||||
|
+static char outer_separator_beg = '[';
|
||||||
|
+static char outer_separator_end = ']';
|
||||||
|
+static char inner_separator = ' ';
|
||||||
|
+static unsigned truncate_icons_after = 2; /* will default to 1, that is the min */
|
||||||
|
+static char truncate_symbol[] = "...";
|
||||||
|
+
|
||||||
|
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
|
||||||
|
static const Rule rules[] = {
|
||||||
|
- /* app_id title tags mask isfloating monitor */
|
||||||
|
+ /* app_id title tags mask isfloating monitor appicon*/
|
||||||
|
/* examples: */
|
||||||
|
- { "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
|
||||||
|
- { "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
|
||||||
|
+ { "Gimp_EXAMPLE", NULL, 0, 1, -1, NULL }, /* Start on currently visible tags floating, not tiled */
|
||||||
|
+ { "firefox_EXAMPLE", NULL, 1 << 8, 0, -1, "" }, /* Start on ONLY tag "9" */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* layout(s) */
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index bf340d8..e2baf66 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -143,6 +143,7 @@ typedef struct {
|
||||||
|
struct wl_listener set_hints;
|
||||||
|
#endif
|
||||||
|
unsigned int bw;
|
||||||
|
+ char *appicon;
|
||||||
|
uint32_t tags;
|
||||||
|
int isfloating, isurgent, isfullscreen;
|
||||||
|
uint32_t resize; /* configure serial of a pending resize */
|
||||||
|
@@ -221,6 +222,7 @@ struct Monitor {
|
||||||
|
unsigned int seltags;
|
||||||
|
unsigned int sellt;
|
||||||
|
uint32_t tagset[2];
|
||||||
|
+ char **tag_icons;
|
||||||
|
float mfact;
|
||||||
|
int gamma_lut_changed;
|
||||||
|
int nmaster;
|
||||||
|
@@ -252,6 +254,7 @@ typedef struct {
|
||||||
|
uint32_t tags;
|
||||||
|
int isfloating;
|
||||||
|
int monitor;
|
||||||
|
+ const char *appicon;
|
||||||
|
} Rule;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
@@ -313,6 +316,9 @@ static void destroypointerconstraint(struct wl_listener *listener, void *data);
|
||||||
|
static void destroysessionlock(struct wl_listener *listener, void *data);
|
||||||
|
static void destroykeyboardgroup(struct wl_listener *listener, void *data);
|
||||||
|
static Monitor *dirtomon(enum wlr_direction dir);
|
||||||
|
+static void remove_outer_separators(char **str);
|
||||||
|
+static void appiconsappend(char **str, const char *appicon, size_t new_size);
|
||||||
|
+static void applyappicon(char *tag_icons[], unsigned int *icons_per_tag, const Client *c);
|
||||||
|
static void drawbar(Monitor *m);
|
||||||
|
static void drawbars(void);
|
||||||
|
static void focusclient(Client *c, int lift);
|
||||||
|
@@ -527,12 +533,19 @@ applyrules(Client *c)
|
||||||
|
const Rule *r;
|
||||||
|
Monitor *mon = selmon, *m;
|
||||||
|
|
||||||
|
+ outer_separator_beg = outer_separator_beg ? outer_separator_beg : ' ';
|
||||||
|
+ outer_separator_end = outer_separator_end ? outer_separator_end : ' ';
|
||||||
|
+ inner_separator = inner_separator ? inner_separator : ' ';
|
||||||
|
+ truncate_icons_after = truncate_icons_after > 0 ? truncate_icons_after : 1;
|
||||||
|
+
|
||||||
|
appid = client_get_appid(c);
|
||||||
|
title = client_get_title(c);
|
||||||
|
|
||||||
|
for (r = rules; r < END(rules); r++) {
|
||||||
|
if ((!r->title || strstr(title, r->title))
|
||||||
|
&& (!r->id || strstr(appid, r->id))) {
|
||||||
|
+ /* r->appicon is static, so lifetime is sufficient */
|
||||||
|
+ c->appicon = (char*) r->appicon;
|
||||||
|
c->isfloating = r->isfloating;
|
||||||
|
newtags |= r->tags;
|
||||||
|
i = 0;
|
||||||
|
@@ -775,7 +788,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
(buffer = wlr_scene_buffer_from_node(node)) && buffer == selmon->scene_buffer) {
|
||||||
|
cx = (cursor->x - selmon->m.x) * selmon->wlr_output->scale;
|
||||||
|
do
|
||||||
|
- x += TEXTW(selmon, tags[i]);
|
||||||
|
+ x += TEXTW(selmon, selmon->tag_icons[i]);
|
||||||
|
while (cx >= x && ++i < LENGTH(tags));
|
||||||
|
if (i < LENGTH(tags)) {
|
||||||
|
click = ClkTagBar;
|
||||||
|
@@ -905,6 +918,16 @@ cleanupmon(struct wl_listener *listener, void *data)
|
||||||
|
wlr_output_layout_remove(output_layout, m->wlr_output);
|
||||||
|
wlr_scene_output_destroy(m->scene_output);
|
||||||
|
|
||||||
|
+ for (long unsigned int tag_idx = 0; tag_idx < LENGTH(tags); tag_idx++) {
|
||||||
|
+ if (m->tag_icons[tag_idx]) free(m->tag_icons[tag_idx]);
|
||||||
|
+ m->tag_icons[tag_idx] = NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (m->tag_icons) {
|
||||||
|
+ free(m->tag_icons);
|
||||||
|
+ m->tag_icons = NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
closemon(m);
|
||||||
|
wlr_scene_node_destroy(&m->fullscreen_bg->node);
|
||||||
|
wlr_scene_node_destroy(&m->scene_buffer->node);
|
||||||
|
@@ -1227,6 +1250,13 @@ createmon(struct wl_listener *listener, void *data)
|
||||||
|
m->lt[0] = r->lt;
|
||||||
|
m->lt[1] = &layouts[LENGTH(layouts) > 1 && r->lt != &layouts[1]];
|
||||||
|
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof(m->ltsymbol));
|
||||||
|
+
|
||||||
|
+ m->tag_icons = (char**) malloc(LENGTH(tags) * sizeof(char*));
|
||||||
|
+ if (m->tag_icons == NULL) perror("dwm: malloc()");
|
||||||
|
+ for (long unsigned int tag_idx = 0; tag_idx < LENGTH(tags); tag_idx++) {
|
||||||
|
+ m->tag_icons[tag_idx] = NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
wlr_output_state_set_scale(&state, r->scale);
|
||||||
|
wlr_output_state_set_transform(&state, r->rr);
|
||||||
|
break;
|
||||||
|
@@ -1566,6 +1596,98 @@ dirtomon(enum wlr_direction dir)
|
||||||
|
return selmon;
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+remove_outer_separators(char **str)
|
||||||
|
+{
|
||||||
|
+ const char *clean_tag_name_beg = *str + 1;
|
||||||
|
+ const size_t clean_tag_name_len = strlen(*str) - 2;
|
||||||
|
+
|
||||||
|
+ char *temp_tag_name = (char*)
|
||||||
|
+ malloc(clean_tag_name_len + 1);
|
||||||
|
+
|
||||||
|
+ if (temp_tag_name == NULL) perror("dwm: malloc()");
|
||||||
|
+
|
||||||
|
+ memset(temp_tag_name, 0, clean_tag_name_len + 1);
|
||||||
|
+
|
||||||
|
+ strncpy(temp_tag_name,
|
||||||
|
+ clean_tag_name_beg,
|
||||||
|
+ clean_tag_name_len);
|
||||||
|
+
|
||||||
|
+ if (*str) free(*str);
|
||||||
|
+ *str = temp_tag_name;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+appiconsappend(char **str, const char *appicon, size_t new_size)
|
||||||
|
+{
|
||||||
|
+ char *temp_tag_name = (char*) malloc(new_size);
|
||||||
|
+ if (temp_tag_name == NULL) perror("dwm: malloc()");
|
||||||
|
+
|
||||||
|
+ /* NOTE: Example format of temp_tag_name (with two appicons):
|
||||||
|
+ * <outer_sep_beg><appicon><inner_sep><appicon><outer_sep_end>
|
||||||
|
+ */
|
||||||
|
+ temp_tag_name = memset(temp_tag_name, 0, new_size);
|
||||||
|
+
|
||||||
|
+ temp_tag_name[0] = outer_separator_beg;
|
||||||
|
+ temp_tag_name[new_size - 2] = outer_separator_end;
|
||||||
|
+
|
||||||
|
+ strncpy(temp_tag_name + 1, *str, strlen(*str));
|
||||||
|
+ temp_tag_name[strlen(temp_tag_name)] = inner_separator;
|
||||||
|
+
|
||||||
|
+ strncpy(temp_tag_name + strlen(temp_tag_name),
|
||||||
|
+ appicon, strlen(appicon));
|
||||||
|
+
|
||||||
|
+ if (*str) free(*str);
|
||||||
|
+ *str = temp_tag_name;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+applyappicon(char *tag_icons[], unsigned int *icons_per_tag, const Client *c)
|
||||||
|
+{
|
||||||
|
+ const size_t outer_separators_size = 2;
|
||||||
|
+ const size_t inner_separator_size = 1;
|
||||||
|
+ size_t new_size = 0;
|
||||||
|
+
|
||||||
|
+ for (unsigned t = 1, i = 0;
|
||||||
|
+ i < LENGTH(tags);
|
||||||
|
+ t <<= 1, i++)
|
||||||
|
+ {
|
||||||
|
+ if (c->tags & t) {
|
||||||
|
+ if (icons_per_tag[i] == 0) {
|
||||||
|
+ if (tag_icons[i]) free(tag_icons[i]);
|
||||||
|
+ tag_icons[i] = strndup(c->appicon, strlen(c->appicon));
|
||||||
|
+ } else {
|
||||||
|
+ char *icon = NULL;
|
||||||
|
+ if (icons_per_tag[i] < truncate_icons_after)
|
||||||
|
+ icon = c->appicon;
|
||||||
|
+ else if (icons_per_tag[i] == truncate_icons_after)
|
||||||
|
+ icon = truncate_symbol;
|
||||||
|
+ else {
|
||||||
|
+ icons_per_tag[i]++;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* remove outer separators from previous iterations
|
||||||
|
+ * otherwise they get applied recursively */
|
||||||
|
+ if (icons_per_tag[i] > 1) {
|
||||||
|
+ remove_outer_separators(&tag_icons[i]);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ new_size = strlen(tag_icons[i])
|
||||||
|
+ + outer_separators_size
|
||||||
|
+ + inner_separator_size
|
||||||
|
+ + strlen(icon)
|
||||||
|
+ + 1;
|
||||||
|
+
|
||||||
|
+ appiconsappend(&tag_icons[i], icon, new_size);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ icons_per_tag[i]++;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
void
|
||||||
|
drawbar(Monitor *m)
|
||||||
|
{
|
||||||
|
@@ -1575,6 +1697,7 @@ drawbar(Monitor *m)
|
||||||
|
uint32_t i, occ = 0, urg = 0;
|
||||||
|
Client *c;
|
||||||
|
Buffer *buf;
|
||||||
|
+ unsigned int icons_per_tag[LENGTH(tags)];
|
||||||
|
|
||||||
|
if (!m->scene_buffer->node.enabled)
|
||||||
|
return;
|
||||||
|
@@ -1588,9 +1711,21 @@ drawbar(Monitor *m)
|
||||||
|
drwl_text(m->drw, m->b.width - tw, 0, tw, m->b.height, 0, stext, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ memset(icons_per_tag, 0, LENGTH(tags) * sizeof(int));
|
||||||
|
+
|
||||||
|
+ for (long unsigned int tag_idx = 0; tag_idx < LENGTH(tags); tag_idx++) {
|
||||||
|
+ /* set each tag to default value */
|
||||||
|
+ m->tag_icons[tag_idx] = strndup(tags[tag_idx], strlen(tags[tag_idx]));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
wl_list_for_each(c, &clients, link) {
|
||||||
|
if (c->mon != m)
|
||||||
|
continue;
|
||||||
|
+
|
||||||
|
+ if (c->appicon && strlen(c->appicon) > 0) {
|
||||||
|
+ applyappicon(m->tag_icons, icons_per_tag, c);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
occ |= c->tags;
|
||||||
|
if (c->isurgent)
|
||||||
|
urg |= c->tags;
|
||||||
|
@@ -1598,10 +1733,10 @@ drawbar(Monitor *m)
|
||||||
|
x = 0;
|
||||||
|
c = focustop(m);
|
||||||
|
for (i = 0; i < LENGTH(tags); i++) {
|
||||||
|
- w = TEXTW(m, tags[i]);
|
||||||
|
+ w = TEXTW(m, m->tag_icons[i]);
|
||||||
|
drwl_setscheme(m->drw, colors[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
||||||
|
- drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, tags[i], urg & 1 << i);
|
||||||
|
- if (occ & 1 << i)
|
||||||
|
+ drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, m->tag_icons[i], urg & 1 << i);
|
||||||
|
+ if (occ & 1 << i && icons_per_tag[i] ==0)
|
||||||
|
drwl_rect(m->drw, x + boxs, boxs, boxw, boxw,
|
||||||
|
m == selmon && c && c->tags & 1 << i,
|
||||||
|
urg & 1 << i);
|
||||||
|
--
|
||||||
|
2.52.0
|
||||||
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
@@ -0,0 +1,31 @@
|
|||||||
|

|
||||||
|
|
||||||
|
### Description
|
||||||
|
|
||||||
|
Add a mode indicator to bar that tells which mode you are in, just like
|
||||||
|
river-classic's [dam](https://codeberg.org/sewn/dam) bar.
|
||||||
|
|
||||||
|
The string from `modes_labels` defined in `config.h` is used, while normal mode
|
||||||
|
is ignored.
|
||||||
|
|
||||||
|
Another usage is to serve as a hint for each modes keybindings:
|
||||||
|
|
||||||
|
```c
|
||||||
|
enum {
|
||||||
|
BROWSER,
|
||||||
|
};
|
||||||
|
const char *modes_labels[] = {
|
||||||
|
"[f]irefox [b]rave [c]hromium [q]utebrowser",
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
this patch depends on:
|
||||||
|
- [bar](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/bar/) patch
|
||||||
|
- [modes](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/modes/) patch
|
||||||
|
|
||||||
|
### Download
|
||||||
|
- [v0.8](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/bar-modes/bar-modes.patch)
|
||||||
|
|
||||||
|
### Authors
|
||||||
|
- [unixchad](https://codeberg.org/unixchad/)
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
From 04b37902e0098fb69250fd25b5afbc610a284529 Mon Sep 17 00:00:00 2001
|
||||||
|
From: nate zhou <gnuunixchad@outlook.com>
|
||||||
|
Date: Mon, 2 Mar 2026 21:54:03 +0800
|
||||||
|
Subject: [PATCH] Patch: bar-modes for 0.8
|
||||||
|
|
||||||
|
Add modes_labels indicator to bar, which behaves like river-classic's
|
||||||
|
dam bar. This patch has to be applied after the bar and modes patch.
|
||||||
|
---
|
||||||
|
dwl.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++-----------
|
||||||
|
1 file changed, 72 insertions(+), 15 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index ae290ad..7229034 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -1585,19 +1585,29 @@ drawbar(Monitor *m)
|
||||||
|
uint32_t i, occ = 0, urg = 0;
|
||||||
|
Client *c;
|
||||||
|
Buffer *buf;
|
||||||
|
+ char mode_text[256] = "";
|
||||||
|
+ int mode_width = 0;
|
||||||
|
+ int title_width;
|
||||||
|
+ int remaining;
|
||||||
|
+ int status_shown = 0;
|
||||||
|
|
||||||
|
if (!m->scene_buffer->node.enabled)
|
||||||
|
return;
|
||||||
|
if (!(buf = bufmon(m)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
- /* draw status first so it can be overdrawn by tags later */
|
||||||
|
- if (m == selmon) { /* status is only drawn on selected monitor */
|
||||||
|
- drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||||
|
- tw = TEXTW(m, stext) - m->lrpad + 2; /* 2px right padding */
|
||||||
|
- drwl_text(m->drw, m->b.width - tw, 0, tw, m->b.height, 0, stext, 0);
|
||||||
|
+ /* get current mode text if in a mode (not normal) */
|
||||||
|
+ if (active_mode_index >= 0 && active_mode_index < LENGTH(modes_labels) &&
|
||||||
|
+ modes_labels[active_mode_index]) {
|
||||||
|
+ strncpy(mode_text, modes_labels[active_mode_index], sizeof(mode_text) - 1);
|
||||||
|
+ mode_text[sizeof(mode_text) - 1] = '\0';
|
||||||
|
+ mode_width = TEXTW(m, mode_text);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* calculate status text width */
|
||||||
|
+ drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||||
|
+ tw = TEXTW(m, stext) - m->lrpad + 2;
|
||||||
|
+
|
||||||
|
wl_list_for_each(c, &clients, link) {
|
||||||
|
if (c->mon != m)
|
||||||
|
continue;
|
||||||
|
@@ -1607,6 +1617,8 @@ drawbar(Monitor *m)
|
||||||
|
}
|
||||||
|
x = 0;
|
||||||
|
c = focustop(m);
|
||||||
|
+
|
||||||
|
+ /* draw tags (always shown) */
|
||||||
|
for (i = 0; i < LENGTH(tags); i++) {
|
||||||
|
w = TEXTW(m, tags[i]);
|
||||||
|
drwl_setscheme(m->drw, colors[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
||||||
|
@@ -1617,19 +1629,63 @@ drawbar(Monitor *m)
|
||||||
|
urg & 1 << i);
|
||||||
|
x += w;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ /* draw mode indicator after tags if in a mode */
|
||||||
|
+ if (mode_text[0]) {
|
||||||
|
+ drwl_setscheme(m->drw, colors[SchemeSel]);
|
||||||
|
+ drwl_text(m->drw, x, 0, mode_width, m->b.height, m->lrpad / 2, mode_text, 0);
|
||||||
|
+ x += mode_width;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* draw layout symbol after mode */
|
||||||
|
w = TEXTW(m, m->ltsymbol);
|
||||||
|
drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||||
|
- x = drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, m->ltsymbol, 0);
|
||||||
|
-
|
||||||
|
- if ((w = m->b.width - tw - x) > m->b.height) {
|
||||||
|
- if (c) {
|
||||||
|
- drwl_setscheme(m->drw, colors[m == selmon ? SchemeSel : SchemeNorm]);
|
||||||
|
- drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, client_get_title(c), 0);
|
||||||
|
- if (c && c->isfloating)
|
||||||
|
- drwl_rect(m->drw, x + boxs, boxs, boxw, boxw, 0, 0);
|
||||||
|
- } else {
|
||||||
|
+ drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, m->ltsymbol, 0);
|
||||||
|
+ x += w;
|
||||||
|
+
|
||||||
|
+ remaining = m->b.width - x;
|
||||||
|
+
|
||||||
|
+ if (mode_text[0] && remaining >= tw) {
|
||||||
|
+ drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||||
|
+ drwl_text(m->drw, m->b.width - tw, 0, tw, m->b.height, 0, stext, 0);
|
||||||
|
+ remaining -= tw;
|
||||||
|
+ status_shown = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ title_width = remaining;
|
||||||
|
+
|
||||||
|
+ if (c && title_width > m->b.height) {
|
||||||
|
+ drwl_setscheme(m->drw, colors[m == selmon ? SchemeSel : SchemeNorm]);
|
||||||
|
+ drwl_text(m->drw, x, 0, title_width, m->b.height, m->lrpad / 2,
|
||||||
|
+ client_get_title(c), 0);
|
||||||
|
+ if (c && c->isfloating)
|
||||||
|
+ drwl_rect(m->drw, x + boxs, boxs, boxw, boxw, 0, 0);
|
||||||
|
+ } else if (title_width > 0) {
|
||||||
|
+ drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||||
|
+ drwl_rect(m->drw, x, 0, title_width, m->b.height, 1, 1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!mode_text[0]) {
|
||||||
|
+ /* not in a mode - normal behavior with status */
|
||||||
|
+ if (remaining >= tw) {
|
||||||
|
+ drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||||
|
+ drwl_text(m->drw, m->b.width - tw, 0, tw, m->b.height, 0, stext, 0);
|
||||||
|
+
|
||||||
|
+ int title_space = remaining - tw;
|
||||||
|
+ if (title_space > m->b.height && c) {
|
||||||
|
+ drwl_setscheme(m->drw, colors[m == selmon ? SchemeSel : SchemeNorm]);
|
||||||
|
+ drwl_text(m->drw, x, 0, title_space, m->b.height, m->lrpad / 2,
|
||||||
|
+ client_get_title(c), 0);
|
||||||
|
+ if (c && c->isfloating)
|
||||||
|
+ drwl_rect(m->drw, x + boxs, boxs, boxw, boxw, 0, 0);
|
||||||
|
+ } else if (title_space > 0) {
|
||||||
|
+ drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||||
|
+ drwl_rect(m->drw, x, 0, title_space, m->b.height, 1, 1);
|
||||||
|
+ }
|
||||||
|
+ } else if (remaining > 0) {
|
||||||
|
drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||||
|
- drwl_rect(m->drw, x, 0, w, m->b.height, 1, 1);
|
||||||
|
+ drwl_text(m->drw, m->b.width - remaining, 0, remaining, m->b.height, 0,
|
||||||
|
+ stext, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -3437,6 +3493,7 @@ entermode(const Arg *arg)
|
||||||
|
{
|
||||||
|
active_mode_index = arg->i;
|
||||||
|
printstatus();
|
||||||
|
+ drawbars();
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef XWAYLAND
|
||||||
|
--
|
||||||
|
2.53.0
|
||||||
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 6.4 KiB |
@@ -0,0 +1,14 @@
|
|||||||
|
### Description
|
||||||
|
Add a `window_title` option to toggle showing window titles in the bar, similar to the DWM `notitle` patch.
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
this patch depends on [bar](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/bar/) patch
|
||||||
|
|
||||||
|
### Download
|
||||||
|
- [git branch](/pi66/dwl-patches/src/branch/bar-notitle)
|
||||||
|
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/bar-notitle/bar-notitle.patch)
|
||||||
|
- [main 2026-02-28](/dwl/dwl-patches/raw/branch/main/patches/bar-notitle/bar-notitle.patch)
|
||||||
|
|
||||||
|
### Authors
|
||||||
|
- [Pi66](https://codeberg.org/pi66)
|
||||||
|
[website](https://pi66.xyz)
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
From d2f3ac840845802eaf9ff7daf406f04722fd02aa Mon Sep 17 00:00:00 2001
|
From 5dc83d75ff1b7dadf1fd1f96fe2303848e35d382 Mon Sep 17 00:00:00 2001
|
||||||
From: Oak <Oak@petrifiedoak.com>
|
From: pi66 <pixel2176@proton.me>
|
||||||
Date: Sun, 25 Aug 2024 17:43:17 +0200
|
Date: Sat, 28 Feb 2026 20:26:28 +0100
|
||||||
Subject: [PATCH] Implement barheight patch
|
Subject: [PATCH] add window_title option (like dwm notitle patch)
|
||||||
|
|
||||||
---
|
---
|
||||||
config.def.h | 1 +
|
config.def.h | 1 +
|
||||||
@@ -9,30 +9,30 @@ Subject: [PATCH] Implement barheight patch
|
|||||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
diff --git a/config.def.h b/config.def.h
|
||||||
index 5d1dc2b..f11089c 100644
|
index 7da50d2..3d3dfe8 100644
|
||||||
--- a/config.def.h
|
--- a/config.def.h
|
||||||
+++ b/config.def.h
|
+++ b/config.def.h
|
||||||
@@ -7,6 +7,7 @@
|
@@ -7,6 +7,7 @@
|
||||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||||
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
|
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
|
||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
+static const int user_bh = 30; /* 0 means that dwl will calculate barheight, >= 1 means dwl will use user_bh as the bar height. */
|
+static const int window_title = 0; /* 1 means showing window titles on the bar */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
static const int topbar = 1; /* 0 means bottom bar */
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
static const char *fonts[] = {"monospace:size=10"};
|
static const char *fonts[] = {"monospace:size=10"};
|
||||||
diff --git a/dwl.c b/dwl.c
|
diff --git a/dwl.c b/dwl.c
|
||||||
index ece537a..2863202 100644
|
index 7fe9468..0c7262a 100644
|
||||||
--- a/dwl.c
|
--- a/dwl.c
|
||||||
+++ b/dwl.c
|
+++ b/dwl.c
|
||||||
@@ -3183,7 +3183,7 @@ updatebar(Monitor *m)
|
@@ -1614,7 +1614,7 @@ drawbar(Monitor *m)
|
||||||
|
x = drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, m->ltsymbol, 0);
|
||||||
m->b.scale = m->wlr_output->scale;
|
|
||||||
m->lrpad = m->drw->font->height;
|
|
||||||
- m->b.height = m->drw->font->height + 2;
|
|
||||||
+ m->b.height = user_bh ? user_bh : m->drw->font->height + 2;
|
|
||||||
m->b.real_height = (int)((float)m->b.height / m->wlr_output->scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if ((w = m->b.width - tw - x) > m->b.height) {
|
||||||
|
- if (c) {
|
||||||
|
+ if (c && window_title) {
|
||||||
|
drwl_setscheme(m->drw, colors[m == selmon ? SchemeSel : SchemeNorm]);
|
||||||
|
drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, client_get_title(c), 0);
|
||||||
|
if (c && c->isfloating)
|
||||||
--
|
--
|
||||||
2.46.0
|
2.52.0
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# Description
|
||||||
|
Reload colorscheme on the fly without restart or recompile DWL.
|
||||||
|
|
||||||
|
> NOTE:
|
||||||
|
The patch works on (main 2025-11-01) and v0.7
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
this patch depends on [bar](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/bar/) patch
|
||||||
|
|
||||||
|
# Download
|
||||||
|
- [git branch](https://codeberg.org/pi66/dwl-patches/raw/branch/main/patches/bar-recolr/bar-recolr.patch)
|
||||||
|
- [main 2025-11-01](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/bar-recolr/bar-recolr.patch)
|
||||||
|
- [v0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/bar-recolr/bar-recolr.patch)
|
||||||
|
|
||||||
|
# Authors
|
||||||
|
- [pi66](https://pi66.xyz)
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
From 89029325be300f03bbc3ca3b2d77f107d0cb5ca2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: pi66 <pixel2176@proton.me>
|
||||||
|
Date: Tue, 25 Nov 2025 12:53:36 +0100
|
||||||
|
Subject: [PATCH] Add: load colors from an external file
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 3 +++
|
||||||
|
dwl.c | 21 +++++++++++++++++++++
|
||||||
|
2 files changed, 24 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 1b7472d..3c04759 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -9,6 +9,8 @@ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will
|
||||||
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
|
+static const int refresh_colors = 0; /* 1 means reloading colors when the session starts*/
|
||||||
|
+static const char *colors_file = "/home/pixel/.cache/wal/dwl-colors"; /* change the username */
|
||||||
|
static const char *fonts[] = {"monospace:size=10"};
|
||||||
|
static const float rootcolor[] = COLOR(0x000000ff);
|
||||||
|
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||||
|
@@ -135,6 +137,7 @@ static const Key keys[] = {
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
|
||||||
|
{ MODKEY, XKB_KEY_b, togglebar, {0} },
|
||||||
|
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
||||||
|
+ { MODKEY, XKB_KEY_n, reload_colors, {0} },
|
||||||
|
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
||||||
|
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||||
|
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index bf340d8..fc81d89 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -345,6 +345,7 @@ static void pointerfocus(Client *c, struct wlr_surface *surface,
|
||||||
|
double sx, double sy, uint32_t time);
|
||||||
|
static void powermgrsetmode(struct wl_listener *listener, void *data);
|
||||||
|
static void quit(const Arg *arg);
|
||||||
|
+static void reload_colors(const Arg *arg);
|
||||||
|
static void rendermon(struct wl_listener *listener, void *data);
|
||||||
|
static void requestdecorationmode(struct wl_listener *listener, void *data);
|
||||||
|
static void requeststartdrag(struct wl_listener *listener, void *data);
|
||||||
|
@@ -2348,6 +2349,25 @@ quit(const Arg *arg)
|
||||||
|
wl_display_terminate(dpy);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+reload_colors(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ FILE *f = fopen(colors_file, "r");
|
||||||
|
+ if (!f) return;
|
||||||
|
+
|
||||||
|
+ for (int i = 0; i < (int)LENGTH(colors); i++) {
|
||||||
|
+ unsigned int fg, bg, border;
|
||||||
|
+ if (fscanf(f, "%x %x %x", &fg, &bg, &border) != 3)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ colors[i][ColFg] = fg;
|
||||||
|
+ colors[i][ColBg] = bg;
|
||||||
|
+ colors[i][ColBorder] = border;
|
||||||
|
+ }
|
||||||
|
+ fclose(f);
|
||||||
|
+ drawbars();
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
rendermon(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
@@ -3482,6 +3502,7 @@ main(int argc, char *argv[])
|
||||||
|
if (!getenv("XDG_RUNTIME_DIR"))
|
||||||
|
die("XDG_RUNTIME_DIR must be set");
|
||||||
|
setup();
|
||||||
|
+ if (refresh_colors) reload_colors(0);
|
||||||
|
run(startup_cmd);
|
||||||
|
cleanup();
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
--
|
||||||
|
2.51.2
|
||||||
|
|
||||||
@@ -1,30 +1,18 @@
|
|||||||
### Description
|
### Description
|
||||||
Add a system tray next to the [bar](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/bar). Heed the warning, this is far from suckless ^^
|
Add a system tray to the [bar](/dwl/dwl-patches/src/branch/main/patches/bar).
|
||||||
|
|
||||||

|
To keep dependencies to minimum, icon(svg) loading from the filesystem is not
|
||||||
|
supported. Applications that expect this will show the initial letter of the
|
||||||
|
program name, instead of a real icon.
|
||||||
|
|
||||||
|
Menus for the icons are handled by a dmenu-like program of the user's choice.
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
- GTK4
|
- [bar.patch](/dwl/dwl-patches/src/branch/main/patches/bar)
|
||||||
- [bar.patch](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/bar) as mentioned.
|
- [libdbus](https://gitlab.freedesktop.org/dbus/dbus)
|
||||||
- [gtk4-layer-shell](https://github.com/wmww/gtk4-layer-shell)
|
|
||||||
- [statusnotifier-systray-gtk4](https://codeberg.org/janetski/statusnotifier-systray-gtk4) built as a static library.
|
|
||||||
|
|
||||||
### Applying the patch
|
|
||||||
The patch applies on top of the bar patch. That needs to be applied first.
|
|
||||||
|
|
||||||
The patch creates subdirectories `lib` and `include`. After patching, but before `make`, install
|
|
||||||
`libstatusnotifier-systray-gtk4.a` and `snsystray.h` from statusnotifier-systray-gtk4 in the
|
|
||||||
directories. One possible way to do that:
|
|
||||||
|
|
||||||
1. Clone [https://codeberg.org/janetski/statusnotifier-systray-gtk4](https://codeberg.org/janetski/statusnotifier-systray-gtk4). Can clone to any location.
|
|
||||||
2. From statusnotifier-systray-gtk4 root:
|
|
||||||
1. `$ meson setup --default-library=static --prefix=/ -Dgir=false -Dvala=false -Ddocs=false build`
|
|
||||||
2. `$ meson compile -C build`
|
|
||||||
3. `$ DESTDIR=$DWLDIR meson install -C build`, where $DWLDIR is the path to dwl root.
|
|
||||||
3. Finally, from dwl root, run `make`.
|
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
- [git branch](/janetski/dwl/src/branch/0.7-systray)
|
- [git branch](/janetski/dwl/src/branch/0.7-bar-systray)
|
||||||
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/bar-systray/bar-systray-0.7.patch)
|
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/bar-systray/bar-systray-0.7.patch)
|
||||||
|
|
||||||
### Authors
|
### Authors
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -13,6 +13,7 @@ slstatus -s | dwl
|
|||||||
* pixman
|
* pixman
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
|
- [main 2026-01-05](/dwl/dwl-patches/raw/branch/main/patches/bar/bar.patch)
|
||||||
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/bar/bar-0.7.patch)
|
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/bar/bar-0.7.patch)
|
||||||
- [0.6](/dwl/dwl-patches/raw/branch/main/patches/bar/bar-0.6.patch)
|
- [0.6](/dwl/dwl-patches/raw/branch/main/patches/bar/bar-0.6.patch)
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,25 @@
|
|||||||
From 16f4f7cdc4ca9253a5bf97ee0e2ce5afd666fbbb Mon Sep 17 00:00:00 2001
|
From d2b529d9ebee6b2e625afd5c89c2ede5bb0ca91b Mon Sep 17 00:00:00 2001
|
||||||
From: Kerberoge <sjoerdenjh@gmail.com>
|
From: Kerberoge <sjoerdenjh@gmail.com>
|
||||||
Date: Sun, 25 Aug 2024 22:41:55 +0200
|
Date: Sun, 25 Aug 2024 22:41:55 +0200
|
||||||
Subject: [PATCH 1/1] applied barcolors patch
|
Subject: [PATCH 1/1] updated barcolors
|
||||||
|
|
||||||
---
|
---
|
||||||
dwl.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
|
dwl.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
|
||||||
1 file changed, 83 insertions(+), 6 deletions(-)
|
1 file changed, 87 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
diff --git a/dwl.c b/dwl.c
|
diff --git a/dwl.c b/dwl.c
|
||||||
index ece537a..50d6ead 100644
|
index ece537a..6663399 100644
|
||||||
--- a/dwl.c
|
--- a/dwl.c
|
||||||
+++ b/dwl.c
|
+++ b/dwl.c
|
||||||
@@ -318,6 +318,7 @@ static void destroykeyboardgroup(struct wl_listener *listener, void *data);
|
@@ -83,6 +83,7 @@
|
||||||
|
#define LISTEN(E, L, H) wl_signal_add((E), ((L)->notify = (H), (L)))
|
||||||
|
#define LISTEN_STATIC(E, H) do { static struct wl_listener _l = {.notify = (H)}; wl_signal_add((E), &_l); } while (0)
|
||||||
|
#define TEXTW(mon, text) (drwl_font_getwidth(mon->drw, text) + mon->lrpad)
|
||||||
|
+#define PREFIX(str, prefix) !strncmp(str, prefix, strlen(prefix))
|
||||||
|
|
||||||
|
/* enums */
|
||||||
|
enum { SchemeNorm, SchemeSel, SchemeUrg }; /* color schemes */
|
||||||
|
@@ -318,6 +319,7 @@ static void destroykeyboardgroup(struct wl_listener *listener, void *data);
|
||||||
static Monitor *dirtomon(enum wlr_direction dir);
|
static Monitor *dirtomon(enum wlr_direction dir);
|
||||||
static void drawbar(Monitor *m);
|
static void drawbar(Monitor *m);
|
||||||
static void drawbars(void);
|
static void drawbars(void);
|
||||||
@@ -19,7 +27,7 @@ index ece537a..50d6ead 100644
|
|||||||
static void focusclient(Client *c, int lift);
|
static void focusclient(Client *c, int lift);
|
||||||
static void focusmon(const Arg *arg);
|
static void focusmon(const Arg *arg);
|
||||||
static void focusstack(const Arg *arg);
|
static void focusstack(const Arg *arg);
|
||||||
@@ -448,7 +449,7 @@ static struct wlr_box sgeom;
|
@@ -448,7 +450,7 @@ static struct wlr_box sgeom;
|
||||||
static struct wl_list mons;
|
static struct wl_list mons;
|
||||||
static Monitor *selmon;
|
static Monitor *selmon;
|
||||||
|
|
||||||
@@ -28,7 +36,7 @@ index ece537a..50d6ead 100644
|
|||||||
static struct wl_event_source *status_event_source;
|
static struct wl_event_source *status_event_source;
|
||||||
|
|
||||||
static const struct wlr_buffer_impl buffer_impl = {
|
static const struct wlr_buffer_impl buffer_impl = {
|
||||||
@@ -1519,11 +1520,8 @@ drawbar(Monitor *m)
|
@@ -1519,11 +1521,8 @@ drawbar(Monitor *m)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* draw status first so it can be overdrawn by tags later */
|
/* draw status first so it can be overdrawn by tags later */
|
||||||
@@ -42,7 +50,7 @@ index ece537a..50d6ead 100644
|
|||||||
|
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (c->mon != m)
|
if (c->mon != m)
|
||||||
@@ -1577,6 +1575,85 @@ drawbars(void)
|
@@ -1577,6 +1576,88 @@ drawbars(void)
|
||||||
drawbar(m);
|
drawbar(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,23 +64,23 @@ index ece537a..50d6ead 100644
|
|||||||
+
|
+
|
||||||
+ /* calculate real width of stext */
|
+ /* calculate real width of stext */
|
||||||
+ for (p = stext; *p; p++) {
|
+ for (p = stext; *p; p++) {
|
||||||
+ if (*p == '^') {
|
+ if (PREFIX(p, "^^")) {
|
||||||
|
+ strncat(rstext, p, 2);
|
||||||
+ p++;
|
+ p++;
|
||||||
+ if (!strncmp(p, "fg(", 3) || !strncmp(p, "bg(", 3)) {
|
+ } else if (PREFIX(p, "^fg(") || PREFIX(p, "^bg(")) {
|
||||||
+ argend = strchr(p, ')');
|
+ argend = strchr(p, ')');
|
||||||
+ if (!argend)
|
+ if (!argend) { /* ignore this command */
|
||||||
+ argend = p + 2;
|
+ argstart = strchr(p, '(') + 1;
|
||||||
+ p = argend;
|
+ strncat(rstext, p, argstart - p);
|
||||||
+ } else if (*p == '^') {
|
+ p = argstart - 1;
|
||||||
+ strncat(rstext, p, 1);
|
|
||||||
+ } else {
|
+ } else {
|
||||||
+ strncat(rstext, p - 1, 2);
|
+ p = argend;
|
||||||
+ }
|
+ }
|
||||||
+ } else {
|
+ } else {
|
||||||
+ strncat(rstext, p, 1);
|
+ strncat(rstext, p, 1);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ tw = TEXTW(m, rstext) - m->lrpad + 2; /* 2px right padding */
|
+ tw = TEXTW(m, rstext) - m->lrpad;
|
||||||
+
|
+
|
||||||
+ x = m->b.width - tw;
|
+ x = m->b.width - tw;
|
||||||
+ itext = stext;
|
+ itext = stext;
|
||||||
@@ -80,48 +88,51 @@ index ece537a..50d6ead 100644
|
|||||||
+ scheme[1] = colors[SchemeNorm][1];
|
+ scheme[1] = colors[SchemeNorm][1];
|
||||||
+ drwl_setscheme(m->drw, scheme);
|
+ drwl_setscheme(m->drw, scheme);
|
||||||
+ for (p = stext; *p; p++) {
|
+ for (p = stext; *p; p++) {
|
||||||
+ if (*p == '^') {
|
+ if (PREFIX(p, "^^")) {
|
||||||
+ p++;
|
+ p++;
|
||||||
+ if (!strncmp(p, "fg(", 3) || !strncmp(p, "bg(", 3)) {
|
+ } else if (PREFIX(p, "^fg(") || PREFIX(p, "^bg(")) {
|
||||||
+ *(p - 1) = '\0';
|
+ argstart = strchr(p, '(') + 1;
|
||||||
+ iw = TEXTW(m, itext) - m->lrpad;
|
+ argend = strchr(argstart, ')');
|
||||||
+ if (*itext) /* only draw text if there is something to draw */
|
+ if (!argend) { /* ignore this command */
|
||||||
+ x = drwl_text(m->drw, x, 0, iw, m->b.height, 0, itext, 0);
|
+ p = argstart - 1;
|
||||||
+ *(p - 1) = '^';
|
+ continue;
|
||||||
+
|
|
||||||
+ argstart = p + 3;
|
|
||||||
+ argend = strchr(argstart, ')');
|
|
||||||
+ if (!argend) argend = argstart - 1;
|
|
||||||
+ itext = argend + 1;
|
|
||||||
+
|
|
||||||
+ if (!strncmp(p, "fg(", 3)) /* foreground */
|
|
||||||
+ color = &scheme[0];
|
|
||||||
+ else /* background */
|
|
||||||
+ color = &scheme[1];
|
|
||||||
+
|
|
||||||
+ if (argend - argstart > 0) {
|
|
||||||
+ *argend = '\0';
|
|
||||||
+ *color = strtoul(argstart, NULL, 16);
|
|
||||||
+ *color = *color << 8 | 0xff; /* add alpha channel */
|
|
||||||
+ *argend = ')';
|
|
||||||
+ } else {
|
|
||||||
+ *color = 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* reset color back to normal if none was provided */
|
|
||||||
+ if (!scheme[0])
|
|
||||||
+ scheme[0] = colors[SchemeNorm][0];
|
|
||||||
+ if (!scheme[1])
|
|
||||||
+ scheme[1] = colors[SchemeNorm][1];
|
|
||||||
+
|
|
||||||
+ drwl_setscheme(m->drw, scheme);
|
|
||||||
+ p = argend;
|
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ *p = '\0';
|
||||||
|
+ iw = TEXTW(m, itext) - m->lrpad;
|
||||||
|
+ if (*itext) /* only draw text if there is something to draw */
|
||||||
|
+ x = drwl_text(m->drw, x, 0, iw, m->b.height, 0, itext, 0);
|
||||||
|
+ *p = '^';
|
||||||
|
+
|
||||||
|
+ if (PREFIX(p, "^fg("))
|
||||||
|
+ color = &scheme[0];
|
||||||
|
+ else
|
||||||
|
+ color = &scheme[1];
|
||||||
|
+
|
||||||
|
+ if (argend != argstart) {
|
||||||
|
+ *argend = '\0';
|
||||||
|
+ *color = strtoul(argstart, NULL, 16);
|
||||||
|
+ *color = *color << 8 | 0xff; /* add alpha channel */
|
||||||
|
+ *argend = ')';
|
||||||
|
+ } else {
|
||||||
|
+ *color = 0; /* reset */
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* reset color back to normal if none was provided */
|
||||||
|
+ if (!scheme[0])
|
||||||
|
+ scheme[0] = colors[SchemeNorm][0];
|
||||||
|
+ if (!scheme[1])
|
||||||
|
+ scheme[1] = colors[SchemeNorm][1];
|
||||||
|
+
|
||||||
|
+ itext = argend + 1;
|
||||||
|
+ drwl_setscheme(m->drw, scheme);
|
||||||
|
+ p = argend;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ iw = TEXTW(m, itext) - m->lrpad;
|
+ iw = TEXTW(m, itext) - m->lrpad;
|
||||||
+ if (*itext)
|
+ if (*itext)
|
||||||
+ drwl_text(m->drw, x, 0, iw, m->b.height, 0, itext, 0);
|
+ drwl_text(m->drw, x, 0, iw, m->b.height, 0, itext, 0);
|
||||||
|
+
|
||||||
+ return tw;
|
+ return tw;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
@@ -129,5 +140,5 @@ index ece537a..50d6ead 100644
|
|||||||
focusclient(Client *c, int lift)
|
focusclient(Client *c, int lift)
|
||||||
{
|
{
|
||||||
--
|
--
|
||||||
2.46.0
|
2.48.1
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
### Description
|
||||||
|
This patch **requires** the dwl [barconfig](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/bar) patch be applied first! The barconfig patch provides configuration for the dwl bar via the variable
|
||||||
|
`barlayout`. This determines which of the elements listed below to
|
||||||
|
display on the bar and in which order:
|
||||||
|
|
||||||
|
- 't' -> the tags
|
||||||
|
- 'l' -> the current layout symbol
|
||||||
|
- 'n' -> the window name
|
||||||
|
- 's' -> the status message
|
||||||
|
- '|' -> elements on the right of this separator will be displayed from
|
||||||
|
the right
|
||||||
|
|
||||||
|
**NOTE**: This patch is a dwl port of the [original](https://dwm.suckless.org/patches/barconfig/) barconfig patch for dwm.
|
||||||
|
|
||||||
|
### Known Issues With Patch
|
||||||
|
Changing the location of the tags breaks the tag button presses (the buttons expect the click in the usual location of the tags). I do not have any plans to look into this, as I ported this patch for the sole purpose of having the option to omit the layout symbol from the bar.
|
||||||
|
|
||||||
|
### Download
|
||||||
|
- [main 2025-10-24](/dwl/dwl-patches/raw/branch/main/patches/barconfig/barconfig.patch)
|
||||||
|
|
||||||
|
|
||||||
|
### Authors - latest at top
|
||||||
|
- Rumen Mitov
|
||||||
|
Codeberg: [rumenmitov](https://codeberg.org/rumenmitov)
|
||||||
|
Email: rumenmitov@protonmail.com
|
||||||
@@ -0,0 +1,194 @@
|
|||||||
|
From e733fda4e498c998a104d0d5bb42b9c7373f2c9d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Rumen <rumenmitov@protonmail.com>
|
||||||
|
Date: Fri, 24 Oct 2025 09:33:24 +0200
|
||||||
|
Subject: [PATCH] Barconfig: Configure the dwl bar!
|
||||||
|
|
||||||
|
NOTE: This is a port of the original barconfig patch for dwm!
|
||||||
|
|
||||||
|
This patch provides configuration for the dwl bar via the variable
|
||||||
|
`barlayout`. This determines which of the elements listed below to
|
||||||
|
display on the bar and in which order:
|
||||||
|
|
||||||
|
- 't' -> the tags
|
||||||
|
- 'l' -> the current layout symbol
|
||||||
|
- 'n' -> the window name
|
||||||
|
- 's' -> the status message
|
||||||
|
- '|' -> elements on the right of this separator will be displayed from
|
||||||
|
the right
|
||||||
|
---
|
||||||
|
config.def.h | 1 +
|
||||||
|
dwl.c | 134 +++++++++++++++++++++++++++++++++++----------------
|
||||||
|
2 files changed, 93 insertions(+), 42 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 1b7472d..c7a33d6 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -9,6 +9,7 @@ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will
|
||||||
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
|
+static const char *barlayout = "tln|s";
|
||||||
|
static const char *fonts[] = {"monospace:size=10"};
|
||||||
|
static const float rootcolor[] = COLOR(0x000000ff);
|
||||||
|
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index bf340d8..f0d72cf 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -1569,10 +1569,10 @@ dirtomon(enum wlr_direction dir)
|
||||||
|
void
|
||||||
|
drawbar(Monitor *m)
|
||||||
|
{
|
||||||
|
- int x, w, tw = 0;
|
||||||
|
+ int x = 0, w, tw = 0, moveright = 0;
|
||||||
|
int boxs = m->drw->font->height / 9;
|
||||||
|
int boxw = m->drw->font->height / 6 + 2;
|
||||||
|
- uint32_t i, occ = 0, urg = 0;
|
||||||
|
+ uint32_t i, j, occ = 0, urg = 0;
|
||||||
|
Client *c;
|
||||||
|
Buffer *buf;
|
||||||
|
|
||||||
|
@@ -1581,48 +1581,99 @@ drawbar(Monitor *m)
|
||||||
|
if (!(buf = bufmon(m)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
- /* draw status first so it can be overdrawn by tags later */
|
||||||
|
- if (m == selmon) { /* status is only drawn on selected monitor */
|
||||||
|
- drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||||
|
- tw = TEXTW(m, stext) - m->lrpad + 2; /* 2px right padding */
|
||||||
|
- drwl_text(m->drw, m->b.width - tw, 0, tw, m->b.height, 0, stext, 0);
|
||||||
|
- }
|
||||||
|
+ if (barlayout[0] == '\0')
|
||||||
|
+ barlayout = "tln|s";
|
||||||
|
+
|
||||||
|
+ drwl_text(m->drw, 0, 0, m->w.width, m->b.height, 0, "", 0); /* draw background */
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < strlen(barlayout); i++) {
|
||||||
|
+ switch (barlayout[i]) {
|
||||||
|
+ case 'l':
|
||||||
|
+ w = TEXTW(m, m->ltsymbol);
|
||||||
|
+ drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||||
|
+ if (moveright) {
|
||||||
|
+ x -= w;
|
||||||
|
+ drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, m->ltsymbol, 0);
|
||||||
|
+ } else
|
||||||
|
+ x = drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, m->ltsymbol, 0);
|
||||||
|
+ break;
|
||||||
|
|
||||||
|
- wl_list_for_each(c, &clients, link) {
|
||||||
|
- if (c->mon != m)
|
||||||
|
- continue;
|
||||||
|
- occ |= c->tags;
|
||||||
|
- if (c->isurgent)
|
||||||
|
- urg |= c->tags;
|
||||||
|
- }
|
||||||
|
- x = 0;
|
||||||
|
- c = focustop(m);
|
||||||
|
- for (i = 0; i < LENGTH(tags); i++) {
|
||||||
|
- w = TEXTW(m, tags[i]);
|
||||||
|
- drwl_setscheme(m->drw, colors[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
||||||
|
- drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, tags[i], urg & 1 << i);
|
||||||
|
- if (occ & 1 << i)
|
||||||
|
- drwl_rect(m->drw, x + boxs, boxs, boxw, boxw,
|
||||||
|
- m == selmon && c && c->tags & 1 << i,
|
||||||
|
- urg & 1 << i);
|
||||||
|
- x += w;
|
||||||
|
- }
|
||||||
|
- w = TEXTW(m, m->ltsymbol);
|
||||||
|
- drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||||
|
- x = drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, m->ltsymbol, 0);
|
||||||
|
-
|
||||||
|
- if ((w = m->b.width - tw - x) > m->b.height) {
|
||||||
|
- if (c) {
|
||||||
|
- drwl_setscheme(m->drw, colors[m == selmon ? SchemeSel : SchemeNorm]);
|
||||||
|
- drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, client_get_title(c), 0);
|
||||||
|
- if (c && c->isfloating)
|
||||||
|
- drwl_rect(m->drw, x + boxs, boxs, boxw, boxw, 0, 0);
|
||||||
|
- } else {
|
||||||
|
- drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||||
|
- drwl_rect(m->drw, x, 0, w, m->b.height, 1, 1);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
+ case 'n':
|
||||||
|
+ c = focustop(m);
|
||||||
|
+
|
||||||
|
+ if (c) {
|
||||||
|
+ tw = TEXTW(m, client_get_title(c));
|
||||||
|
+ if (moveright)
|
||||||
|
+ x -= tw;
|
||||||
|
+
|
||||||
|
+ drwl_setscheme(m->drw, colors[m == selmon ? SchemeSel : SchemeNorm]);
|
||||||
|
+ drwl_text(m->drw, x, 0, moveright ? tw : m->w.width, m->b.height, m->lrpad / 2, client_get_title(c), 0);
|
||||||
|
+
|
||||||
|
+ if (c && c->isfloating)
|
||||||
|
+ drwl_rect(m->drw, x + boxs, boxs, boxw, boxw, 0, 0);
|
||||||
|
+
|
||||||
|
+ } else {
|
||||||
|
+ drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||||
|
+ drwl_rect(m->drw, x, 0, tw, m->b.height, 1, 1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!moveright)
|
||||||
|
+ x += tw;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case 's':
|
||||||
|
+ if (m == selmon) { /* status is only drawn on selected monitor */
|
||||||
|
+ drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||||
|
+ tw = TEXTW(m, stext) - m->lrpad + 2; /* 2px right padding */
|
||||||
|
+ if (moveright) {
|
||||||
|
+ x -= tw;
|
||||||
|
+ drwl_text(m->drw, x, 0, tw, m->b.height, 0, stext, 0);
|
||||||
|
+ } else
|
||||||
|
+ x = drwl_text(m->drw, x, 0, tw, m->b.height, 0, stext, 0);
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case 't':
|
||||||
|
+ wl_list_for_each(c, &clients, link) {
|
||||||
|
+ if (c->mon != m)
|
||||||
|
+ continue;
|
||||||
|
+ occ |= c->tags;
|
||||||
|
+ if (c->isurgent)
|
||||||
|
+ urg |= c->tags;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ c = focustop(m);
|
||||||
|
+
|
||||||
|
+ /* tags */
|
||||||
|
+ if (moveright) {
|
||||||
|
+ tw = 0;
|
||||||
|
+ for (j = 0; j < LENGTH(tags); j++) {
|
||||||
|
+ tw += TEXTW(m, tags[j]);
|
||||||
|
+ }
|
||||||
|
+ x -= tw;
|
||||||
|
+ }
|
||||||
|
+ for (j = 0; j < LENGTH(tags); j++) {
|
||||||
|
+ w = TEXTW(m, tags[j]);
|
||||||
|
+ drwl_setscheme(m->drw, colors[m->tagset[m->seltags] & 1 << j ? SchemeSel : SchemeNorm]);
|
||||||
|
+ drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, tags[j], urg & 1 << j);
|
||||||
|
+ if (occ & 1 << j)
|
||||||
|
+ drwl_rect(m->drw, x + boxs, boxs, boxw, boxw,
|
||||||
|
+ m == selmon && c && c->tags & 1 << j,
|
||||||
|
+ urg & 1 << i);
|
||||||
|
+ x += w;
|
||||||
|
+ }
|
||||||
|
+ if (moveright)
|
||||||
|
+ x -= tw;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case '|':
|
||||||
|
+ moveright = 1;
|
||||||
|
+ x = m->w.width;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
|
||||||
|
+
|
||||||
|
wlr_scene_buffer_set_dest_size(m->scene_buffer,
|
||||||
|
m->b.real_width, m->b.real_height);
|
||||||
|
wlr_scene_node_set_position(&m->scene_buffer->node, m->m.x,
|
||||||
|
--
|
||||||
|
2.51.1
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
### Description
|
|
||||||
|
|
||||||
Adds the ability to change the [bar's](https://codeberg.org/dwl/dwl-patches/wiki/bar) height.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/barheight/barheight.patch) (bar 0.7)
|
|
||||||
- [git branch](https://codeberg.org/Oak/dwl/src/branch/barheight)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [Oak](https://codeberg.org/oak)
|
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
### Description
|
||||||
|
A homegrown port of dwm's _truecenteredtitle_ patch, with the addition of a config option to toggle its effects.<br>Requires [the bar patch](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/bar) to be applied beforehand.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Download
|
||||||
|
- [v0.7/v0.6](/dwl/dwl-patches/raw/branch/main/patches/bartruecenteredtitle/bartruecenteredtitle.patch)<br>Works on both v0.7 and v0.6.
|
||||||
|
|
||||||
|
### Author
|
||||||
|
- [moonsabre](https://codeberg.org/moonsabre)
|
||||||
|
- [sewn](https://codeberg.org/sewn)
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
From 17501c9f28226b1f332d6842be0d7f50ba618a29 Mon Sep 17 00:00:00 2001
|
||||||
|
From: moonsabre <moonsabre@tuta.io>
|
||||||
|
Date: Fri, 14 Mar 2025 16:04:25 -0700
|
||||||
|
Subject: [PATCH] Bar title centering parameter.
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 1 +
|
||||||
|
dwl.c | 9 +++++++--
|
||||||
|
2 files changed, 8 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 5d1dc2b..8ac3a8b 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -9,6 +9,7 @@ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will
|
||||||
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
|
+static const int centeredtitle = 1; /* 1 means centered title */
|
||||||
|
static const char *fonts[] = {"monospace:size=10"};
|
||||||
|
static const float rootcolor[] = COLOR(0x000000ff);
|
||||||
|
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index ece537a..9eb816b 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -1551,9 +1551,14 @@ drawbar(Monitor *m)
|
||||||
|
if ((w = m->b.width - tw - x) > m->b.height) {
|
||||||
|
if (c) {
|
||||||
|
drwl_setscheme(m->drw, colors[m == selmon ? SchemeSel : SchemeNorm]);
|
||||||
|
- drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, client_get_title(c), 0);
|
||||||
|
+ tw = TEXTW(selmon, client_get_title(c));
|
||||||
|
+ drwl_text(m->drw, x, 0, w, m->b.height,
|
||||||
|
+ !centeredtitle || tw > w ? m->lrpad / 2 : (w - tw) / 2,
|
||||||
|
+ client_get_title(c), 0);
|
||||||
|
if (c && c->isfloating)
|
||||||
|
- drwl_rect(m->drw, x + boxs, boxs, boxw, boxw, 0, 0);
|
||||||
|
+ drwl_rect(m->drw,
|
||||||
|
+ !centeredtitle || tw > w ? x + boxs : x + ((w - tw) / 2 - boxs * 8),
|
||||||
|
+ boxs, boxw, boxw, 0, 0);
|
||||||
|
} else {
|
||||||
|
drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||||
|
drwl_rect(m->drw, x, 0, w, m->b.height, 1, 1);
|
||||||
|
--
|
||||||
|
2.48.1
|
||||||
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@@ -0,0 +1,48 @@
|
|||||||
|
### Description
|
||||||
|
This patch allows you to configure window resizing more flexibly.
|
||||||
|
It introduces three options with the following possible values:
|
||||||
|
|
||||||
|
- warp_cursor:
|
||||||
|
```
|
||||||
|
0 - the mouse cursor remains in its original position at the start of the resize.
|
||||||
|
1 - the cursor is automatically warped to the selected corner before resizing begins.
|
||||||
|
```
|
||||||
|
|
||||||
|
- lock_cursor:
|
||||||
|
```
|
||||||
|
0 - the cursor can move freely during the resize.
|
||||||
|
1 - the cursor position is completely frozen for the entire duration of the resize.
|
||||||
|
```
|
||||||
|
|
||||||
|
- resize_corner:
|
||||||
|
```
|
||||||
|
0: top-left
|
||||||
|
1: top-right
|
||||||
|
2: bottom-left
|
||||||
|
3: bottom-right
|
||||||
|
4: selects the corner based on the current mouse quadrant
|
||||||
|
```
|
||||||
|
|
||||||
|
### Demos
|
||||||
|
All demos below use resize_corner = 4:
|
||||||
|
| no warp + no lock | warp + lock |
|
||||||
|
|-|-|
|
||||||
|
|  |  |
|
||||||
|
|
||||||
|
| no warp + lock | warp + no lock |
|
||||||
|
|-|-|
|
||||||
|
|  |  |
|
||||||
|
|
||||||
|
### Known Issues (warp + lock)
|
||||||
|
The combination of warp_cursor and lock_cursor is not recommended without outer gaps.
|
||||||
|
If the selected resize corner aligns exactly with a screen corner, the cursor gets locked there and cannot be moved outward, so resizing only works inward.
|
||||||
|
To resize outward, you must restart the resize operation with the cursor positioned somewhere away from the screen corner.
|
||||||
|
This happens because the locked cursor cannot move past the screen edge, and therefore cannot generate a non-zero delta to resize outward.
|
||||||
|
|
||||||
|
On multihead setups, if the resize corner is near another screen, the window may switch monitors upon completion of the resize.
|
||||||
|
|
||||||
|
### Download
|
||||||
|
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/better-resize/better-resize-0.7.patch)
|
||||||
|
|
||||||
|
### Authors
|
||||||
|
- [mmistika](https://codeberg.org/mmistika)
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
From 5fab55803d009d400f6c3fcbe6a0fc807431bbe7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: mmistika <mistikasoft@gmail.com>
|
||||||
|
Date: Thu, 17 Jul 2025 11:59:18 +0200
|
||||||
|
Subject: [PATCH] Add configurable window resize
|
||||||
|
|
||||||
|
Signed-off-by: mmistika <mistikasoft@gmail.com>
|
||||||
|
---
|
||||||
|
config.def.h | 12 ++++++++++++
|
||||||
|
dwl.c | 48 ++++++++++++++++++++++++++++++++++++++++--------
|
||||||
|
2 files changed, 52 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 22d2171..e404549 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -20,6 +20,18 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||||
|
/* logging */
|
||||||
|
static int log_level = WLR_ERROR;
|
||||||
|
|
||||||
|
+/* window resizing */
|
||||||
|
+/* resize_corner:
|
||||||
|
+ * 0: top-left
|
||||||
|
+ * 1: top-right
|
||||||
|
+ * 2: bottom-left
|
||||||
|
+ * 3: bottom-right
|
||||||
|
+ * 4: closest to the cursor
|
||||||
|
+ */
|
||||||
|
+static const int resize_corner = 4;
|
||||||
|
+static const int warp_cursor = 1; /* 1: warp to corner, 0: don’t warp */
|
||||||
|
+static const int lock_cursor = 0; /* 1: lock cursor, 0: don't lock */
|
||||||
|
+
|
||||||
|
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
|
||||||
|
static const Rule rules[] = {
|
||||||
|
/* app_id title tags mask isfloating monitor */
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index c717c1d..0d56b49 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -407,6 +407,7 @@ static KeyboardGroup *kb_group;
|
||||||
|
static unsigned int cursor_mode;
|
||||||
|
static Client *grabc;
|
||||||
|
static int grabcx, grabcy; /* client-relative */
|
||||||
|
+static int rzcorner;
|
||||||
|
|
||||||
|
static struct wlr_output_layout *output_layout;
|
||||||
|
static struct wlr_box sgeom;
|
||||||
|
@@ -1873,8 +1874,27 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
|
||||||
|
.width = grabc->geom.width, .height = grabc->geom.height}, 1);
|
||||||
|
return;
|
||||||
|
} else if (cursor_mode == CurResize) {
|
||||||
|
- resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y,
|
||||||
|
- .width = (int)round(cursor->x) - grabc->geom.x, .height = (int)round(cursor->y) - grabc->geom.y}, 1);
|
||||||
|
+ int cdx = (int)round(cursor->x) - grabcx;
|
||||||
|
+ int cdy = (int)round(cursor->y) - grabcy;
|
||||||
|
+
|
||||||
|
+ cdx = !(rzcorner & 1) && grabc->geom.width - 2 * (int)grabc->bw - cdx < 1 ? 0 : cdx;
|
||||||
|
+ cdy = !(rzcorner & 2) && grabc->geom.height - 2 * (int)grabc->bw - cdy < 1 ? 0 : cdy;
|
||||||
|
+
|
||||||
|
+ const struct wlr_box box = {
|
||||||
|
+ .x = grabc->geom.x + (rzcorner & 1 ? 0 : cdx),
|
||||||
|
+ .y = grabc->geom.y + (rzcorner & 2 ? 0 : cdy),
|
||||||
|
+ .width = grabc->geom.width + (rzcorner & 1 ? cdx : -cdx),
|
||||||
|
+ .height = grabc->geom.height + (rzcorner & 2 ? cdy : -cdy)
|
||||||
|
+ };
|
||||||
|
+ resize(grabc, box, 1);
|
||||||
|
+
|
||||||
|
+ if (!lock_cursor) {
|
||||||
|
+ grabcx += cdx;
|
||||||
|
+ grabcy += cdy;
|
||||||
|
+ } else {
|
||||||
|
+ wlr_cursor_warp_closest(cursor, NULL, grabcx, grabcy);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1920,12 +1940,24 @@ moveresize(const Arg *arg)
|
||||||
|
wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
|
||||||
|
break;
|
||||||
|
case CurResize:
|
||||||
|
- /* Doesn't work for X11 output - the next absolute motion event
|
||||||
|
- * returns the cursor to where it started */
|
||||||
|
- wlr_cursor_warp_closest(cursor, NULL,
|
||||||
|
- grabc->geom.x + grabc->geom.width,
|
||||||
|
- grabc->geom.y + grabc->geom.height);
|
||||||
|
- wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||||
|
+ const char *cursors[] = { "nw-resize", "ne-resize", "sw-resize", "se-resize" };
|
||||||
|
+
|
||||||
|
+ rzcorner = resize_corner;
|
||||||
|
+ grabcx = (int)round(cursor->x);
|
||||||
|
+ grabcy = (int)round(cursor->y);
|
||||||
|
+
|
||||||
|
+ if (rzcorner == 4)
|
||||||
|
+ /* identify the closest corner index */
|
||||||
|
+ rzcorner = (grabcx - grabc->geom.x < grabc->geom.x + grabc->geom.width - grabcx ? 0 : 1)
|
||||||
|
+ + (grabcy - grabc->geom.y < grabc->geom.y + grabc->geom.height - grabcy ? 0 : 2);
|
||||||
|
+
|
||||||
|
+ if (warp_cursor) {
|
||||||
|
+ grabcx = rzcorner & 1 ? grabc->geom.x + grabc->geom.width : grabc->geom.x;
|
||||||
|
+ grabcy = rzcorner & 2 ? grabc->geom.y + grabc->geom.height : grabc->geom.y;
|
||||||
|
+ wlr_cursor_warp_closest(cursor, NULL, grabcx, grabcy);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, cursors[rzcorner]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.50.1
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
### Description
|
||||||
|
Borderless client if rule set to borderless
|
||||||
|
|
||||||
|
### Download
|
||||||
|
[main 2025-11-29](/dwl/dwl-patches/raw/branch/main/patches/borderlessrule/borderlessrule.patch)
|
||||||
|
|
||||||
|
### Author
|
||||||
|
- [freezboltz](https://codeberg.org/freezboltz)
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
From 2a81a809a648046f8361056af06dadf3397fecaa Mon Sep 17 00:00:00 2001
|
||||||
|
From: Anant Murmu <freezboltz@gmail.com>
|
||||||
|
Date: Tue, 2 Dec 2025 08:02:16 +0530
|
||||||
|
Subject: [PATCH] fix: missing field in struct Rule isborderless
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 7 ++++---
|
||||||
|
dwl.c | 7 ++++++-
|
||||||
|
2 files changed, 10 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 95c2afa..9eee6ca 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -22,10 +22,11 @@ static int log_level = WLR_ERROR;
|
||||||
|
|
||||||
|
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
|
||||||
|
static const Rule rules[] = {
|
||||||
|
- /* app_id title tags mask isfloating monitor */
|
||||||
|
+ /* app_id title tags mask isfloating monitor isborderless */
|
||||||
|
/* examples: */
|
||||||
|
- { "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
|
||||||
|
- { "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
|
||||||
|
+ { "Gimp_EXAMPLE", NULL, 0, 1, -1, 0 }, /* Start on currently visible tags floating, not tiled */
|
||||||
|
+ { "firefox_EXAMPLE", NULL, 1 << 8, 0, -1, 0 }, /* Start on ONLY tag "9" */
|
||||||
|
+ { "foo_EXAMPLE", NULL, 0, 0, -1, 1 }, /* Start on currently visible tags with no border around it */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* layout(s) */
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index 12f441e..572f754 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -137,7 +137,7 @@ typedef struct {
|
||||||
|
#endif
|
||||||
|
unsigned int bw;
|
||||||
|
uint32_t tags;
|
||||||
|
- int isfloating, isurgent, isfullscreen;
|
||||||
|
+ int isfloating, isurgent, isborderless, isfullscreen;
|
||||||
|
uint32_t resize; /* configure serial of a pending resize */
|
||||||
|
} Client;
|
||||||
|
|
||||||
|
@@ -228,6 +228,7 @@ typedef struct {
|
||||||
|
uint32_t tags;
|
||||||
|
int isfloating;
|
||||||
|
int monitor;
|
||||||
|
+ int isborderless;
|
||||||
|
} Rule;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
@@ -490,6 +491,7 @@ applyrules(Client *c)
|
||||||
|
if ((!r->title || strstr(title, r->title))
|
||||||
|
&& (!r->id || strstr(appid, r->id))) {
|
||||||
|
c->isfloating = r->isfloating;
|
||||||
|
+ c->isborderless = r->isborderless;
|
||||||
|
newtags |= r->tags;
|
||||||
|
i = 0;
|
||||||
|
wl_list_for_each(m, &mons, link) {
|
||||||
|
@@ -2210,6 +2212,9 @@ resize(Client *c, struct wlr_box geo, int interact)
|
||||||
|
if (!c->mon || !client_surface(c)->mapped)
|
||||||
|
return;
|
||||||
|
|
||||||
|
+ if (c->isborderless)
|
||||||
|
+ c->bw = 0;
|
||||||
|
+
|
||||||
|
bbox = interact ? &sgeom : &c->mon->w;
|
||||||
|
|
||||||
|
client_set_bounds(c, geo.width, geo.height);
|
||||||
|
--
|
||||||
|
2.52.0
|
||||||
|
|
||||||
@@ -3,7 +3,7 @@ From: wochap <gean.marroquin@gmail.com>
|
|||||||
Date: Tue, 4 Jun 2024 16:02:25 -0500
|
Date: Tue, 4 Jun 2024 16:02:25 -0500
|
||||||
Subject: [PATCH] implement borders patch
|
Subject: [PATCH] implement borders patch
|
||||||
|
|
||||||
tihs patch adds 2 extra borders relative to the client, they don't
|
this patch adds 2 extra borders relative to the client, they don't
|
||||||
change the size of the client
|
change the size of the client
|
||||||
---
|
---
|
||||||
client.h | 16 +++++++++++++---
|
client.h | 16 +++++++++++++---
|
||||||
|
|||||||
@@ -15,12 +15,14 @@ bstack (TTT) bstackhoriz (===)
|
|||||||
|
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
|
- [v0.8](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/bottomstack/bottomstack.patch)
|
||||||
- [git branch](https://codeberg.org/wochap/dwl/src/branch/v0.6-b/bottomstack)
|
- [git branch](https://codeberg.org/wochap/dwl/src/branch/v0.6-b/bottomstack)
|
||||||
- [2024-07-09](https://codeberg.org/dwl/dwl-patches/raw/commit/20de07dc8759200c8a4c9651475acb331d245890/patches/bottomstack/bottomstack.patch)
|
- [2024-07-09](https://codeberg.org/dwl/dwl-patches/raw/commit/20de07dc8759200c8a4c9651475acb331d245890/patches/bottomstack/bottomstack.patch)
|
||||||
- [2024-04-11](https://codeberg.org/dwl/dwl-patches/raw/commit/0f4e40fee49d1b8b430778e241b29496ae3b3b70/bottomstack/bottomstack.patch)
|
- [2024-04-11](https://codeberg.org/dwl/dwl-patches/raw/commit/0f4e40fee49d1b8b430778e241b29496ae3b3b70/bottomstack/bottomstack.patch)
|
||||||
- [v0.5](https://codeberg.org/dwl/dwl-patches/raw/commit/5368aa392c7ebf8d7d24c232b80cfae1be457d41/bottomstack/bottomstack.patch)
|
- [v0.5](https://codeberg.org/dwl/dwl-patches/raw/commit/5368aa392c7ebf8d7d24c232b80cfae1be457d41/bottomstack/bottomstack.patch)
|
||||||
|
|
||||||
### Authors
|
### Authors
|
||||||
|
- [unixchad](https://codeberg.org/unixchad)
|
||||||
- [wochap](https://codeberg.org/wochap)
|
- [wochap](https://codeberg.org/wochap)
|
||||||
- [DanielMowitz](https://github.com/DanielMowitz)
|
- [DanielMowitz](https://github.com/DanielMowitz)
|
||||||
- [Abanoub8](https://github.com/Abanoub8)
|
- [Abanoub8](https://github.com/Abanoub8)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
From b352fb08f40b1ee2d8c4748be4922df711e3aaa9 Mon Sep 17 00:00:00 2001
|
From 86e379b187bcc9f8f5896a87309474fcf3736de9 Mon Sep 17 00:00:00 2001
|
||||||
From: wochap <gean.marroquin@gmail.com>
|
From: nate zhou <gnuunixchad@outlook.com>
|
||||||
Date: Fri, 5 Jul 2024 10:44:29 -0500
|
Date: Sat, 28 Feb 2026 21:29:53 +0800
|
||||||
Subject: [PATCH] implement bottomstack
|
Subject: [PATCH] Patch: bottomstack-0.8.patch
|
||||||
|
|
||||||
---
|
---
|
||||||
config.def.h | 4 +++
|
config.def.h | 4 +++
|
||||||
@@ -9,10 +9,10 @@ Subject: [PATCH] implement bottomstack
|
|||||||
2 files changed, 88 insertions(+)
|
2 files changed, 88 insertions(+)
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
diff --git a/config.def.h b/config.def.h
|
||||||
index 22d2171..5aac3e9 100644
|
index 8a6eda0..ae87518 100644
|
||||||
--- a/config.def.h
|
--- a/config.def.h
|
||||||
+++ b/config.def.h
|
+++ b/config.def.h
|
||||||
@@ -34,6 +34,8 @@ static const Layout layouts[] = {
|
@@ -33,6 +33,8 @@ static const Layout layouts[] = {
|
||||||
{ "[]=", tile },
|
{ "[]=", tile },
|
||||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
{ "[M]", monocle },
|
{ "[M]", monocle },
|
||||||
@@ -21,20 +21,20 @@ index 22d2171..5aac3e9 100644
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* monitors */
|
/* monitors */
|
||||||
@@ -139,6 +141,8 @@ static const Key keys[] = {
|
@@ -135,6 +137,8 @@ static const Key keys[] = {
|
||||||
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
||||||
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||||
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||||
+ { MODKEY, XKB_KEY_u, setlayout, {.v = &layouts[3]} },
|
+ { MODKEY, XKB_KEY_u, setlayout, {.v = &layouts[3]} },
|
||||||
+ { MODKEY, XKB_KEY_o, setlayout, {.v = &layouts[4]} },
|
+ { MODKEY, XKB_KEY_o, setlayout, {.v = &layouts[4]} },
|
||||||
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||||
diff --git a/dwl.c b/dwl.c
|
diff --git a/dwl.c b/dwl.c
|
||||||
index dc0437e..5648d5f 100644
|
index 44f3ad9..68c25a5 100644
|
||||||
--- a/dwl.c
|
--- a/dwl.c
|
||||||
+++ b/dwl.c
|
+++ b/dwl.c
|
||||||
@@ -57,6 +57,7 @@
|
@@ -59,6 +59,7 @@
|
||||||
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
||||||
#include <wlr/types/wlr_xdg_output_v1.h>
|
#include <wlr/types/wlr_xdg_output_v1.h>
|
||||||
#include <wlr/types/wlr_xdg_shell.h>
|
#include <wlr/types/wlr_xdg_shell.h>
|
||||||
@@ -50,8 +50,8 @@ index dc0437e..5648d5f 100644
|
|||||||
+static void bstackhoriz(Monitor *m);
|
+static void bstackhoriz(Monitor *m);
|
||||||
|
|
||||||
/* variables */
|
/* variables */
|
||||||
static const char broken[] = "broken";
|
static pid_t child_pid = -1;
|
||||||
@@ -3160,3 +3163,84 @@ main(int argc, char *argv[])
|
@@ -3213,3 +3216,84 @@ main(int argc, char *argv[])
|
||||||
usage:
|
usage:
|
||||||
die("Usage: %s [-v] [-d] [-s startup command]", argv[0]);
|
die("Usage: %s [-v] [-d] [-s startup command]", argv[0]);
|
||||||
}
|
}
|
||||||
@@ -137,4 +137,5 @@ index dc0437e..5648d5f 100644
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
--
|
--
|
||||||
2.45.1
|
2.53.0
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
It provides a focus-driven, mouse- and keyboard-friendly tiling layout that grants you granular control over how clients are placed and resized.
|
It provides a focus-driven, mouse- and keyboard-friendly tiling layout that grants you granular control over how clients are placed and resized.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -51,10 +51,6 @@ When a new client appears:
|
|||||||
|
|
||||||
# What It Doesn’t Handle
|
# What It Doesn’t Handle
|
||||||
|
|
||||||
- **Multi-Tag client Management**
|
|
||||||
btrtile intentionally reverts clients to a single tag if they span multiple tags. This prevents potential inconsistencies or duplicate entries in its per-tag client tree.
|
|
||||||
- If you attempt to place a single client on multiple tags while using the btrtile layout, btrtile will enforce a single-tag assignment to maintain stability.
|
|
||||||
|
|
||||||
- **Suckless philosophy**
|
- **Suckless philosophy**
|
||||||
- Yea, it's a bloat. I tried to hide the suck inside a single file as much I could. While this approach is not ideal, it's how it's at least for now.
|
- Yea, it's a bloat. I tried to hide the suck inside a single file as much I could. While this approach is not ideal, it's how it's at least for now.
|
||||||
|
|
||||||
@@ -65,7 +61,7 @@ When a new client appears:
|
|||||||
btrtile adds couple variables to config.h to fine tune the mouse resizing of tiled clients.
|
btrtile adds couple variables to config.h to fine tune the mouse resizing of tiled clients.
|
||||||
|
|
||||||
1. **resize_factor**
|
1. **resize_factor**
|
||||||
- A multiplier to transfer pointer movement to client weight ratio. Depends heavily on mouse sensivity.
|
- A multiplier to transfer pointer movement to client weight ratio. Depends heavily on mouse sensitivity.
|
||||||
Defaults to 0.0002f.
|
Defaults to 0.0002f.
|
||||||
|
|
||||||
2. **resize_interval_ms**
|
2. **resize_interval_ms**
|
||||||
@@ -99,8 +95,11 @@ If mouse resizing feels sluggish, you can try compiling dwl with more aggressive
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
- [0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/btrtile/btrtile-v0.7.patch)
|
- [git branch](https://codeberg.org/julmajustus/dwl/src/branch/btrtile-dev)
|
||||||
- [0.7 WITH gapps](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/btrtile/btrtile-v0.7-gapps.patch)
|
- [0.8](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/btrtile/btrtile-v0.8.patch)
|
||||||
|
- [0.8 WITH gaps](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/btrtile/btrtile-v0.8-gaps.patch)
|
||||||
|
- [wlroots-next](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/btrtile/btrtile-wlroots-next-d41ecb7.patch)
|
||||||
|
- [wlroots-next WITH gaps](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/btrtile/btrtile-wlroots-next-d41ecb7-gaps.patch)
|
||||||
|
|
||||||
### Authors
|
### Authors
|
||||||
- [julmajustus](https://codeberg.org/julmajustus)
|
- [julmajustus](https://codeberg.org/julmajustus)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,929 @@
|
|||||||
|
From 1520d1f200ef0fb381683c1bcd58e553b52ac289 Mon Sep 17 00:00:00 2001
|
||||||
|
From: julmajustus <julmajustus@tutanota.com>
|
||||||
|
Date: Thu, 21 May 2026 00:42:07 +0300
|
||||||
|
Subject: [PATCH] btrtile: Spring update pt2
|
||||||
|
|
||||||
|
- Simplified the resizing logic to avoid full arrange calls from
|
||||||
|
motionnotify
|
||||||
|
- Minor intend fixes
|
||||||
|
---
|
||||||
|
btrtile.c | 583 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
config.def.h | 12 ++
|
||||||
|
dwl.c | 152 +++++++++++---
|
||||||
|
3 files changed, 720 insertions(+), 27 deletions(-)
|
||||||
|
create mode 100644 btrtile.c
|
||||||
|
|
||||||
|
diff --git a/btrtile.c b/btrtile.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..f05a30f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/btrtile.c
|
||||||
|
@@ -0,0 +1,583 @@
|
||||||
|
+/* ************************************************************************** */
|
||||||
|
+/* @@@ @@@@@@@@ */
|
||||||
|
+/* @@@ @@@@@@@@@@ */
|
||||||
|
+/* @@! @@! @@@@ */
|
||||||
|
+/* !@! !@! @!@!@ */
|
||||||
|
+/* btrtile.c @!! @!@ @! !@! */
|
||||||
|
+/* !!! !@!!! !!! */
|
||||||
|
+/* By: julmajustus <julmajustus@tutanota.com> !!: !!:! !!! */
|
||||||
|
+/* ::! :!: !:! */
|
||||||
|
+/* Created: 2024/12/15 00:26:07 by julmajustus :: ::::::: :: */
|
||||||
|
+/* Updated: 2026/05/20 22:38:02 by julmajustus : : : : : : */
|
||||||
|
+/* */
|
||||||
|
+/* ************************************************************************** */
|
||||||
|
+
|
||||||
|
+typedef struct LayoutNode {
|
||||||
|
+ unsigned int is_client_node;
|
||||||
|
+ unsigned int is_split_vertically;
|
||||||
|
+ float split_ratio;
|
||||||
|
+ struct LayoutNode *left;
|
||||||
|
+ struct LayoutNode *right;
|
||||||
|
+ struct LayoutNode *split_node;
|
||||||
|
+ Client *client;
|
||||||
|
+} LayoutNode;
|
||||||
|
+
|
||||||
|
+static void apply_layout(Monitor *m, LayoutNode *node,
|
||||||
|
+ struct wlr_box area, unsigned int is_root);
|
||||||
|
+static void btrtile(Monitor *m);
|
||||||
|
+static LayoutNode *create_client_node(Client *c);
|
||||||
|
+static LayoutNode *create_split_node(unsigned int is_split_vertically,
|
||||||
|
+ LayoutNode *left, LayoutNode *right);
|
||||||
|
+static void destroy_node(LayoutNode *node);
|
||||||
|
+static void destroy_tree(Monitor *m);
|
||||||
|
+static LayoutNode *find_client_node(LayoutNode *node, Client *c);
|
||||||
|
+static LayoutNode *find_suitable_split(Monitor *m, LayoutNode *start,
|
||||||
|
+ unsigned int need_vertical, int focused_on_left);
|
||||||
|
+static void init_tree(Monitor *m);
|
||||||
|
+static void insert_client(Monitor *m, Client *focused_client, Client *new_client);
|
||||||
|
+static LayoutNode *remove_client_node(LayoutNode *node, Client *c);
|
||||||
|
+static void remove_client(Monitor *m, Client *c);
|
||||||
|
+static void setratio_h(const Arg *arg);
|
||||||
|
+static void setratio_v(const Arg *arg);
|
||||||
|
+static void swapclients(const Arg *arg);
|
||||||
|
+static unsigned int visible_count(LayoutNode *node, Monitor *m);
|
||||||
|
+static Client *xytoclient(double x, double y);
|
||||||
|
+
|
||||||
|
+static double resize_last_update_x, resize_last_update_y;
|
||||||
|
+static uint32_t last_resize_time = 0;
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+apply_layout(Monitor *m, LayoutNode *node,
|
||||||
|
+ struct wlr_box area, unsigned int is_root)
|
||||||
|
+{
|
||||||
|
+ Client *c;
|
||||||
|
+ float ratio;
|
||||||
|
+ unsigned int left_count, right_count, mid, e = m->gaps;
|
||||||
|
+ struct wlr_box left_area, right_area;
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (is_root && e) {
|
||||||
|
+ area.x += gappx;
|
||||||
|
+ area.y += gappx;
|
||||||
|
+ area.width -= 2 * gappx;
|
||||||
|
+ area.height -= 2 * gappx;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If this node is a client node, check if it is visible. */
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ c = node->client;
|
||||||
|
+ if (!c || !VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||||
|
+ return;
|
||||||
|
+ if (area.x == c->old_geom.x && area.y == c->old_geom.y &&
|
||||||
|
+ area.width == c->old_geom.width && area.height == c->old_geom.height)
|
||||||
|
+ return;
|
||||||
|
+ resize(c, area, 0);
|
||||||
|
+ c->old_geom = area;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* For a split node, we see how many visible children are on each side: */
|
||||||
|
+ left_count = visible_count(node->left, m);
|
||||||
|
+ right_count = visible_count(node->right, m);
|
||||||
|
+
|
||||||
|
+ if (left_count == 0 && right_count == 0) {
|
||||||
|
+ return;
|
||||||
|
+ } else if (left_count > 0 && right_count == 0) {
|
||||||
|
+ apply_layout(m, node->left, area, 0);
|
||||||
|
+ return;
|
||||||
|
+ } else if (left_count == 0 && right_count > 0) {
|
||||||
|
+ apply_layout(m, node->right, area, 0);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If we’re here, we have visible clients in both subtrees. */
|
||||||
|
+ ratio = node->split_ratio;
|
||||||
|
+ if (ratio < 0.05f)
|
||||||
|
+ ratio = 0.05f;
|
||||||
|
+ if (ratio > 0.95f)
|
||||||
|
+ ratio = 0.95f;
|
||||||
|
+
|
||||||
|
+ memset(&left_area, 0, sizeof(left_area));
|
||||||
|
+ memset(&right_area, 0, sizeof(right_area));
|
||||||
|
+
|
||||||
|
+ if (node->is_split_vertically) {
|
||||||
|
+ mid = (unsigned int)(area.width * ratio);
|
||||||
|
+ left_area.x = area.x;
|
||||||
|
+ left_area.y = area.y;
|
||||||
|
+ left_area.width = mid;
|
||||||
|
+ left_area.height = area.height;
|
||||||
|
+
|
||||||
|
+ right_area.x = area.x + mid;
|
||||||
|
+ right_area.y = area.y;
|
||||||
|
+ right_area.width = area.width - mid;
|
||||||
|
+ right_area.height = area.height;
|
||||||
|
+
|
||||||
|
+ if (e) {
|
||||||
|
+ left_area.width -= gappx / 2;
|
||||||
|
+ right_area.x += gappx / 2;
|
||||||
|
+ right_area.width -= gappx / 2;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ /* horizontal split */
|
||||||
|
+ mid = (unsigned int)(area.height * ratio);
|
||||||
|
+ left_area.x = area.x;
|
||||||
|
+ left_area.y = area.y;
|
||||||
|
+ left_area.width = area.width;
|
||||||
|
+ left_area.height = mid;
|
||||||
|
+
|
||||||
|
+ right_area.x = area.x;
|
||||||
|
+ right_area.y = area.y + mid;
|
||||||
|
+ right_area.width = area.width;
|
||||||
|
+ right_area.height= area.height - mid;
|
||||||
|
+
|
||||||
|
+ if (e) {
|
||||||
|
+ left_area.height -= gappx / 2;
|
||||||
|
+ right_area.y += gappx / 2;
|
||||||
|
+ right_area.height -= gappx / 2;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ apply_layout(m, node->left, left_area, 0);
|
||||||
|
+ apply_layout(m, node->right, right_area, 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+btrtile(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ Client *c, *focused = NULL;
|
||||||
|
+ int n = 0;
|
||||||
|
+ LayoutNode *found;
|
||||||
|
+ struct wlr_box full_area;
|
||||||
|
+
|
||||||
|
+ if (!m)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ /* Remove non tiled clients from tree. */
|
||||||
|
+ wl_list_for_each(c, &clients, link) {
|
||||||
|
+ if (c->mon == m && !c->isfloating && !c->isfullscreen) {
|
||||||
|
+ } else {
|
||||||
|
+ remove_client(m, c);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If no client is found under cursor, fallback to focustop(m) */
|
||||||
|
+ if (!(focused = xytoclient(cursor->x, cursor->y)))
|
||||||
|
+ focused = focustop(m);
|
||||||
|
+
|
||||||
|
+ /* Insert visible clients that are not part of the tree. */
|
||||||
|
+ wl_list_for_each(c, &clients, link) {
|
||||||
|
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen && c->mon == m) {
|
||||||
|
+ found = find_client_node(m->root, c);
|
||||||
|
+ if (!found) {
|
||||||
|
+ insert_client(m, focused, c);
|
||||||
|
+ }
|
||||||
|
+ n++;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (n == 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ full_area = m->w;
|
||||||
|
+ apply_layout(m, m->root, full_area, 1);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+create_client_node(Client *c)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *node = calloc(1, sizeof(LayoutNode));
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return NULL;
|
||||||
|
+ node->is_client_node = 1;
|
||||||
|
+ node->split_ratio = 0.5f;
|
||||||
|
+ node->client = c;
|
||||||
|
+ return node;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+create_split_node(unsigned int is_split_vertically,
|
||||||
|
+ LayoutNode *left, LayoutNode *right)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *node = calloc(1, sizeof(LayoutNode));
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return NULL;
|
||||||
|
+ node->is_client_node = 0;
|
||||||
|
+ node->split_ratio = 0.5f;
|
||||||
|
+ node->is_split_vertically = is_split_vertically;
|
||||||
|
+ node->left = left;
|
||||||
|
+ node->right = right;
|
||||||
|
+ if (left)
|
||||||
|
+ left->split_node = node;
|
||||||
|
+ if (right)
|
||||||
|
+ right->split_node = node;
|
||||||
|
+ return node;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+destroy_node(LayoutNode *node)
|
||||||
|
+{
|
||||||
|
+ if (!node)
|
||||||
|
+ return;
|
||||||
|
+ if (!node->is_client_node) {
|
||||||
|
+ destroy_node(node->left);
|
||||||
|
+ destroy_node(node->right);
|
||||||
|
+ }
|
||||||
|
+ free(node);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+destroy_tree(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ if (!m || !m->root)
|
||||||
|
+ return;
|
||||||
|
+ destroy_node(m->root);
|
||||||
|
+ m->root = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+find_client_node(LayoutNode *node, Client *c)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *res;
|
||||||
|
+
|
||||||
|
+ if (!node || !c)
|
||||||
|
+ return NULL;
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ return (node->client == c) ? node : NULL;
|
||||||
|
+ }
|
||||||
|
+ res = find_client_node(node->left, c);
|
||||||
|
+ return res ? res : find_client_node(node->right, c);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+find_suitable_split(Monitor *m, LayoutNode *start_node,
|
||||||
|
+ unsigned int need_vertical, int focused_on_left)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *n = start_node, *child = NULL;
|
||||||
|
+
|
||||||
|
+ if (!m)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ if (n && n->is_client_node) {
|
||||||
|
+ child = n;
|
||||||
|
+ n = n->split_node;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ while (n) {
|
||||||
|
+ if (!n->is_client_node && n->is_split_vertically == need_vertical
|
||||||
|
+ && visible_count(n->left, m) > 0
|
||||||
|
+ && visible_count(n->right, m) > 0) {
|
||||||
|
+ if ((focused_on_left && n->left == child) ||
|
||||||
|
+ (!focused_on_left && n->right == child))
|
||||||
|
+ return n;
|
||||||
|
+ }
|
||||||
|
+ child = n;
|
||||||
|
+ n = n->split_node;
|
||||||
|
+ }
|
||||||
|
+ return NULL;
|
||||||
|
+}
|
||||||
|
+void
|
||||||
|
+init_tree(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ if (m)
|
||||||
|
+ m->root = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+insert_client(Monitor *m, Client *focused_client, Client *new_client)
|
||||||
|
+{
|
||||||
|
+ Client *old_client;
|
||||||
|
+ LayoutNode **root = &m->root, *old_root,
|
||||||
|
+ *focused_node, *new_client_node, *old_client_node;
|
||||||
|
+ unsigned int wider, mid_x, mid_y;
|
||||||
|
+
|
||||||
|
+ /* If no root , new client becomes the root. */
|
||||||
|
+ if (!*root) {
|
||||||
|
+ *root = create_client_node(new_client);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Find the focused_client node,
|
||||||
|
+ * if not found split the root. */
|
||||||
|
+ focused_node = focused_client ?
|
||||||
|
+ find_client_node(*root, focused_client) : NULL;
|
||||||
|
+ if (!focused_node) {
|
||||||
|
+ old_root = *root;
|
||||||
|
+ new_client_node = create_client_node(new_client);
|
||||||
|
+ *root = create_split_node(1, old_root, new_client_node);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Turn focused node from a client node into a split node,
|
||||||
|
+ * and attach old_client + new_client. */
|
||||||
|
+ old_client = focused_node->client;
|
||||||
|
+ old_client_node = create_client_node(old_client);
|
||||||
|
+ new_client_node = create_client_node(new_client);
|
||||||
|
+
|
||||||
|
+ /* Decide split direction. */
|
||||||
|
+ wider = (focused_client->geom.width >= focused_client->geom.height);
|
||||||
|
+ focused_node->is_client_node = 0;
|
||||||
|
+ focused_node->client = NULL;
|
||||||
|
+ focused_node->is_split_vertically = (wider ? 1 : 0);
|
||||||
|
+
|
||||||
|
+ /* Pick new_client side depending on the cursor position. */
|
||||||
|
+ mid_x = focused_client->geom.x + focused_client->geom.width / 2;
|
||||||
|
+ mid_y = focused_client->geom.y + focused_client->geom.height / 2;
|
||||||
|
+
|
||||||
|
+ if (wider) {
|
||||||
|
+ /* vertical split => left vs right */
|
||||||
|
+ if (cursor->x <= mid_x) {
|
||||||
|
+ focused_node->left = new_client_node;
|
||||||
|
+ focused_node->right = old_client_node;
|
||||||
|
+ } else {
|
||||||
|
+ focused_node->left = old_client_node;
|
||||||
|
+ focused_node->right = new_client_node;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ /* horizontal split => top vs bottom */
|
||||||
|
+ if (cursor->y <= mid_y) {
|
||||||
|
+ focused_node->left = new_client_node;
|
||||||
|
+ focused_node->right = old_client_node;
|
||||||
|
+ } else {
|
||||||
|
+ focused_node->left = old_client_node;
|
||||||
|
+ focused_node->right = new_client_node;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ old_client_node->split_node = focused_node;
|
||||||
|
+ new_client_node->split_node = focused_node;
|
||||||
|
+ focused_node->split_ratio = 0.5f;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+remove_client_node(LayoutNode *node, Client *c)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *tmp;
|
||||||
|
+ if (!node)
|
||||||
|
+ return NULL;
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ /* If this client_node is the client we're removing,
|
||||||
|
+ * return NULL to remove it */
|
||||||
|
+ if (node->client == c) {
|
||||||
|
+ free(node);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+ return node;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ node->left = remove_client_node(node->left, c);
|
||||||
|
+ node->right = remove_client_node(node->right, c);
|
||||||
|
+
|
||||||
|
+ /* If one of the client node is NULL after removal and the other is not,
|
||||||
|
+ * we "lift" the other client node up to replace this split node. */
|
||||||
|
+ if (!node->left && node->right) {
|
||||||
|
+ tmp = node->right;
|
||||||
|
+
|
||||||
|
+ /* Save pointer to split node */
|
||||||
|
+ if (tmp)
|
||||||
|
+ tmp->split_node = node->split_node;
|
||||||
|
+
|
||||||
|
+ free(node);
|
||||||
|
+ return tmp;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!node->right && node->left) {
|
||||||
|
+ tmp = node->left;
|
||||||
|
+
|
||||||
|
+ /* Save pointer to split node */
|
||||||
|
+ if (tmp)
|
||||||
|
+ tmp->split_node = node->split_node;
|
||||||
|
+
|
||||||
|
+ free(node);
|
||||||
|
+ return tmp;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If both children exist or both are NULL (empty tree),
|
||||||
|
+ * return node as is. */
|
||||||
|
+ return node;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+remove_client(Monitor *m, Client *c)
|
||||||
|
+{
|
||||||
|
+ if (!m->root || !c)
|
||||||
|
+ return;
|
||||||
|
+ m->root = remove_client_node(m->root, c);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+setratio(unsigned int need_vertical, const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ Client *sel;
|
||||||
|
+ LayoutNode *client_node, *split_node;
|
||||||
|
+ float new_ratio;
|
||||||
|
+ int focused_on_left;
|
||||||
|
+
|
||||||
|
+ if (!selmon || !selmon->lt[selmon->sellt]->arrange)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ sel = focustop(selmon);
|
||||||
|
+ if (!sel)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ client_node = find_client_node(selmon->root, sel);
|
||||||
|
+ if (!client_node)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ focused_on_left = (arg->f >= 0.0f);
|
||||||
|
+
|
||||||
|
+ split_node = find_suitable_split(selmon, client_node, need_vertical, focused_on_left);
|
||||||
|
+
|
||||||
|
+ if (!split_node)
|
||||||
|
+ split_node = find_suitable_split(selmon, client_node, need_vertical, !focused_on_left);
|
||||||
|
+ if (!split_node)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ new_ratio = (arg->f != 0.0f) ? (split_node->split_ratio + arg->f) : 0.5f;
|
||||||
|
+ if (new_ratio < 0.05f)
|
||||||
|
+ new_ratio = 0.05f;
|
||||||
|
+ if (new_ratio > 0.95f)
|
||||||
|
+ new_ratio = 0.95f;
|
||||||
|
+ split_node->split_ratio = new_ratio;
|
||||||
|
+
|
||||||
|
+ apply_layout(selmon, selmon->root, selmon->w, 1);
|
||||||
|
+ /* Skip the arrange when called from motionnotify; that path calls
|
||||||
|
+ * arrange itself after rate-limiting. */
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+setratio_h(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setratio(1, arg);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+setratio_v(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setratio(0, arg);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void swapclients(const Arg *arg) {
|
||||||
|
+ Client *c, *tmp, *target = NULL, *sel = focustop(selmon);
|
||||||
|
+ LayoutNode *sel_node, *target_node;
|
||||||
|
+ int closest_dist = INT_MAX, dist, sel_center_x, sel_center_y,
|
||||||
|
+ cand_center_x, cand_center_y;
|
||||||
|
+
|
||||||
|
+ if (!sel || sel->isfullscreen ||
|
||||||
|
+ !selmon->root || !selmon->lt[selmon->sellt]->arrange)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ /* Get the center coordinates of the selected client */
|
||||||
|
+ sel_center_x = sel->geom.x + sel->geom.width / 2;
|
||||||
|
+ sel_center_y = sel->geom.y + sel->geom.height / 2;
|
||||||
|
+
|
||||||
|
+ wl_list_for_each(c, &clients, link) {
|
||||||
|
+ if (!VISIBLEON(c, selmon) || c->isfloating || c->isfullscreen || c == sel)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ /* Get the center of candidate client */
|
||||||
|
+ cand_center_x = c->geom.x + c->geom.width / 2;
|
||||||
|
+ cand_center_y = c->geom.y + c->geom.height / 2;
|
||||||
|
+
|
||||||
|
+ /* Check that the candidate lies in the requested direction. */
|
||||||
|
+ switch (arg->ui) {
|
||||||
|
+ case 0:
|
||||||
|
+ if (cand_center_x >= sel_center_x)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ case 1:
|
||||||
|
+ if (cand_center_x <= sel_center_x)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ case 2:
|
||||||
|
+ if (cand_center_y >= sel_center_y)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ case 3:
|
||||||
|
+ if (cand_center_y <= sel_center_y)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Get distance between the centers */
|
||||||
|
+ dist = abs(sel_center_x - cand_center_x) + abs(sel_center_y - cand_center_y);
|
||||||
|
+ if (dist < closest_dist) {
|
||||||
|
+ closest_dist = dist;
|
||||||
|
+ target = c;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If target is found, swap the two clients’ positions in the layout tree */
|
||||||
|
+ if (target) {
|
||||||
|
+ sel_node = find_client_node(selmon->root, sel);
|
||||||
|
+ target_node = find_client_node(selmon->root, target);
|
||||||
|
+ if (sel_node && target_node) {
|
||||||
|
+ tmp = sel_node->client;
|
||||||
|
+ sel_node->client = target_node->client;
|
||||||
|
+ target_node->client = tmp;
|
||||||
|
+ arrange(selmon);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+unsigned int
|
||||||
|
+visible_count(LayoutNode *node, Monitor *m)
|
||||||
|
+{
|
||||||
|
+ Client *c;
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return 0;
|
||||||
|
+ /* Check if this client is visible. */
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ c = node->client;
|
||||||
|
+ if (c && VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen)
|
||||||
|
+ return 1;
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ /* Else it’s a split node. */
|
||||||
|
+ return visible_count(node->left, m) + visible_count(node->right, m);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+Client *
|
||||||
|
+xytoclient(double x, double y) {
|
||||||
|
+ Monitor *m = xytomon(x, y);
|
||||||
|
+ Client *c, *closest = NULL;
|
||||||
|
+ double dist, mindist = INT_MAX, dx, dy;
|
||||||
|
+
|
||||||
|
+ wl_list_for_each_reverse(c, &clients, link) {
|
||||||
|
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen &&
|
||||||
|
+ x >= c->geom.x && x <= (c->geom.x + c->geom.width) &&
|
||||||
|
+ y >= c->geom.y && y <= (c->geom.y + c->geom.height)){
|
||||||
|
+ return c;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If no client was found at cursor position fallback to closest. */
|
||||||
|
+ wl_list_for_each_reverse(c, &clients, link) {
|
||||||
|
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen) {
|
||||||
|
+ dx = 0, dy = 0;
|
||||||
|
+
|
||||||
|
+ if (x < c->geom.x)
|
||||||
|
+ dx = c->geom.x - x;
|
||||||
|
+ else if (x > (c->geom.x + c->geom.width))
|
||||||
|
+ dx = x - (c->geom.x + c->geom.width);
|
||||||
|
+
|
||||||
|
+ if (y < c->geom.y)
|
||||||
|
+ dy = c->geom.y - y;
|
||||||
|
+ else if (y > (c->geom.y + c->geom.height))
|
||||||
|
+ dy = y - (c->geom.y + c->geom.height);
|
||||||
|
+
|
||||||
|
+ dist = dx * dx + dy * dy;
|
||||||
|
+ if (dist < mindist) {
|
||||||
|
+ mindist = dist;
|
||||||
|
+ closest = c;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ return closest;
|
||||||
|
+}
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 8a6eda0..bc04e3f 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -13,7 +13,10 @@ static const float focuscolor[] = COLOR(0x005577ff);
|
||||||
|
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||||
|
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||||
|
static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */
|
||||||
|
+static const float resize_factor = 0.0002f; /* Resize multiplier for mouse resizing, depends on mouse sensivity. */
|
||||||
|
+static const uint32_t resize_interval_ms = 16; /* Resize interval depends on framerate and screen refresh rate. */
|
||||||
|
|
||||||
|
+enum Direction { DIR_LEFT, DIR_RIGHT, DIR_UP, DIR_DOWN };
|
||||||
|
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||||
|
#define TAGCOUNT (9)
|
||||||
|
|
||||||
|
@@ -30,6 +33,7 @@ static const Rule rules[] = {
|
||||||
|
/* layout(s) */
|
||||||
|
static const Layout layouts[] = {
|
||||||
|
/* symbol arrange function */
|
||||||
|
+ { "|w|", btrtile },
|
||||||
|
{ "[]=", tile },
|
||||||
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
@@ -144,6 +148,14 @@ static const Key keys[] = {
|
||||||
|
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Up, swapclients, {.i = DIR_UP} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Down, swapclients, {.i = DIR_DOWN} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Right, swapclients, {.i = DIR_RIGHT} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Left, swapclients, {.i = DIR_LEFT} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Right, setratio_h, {.f = +0.025f} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Left, setratio_h, {.f = -0.025f} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Up, setratio_v, {.f = -0.025f} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Down, setratio_v, {.f = +0.025f} },
|
||||||
|
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
||||||
|
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
||||||
|
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index 44f3ad9..a121efc 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
/*
|
||||||
|
* See LICENSE file for copyright and license details.
|
||||||
|
*/
|
||||||
|
+#include <limits.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
#include <libinput.h>
|
||||||
|
#include <linux/input-event-codes.h>
|
||||||
|
@@ -100,6 +101,7 @@ typedef struct {
|
||||||
|
const Arg arg;
|
||||||
|
} Button;
|
||||||
|
|
||||||
|
+typedef struct LayoutNode LayoutNode;
|
||||||
|
typedef struct Monitor Monitor;
|
||||||
|
typedef struct {
|
||||||
|
/* Must keep this field first */
|
||||||
|
@@ -137,8 +139,9 @@ typedef struct {
|
||||||
|
#endif
|
||||||
|
unsigned int bw;
|
||||||
|
uint32_t tags;
|
||||||
|
- int isfloating, isurgent, isfullscreen;
|
||||||
|
+ int isfloating, isurgent, isfullscreen, was_tiled;
|
||||||
|
uint32_t resize; /* configure serial of a pending resize */
|
||||||
|
+ struct wlr_box old_geom;
|
||||||
|
} Client;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
@@ -205,6 +208,7 @@ struct Monitor {
|
||||||
|
int nmaster;
|
||||||
|
char ltsymbol[16];
|
||||||
|
int asleep;
|
||||||
|
+ LayoutNode *root;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
@@ -247,6 +251,7 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||||
|
struct wlr_box *usable_area, int exclusive);
|
||||||
|
static void arrangelayers(Monitor *m);
|
||||||
|
static void axisnotify(struct wl_listener *listener, void *data);
|
||||||
|
+static void btrtile(Monitor *m);
|
||||||
|
static void buttonpress(struct wl_listener *listener, void *data);
|
||||||
|
static void chvt(const Arg *arg);
|
||||||
|
static void checkidleinhibitor(struct wlr_surface *exclude);
|
||||||
|
@@ -329,6 +334,9 @@ static void setmon(Client *c, Monitor *m, uint32_t newtags);
|
||||||
|
static void setpsel(struct wl_listener *listener, void *data);
|
||||||
|
static void setsel(struct wl_listener *listener, void *data);
|
||||||
|
static void setup(void);
|
||||||
|
+static void setratio_h(const Arg *arg);
|
||||||
|
+static void setratio_v(const Arg *arg);
|
||||||
|
+static void swapclients(const Arg *arg);
|
||||||
|
static void spawn(const Arg *arg);
|
||||||
|
static void startdrag(struct wl_listener *listener, void *data);
|
||||||
|
static void tag(const Arg *arg);
|
||||||
|
@@ -454,6 +462,7 @@ static struct wlr_xwayland *xwayland;
|
||||||
|
|
||||||
|
/* attempt to encapsulate suck into one file */
|
||||||
|
#include "client.h"
|
||||||
|
+#include "btrtile.c"
|
||||||
|
|
||||||
|
/* function implementations */
|
||||||
|
void
|
||||||
|
@@ -624,7 +633,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
struct wlr_pointer_button_event *event = data;
|
||||||
|
struct wlr_keyboard *keyboard;
|
||||||
|
uint32_t mods;
|
||||||
|
- Client *c;
|
||||||
|
+ Client *c, *target = NULL;
|
||||||
|
const Button *b;
|
||||||
|
|
||||||
|
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||||
|
@@ -645,7 +654,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
mods = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0;
|
||||||
|
for (b = buttons; b < END(buttons); b++) {
|
||||||
|
if (CLEANMASK(mods) == CLEANMASK(b->mod) &&
|
||||||
|
- event->button == b->button && b->func) {
|
||||||
|
+ event->button == b->button && b->func) {
|
||||||
|
b->func(&b->arg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@@ -655,6 +664,21 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
/* If you released any buttons, we exit interactive move/resize mode. */
|
||||||
|
/* TODO: should reset to the pointer focus's current setcursor */
|
||||||
|
if (!locked && cursor_mode != CurNormal && cursor_mode != CurPressed) {
|
||||||
|
+ c = grabc;
|
||||||
|
+ if (c && c->was_tiled && !strcmp(selmon->ltsymbol, "|w|")) {
|
||||||
|
+ if (cursor_mode == CurMove && c->isfloating) {
|
||||||
|
+ target = xytoclient(cursor->x, cursor->y);
|
||||||
|
+
|
||||||
|
+ if (target && !target->isfloating && !target->isfullscreen)
|
||||||
|
+ insert_client(selmon, target, c);
|
||||||
|
+ else
|
||||||
|
+ selmon->root = create_client_node(c);
|
||||||
|
+
|
||||||
|
+ setfloating(c, 0);
|
||||||
|
+ apply_layout(selmon, selmon->root, selmon->w, 1);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ /* Default behaviour */
|
||||||
|
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
||||||
|
cursor_mode = CurNormal;
|
||||||
|
/* Drop the window off on its new monitor */
|
||||||
|
@@ -746,6 +770,7 @@ cleanupmon(struct wl_listener *listener, void *data)
|
||||||
|
wlr_output_layout_remove(output_layout, m->wlr_output);
|
||||||
|
wlr_scene_output_destroy(m->scene_output);
|
||||||
|
|
||||||
|
+ destroy_tree(m);
|
||||||
|
closemon(m);
|
||||||
|
wlr_scene_node_destroy(&m->fullscreen_bg->node);
|
||||||
|
free(m);
|
||||||
|
@@ -1090,6 +1115,7 @@ createmon(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
|
wl_list_insert(&mons, &m->link);
|
||||||
|
printstatus();
|
||||||
|
+ init_tree(m);
|
||||||
|
|
||||||
|
/* The xdg-protocol specifies:
|
||||||
|
*
|
||||||
|
@@ -1329,9 +1355,17 @@ destroynotify(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
/* Called when the xdg_toplevel is destroyed. */
|
||||||
|
Client *c = wl_container_of(listener, c, destroy);
|
||||||
|
+ Monitor *mon;
|
||||||
|
wl_list_remove(&c->destroy.link);
|
||||||
|
wl_list_remove(&c->set_title.link);
|
||||||
|
wl_list_remove(&c->fullscreen.link);
|
||||||
|
+ /* We check if the destroyed client was part of any tiled_list, to catch
|
||||||
|
+ * client removals even if they would not be currently managed by btrtile */
|
||||||
|
+ wl_list_for_each(mon, &mons, link) {
|
||||||
|
+ if (mon->root) {
|
||||||
|
+ remove_client(mon, c);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
#ifdef XWAYLAND
|
||||||
|
if (c->type != XDGShell) {
|
||||||
|
wl_list_remove(&c->activate.link);
|
||||||
|
@@ -1862,7 +1896,8 @@ void
|
||||||
|
motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double dy,
|
||||||
|
double dx_unaccel, double dy_unaccel)
|
||||||
|
{
|
||||||
|
- double sx = 0, sy = 0, sx_confined, sy_confined;
|
||||||
|
+ int tiled = 0;
|
||||||
|
+ double sx = 0, sy = 0, sx_confined, sy_confined, dx_total, dy_total;
|
||||||
|
Client *c = NULL, *w = NULL;
|
||||||
|
LayerSurface *l = NULL;
|
||||||
|
struct wlr_surface *surface = NULL;
|
||||||
|
@@ -1916,18 +1951,55 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
|
||||||
|
/* Update drag icon's position */
|
||||||
|
wlr_scene_node_set_position(&drag_icon->node, (int)round(cursor->x), (int)round(cursor->y));
|
||||||
|
|
||||||
|
- /* If we are currently grabbing the mouse, handle and return */
|
||||||
|
+ /* Skip if internal call */
|
||||||
|
+ if (time == 0)
|
||||||
|
+ goto focus;
|
||||||
|
+
|
||||||
|
+ tiled = grabc && !grabc->isfloating && !grabc->isfullscreen;
|
||||||
|
if (cursor_mode == CurMove) {
|
||||||
|
/* Move the grabbed client to the new position. */
|
||||||
|
- resize(grabc, (struct wlr_box){.x = (int)round(cursor->x) - grabcx, .y = (int)round(cursor->y) - grabcy,
|
||||||
|
- .width = grabc->geom.width, .height = grabc->geom.height}, 1);
|
||||||
|
- return;
|
||||||
|
+ if (grabc && grabc->isfloating) {
|
||||||
|
+ resize(grabc, (struct wlr_box){
|
||||||
|
+ .x = (int)round(cursor->x) - grabcx,
|
||||||
|
+ .y = (int)round(cursor->y) - grabcy,
|
||||||
|
+ .width = grabc->geom.width,
|
||||||
|
+ .height = grabc->geom.height
|
||||||
|
+ }, 1);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
} else if (cursor_mode == CurResize) {
|
||||||
|
- resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y,
|
||||||
|
- .width = (int)round(cursor->x) - grabc->geom.x, .height = (int)round(cursor->y) - grabc->geom.y}, 1);
|
||||||
|
- return;
|
||||||
|
+ if (tiled) {
|
||||||
|
+ dx_total = cursor->x - resize_last_update_x;
|
||||||
|
+ dy_total = cursor->y - resize_last_update_y;
|
||||||
|
+
|
||||||
|
+ if (time - last_resize_time >= resize_interval_ms) {
|
||||||
|
+ Arg a = {0};
|
||||||
|
+ if (fabs(dx_total) > fabs(dy_total)) {
|
||||||
|
+ a.f = (float)(dx_total * resize_factor);
|
||||||
|
+ setratio_h(&a);
|
||||||
|
+ } else {
|
||||||
|
+ a.f = (float)(dy_total * resize_factor);
|
||||||
|
+ setratio_v(&a);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ last_resize_time = time;
|
||||||
|
+ resize_last_update_x = cursor->x;
|
||||||
|
+ resize_last_update_y = cursor->y;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ } else if (grabc && grabc->isfloating) {
|
||||||
|
+ /* Floating resize as original */
|
||||||
|
+ resize(grabc, (struct wlr_box){
|
||||||
|
+ .x = grabc->geom.x,
|
||||||
|
+ .y = grabc->geom.y,
|
||||||
|
+ .width = (int)round(cursor->x) - grabc->geom.x,
|
||||||
|
+ .height = (int)round(cursor->y) - grabc->geom.y
|
||||||
|
+ }, 1);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
+focus:
|
||||||
|
/* If there's no client surface under the cursor, set the cursor image to a
|
||||||
|
* default. This is what makes the cursor image appear when you move it
|
||||||
|
* off of a client or over its border. */
|
||||||
|
@@ -1961,22 +2033,40 @@ moveresize(const Arg *arg)
|
||||||
|
if (!grabc || client_is_unmanaged(grabc) || grabc->isfullscreen)
|
||||||
|
return;
|
||||||
|
|
||||||
|
- /* Float the window and tell motionnotify to grab it */
|
||||||
|
- setfloating(grabc, 1);
|
||||||
|
- switch (cursor_mode = arg->ui) {
|
||||||
|
- case CurMove:
|
||||||
|
- grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||||
|
- grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||||
|
- wlr_cursor_set_xcursor(cursor, cursor_mgr, "all-scroll");
|
||||||
|
- break;
|
||||||
|
- case CurResize:
|
||||||
|
- /* Doesn't work for X11 output - the next absolute motion event
|
||||||
|
- * returns the cursor to where it started */
|
||||||
|
- wlr_cursor_warp_closest(cursor, NULL,
|
||||||
|
- grabc->geom.x + grabc->geom.width,
|
||||||
|
- grabc->geom.y + grabc->geom.height);
|
||||||
|
- wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||||
|
- break;
|
||||||
|
+ cursor_mode = arg->ui;
|
||||||
|
+ grabc->was_tiled = (!grabc->isfloating && !grabc->isfullscreen);
|
||||||
|
+
|
||||||
|
+ if (grabc->was_tiled) {
|
||||||
|
+ switch (cursor_mode) {
|
||||||
|
+ case CurMove:
|
||||||
|
+ setfloating(grabc, 1);
|
||||||
|
+ grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||||
|
+ grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
|
||||||
|
+ break;
|
||||||
|
+ case CurResize:
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||||
|
+ resize_last_update_x = cursor->x;
|
||||||
|
+ resize_last_update_y = cursor->y;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ /* Default floating logic */
|
||||||
|
+ /* Float the window and tell motionnotify to grab it */
|
||||||
|
+ setfloating(grabc, 1);
|
||||||
|
+ switch (cursor_mode) {
|
||||||
|
+ case CurMove:
|
||||||
|
+ grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||||
|
+ grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
|
||||||
|
+ break;
|
||||||
|
+ case CurResize:
|
||||||
|
+ wlr_cursor_warp_closest(cursor, NULL,
|
||||||
|
+ grabc->geom.x + grabc->geom.width,
|
||||||
|
+ grabc->geom.y + grabc->geom.height);
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -2826,6 +2916,14 @@ unmapnotify(struct wl_listener *listener, void *data)
|
||||||
|
focusclient(focustop(selmon), 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
+ /* btrtile remove clients for each monitor */
|
||||||
|
+ Monitor *mon;
|
||||||
|
+ wl_list_for_each(mon, &mons, link) {
|
||||||
|
+ if (mon->root) {
|
||||||
|
+ remove_client(mon, c);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
wl_list_remove(&c->link);
|
||||||
|
setmon(c, NULL, 0);
|
||||||
|
wl_list_remove(&c->flink);
|
||||||
|
--
|
||||||
|
2.53.0
|
||||||
|
|
||||||
@@ -0,0 +1,910 @@
|
|||||||
|
From 618e3b70204520b6eb2c5040e072087ac0a3b3f7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: julmajustus <julmajustus@tutanota.com>
|
||||||
|
Date: Thu, 21 May 2026 00:40:54 +0300
|
||||||
|
Subject: [PATCH] btrtile: Spring update pt2
|
||||||
|
|
||||||
|
- Simplified the resizing logic to avoid full arrange calls from
|
||||||
|
motionnotify
|
||||||
|
- Minor intend fixes
|
||||||
|
---
|
||||||
|
btrtile.c | 564 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
config.def.h | 12 ++
|
||||||
|
dwl.c | 152 +++++++++++---
|
||||||
|
3 files changed, 701 insertions(+), 27 deletions(-)
|
||||||
|
create mode 100644 btrtile.c
|
||||||
|
|
||||||
|
diff --git a/btrtile.c b/btrtile.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..357ffb9
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/btrtile.c
|
||||||
|
@@ -0,0 +1,564 @@
|
||||||
|
+/* ************************************************************************** */
|
||||||
|
+/* @@@ @@@@@@@@ */
|
||||||
|
+/* @@@ @@@@@@@@@@ */
|
||||||
|
+/* @@! @@! @@@@ */
|
||||||
|
+/* !@! !@! @!@!@ */
|
||||||
|
+/* btrtile.c @!! @!@ @! !@! */
|
||||||
|
+/* !!! !@!!! !!! */
|
||||||
|
+/* By: julmajustus <julmajustus@tutanota.com> !!: !!:! !!! */
|
||||||
|
+/* ::! :!: !:! */
|
||||||
|
+/* Created: 2024/12/15 00:26:07 by julmajustus :: ::::::: :: */
|
||||||
|
+/* Updated: 2026/05/20 22:51:54 by julmajustus : : : : : : */
|
||||||
|
+/* */
|
||||||
|
+/* ************************************************************************** */
|
||||||
|
+
|
||||||
|
+typedef struct LayoutNode {
|
||||||
|
+ unsigned int is_client_node;
|
||||||
|
+ unsigned int is_split_vertically;
|
||||||
|
+ float split_ratio;
|
||||||
|
+ struct LayoutNode *left;
|
||||||
|
+ struct LayoutNode *right;
|
||||||
|
+ struct LayoutNode *split_node;
|
||||||
|
+ Client *client;
|
||||||
|
+} LayoutNode;
|
||||||
|
+
|
||||||
|
+static void apply_layout(Monitor *m, LayoutNode *node,
|
||||||
|
+ struct wlr_box area, unsigned int is_root);
|
||||||
|
+static void btrtile(Monitor *m);
|
||||||
|
+static LayoutNode *create_client_node(Client *c);
|
||||||
|
+static LayoutNode *create_split_node(unsigned int is_split_vertically,
|
||||||
|
+ LayoutNode *left, LayoutNode *right);
|
||||||
|
+static void destroy_node(LayoutNode *node);
|
||||||
|
+static void destroy_tree(Monitor *m);
|
||||||
|
+static LayoutNode *find_client_node(LayoutNode *node, Client *c);
|
||||||
|
+static LayoutNode *find_suitable_split(Monitor *m, LayoutNode *start,
|
||||||
|
+ unsigned int need_vertical, int focused_on_left);
|
||||||
|
+static void init_tree(Monitor *m);
|
||||||
|
+static void insert_client(Monitor *m, Client *focused_client, Client *new_client);
|
||||||
|
+static LayoutNode *remove_client_node(LayoutNode *node, Client *c);
|
||||||
|
+static void remove_client(Monitor *m, Client *c);
|
||||||
|
+static void setratio_h(const Arg *arg);
|
||||||
|
+static void setratio_v(const Arg *arg);
|
||||||
|
+static void swapclients(const Arg *arg);
|
||||||
|
+static unsigned int visible_count(LayoutNode *node, Monitor *m);
|
||||||
|
+static Client *xytoclient(double x, double y);
|
||||||
|
+
|
||||||
|
+static double resize_last_update_x, resize_last_update_y;
|
||||||
|
+static uint32_t last_resize_time = 0;
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+apply_layout(Monitor *m, LayoutNode *node,
|
||||||
|
+ struct wlr_box area, unsigned int is_root)
|
||||||
|
+{
|
||||||
|
+ Client *c;
|
||||||
|
+ float ratio;
|
||||||
|
+ unsigned int left_count, right_count, mid;
|
||||||
|
+ struct wlr_box left_area, right_area;
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ /* If this node is a client node, check if it is visible. */
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ c = node->client;
|
||||||
|
+ if (!c || !VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||||
|
+ return;
|
||||||
|
+ if (area.x == c->old_geom.x && area.y == c->old_geom.y &&
|
||||||
|
+ area.width == c->old_geom.width && area.height == c->old_geom.height)
|
||||||
|
+ return;
|
||||||
|
+ resize(c, area, 0);
|
||||||
|
+ c->old_geom = area;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* For a split node, we see how many visible children are on each side: */
|
||||||
|
+ left_count = visible_count(node->left, m);
|
||||||
|
+ right_count = visible_count(node->right, m);
|
||||||
|
+
|
||||||
|
+ if (left_count == 0 && right_count == 0) {
|
||||||
|
+ return;
|
||||||
|
+ } else if (left_count > 0 && right_count == 0) {
|
||||||
|
+ apply_layout(m, node->left, area, 0);
|
||||||
|
+ return;
|
||||||
|
+ } else if (left_count == 0 && right_count > 0) {
|
||||||
|
+ apply_layout(m, node->right, area, 0);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If we’re here, we have visible clients in both subtrees. */
|
||||||
|
+ ratio = node->split_ratio;
|
||||||
|
+ if (ratio < 0.05f)
|
||||||
|
+ ratio = 0.05f;
|
||||||
|
+ if (ratio > 0.95f)
|
||||||
|
+ ratio = 0.95f;
|
||||||
|
+
|
||||||
|
+ memset(&left_area, 0, sizeof(left_area));
|
||||||
|
+ memset(&right_area, 0, sizeof(right_area));
|
||||||
|
+
|
||||||
|
+ if (node->is_split_vertically) {
|
||||||
|
+ mid = (unsigned int)(area.width * ratio);
|
||||||
|
+ left_area.x = area.x;
|
||||||
|
+ left_area.y = area.y;
|
||||||
|
+ left_area.width = mid;
|
||||||
|
+ left_area.height = area.height;
|
||||||
|
+
|
||||||
|
+ right_area.x = area.x + mid;
|
||||||
|
+ right_area.y = area.y;
|
||||||
|
+ right_area.width = area.width - mid;
|
||||||
|
+ right_area.height = area.height;
|
||||||
|
+ } else {
|
||||||
|
+ /* horizontal split */
|
||||||
|
+ mid = (unsigned int)(area.height * ratio);
|
||||||
|
+ left_area.x = area.x;
|
||||||
|
+ left_area.y = area.y;
|
||||||
|
+ left_area.width = area.width;
|
||||||
|
+ left_area.height = mid;
|
||||||
|
+
|
||||||
|
+ right_area.x = area.x;
|
||||||
|
+ right_area.y = area.y + mid;
|
||||||
|
+ right_area.width = area.width;
|
||||||
|
+ right_area.height= area.height - mid;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ apply_layout(m, node->left, left_area, 0);
|
||||||
|
+ apply_layout(m, node->right, right_area, 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+btrtile(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ Client *c, *focused = NULL;
|
||||||
|
+ int n = 0;
|
||||||
|
+ LayoutNode *found;
|
||||||
|
+ struct wlr_box full_area;
|
||||||
|
+
|
||||||
|
+ if (!m)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ /* Remove non tiled clients from tree. */
|
||||||
|
+ wl_list_for_each(c, &clients, link) {
|
||||||
|
+ if (c->mon == m && !c->isfloating && !c->isfullscreen) {
|
||||||
|
+ } else {
|
||||||
|
+ remove_client(m, c);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If no client is found under cursor, fallback to focustop(m) */
|
||||||
|
+ if (!(focused = xytoclient(cursor->x, cursor->y)))
|
||||||
|
+ focused = focustop(m);
|
||||||
|
+
|
||||||
|
+ /* Insert visible clients that are not part of the tree. */
|
||||||
|
+ wl_list_for_each(c, &clients, link) {
|
||||||
|
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen && c->mon == m) {
|
||||||
|
+ found = find_client_node(m->root, c);
|
||||||
|
+ if (!found) {
|
||||||
|
+ insert_client(m, focused, c);
|
||||||
|
+ }
|
||||||
|
+ n++;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (n == 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ full_area = m->w;
|
||||||
|
+ apply_layout(m, m->root, full_area, 1);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+create_client_node(Client *c)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *node = calloc(1, sizeof(LayoutNode));
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return NULL;
|
||||||
|
+ node->is_client_node = 1;
|
||||||
|
+ node->split_ratio = 0.5f;
|
||||||
|
+ node->client = c;
|
||||||
|
+ return node;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+create_split_node(unsigned int is_split_vertically,
|
||||||
|
+ LayoutNode *left, LayoutNode *right)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *node = calloc(1, sizeof(LayoutNode));
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return NULL;
|
||||||
|
+ node->is_client_node = 0;
|
||||||
|
+ node->split_ratio = 0.5f;
|
||||||
|
+ node->is_split_vertically = is_split_vertically;
|
||||||
|
+ node->left = left;
|
||||||
|
+ node->right = right;
|
||||||
|
+ if (left)
|
||||||
|
+ left->split_node = node;
|
||||||
|
+ if (right)
|
||||||
|
+ right->split_node = node;
|
||||||
|
+ return node;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+destroy_node(LayoutNode *node)
|
||||||
|
+{
|
||||||
|
+ if (!node)
|
||||||
|
+ return;
|
||||||
|
+ if (!node->is_client_node) {
|
||||||
|
+ destroy_node(node->left);
|
||||||
|
+ destroy_node(node->right);
|
||||||
|
+ }
|
||||||
|
+ free(node);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+destroy_tree(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ if (!m || !m->root)
|
||||||
|
+ return;
|
||||||
|
+ destroy_node(m->root);
|
||||||
|
+ m->root = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+find_client_node(LayoutNode *node, Client *c)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *res;
|
||||||
|
+
|
||||||
|
+ if (!node || !c)
|
||||||
|
+ return NULL;
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ return (node->client == c) ? node : NULL;
|
||||||
|
+ }
|
||||||
|
+ res = find_client_node(node->left, c);
|
||||||
|
+ return res ? res : find_client_node(node->right, c);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+find_suitable_split(Monitor *m, LayoutNode *start_node,
|
||||||
|
+ unsigned int need_vertical, int focused_on_left)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *n = start_node, *child = NULL;
|
||||||
|
+
|
||||||
|
+ if (!m)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ if (n && n->is_client_node) {
|
||||||
|
+ child = n;
|
||||||
|
+ n = n->split_node;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ while (n) {
|
||||||
|
+ if (!n->is_client_node && n->is_split_vertically == need_vertical
|
||||||
|
+ && visible_count(n->left, m) > 0
|
||||||
|
+ && visible_count(n->right, m) > 0) {
|
||||||
|
+ if ((focused_on_left && n->left == child) ||
|
||||||
|
+ (!focused_on_left && n->right == child))
|
||||||
|
+ return n;
|
||||||
|
+ }
|
||||||
|
+ child = n;
|
||||||
|
+ n = n->split_node;
|
||||||
|
+ }
|
||||||
|
+ return NULL;
|
||||||
|
+}
|
||||||
|
+void
|
||||||
|
+init_tree(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ if (m)
|
||||||
|
+ m->root = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+insert_client(Monitor *m, Client *focused_client, Client *new_client)
|
||||||
|
+{
|
||||||
|
+ Client *old_client;
|
||||||
|
+ LayoutNode **root = &m->root, *old_root,
|
||||||
|
+ *focused_node, *new_client_node, *old_client_node;
|
||||||
|
+ unsigned int wider, mid_x, mid_y;
|
||||||
|
+
|
||||||
|
+ /* If no root , new client becomes the root. */
|
||||||
|
+ if (!*root) {
|
||||||
|
+ *root = create_client_node(new_client);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Find the focused_client node,
|
||||||
|
+ * if not found split the root. */
|
||||||
|
+ focused_node = focused_client ?
|
||||||
|
+ find_client_node(*root, focused_client) : NULL;
|
||||||
|
+ if (!focused_node) {
|
||||||
|
+ old_root = *root;
|
||||||
|
+ new_client_node = create_client_node(new_client);
|
||||||
|
+ *root = create_split_node(1, old_root, new_client_node);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Turn focused node from a client node into a split node,
|
||||||
|
+ * and attach old_client + new_client. */
|
||||||
|
+ old_client = focused_node->client;
|
||||||
|
+ old_client_node = create_client_node(old_client);
|
||||||
|
+ new_client_node = create_client_node(new_client);
|
||||||
|
+
|
||||||
|
+ /* Decide split direction. */
|
||||||
|
+ wider = (focused_client->geom.width >= focused_client->geom.height);
|
||||||
|
+ focused_node->is_client_node = 0;
|
||||||
|
+ focused_node->client = NULL;
|
||||||
|
+ focused_node->is_split_vertically = (wider ? 1 : 0);
|
||||||
|
+
|
||||||
|
+ /* Pick new_client side depending on the cursor position. */
|
||||||
|
+ mid_x = focused_client->geom.x + focused_client->geom.width / 2;
|
||||||
|
+ mid_y = focused_client->geom.y + focused_client->geom.height / 2;
|
||||||
|
+
|
||||||
|
+ if (wider) {
|
||||||
|
+ /* vertical split => left vs right */
|
||||||
|
+ if (cursor->x <= mid_x) {
|
||||||
|
+ focused_node->left = new_client_node;
|
||||||
|
+ focused_node->right = old_client_node;
|
||||||
|
+ } else {
|
||||||
|
+ focused_node->left = old_client_node;
|
||||||
|
+ focused_node->right = new_client_node;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ /* horizontal split => top vs bottom */
|
||||||
|
+ if (cursor->y <= mid_y) {
|
||||||
|
+ focused_node->left = new_client_node;
|
||||||
|
+ focused_node->right = old_client_node;
|
||||||
|
+ } else {
|
||||||
|
+ focused_node->left = old_client_node;
|
||||||
|
+ focused_node->right = new_client_node;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ old_client_node->split_node = focused_node;
|
||||||
|
+ new_client_node->split_node = focused_node;
|
||||||
|
+ focused_node->split_ratio = 0.5f;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+remove_client_node(LayoutNode *node, Client *c)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *tmp;
|
||||||
|
+ if (!node)
|
||||||
|
+ return NULL;
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ /* If this client_node is the client we're removing,
|
||||||
|
+ * return NULL to remove it */
|
||||||
|
+ if (node->client == c) {
|
||||||
|
+ free(node);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+ return node;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ node->left = remove_client_node(node->left, c);
|
||||||
|
+ node->right = remove_client_node(node->right, c);
|
||||||
|
+
|
||||||
|
+ /* If one of the client node is NULL after removal and the other is not,
|
||||||
|
+ * we "lift" the other client node up to replace this split node. */
|
||||||
|
+ if (!node->left && node->right) {
|
||||||
|
+ tmp = node->right;
|
||||||
|
+
|
||||||
|
+ /* Save pointer to split node */
|
||||||
|
+ if (tmp)
|
||||||
|
+ tmp->split_node = node->split_node;
|
||||||
|
+
|
||||||
|
+ free(node);
|
||||||
|
+ return tmp;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!node->right && node->left) {
|
||||||
|
+ tmp = node->left;
|
||||||
|
+
|
||||||
|
+ /* Save pointer to split node */
|
||||||
|
+ if (tmp)
|
||||||
|
+ tmp->split_node = node->split_node;
|
||||||
|
+
|
||||||
|
+ free(node);
|
||||||
|
+ return tmp;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If both children exist or both are NULL (empty tree),
|
||||||
|
+ * return node as is. */
|
||||||
|
+ return node;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+remove_client(Monitor *m, Client *c)
|
||||||
|
+{
|
||||||
|
+ if (!m->root || !c)
|
||||||
|
+ return;
|
||||||
|
+ m->root = remove_client_node(m->root, c);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+setratio(unsigned int need_vertical, const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ Client *sel;
|
||||||
|
+ LayoutNode *client_node, *split_node;
|
||||||
|
+ float new_ratio;
|
||||||
|
+ int focused_on_left;
|
||||||
|
+
|
||||||
|
+ if (!selmon || !selmon->lt[selmon->sellt]->arrange)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ sel = focustop(selmon);
|
||||||
|
+ if (!sel)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ client_node = find_client_node(selmon->root, sel);
|
||||||
|
+ if (!client_node)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ focused_on_left = (arg->f >= 0.0f);
|
||||||
|
+
|
||||||
|
+ split_node = find_suitable_split(selmon, client_node, need_vertical, focused_on_left);
|
||||||
|
+
|
||||||
|
+ if (!split_node)
|
||||||
|
+ split_node = find_suitable_split(selmon, client_node, need_vertical, !focused_on_left);
|
||||||
|
+ if (!split_node)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ new_ratio = (arg->f != 0.0f) ? (split_node->split_ratio + arg->f) : 0.5f;
|
||||||
|
+ if (new_ratio < 0.05f)
|
||||||
|
+ new_ratio = 0.05f;
|
||||||
|
+ if (new_ratio > 0.95f)
|
||||||
|
+ new_ratio = 0.95f;
|
||||||
|
+ split_node->split_ratio = new_ratio;
|
||||||
|
+
|
||||||
|
+ apply_layout(selmon, selmon->root, selmon->w, 1);
|
||||||
|
+ /* Skip the arrange when called from motionnotify; that path calls
|
||||||
|
+ * arrange itself after rate-limiting. */
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+setratio_h(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setratio(1, arg);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+setratio_v(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setratio(0, arg);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void swapclients(const Arg *arg) {
|
||||||
|
+ Client *c, *tmp, *target = NULL, *sel = focustop(selmon);
|
||||||
|
+ LayoutNode *sel_node, *target_node;
|
||||||
|
+ int closest_dist = INT_MAX, dist, sel_center_x, sel_center_y,
|
||||||
|
+ cand_center_x, cand_center_y;
|
||||||
|
+
|
||||||
|
+ if (!sel || sel->isfullscreen ||
|
||||||
|
+ !selmon->root || !selmon->lt[selmon->sellt]->arrange)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ /* Get the center coordinates of the selected client */
|
||||||
|
+ sel_center_x = sel->geom.x + sel->geom.width / 2;
|
||||||
|
+ sel_center_y = sel->geom.y + sel->geom.height / 2;
|
||||||
|
+
|
||||||
|
+ wl_list_for_each(c, &clients, link) {
|
||||||
|
+ if (!VISIBLEON(c, selmon) || c->isfloating || c->isfullscreen || c == sel)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ /* Get the center of candidate client */
|
||||||
|
+ cand_center_x = c->geom.x + c->geom.width / 2;
|
||||||
|
+ cand_center_y = c->geom.y + c->geom.height / 2;
|
||||||
|
+
|
||||||
|
+ /* Check that the candidate lies in the requested direction. */
|
||||||
|
+ switch (arg->ui) {
|
||||||
|
+ case 0:
|
||||||
|
+ if (cand_center_x >= sel_center_x)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ case 1:
|
||||||
|
+ if (cand_center_x <= sel_center_x)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ case 2:
|
||||||
|
+ if (cand_center_y >= sel_center_y)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ case 3:
|
||||||
|
+ if (cand_center_y <= sel_center_y)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Get distance between the centers */
|
||||||
|
+ dist = abs(sel_center_x - cand_center_x) + abs(sel_center_y - cand_center_y);
|
||||||
|
+ if (dist < closest_dist) {
|
||||||
|
+ closest_dist = dist;
|
||||||
|
+ target = c;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If target is found, swap the two clients’ positions in the layout tree */
|
||||||
|
+ if (target) {
|
||||||
|
+ sel_node = find_client_node(selmon->root, sel);
|
||||||
|
+ target_node = find_client_node(selmon->root, target);
|
||||||
|
+ if (sel_node && target_node) {
|
||||||
|
+ tmp = sel_node->client;
|
||||||
|
+ sel_node->client = target_node->client;
|
||||||
|
+ target_node->client = tmp;
|
||||||
|
+ arrange(selmon);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+unsigned int
|
||||||
|
+visible_count(LayoutNode *node, Monitor *m)
|
||||||
|
+{
|
||||||
|
+ Client *c;
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return 0;
|
||||||
|
+ /* Check if this client is visible. */
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ c = node->client;
|
||||||
|
+ if (c && VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen)
|
||||||
|
+ return 1;
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ /* Else it’s a split node. */
|
||||||
|
+ return visible_count(node->left, m) + visible_count(node->right, m);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+Client *
|
||||||
|
+xytoclient(double x, double y) {
|
||||||
|
+ Monitor *m = xytomon(x, y);
|
||||||
|
+ Client *c, *closest = NULL;
|
||||||
|
+ double dist, mindist = INT_MAX, dx, dy;
|
||||||
|
+
|
||||||
|
+ wl_list_for_each_reverse(c, &clients, link) {
|
||||||
|
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen &&
|
||||||
|
+ x >= c->geom.x && x <= (c->geom.x + c->geom.width) &&
|
||||||
|
+ y >= c->geom.y && y <= (c->geom.y + c->geom.height)){
|
||||||
|
+ return c;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If no client was found at cursor position fallback to closest. */
|
||||||
|
+ wl_list_for_each_reverse(c, &clients, link) {
|
||||||
|
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen) {
|
||||||
|
+ dx = 0, dy = 0;
|
||||||
|
+
|
||||||
|
+ if (x < c->geom.x)
|
||||||
|
+ dx = c->geom.x - x;
|
||||||
|
+ else if (x > (c->geom.x + c->geom.width))
|
||||||
|
+ dx = x - (c->geom.x + c->geom.width);
|
||||||
|
+
|
||||||
|
+ if (y < c->geom.y)
|
||||||
|
+ dy = c->geom.y - y;
|
||||||
|
+ else if (y > (c->geom.y + c->geom.height))
|
||||||
|
+ dy = y - (c->geom.y + c->geom.height);
|
||||||
|
+
|
||||||
|
+ dist = dx * dx + dy * dy;
|
||||||
|
+ if (dist < mindist) {
|
||||||
|
+ mindist = dist;
|
||||||
|
+ closest = c;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ return closest;
|
||||||
|
+}
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 8a6eda0..bc04e3f 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -13,7 +13,10 @@ static const float focuscolor[] = COLOR(0x005577ff);
|
||||||
|
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||||
|
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||||
|
static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */
|
||||||
|
+static const float resize_factor = 0.0002f; /* Resize multiplier for mouse resizing, depends on mouse sensivity. */
|
||||||
|
+static const uint32_t resize_interval_ms = 16; /* Resize interval depends on framerate and screen refresh rate. */
|
||||||
|
|
||||||
|
+enum Direction { DIR_LEFT, DIR_RIGHT, DIR_UP, DIR_DOWN };
|
||||||
|
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||||
|
#define TAGCOUNT (9)
|
||||||
|
|
||||||
|
@@ -30,6 +33,7 @@ static const Rule rules[] = {
|
||||||
|
/* layout(s) */
|
||||||
|
static const Layout layouts[] = {
|
||||||
|
/* symbol arrange function */
|
||||||
|
+ { "|w|", btrtile },
|
||||||
|
{ "[]=", tile },
|
||||||
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
@@ -144,6 +148,14 @@ static const Key keys[] = {
|
||||||
|
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Up, swapclients, {.i = DIR_UP} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Down, swapclients, {.i = DIR_DOWN} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Right, swapclients, {.i = DIR_RIGHT} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Left, swapclients, {.i = DIR_LEFT} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Right, setratio_h, {.f = +0.025f} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Left, setratio_h, {.f = -0.025f} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Up, setratio_v, {.f = -0.025f} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Down, setratio_v, {.f = +0.025f} },
|
||||||
|
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
||||||
|
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
||||||
|
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index 44f3ad9..a121efc 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
/*
|
||||||
|
* See LICENSE file for copyright and license details.
|
||||||
|
*/
|
||||||
|
+#include <limits.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
#include <libinput.h>
|
||||||
|
#include <linux/input-event-codes.h>
|
||||||
|
@@ -100,6 +101,7 @@ typedef struct {
|
||||||
|
const Arg arg;
|
||||||
|
} Button;
|
||||||
|
|
||||||
|
+typedef struct LayoutNode LayoutNode;
|
||||||
|
typedef struct Monitor Monitor;
|
||||||
|
typedef struct {
|
||||||
|
/* Must keep this field first */
|
||||||
|
@@ -137,8 +139,9 @@ typedef struct {
|
||||||
|
#endif
|
||||||
|
unsigned int bw;
|
||||||
|
uint32_t tags;
|
||||||
|
- int isfloating, isurgent, isfullscreen;
|
||||||
|
+ int isfloating, isurgent, isfullscreen, was_tiled;
|
||||||
|
uint32_t resize; /* configure serial of a pending resize */
|
||||||
|
+ struct wlr_box old_geom;
|
||||||
|
} Client;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
@@ -205,6 +208,7 @@ struct Monitor {
|
||||||
|
int nmaster;
|
||||||
|
char ltsymbol[16];
|
||||||
|
int asleep;
|
||||||
|
+ LayoutNode *root;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
@@ -247,6 +251,7 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||||
|
struct wlr_box *usable_area, int exclusive);
|
||||||
|
static void arrangelayers(Monitor *m);
|
||||||
|
static void axisnotify(struct wl_listener *listener, void *data);
|
||||||
|
+static void btrtile(Monitor *m);
|
||||||
|
static void buttonpress(struct wl_listener *listener, void *data);
|
||||||
|
static void chvt(const Arg *arg);
|
||||||
|
static void checkidleinhibitor(struct wlr_surface *exclude);
|
||||||
|
@@ -329,6 +334,9 @@ static void setmon(Client *c, Monitor *m, uint32_t newtags);
|
||||||
|
static void setpsel(struct wl_listener *listener, void *data);
|
||||||
|
static void setsel(struct wl_listener *listener, void *data);
|
||||||
|
static void setup(void);
|
||||||
|
+static void setratio_h(const Arg *arg);
|
||||||
|
+static void setratio_v(const Arg *arg);
|
||||||
|
+static void swapclients(const Arg *arg);
|
||||||
|
static void spawn(const Arg *arg);
|
||||||
|
static void startdrag(struct wl_listener *listener, void *data);
|
||||||
|
static void tag(const Arg *arg);
|
||||||
|
@@ -454,6 +462,7 @@ static struct wlr_xwayland *xwayland;
|
||||||
|
|
||||||
|
/* attempt to encapsulate suck into one file */
|
||||||
|
#include "client.h"
|
||||||
|
+#include "btrtile.c"
|
||||||
|
|
||||||
|
/* function implementations */
|
||||||
|
void
|
||||||
|
@@ -624,7 +633,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
struct wlr_pointer_button_event *event = data;
|
||||||
|
struct wlr_keyboard *keyboard;
|
||||||
|
uint32_t mods;
|
||||||
|
- Client *c;
|
||||||
|
+ Client *c, *target = NULL;
|
||||||
|
const Button *b;
|
||||||
|
|
||||||
|
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||||
|
@@ -645,7 +654,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
mods = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0;
|
||||||
|
for (b = buttons; b < END(buttons); b++) {
|
||||||
|
if (CLEANMASK(mods) == CLEANMASK(b->mod) &&
|
||||||
|
- event->button == b->button && b->func) {
|
||||||
|
+ event->button == b->button && b->func) {
|
||||||
|
b->func(&b->arg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@@ -655,6 +664,21 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
/* If you released any buttons, we exit interactive move/resize mode. */
|
||||||
|
/* TODO: should reset to the pointer focus's current setcursor */
|
||||||
|
if (!locked && cursor_mode != CurNormal && cursor_mode != CurPressed) {
|
||||||
|
+ c = grabc;
|
||||||
|
+ if (c && c->was_tiled && !strcmp(selmon->ltsymbol, "|w|")) {
|
||||||
|
+ if (cursor_mode == CurMove && c->isfloating) {
|
||||||
|
+ target = xytoclient(cursor->x, cursor->y);
|
||||||
|
+
|
||||||
|
+ if (target && !target->isfloating && !target->isfullscreen)
|
||||||
|
+ insert_client(selmon, target, c);
|
||||||
|
+ else
|
||||||
|
+ selmon->root = create_client_node(c);
|
||||||
|
+
|
||||||
|
+ setfloating(c, 0);
|
||||||
|
+ apply_layout(selmon, selmon->root, selmon->w, 1);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ /* Default behaviour */
|
||||||
|
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
||||||
|
cursor_mode = CurNormal;
|
||||||
|
/* Drop the window off on its new monitor */
|
||||||
|
@@ -746,6 +770,7 @@ cleanupmon(struct wl_listener *listener, void *data)
|
||||||
|
wlr_output_layout_remove(output_layout, m->wlr_output);
|
||||||
|
wlr_scene_output_destroy(m->scene_output);
|
||||||
|
|
||||||
|
+ destroy_tree(m);
|
||||||
|
closemon(m);
|
||||||
|
wlr_scene_node_destroy(&m->fullscreen_bg->node);
|
||||||
|
free(m);
|
||||||
|
@@ -1090,6 +1115,7 @@ createmon(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
|
wl_list_insert(&mons, &m->link);
|
||||||
|
printstatus();
|
||||||
|
+ init_tree(m);
|
||||||
|
|
||||||
|
/* The xdg-protocol specifies:
|
||||||
|
*
|
||||||
|
@@ -1329,9 +1355,17 @@ destroynotify(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
/* Called when the xdg_toplevel is destroyed. */
|
||||||
|
Client *c = wl_container_of(listener, c, destroy);
|
||||||
|
+ Monitor *mon;
|
||||||
|
wl_list_remove(&c->destroy.link);
|
||||||
|
wl_list_remove(&c->set_title.link);
|
||||||
|
wl_list_remove(&c->fullscreen.link);
|
||||||
|
+ /* We check if the destroyed client was part of any tiled_list, to catch
|
||||||
|
+ * client removals even if they would not be currently managed by btrtile */
|
||||||
|
+ wl_list_for_each(mon, &mons, link) {
|
||||||
|
+ if (mon->root) {
|
||||||
|
+ remove_client(mon, c);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
#ifdef XWAYLAND
|
||||||
|
if (c->type != XDGShell) {
|
||||||
|
wl_list_remove(&c->activate.link);
|
||||||
|
@@ -1862,7 +1896,8 @@ void
|
||||||
|
motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double dy,
|
||||||
|
double dx_unaccel, double dy_unaccel)
|
||||||
|
{
|
||||||
|
- double sx = 0, sy = 0, sx_confined, sy_confined;
|
||||||
|
+ int tiled = 0;
|
||||||
|
+ double sx = 0, sy = 0, sx_confined, sy_confined, dx_total, dy_total;
|
||||||
|
Client *c = NULL, *w = NULL;
|
||||||
|
LayerSurface *l = NULL;
|
||||||
|
struct wlr_surface *surface = NULL;
|
||||||
|
@@ -1916,18 +1951,55 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
|
||||||
|
/* Update drag icon's position */
|
||||||
|
wlr_scene_node_set_position(&drag_icon->node, (int)round(cursor->x), (int)round(cursor->y));
|
||||||
|
|
||||||
|
- /* If we are currently grabbing the mouse, handle and return */
|
||||||
|
+ /* Skip if internal call */
|
||||||
|
+ if (time == 0)
|
||||||
|
+ goto focus;
|
||||||
|
+
|
||||||
|
+ tiled = grabc && !grabc->isfloating && !grabc->isfullscreen;
|
||||||
|
if (cursor_mode == CurMove) {
|
||||||
|
/* Move the grabbed client to the new position. */
|
||||||
|
- resize(grabc, (struct wlr_box){.x = (int)round(cursor->x) - grabcx, .y = (int)round(cursor->y) - grabcy,
|
||||||
|
- .width = grabc->geom.width, .height = grabc->geom.height}, 1);
|
||||||
|
- return;
|
||||||
|
+ if (grabc && grabc->isfloating) {
|
||||||
|
+ resize(grabc, (struct wlr_box){
|
||||||
|
+ .x = (int)round(cursor->x) - grabcx,
|
||||||
|
+ .y = (int)round(cursor->y) - grabcy,
|
||||||
|
+ .width = grabc->geom.width,
|
||||||
|
+ .height = grabc->geom.height
|
||||||
|
+ }, 1);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
} else if (cursor_mode == CurResize) {
|
||||||
|
- resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y,
|
||||||
|
- .width = (int)round(cursor->x) - grabc->geom.x, .height = (int)round(cursor->y) - grabc->geom.y}, 1);
|
||||||
|
- return;
|
||||||
|
+ if (tiled) {
|
||||||
|
+ dx_total = cursor->x - resize_last_update_x;
|
||||||
|
+ dy_total = cursor->y - resize_last_update_y;
|
||||||
|
+
|
||||||
|
+ if (time - last_resize_time >= resize_interval_ms) {
|
||||||
|
+ Arg a = {0};
|
||||||
|
+ if (fabs(dx_total) > fabs(dy_total)) {
|
||||||
|
+ a.f = (float)(dx_total * resize_factor);
|
||||||
|
+ setratio_h(&a);
|
||||||
|
+ } else {
|
||||||
|
+ a.f = (float)(dy_total * resize_factor);
|
||||||
|
+ setratio_v(&a);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ last_resize_time = time;
|
||||||
|
+ resize_last_update_x = cursor->x;
|
||||||
|
+ resize_last_update_y = cursor->y;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ } else if (grabc && grabc->isfloating) {
|
||||||
|
+ /* Floating resize as original */
|
||||||
|
+ resize(grabc, (struct wlr_box){
|
||||||
|
+ .x = grabc->geom.x,
|
||||||
|
+ .y = grabc->geom.y,
|
||||||
|
+ .width = (int)round(cursor->x) - grabc->geom.x,
|
||||||
|
+ .height = (int)round(cursor->y) - grabc->geom.y
|
||||||
|
+ }, 1);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
+focus:
|
||||||
|
/* If there's no client surface under the cursor, set the cursor image to a
|
||||||
|
* default. This is what makes the cursor image appear when you move it
|
||||||
|
* off of a client or over its border. */
|
||||||
|
@@ -1961,22 +2033,40 @@ moveresize(const Arg *arg)
|
||||||
|
if (!grabc || client_is_unmanaged(grabc) || grabc->isfullscreen)
|
||||||
|
return;
|
||||||
|
|
||||||
|
- /* Float the window and tell motionnotify to grab it */
|
||||||
|
- setfloating(grabc, 1);
|
||||||
|
- switch (cursor_mode = arg->ui) {
|
||||||
|
- case CurMove:
|
||||||
|
- grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||||
|
- grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||||
|
- wlr_cursor_set_xcursor(cursor, cursor_mgr, "all-scroll");
|
||||||
|
- break;
|
||||||
|
- case CurResize:
|
||||||
|
- /* Doesn't work for X11 output - the next absolute motion event
|
||||||
|
- * returns the cursor to where it started */
|
||||||
|
- wlr_cursor_warp_closest(cursor, NULL,
|
||||||
|
- grabc->geom.x + grabc->geom.width,
|
||||||
|
- grabc->geom.y + grabc->geom.height);
|
||||||
|
- wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||||
|
- break;
|
||||||
|
+ cursor_mode = arg->ui;
|
||||||
|
+ grabc->was_tiled = (!grabc->isfloating && !grabc->isfullscreen);
|
||||||
|
+
|
||||||
|
+ if (grabc->was_tiled) {
|
||||||
|
+ switch (cursor_mode) {
|
||||||
|
+ case CurMove:
|
||||||
|
+ setfloating(grabc, 1);
|
||||||
|
+ grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||||
|
+ grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
|
||||||
|
+ break;
|
||||||
|
+ case CurResize:
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||||
|
+ resize_last_update_x = cursor->x;
|
||||||
|
+ resize_last_update_y = cursor->y;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ /* Default floating logic */
|
||||||
|
+ /* Float the window and tell motionnotify to grab it */
|
||||||
|
+ setfloating(grabc, 1);
|
||||||
|
+ switch (cursor_mode) {
|
||||||
|
+ case CurMove:
|
||||||
|
+ grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||||
|
+ grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
|
||||||
|
+ break;
|
||||||
|
+ case CurResize:
|
||||||
|
+ wlr_cursor_warp_closest(cursor, NULL,
|
||||||
|
+ grabc->geom.x + grabc->geom.width,
|
||||||
|
+ grabc->geom.y + grabc->geom.height);
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -2826,6 +2916,14 @@ unmapnotify(struct wl_listener *listener, void *data)
|
||||||
|
focusclient(focustop(selmon), 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
+ /* btrtile remove clients for each monitor */
|
||||||
|
+ Monitor *mon;
|
||||||
|
+ wl_list_for_each(mon, &mons, link) {
|
||||||
|
+ if (mon->root) {
|
||||||
|
+ remove_client(mon, c);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
wl_list_remove(&c->link);
|
||||||
|
setmon(c, NULL, 0);
|
||||||
|
wl_list_remove(&c->flink);
|
||||||
|
--
|
||||||
|
2.53.0
|
||||||
|
|
||||||
@@ -0,0 +1,930 @@
|
|||||||
|
From c11b1a8c93c27fad3782e9dbc1b094a4a7b78088 Mon Sep 17 00:00:00 2001
|
||||||
|
From: julmajustus <julmajustus@tutanota.com>
|
||||||
|
Date: Thu, 21 May 2026 00:38:45 +0300
|
||||||
|
Subject: [PATCH] btrtile: Spring update pt2
|
||||||
|
|
||||||
|
- Simplified the resizing logic to avoid full arrange calls from
|
||||||
|
motionnotify
|
||||||
|
- Minor intend fixes
|
||||||
|
---
|
||||||
|
btrtile.c | 583 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
config.def.h | 12 ++
|
||||||
|
dwl.c | 152 +++++++++++---
|
||||||
|
3 files changed, 720 insertions(+), 27 deletions(-)
|
||||||
|
create mode 100644 btrtile.c
|
||||||
|
|
||||||
|
diff --git a/btrtile.c b/btrtile.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..f05a30f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/btrtile.c
|
||||||
|
@@ -0,0 +1,583 @@
|
||||||
|
+/* ************************************************************************** */
|
||||||
|
+/* @@@ @@@@@@@@ */
|
||||||
|
+/* @@@ @@@@@@@@@@ */
|
||||||
|
+/* @@! @@! @@@@ */
|
||||||
|
+/* !@! !@! @!@!@ */
|
||||||
|
+/* btrtile.c @!! @!@ @! !@! */
|
||||||
|
+/* !!! !@!!! !!! */
|
||||||
|
+/* By: julmajustus <julmajustus@tutanota.com> !!: !!:! !!! */
|
||||||
|
+/* ::! :!: !:! */
|
||||||
|
+/* Created: 2024/12/15 00:26:07 by julmajustus :: ::::::: :: */
|
||||||
|
+/* Updated: 2026/05/20 22:38:02 by julmajustus : : : : : : */
|
||||||
|
+/* */
|
||||||
|
+/* ************************************************************************** */
|
||||||
|
+
|
||||||
|
+typedef struct LayoutNode {
|
||||||
|
+ unsigned int is_client_node;
|
||||||
|
+ unsigned int is_split_vertically;
|
||||||
|
+ float split_ratio;
|
||||||
|
+ struct LayoutNode *left;
|
||||||
|
+ struct LayoutNode *right;
|
||||||
|
+ struct LayoutNode *split_node;
|
||||||
|
+ Client *client;
|
||||||
|
+} LayoutNode;
|
||||||
|
+
|
||||||
|
+static void apply_layout(Monitor *m, LayoutNode *node,
|
||||||
|
+ struct wlr_box area, unsigned int is_root);
|
||||||
|
+static void btrtile(Monitor *m);
|
||||||
|
+static LayoutNode *create_client_node(Client *c);
|
||||||
|
+static LayoutNode *create_split_node(unsigned int is_split_vertically,
|
||||||
|
+ LayoutNode *left, LayoutNode *right);
|
||||||
|
+static void destroy_node(LayoutNode *node);
|
||||||
|
+static void destroy_tree(Monitor *m);
|
||||||
|
+static LayoutNode *find_client_node(LayoutNode *node, Client *c);
|
||||||
|
+static LayoutNode *find_suitable_split(Monitor *m, LayoutNode *start,
|
||||||
|
+ unsigned int need_vertical, int focused_on_left);
|
||||||
|
+static void init_tree(Monitor *m);
|
||||||
|
+static void insert_client(Monitor *m, Client *focused_client, Client *new_client);
|
||||||
|
+static LayoutNode *remove_client_node(LayoutNode *node, Client *c);
|
||||||
|
+static void remove_client(Monitor *m, Client *c);
|
||||||
|
+static void setratio_h(const Arg *arg);
|
||||||
|
+static void setratio_v(const Arg *arg);
|
||||||
|
+static void swapclients(const Arg *arg);
|
||||||
|
+static unsigned int visible_count(LayoutNode *node, Monitor *m);
|
||||||
|
+static Client *xytoclient(double x, double y);
|
||||||
|
+
|
||||||
|
+static double resize_last_update_x, resize_last_update_y;
|
||||||
|
+static uint32_t last_resize_time = 0;
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+apply_layout(Monitor *m, LayoutNode *node,
|
||||||
|
+ struct wlr_box area, unsigned int is_root)
|
||||||
|
+{
|
||||||
|
+ Client *c;
|
||||||
|
+ float ratio;
|
||||||
|
+ unsigned int left_count, right_count, mid, e = m->gaps;
|
||||||
|
+ struct wlr_box left_area, right_area;
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (is_root && e) {
|
||||||
|
+ area.x += gappx;
|
||||||
|
+ area.y += gappx;
|
||||||
|
+ area.width -= 2 * gappx;
|
||||||
|
+ area.height -= 2 * gappx;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If this node is a client node, check if it is visible. */
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ c = node->client;
|
||||||
|
+ if (!c || !VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||||
|
+ return;
|
||||||
|
+ if (area.x == c->old_geom.x && area.y == c->old_geom.y &&
|
||||||
|
+ area.width == c->old_geom.width && area.height == c->old_geom.height)
|
||||||
|
+ return;
|
||||||
|
+ resize(c, area, 0);
|
||||||
|
+ c->old_geom = area;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* For a split node, we see how many visible children are on each side: */
|
||||||
|
+ left_count = visible_count(node->left, m);
|
||||||
|
+ right_count = visible_count(node->right, m);
|
||||||
|
+
|
||||||
|
+ if (left_count == 0 && right_count == 0) {
|
||||||
|
+ return;
|
||||||
|
+ } else if (left_count > 0 && right_count == 0) {
|
||||||
|
+ apply_layout(m, node->left, area, 0);
|
||||||
|
+ return;
|
||||||
|
+ } else if (left_count == 0 && right_count > 0) {
|
||||||
|
+ apply_layout(m, node->right, area, 0);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If we’re here, we have visible clients in both subtrees. */
|
||||||
|
+ ratio = node->split_ratio;
|
||||||
|
+ if (ratio < 0.05f)
|
||||||
|
+ ratio = 0.05f;
|
||||||
|
+ if (ratio > 0.95f)
|
||||||
|
+ ratio = 0.95f;
|
||||||
|
+
|
||||||
|
+ memset(&left_area, 0, sizeof(left_area));
|
||||||
|
+ memset(&right_area, 0, sizeof(right_area));
|
||||||
|
+
|
||||||
|
+ if (node->is_split_vertically) {
|
||||||
|
+ mid = (unsigned int)(area.width * ratio);
|
||||||
|
+ left_area.x = area.x;
|
||||||
|
+ left_area.y = area.y;
|
||||||
|
+ left_area.width = mid;
|
||||||
|
+ left_area.height = area.height;
|
||||||
|
+
|
||||||
|
+ right_area.x = area.x + mid;
|
||||||
|
+ right_area.y = area.y;
|
||||||
|
+ right_area.width = area.width - mid;
|
||||||
|
+ right_area.height = area.height;
|
||||||
|
+
|
||||||
|
+ if (e) {
|
||||||
|
+ left_area.width -= gappx / 2;
|
||||||
|
+ right_area.x += gappx / 2;
|
||||||
|
+ right_area.width -= gappx / 2;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ /* horizontal split */
|
||||||
|
+ mid = (unsigned int)(area.height * ratio);
|
||||||
|
+ left_area.x = area.x;
|
||||||
|
+ left_area.y = area.y;
|
||||||
|
+ left_area.width = area.width;
|
||||||
|
+ left_area.height = mid;
|
||||||
|
+
|
||||||
|
+ right_area.x = area.x;
|
||||||
|
+ right_area.y = area.y + mid;
|
||||||
|
+ right_area.width = area.width;
|
||||||
|
+ right_area.height= area.height - mid;
|
||||||
|
+
|
||||||
|
+ if (e) {
|
||||||
|
+ left_area.height -= gappx / 2;
|
||||||
|
+ right_area.y += gappx / 2;
|
||||||
|
+ right_area.height -= gappx / 2;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ apply_layout(m, node->left, left_area, 0);
|
||||||
|
+ apply_layout(m, node->right, right_area, 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+btrtile(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ Client *c, *focused = NULL;
|
||||||
|
+ int n = 0;
|
||||||
|
+ LayoutNode *found;
|
||||||
|
+ struct wlr_box full_area;
|
||||||
|
+
|
||||||
|
+ if (!m)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ /* Remove non tiled clients from tree. */
|
||||||
|
+ wl_list_for_each(c, &clients, link) {
|
||||||
|
+ if (c->mon == m && !c->isfloating && !c->isfullscreen) {
|
||||||
|
+ } else {
|
||||||
|
+ remove_client(m, c);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If no client is found under cursor, fallback to focustop(m) */
|
||||||
|
+ if (!(focused = xytoclient(cursor->x, cursor->y)))
|
||||||
|
+ focused = focustop(m);
|
||||||
|
+
|
||||||
|
+ /* Insert visible clients that are not part of the tree. */
|
||||||
|
+ wl_list_for_each(c, &clients, link) {
|
||||||
|
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen && c->mon == m) {
|
||||||
|
+ found = find_client_node(m->root, c);
|
||||||
|
+ if (!found) {
|
||||||
|
+ insert_client(m, focused, c);
|
||||||
|
+ }
|
||||||
|
+ n++;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (n == 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ full_area = m->w;
|
||||||
|
+ apply_layout(m, m->root, full_area, 1);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+create_client_node(Client *c)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *node = calloc(1, sizeof(LayoutNode));
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return NULL;
|
||||||
|
+ node->is_client_node = 1;
|
||||||
|
+ node->split_ratio = 0.5f;
|
||||||
|
+ node->client = c;
|
||||||
|
+ return node;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+create_split_node(unsigned int is_split_vertically,
|
||||||
|
+ LayoutNode *left, LayoutNode *right)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *node = calloc(1, sizeof(LayoutNode));
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return NULL;
|
||||||
|
+ node->is_client_node = 0;
|
||||||
|
+ node->split_ratio = 0.5f;
|
||||||
|
+ node->is_split_vertically = is_split_vertically;
|
||||||
|
+ node->left = left;
|
||||||
|
+ node->right = right;
|
||||||
|
+ if (left)
|
||||||
|
+ left->split_node = node;
|
||||||
|
+ if (right)
|
||||||
|
+ right->split_node = node;
|
||||||
|
+ return node;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+destroy_node(LayoutNode *node)
|
||||||
|
+{
|
||||||
|
+ if (!node)
|
||||||
|
+ return;
|
||||||
|
+ if (!node->is_client_node) {
|
||||||
|
+ destroy_node(node->left);
|
||||||
|
+ destroy_node(node->right);
|
||||||
|
+ }
|
||||||
|
+ free(node);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+destroy_tree(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ if (!m || !m->root)
|
||||||
|
+ return;
|
||||||
|
+ destroy_node(m->root);
|
||||||
|
+ m->root = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+find_client_node(LayoutNode *node, Client *c)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *res;
|
||||||
|
+
|
||||||
|
+ if (!node || !c)
|
||||||
|
+ return NULL;
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ return (node->client == c) ? node : NULL;
|
||||||
|
+ }
|
||||||
|
+ res = find_client_node(node->left, c);
|
||||||
|
+ return res ? res : find_client_node(node->right, c);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+find_suitable_split(Monitor *m, LayoutNode *start_node,
|
||||||
|
+ unsigned int need_vertical, int focused_on_left)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *n = start_node, *child = NULL;
|
||||||
|
+
|
||||||
|
+ if (!m)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ if (n && n->is_client_node) {
|
||||||
|
+ child = n;
|
||||||
|
+ n = n->split_node;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ while (n) {
|
||||||
|
+ if (!n->is_client_node && n->is_split_vertically == need_vertical
|
||||||
|
+ && visible_count(n->left, m) > 0
|
||||||
|
+ && visible_count(n->right, m) > 0) {
|
||||||
|
+ if ((focused_on_left && n->left == child) ||
|
||||||
|
+ (!focused_on_left && n->right == child))
|
||||||
|
+ return n;
|
||||||
|
+ }
|
||||||
|
+ child = n;
|
||||||
|
+ n = n->split_node;
|
||||||
|
+ }
|
||||||
|
+ return NULL;
|
||||||
|
+}
|
||||||
|
+void
|
||||||
|
+init_tree(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ if (m)
|
||||||
|
+ m->root = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+insert_client(Monitor *m, Client *focused_client, Client *new_client)
|
||||||
|
+{
|
||||||
|
+ Client *old_client;
|
||||||
|
+ LayoutNode **root = &m->root, *old_root,
|
||||||
|
+ *focused_node, *new_client_node, *old_client_node;
|
||||||
|
+ unsigned int wider, mid_x, mid_y;
|
||||||
|
+
|
||||||
|
+ /* If no root , new client becomes the root. */
|
||||||
|
+ if (!*root) {
|
||||||
|
+ *root = create_client_node(new_client);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Find the focused_client node,
|
||||||
|
+ * if not found split the root. */
|
||||||
|
+ focused_node = focused_client ?
|
||||||
|
+ find_client_node(*root, focused_client) : NULL;
|
||||||
|
+ if (!focused_node) {
|
||||||
|
+ old_root = *root;
|
||||||
|
+ new_client_node = create_client_node(new_client);
|
||||||
|
+ *root = create_split_node(1, old_root, new_client_node);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Turn focused node from a client node into a split node,
|
||||||
|
+ * and attach old_client + new_client. */
|
||||||
|
+ old_client = focused_node->client;
|
||||||
|
+ old_client_node = create_client_node(old_client);
|
||||||
|
+ new_client_node = create_client_node(new_client);
|
||||||
|
+
|
||||||
|
+ /* Decide split direction. */
|
||||||
|
+ wider = (focused_client->geom.width >= focused_client->geom.height);
|
||||||
|
+ focused_node->is_client_node = 0;
|
||||||
|
+ focused_node->client = NULL;
|
||||||
|
+ focused_node->is_split_vertically = (wider ? 1 : 0);
|
||||||
|
+
|
||||||
|
+ /* Pick new_client side depending on the cursor position. */
|
||||||
|
+ mid_x = focused_client->geom.x + focused_client->geom.width / 2;
|
||||||
|
+ mid_y = focused_client->geom.y + focused_client->geom.height / 2;
|
||||||
|
+
|
||||||
|
+ if (wider) {
|
||||||
|
+ /* vertical split => left vs right */
|
||||||
|
+ if (cursor->x <= mid_x) {
|
||||||
|
+ focused_node->left = new_client_node;
|
||||||
|
+ focused_node->right = old_client_node;
|
||||||
|
+ } else {
|
||||||
|
+ focused_node->left = old_client_node;
|
||||||
|
+ focused_node->right = new_client_node;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ /* horizontal split => top vs bottom */
|
||||||
|
+ if (cursor->y <= mid_y) {
|
||||||
|
+ focused_node->left = new_client_node;
|
||||||
|
+ focused_node->right = old_client_node;
|
||||||
|
+ } else {
|
||||||
|
+ focused_node->left = old_client_node;
|
||||||
|
+ focused_node->right = new_client_node;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ old_client_node->split_node = focused_node;
|
||||||
|
+ new_client_node->split_node = focused_node;
|
||||||
|
+ focused_node->split_ratio = 0.5f;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+remove_client_node(LayoutNode *node, Client *c)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *tmp;
|
||||||
|
+ if (!node)
|
||||||
|
+ return NULL;
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ /* If this client_node is the client we're removing,
|
||||||
|
+ * return NULL to remove it */
|
||||||
|
+ if (node->client == c) {
|
||||||
|
+ free(node);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+ return node;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ node->left = remove_client_node(node->left, c);
|
||||||
|
+ node->right = remove_client_node(node->right, c);
|
||||||
|
+
|
||||||
|
+ /* If one of the client node is NULL after removal and the other is not,
|
||||||
|
+ * we "lift" the other client node up to replace this split node. */
|
||||||
|
+ if (!node->left && node->right) {
|
||||||
|
+ tmp = node->right;
|
||||||
|
+
|
||||||
|
+ /* Save pointer to split node */
|
||||||
|
+ if (tmp)
|
||||||
|
+ tmp->split_node = node->split_node;
|
||||||
|
+
|
||||||
|
+ free(node);
|
||||||
|
+ return tmp;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!node->right && node->left) {
|
||||||
|
+ tmp = node->left;
|
||||||
|
+
|
||||||
|
+ /* Save pointer to split node */
|
||||||
|
+ if (tmp)
|
||||||
|
+ tmp->split_node = node->split_node;
|
||||||
|
+
|
||||||
|
+ free(node);
|
||||||
|
+ return tmp;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If both children exist or both are NULL (empty tree),
|
||||||
|
+ * return node as is. */
|
||||||
|
+ return node;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+remove_client(Monitor *m, Client *c)
|
||||||
|
+{
|
||||||
|
+ if (!m->root || !c)
|
||||||
|
+ return;
|
||||||
|
+ m->root = remove_client_node(m->root, c);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+setratio(unsigned int need_vertical, const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ Client *sel;
|
||||||
|
+ LayoutNode *client_node, *split_node;
|
||||||
|
+ float new_ratio;
|
||||||
|
+ int focused_on_left;
|
||||||
|
+
|
||||||
|
+ if (!selmon || !selmon->lt[selmon->sellt]->arrange)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ sel = focustop(selmon);
|
||||||
|
+ if (!sel)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ client_node = find_client_node(selmon->root, sel);
|
||||||
|
+ if (!client_node)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ focused_on_left = (arg->f >= 0.0f);
|
||||||
|
+
|
||||||
|
+ split_node = find_suitable_split(selmon, client_node, need_vertical, focused_on_left);
|
||||||
|
+
|
||||||
|
+ if (!split_node)
|
||||||
|
+ split_node = find_suitable_split(selmon, client_node, need_vertical, !focused_on_left);
|
||||||
|
+ if (!split_node)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ new_ratio = (arg->f != 0.0f) ? (split_node->split_ratio + arg->f) : 0.5f;
|
||||||
|
+ if (new_ratio < 0.05f)
|
||||||
|
+ new_ratio = 0.05f;
|
||||||
|
+ if (new_ratio > 0.95f)
|
||||||
|
+ new_ratio = 0.95f;
|
||||||
|
+ split_node->split_ratio = new_ratio;
|
||||||
|
+
|
||||||
|
+ apply_layout(selmon, selmon->root, selmon->w, 1);
|
||||||
|
+ /* Skip the arrange when called from motionnotify; that path calls
|
||||||
|
+ * arrange itself after rate-limiting. */
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+setratio_h(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setratio(1, arg);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+setratio_v(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setratio(0, arg);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void swapclients(const Arg *arg) {
|
||||||
|
+ Client *c, *tmp, *target = NULL, *sel = focustop(selmon);
|
||||||
|
+ LayoutNode *sel_node, *target_node;
|
||||||
|
+ int closest_dist = INT_MAX, dist, sel_center_x, sel_center_y,
|
||||||
|
+ cand_center_x, cand_center_y;
|
||||||
|
+
|
||||||
|
+ if (!sel || sel->isfullscreen ||
|
||||||
|
+ !selmon->root || !selmon->lt[selmon->sellt]->arrange)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ /* Get the center coordinates of the selected client */
|
||||||
|
+ sel_center_x = sel->geom.x + sel->geom.width / 2;
|
||||||
|
+ sel_center_y = sel->geom.y + sel->geom.height / 2;
|
||||||
|
+
|
||||||
|
+ wl_list_for_each(c, &clients, link) {
|
||||||
|
+ if (!VISIBLEON(c, selmon) || c->isfloating || c->isfullscreen || c == sel)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ /* Get the center of candidate client */
|
||||||
|
+ cand_center_x = c->geom.x + c->geom.width / 2;
|
||||||
|
+ cand_center_y = c->geom.y + c->geom.height / 2;
|
||||||
|
+
|
||||||
|
+ /* Check that the candidate lies in the requested direction. */
|
||||||
|
+ switch (arg->ui) {
|
||||||
|
+ case 0:
|
||||||
|
+ if (cand_center_x >= sel_center_x)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ case 1:
|
||||||
|
+ if (cand_center_x <= sel_center_x)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ case 2:
|
||||||
|
+ if (cand_center_y >= sel_center_y)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ case 3:
|
||||||
|
+ if (cand_center_y <= sel_center_y)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Get distance between the centers */
|
||||||
|
+ dist = abs(sel_center_x - cand_center_x) + abs(sel_center_y - cand_center_y);
|
||||||
|
+ if (dist < closest_dist) {
|
||||||
|
+ closest_dist = dist;
|
||||||
|
+ target = c;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If target is found, swap the two clients’ positions in the layout tree */
|
||||||
|
+ if (target) {
|
||||||
|
+ sel_node = find_client_node(selmon->root, sel);
|
||||||
|
+ target_node = find_client_node(selmon->root, target);
|
||||||
|
+ if (sel_node && target_node) {
|
||||||
|
+ tmp = sel_node->client;
|
||||||
|
+ sel_node->client = target_node->client;
|
||||||
|
+ target_node->client = tmp;
|
||||||
|
+ arrange(selmon);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+unsigned int
|
||||||
|
+visible_count(LayoutNode *node, Monitor *m)
|
||||||
|
+{
|
||||||
|
+ Client *c;
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return 0;
|
||||||
|
+ /* Check if this client is visible. */
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ c = node->client;
|
||||||
|
+ if (c && VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen)
|
||||||
|
+ return 1;
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ /* Else it’s a split node. */
|
||||||
|
+ return visible_count(node->left, m) + visible_count(node->right, m);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+Client *
|
||||||
|
+xytoclient(double x, double y) {
|
||||||
|
+ Monitor *m = xytomon(x, y);
|
||||||
|
+ Client *c, *closest = NULL;
|
||||||
|
+ double dist, mindist = INT_MAX, dx, dy;
|
||||||
|
+
|
||||||
|
+ wl_list_for_each_reverse(c, &clients, link) {
|
||||||
|
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen &&
|
||||||
|
+ x >= c->geom.x && x <= (c->geom.x + c->geom.width) &&
|
||||||
|
+ y >= c->geom.y && y <= (c->geom.y + c->geom.height)){
|
||||||
|
+ return c;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If no client was found at cursor position fallback to closest. */
|
||||||
|
+ wl_list_for_each_reverse(c, &clients, link) {
|
||||||
|
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen) {
|
||||||
|
+ dx = 0, dy = 0;
|
||||||
|
+
|
||||||
|
+ if (x < c->geom.x)
|
||||||
|
+ dx = c->geom.x - x;
|
||||||
|
+ else if (x > (c->geom.x + c->geom.width))
|
||||||
|
+ dx = x - (c->geom.x + c->geom.width);
|
||||||
|
+
|
||||||
|
+ if (y < c->geom.y)
|
||||||
|
+ dy = c->geom.y - y;
|
||||||
|
+ else if (y > (c->geom.y + c->geom.height))
|
||||||
|
+ dy = y - (c->geom.y + c->geom.height);
|
||||||
|
+
|
||||||
|
+ dist = dx * dx + dy * dy;
|
||||||
|
+ if (dist < mindist) {
|
||||||
|
+ mindist = dist;
|
||||||
|
+ closest = c;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ return closest;
|
||||||
|
+}
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 8a6eda0..bc04e3f 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -13,7 +13,10 @@ static const float focuscolor[] = COLOR(0x005577ff);
|
||||||
|
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||||
|
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||||
|
static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */
|
||||||
|
+static const float resize_factor = 0.0002f; /* Resize multiplier for mouse resizing, depends on mouse sensivity. */
|
||||||
|
+static const uint32_t resize_interval_ms = 16; /* Resize interval depends on framerate and screen refresh rate. */
|
||||||
|
|
||||||
|
+enum Direction { DIR_LEFT, DIR_RIGHT, DIR_UP, DIR_DOWN };
|
||||||
|
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||||
|
#define TAGCOUNT (9)
|
||||||
|
|
||||||
|
@@ -30,6 +33,7 @@ static const Rule rules[] = {
|
||||||
|
/* layout(s) */
|
||||||
|
static const Layout layouts[] = {
|
||||||
|
/* symbol arrange function */
|
||||||
|
+ { "|w|", btrtile },
|
||||||
|
{ "[]=", tile },
|
||||||
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
@@ -144,6 +148,14 @@ static const Key keys[] = {
|
||||||
|
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Up, swapclients, {.i = DIR_UP} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Down, swapclients, {.i = DIR_DOWN} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Right, swapclients, {.i = DIR_RIGHT} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Left, swapclients, {.i = DIR_LEFT} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Right, setratio_h, {.f = +0.025f} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Left, setratio_h, {.f = -0.025f} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Up, setratio_v, {.f = -0.025f} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Down, setratio_v, {.f = +0.025f} },
|
||||||
|
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
||||||
|
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
||||||
|
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index 8101ffa..c9650c1 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
/*
|
||||||
|
* See LICENSE file for copyright and license details.
|
||||||
|
*/
|
||||||
|
+#include <limits.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
#include <libinput.h>
|
||||||
|
#include <linux/input-event-codes.h>
|
||||||
|
@@ -104,6 +105,7 @@ typedef struct {
|
||||||
|
const Arg arg;
|
||||||
|
} Button;
|
||||||
|
|
||||||
|
+typedef struct LayoutNode LayoutNode;
|
||||||
|
typedef struct Monitor Monitor;
|
||||||
|
typedef struct {
|
||||||
|
/* Must keep this field first */
|
||||||
|
@@ -141,8 +143,9 @@ typedef struct {
|
||||||
|
#endif
|
||||||
|
unsigned int bw;
|
||||||
|
uint32_t tags;
|
||||||
|
- int isfloating, isurgent, isfullscreen;
|
||||||
|
+ int isfloating, isurgent, isfullscreen, was_tiled;
|
||||||
|
uint32_t resize; /* configure serial of a pending resize */
|
||||||
|
+ struct wlr_box old_geom;
|
||||||
|
} Client;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
@@ -209,6 +212,7 @@ struct Monitor {
|
||||||
|
int nmaster;
|
||||||
|
char ltsymbol[16];
|
||||||
|
int asleep;
|
||||||
|
+ LayoutNode *root;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
@@ -251,6 +255,7 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||||
|
struct wlr_box *usable_area, int exclusive);
|
||||||
|
static void arrangelayers(Monitor *m);
|
||||||
|
static void axisnotify(struct wl_listener *listener, void *data);
|
||||||
|
+static void btrtile(Monitor *m);
|
||||||
|
static void buttonpress(struct wl_listener *listener, void *data);
|
||||||
|
static void chvt(const Arg *arg);
|
||||||
|
static void checkidleinhibitor(struct wlr_surface *exclude);
|
||||||
|
@@ -333,6 +338,9 @@ static void setmon(Client *c, Monitor *m, uint32_t newtags);
|
||||||
|
static void setpsel(struct wl_listener *listener, void *data);
|
||||||
|
static void setsel(struct wl_listener *listener, void *data);
|
||||||
|
static void setup(void);
|
||||||
|
+static void setratio_h(const Arg *arg);
|
||||||
|
+static void setratio_v(const Arg *arg);
|
||||||
|
+static void swapclients(const Arg *arg);
|
||||||
|
static void spawn(const Arg *arg);
|
||||||
|
static void startdrag(struct wl_listener *listener, void *data);
|
||||||
|
static void tag(const Arg *arg);
|
||||||
|
@@ -458,6 +466,7 @@ static struct wlr_xwayland *xwayland;
|
||||||
|
|
||||||
|
/* attempt to encapsulate suck into one file */
|
||||||
|
#include "client.h"
|
||||||
|
+#include "btrtile.c"
|
||||||
|
|
||||||
|
/* function implementations */
|
||||||
|
void
|
||||||
|
@@ -628,7 +637,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
struct wlr_pointer_button_event *event = data;
|
||||||
|
struct wlr_keyboard *keyboard;
|
||||||
|
uint32_t mods;
|
||||||
|
- Client *c;
|
||||||
|
+ Client *c, *target = NULL;
|
||||||
|
const Button *b;
|
||||||
|
|
||||||
|
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||||
|
@@ -649,7 +658,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
mods = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0;
|
||||||
|
for (b = buttons; b < END(buttons); b++) {
|
||||||
|
if (CLEANMASK(mods) == CLEANMASK(b->mod) &&
|
||||||
|
- event->button == b->button && b->func) {
|
||||||
|
+ event->button == b->button && b->func) {
|
||||||
|
b->func(&b->arg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@@ -659,6 +668,21 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
/* If you released any buttons, we exit interactive move/resize mode. */
|
||||||
|
/* TODO: should reset to the pointer focus's current setcursor */
|
||||||
|
if (!locked && cursor_mode != CurNormal && cursor_mode != CurPressed) {
|
||||||
|
+ c = grabc;
|
||||||
|
+ if (c && c->was_tiled && !strcmp(selmon->ltsymbol, "|w|")) {
|
||||||
|
+ if (cursor_mode == CurMove && c->isfloating) {
|
||||||
|
+ target = xytoclient(cursor->x, cursor->y);
|
||||||
|
+
|
||||||
|
+ if (target && !target->isfloating && !target->isfullscreen)
|
||||||
|
+ insert_client(selmon, target, c);
|
||||||
|
+ else
|
||||||
|
+ selmon->root = create_client_node(c);
|
||||||
|
+
|
||||||
|
+ setfloating(c, 0);
|
||||||
|
+ apply_layout(selmon, selmon->root, selmon->w, 1);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ /* Default behaviour */
|
||||||
|
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
||||||
|
cursor_mode = CurNormal;
|
||||||
|
/* Drop the window off on its new monitor */
|
||||||
|
@@ -750,6 +774,7 @@ cleanupmon(struct wl_listener *listener, void *data)
|
||||||
|
wlr_output_layout_remove(output_layout, m->wlr_output);
|
||||||
|
wlr_scene_output_destroy(m->scene_output);
|
||||||
|
|
||||||
|
+ destroy_tree(m);
|
||||||
|
closemon(m);
|
||||||
|
wlr_scene_node_destroy(&m->fullscreen_bg->node);
|
||||||
|
free(m);
|
||||||
|
@@ -1094,6 +1119,7 @@ createmon(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
|
wl_list_insert(&mons, &m->link);
|
||||||
|
printstatus();
|
||||||
|
+ init_tree(m);
|
||||||
|
|
||||||
|
/* The xdg-protocol specifies:
|
||||||
|
*
|
||||||
|
@@ -1332,10 +1358,18 @@ void
|
||||||
|
destroynotify(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
/* Called when the xdg_toplevel is destroyed. */
|
||||||
|
+ Monitor *mon;
|
||||||
|
Client *c = wl_container_of(listener, c, destroy);
|
||||||
|
wl_list_remove(&c->destroy.link);
|
||||||
|
wl_list_remove(&c->set_title.link);
|
||||||
|
wl_list_remove(&c->fullscreen.link);
|
||||||
|
+ /* We check if the destroyed client was part of any tiled_list, to catch
|
||||||
|
+ * client removals even if they would not be currently managed by btrtile */
|
||||||
|
+ wl_list_for_each(mon, &mons, link) {
|
||||||
|
+ if (mon->root) {
|
||||||
|
+ remove_client(mon, c);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
#ifdef XWAYLAND
|
||||||
|
if (c->type != XDGShell) {
|
||||||
|
wl_list_remove(&c->activate.link);
|
||||||
|
@@ -1866,7 +1900,8 @@ void
|
||||||
|
motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double dy,
|
||||||
|
double dx_unaccel, double dy_unaccel)
|
||||||
|
{
|
||||||
|
- double sx = 0, sy = 0, sx_confined, sy_confined;
|
||||||
|
+ int tiled = 0;
|
||||||
|
+ double sx = 0, sy = 0, sx_confined, sy_confined, dx_total, dy_total;
|
||||||
|
Client *c = NULL, *w = NULL;
|
||||||
|
LayerSurface *l = NULL;
|
||||||
|
struct wlr_surface *surface = NULL;
|
||||||
|
@@ -1920,18 +1955,55 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
|
||||||
|
/* Update drag icon's position */
|
||||||
|
wlr_scene_node_set_position(&drag_icon->node, (int)round(cursor->x), (int)round(cursor->y));
|
||||||
|
|
||||||
|
- /* If we are currently grabbing the mouse, handle and return */
|
||||||
|
+ /* Skip if internal call */
|
||||||
|
+ if (time == 0)
|
||||||
|
+ goto focus;
|
||||||
|
+
|
||||||
|
+ tiled = grabc && !grabc->isfloating && !grabc->isfullscreen;
|
||||||
|
if (cursor_mode == CurMove) {
|
||||||
|
/* Move the grabbed client to the new position. */
|
||||||
|
- resize(grabc, (struct wlr_box){.x = (int)round(cursor->x) - grabcx, .y = (int)round(cursor->y) - grabcy,
|
||||||
|
- .width = grabc->geom.width, .height = grabc->geom.height}, 1);
|
||||||
|
- return;
|
||||||
|
+ if (grabc && grabc->isfloating) {
|
||||||
|
+ resize(grabc, (struct wlr_box){
|
||||||
|
+ .x = (int)round(cursor->x) - grabcx,
|
||||||
|
+ .y = (int)round(cursor->y) - grabcy,
|
||||||
|
+ .width = grabc->geom.width,
|
||||||
|
+ .height = grabc->geom.height
|
||||||
|
+ }, 1);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
} else if (cursor_mode == CurResize) {
|
||||||
|
- resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y,
|
||||||
|
- .width = (int)round(cursor->x) - grabc->geom.x, .height = (int)round(cursor->y) - grabc->geom.y}, 1);
|
||||||
|
- return;
|
||||||
|
+ if (tiled) {
|
||||||
|
+ dx_total = cursor->x - resize_last_update_x;
|
||||||
|
+ dy_total = cursor->y - resize_last_update_y;
|
||||||
|
+
|
||||||
|
+ if (time - last_resize_time >= resize_interval_ms) {
|
||||||
|
+ Arg a = {0};
|
||||||
|
+ if (fabs(dx_total) > fabs(dy_total)) {
|
||||||
|
+ a.f = (float)(dx_total * resize_factor);
|
||||||
|
+ setratio_h(&a);
|
||||||
|
+ } else {
|
||||||
|
+ a.f = (float)(dy_total * resize_factor);
|
||||||
|
+ setratio_v(&a);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ last_resize_time = time;
|
||||||
|
+ resize_last_update_x = cursor->x;
|
||||||
|
+ resize_last_update_y = cursor->y;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ } else if (grabc && grabc->isfloating) {
|
||||||
|
+ /* Floating resize as original */
|
||||||
|
+ resize(grabc, (struct wlr_box){
|
||||||
|
+ .x = grabc->geom.x,
|
||||||
|
+ .y = grabc->geom.y,
|
||||||
|
+ .width = (int)round(cursor->x) - grabc->geom.x,
|
||||||
|
+ .height = (int)round(cursor->y) - grabc->geom.y
|
||||||
|
+ }, 1);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
+focus:
|
||||||
|
/* If there's no client surface under the cursor, set the cursor image to a
|
||||||
|
* default. This is what makes the cursor image appear when you move it
|
||||||
|
* off of a client or over its border. */
|
||||||
|
@@ -1965,22 +2037,40 @@ moveresize(const Arg *arg)
|
||||||
|
if (!grabc || client_is_unmanaged(grabc) || grabc->isfullscreen)
|
||||||
|
return;
|
||||||
|
|
||||||
|
- /* Float the window and tell motionnotify to grab it */
|
||||||
|
- setfloating(grabc, 1);
|
||||||
|
- switch (cursor_mode = arg->ui) {
|
||||||
|
- case CurMove:
|
||||||
|
- grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||||
|
- grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||||
|
- wlr_cursor_set_xcursor(cursor, cursor_mgr, "all-scroll");
|
||||||
|
- break;
|
||||||
|
- case CurResize:
|
||||||
|
- /* Doesn't work for X11 output - the next absolute motion event
|
||||||
|
- * returns the cursor to where it started */
|
||||||
|
- wlr_cursor_warp_closest(cursor, NULL,
|
||||||
|
- grabc->geom.x + grabc->geom.width,
|
||||||
|
- grabc->geom.y + grabc->geom.height);
|
||||||
|
- wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||||
|
- break;
|
||||||
|
+ cursor_mode = arg->ui;
|
||||||
|
+ grabc->was_tiled = (!grabc->isfloating && !grabc->isfullscreen);
|
||||||
|
+
|
||||||
|
+ if (grabc->was_tiled) {
|
||||||
|
+ switch (cursor_mode) {
|
||||||
|
+ case CurMove:
|
||||||
|
+ setfloating(grabc, 1);
|
||||||
|
+ grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||||
|
+ grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
|
||||||
|
+ break;
|
||||||
|
+ case CurResize:
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||||
|
+ resize_last_update_x = cursor->x;
|
||||||
|
+ resize_last_update_y = cursor->y;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ /* Default floating logic */
|
||||||
|
+ /* Float the window and tell motionnotify to grab it */
|
||||||
|
+ setfloating(grabc, 1);
|
||||||
|
+ switch (cursor_mode) {
|
||||||
|
+ case CurMove:
|
||||||
|
+ grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||||
|
+ grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
|
||||||
|
+ break;
|
||||||
|
+ case CurResize:
|
||||||
|
+ wlr_cursor_warp_closest(cursor, NULL,
|
||||||
|
+ grabc->geom.x + grabc->geom.width,
|
||||||
|
+ grabc->geom.y + grabc->geom.height);
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -2833,6 +2923,14 @@ unmapnotify(struct wl_listener *listener, void *data)
|
||||||
|
focusclient(focustop(selmon), 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
+ /* btrtile remove clients for each monitor */
|
||||||
|
+ Monitor *mon;
|
||||||
|
+ wl_list_for_each(mon, &mons, link) {
|
||||||
|
+ if (mon->root) {
|
||||||
|
+ remove_client(mon, c);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
wl_list_remove(&c->link);
|
||||||
|
setmon(c, NULL, 0);
|
||||||
|
wl_list_remove(&c->flink);
|
||||||
|
--
|
||||||
|
2.53.0
|
||||||
|
|
||||||
@@ -0,0 +1,910 @@
|
|||||||
|
From 47cb7ad9f669643765cafa4c2ecd1a4850bca893 Mon Sep 17 00:00:00 2001
|
||||||
|
From: julmajustus <julmajustus@tutanota.com>
|
||||||
|
Date: Thu, 21 May 2026 00:39:56 +0300
|
||||||
|
Subject: [PATCH] btrtile: Spring update pt2
|
||||||
|
|
||||||
|
- Simplified the resizing logic to avoid full arrange calls from
|
||||||
|
motionnotify
|
||||||
|
- Minor intend fixes
|
||||||
|
---
|
||||||
|
btrtile.c | 564 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
config.def.h | 12 ++
|
||||||
|
dwl.c | 152 +++++++++++---
|
||||||
|
3 files changed, 701 insertions(+), 27 deletions(-)
|
||||||
|
create mode 100644 btrtile.c
|
||||||
|
|
||||||
|
diff --git a/btrtile.c b/btrtile.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..357ffb9
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/btrtile.c
|
||||||
|
@@ -0,0 +1,564 @@
|
||||||
|
+/* ************************************************************************** */
|
||||||
|
+/* @@@ @@@@@@@@ */
|
||||||
|
+/* @@@ @@@@@@@@@@ */
|
||||||
|
+/* @@! @@! @@@@ */
|
||||||
|
+/* !@! !@! @!@!@ */
|
||||||
|
+/* btrtile.c @!! @!@ @! !@! */
|
||||||
|
+/* !!! !@!!! !!! */
|
||||||
|
+/* By: julmajustus <julmajustus@tutanota.com> !!: !!:! !!! */
|
||||||
|
+/* ::! :!: !:! */
|
||||||
|
+/* Created: 2024/12/15 00:26:07 by julmajustus :: ::::::: :: */
|
||||||
|
+/* Updated: 2026/05/20 22:51:54 by julmajustus : : : : : : */
|
||||||
|
+/* */
|
||||||
|
+/* ************************************************************************** */
|
||||||
|
+
|
||||||
|
+typedef struct LayoutNode {
|
||||||
|
+ unsigned int is_client_node;
|
||||||
|
+ unsigned int is_split_vertically;
|
||||||
|
+ float split_ratio;
|
||||||
|
+ struct LayoutNode *left;
|
||||||
|
+ struct LayoutNode *right;
|
||||||
|
+ struct LayoutNode *split_node;
|
||||||
|
+ Client *client;
|
||||||
|
+} LayoutNode;
|
||||||
|
+
|
||||||
|
+static void apply_layout(Monitor *m, LayoutNode *node,
|
||||||
|
+ struct wlr_box area, unsigned int is_root);
|
||||||
|
+static void btrtile(Monitor *m);
|
||||||
|
+static LayoutNode *create_client_node(Client *c);
|
||||||
|
+static LayoutNode *create_split_node(unsigned int is_split_vertically,
|
||||||
|
+ LayoutNode *left, LayoutNode *right);
|
||||||
|
+static void destroy_node(LayoutNode *node);
|
||||||
|
+static void destroy_tree(Monitor *m);
|
||||||
|
+static LayoutNode *find_client_node(LayoutNode *node, Client *c);
|
||||||
|
+static LayoutNode *find_suitable_split(Monitor *m, LayoutNode *start,
|
||||||
|
+ unsigned int need_vertical, int focused_on_left);
|
||||||
|
+static void init_tree(Monitor *m);
|
||||||
|
+static void insert_client(Monitor *m, Client *focused_client, Client *new_client);
|
||||||
|
+static LayoutNode *remove_client_node(LayoutNode *node, Client *c);
|
||||||
|
+static void remove_client(Monitor *m, Client *c);
|
||||||
|
+static void setratio_h(const Arg *arg);
|
||||||
|
+static void setratio_v(const Arg *arg);
|
||||||
|
+static void swapclients(const Arg *arg);
|
||||||
|
+static unsigned int visible_count(LayoutNode *node, Monitor *m);
|
||||||
|
+static Client *xytoclient(double x, double y);
|
||||||
|
+
|
||||||
|
+static double resize_last_update_x, resize_last_update_y;
|
||||||
|
+static uint32_t last_resize_time = 0;
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+apply_layout(Monitor *m, LayoutNode *node,
|
||||||
|
+ struct wlr_box area, unsigned int is_root)
|
||||||
|
+{
|
||||||
|
+ Client *c;
|
||||||
|
+ float ratio;
|
||||||
|
+ unsigned int left_count, right_count, mid;
|
||||||
|
+ struct wlr_box left_area, right_area;
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ /* If this node is a client node, check if it is visible. */
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ c = node->client;
|
||||||
|
+ if (!c || !VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||||
|
+ return;
|
||||||
|
+ if (area.x == c->old_geom.x && area.y == c->old_geom.y &&
|
||||||
|
+ area.width == c->old_geom.width && area.height == c->old_geom.height)
|
||||||
|
+ return;
|
||||||
|
+ resize(c, area, 0);
|
||||||
|
+ c->old_geom = area;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* For a split node, we see how many visible children are on each side: */
|
||||||
|
+ left_count = visible_count(node->left, m);
|
||||||
|
+ right_count = visible_count(node->right, m);
|
||||||
|
+
|
||||||
|
+ if (left_count == 0 && right_count == 0) {
|
||||||
|
+ return;
|
||||||
|
+ } else if (left_count > 0 && right_count == 0) {
|
||||||
|
+ apply_layout(m, node->left, area, 0);
|
||||||
|
+ return;
|
||||||
|
+ } else if (left_count == 0 && right_count > 0) {
|
||||||
|
+ apply_layout(m, node->right, area, 0);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If we’re here, we have visible clients in both subtrees. */
|
||||||
|
+ ratio = node->split_ratio;
|
||||||
|
+ if (ratio < 0.05f)
|
||||||
|
+ ratio = 0.05f;
|
||||||
|
+ if (ratio > 0.95f)
|
||||||
|
+ ratio = 0.95f;
|
||||||
|
+
|
||||||
|
+ memset(&left_area, 0, sizeof(left_area));
|
||||||
|
+ memset(&right_area, 0, sizeof(right_area));
|
||||||
|
+
|
||||||
|
+ if (node->is_split_vertically) {
|
||||||
|
+ mid = (unsigned int)(area.width * ratio);
|
||||||
|
+ left_area.x = area.x;
|
||||||
|
+ left_area.y = area.y;
|
||||||
|
+ left_area.width = mid;
|
||||||
|
+ left_area.height = area.height;
|
||||||
|
+
|
||||||
|
+ right_area.x = area.x + mid;
|
||||||
|
+ right_area.y = area.y;
|
||||||
|
+ right_area.width = area.width - mid;
|
||||||
|
+ right_area.height = area.height;
|
||||||
|
+ } else {
|
||||||
|
+ /* horizontal split */
|
||||||
|
+ mid = (unsigned int)(area.height * ratio);
|
||||||
|
+ left_area.x = area.x;
|
||||||
|
+ left_area.y = area.y;
|
||||||
|
+ left_area.width = area.width;
|
||||||
|
+ left_area.height = mid;
|
||||||
|
+
|
||||||
|
+ right_area.x = area.x;
|
||||||
|
+ right_area.y = area.y + mid;
|
||||||
|
+ right_area.width = area.width;
|
||||||
|
+ right_area.height= area.height - mid;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ apply_layout(m, node->left, left_area, 0);
|
||||||
|
+ apply_layout(m, node->right, right_area, 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+btrtile(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ Client *c, *focused = NULL;
|
||||||
|
+ int n = 0;
|
||||||
|
+ LayoutNode *found;
|
||||||
|
+ struct wlr_box full_area;
|
||||||
|
+
|
||||||
|
+ if (!m)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ /* Remove non tiled clients from tree. */
|
||||||
|
+ wl_list_for_each(c, &clients, link) {
|
||||||
|
+ if (c->mon == m && !c->isfloating && !c->isfullscreen) {
|
||||||
|
+ } else {
|
||||||
|
+ remove_client(m, c);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If no client is found under cursor, fallback to focustop(m) */
|
||||||
|
+ if (!(focused = xytoclient(cursor->x, cursor->y)))
|
||||||
|
+ focused = focustop(m);
|
||||||
|
+
|
||||||
|
+ /* Insert visible clients that are not part of the tree. */
|
||||||
|
+ wl_list_for_each(c, &clients, link) {
|
||||||
|
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen && c->mon == m) {
|
||||||
|
+ found = find_client_node(m->root, c);
|
||||||
|
+ if (!found) {
|
||||||
|
+ insert_client(m, focused, c);
|
||||||
|
+ }
|
||||||
|
+ n++;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (n == 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ full_area = m->w;
|
||||||
|
+ apply_layout(m, m->root, full_area, 1);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+create_client_node(Client *c)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *node = calloc(1, sizeof(LayoutNode));
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return NULL;
|
||||||
|
+ node->is_client_node = 1;
|
||||||
|
+ node->split_ratio = 0.5f;
|
||||||
|
+ node->client = c;
|
||||||
|
+ return node;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+create_split_node(unsigned int is_split_vertically,
|
||||||
|
+ LayoutNode *left, LayoutNode *right)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *node = calloc(1, sizeof(LayoutNode));
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return NULL;
|
||||||
|
+ node->is_client_node = 0;
|
||||||
|
+ node->split_ratio = 0.5f;
|
||||||
|
+ node->is_split_vertically = is_split_vertically;
|
||||||
|
+ node->left = left;
|
||||||
|
+ node->right = right;
|
||||||
|
+ if (left)
|
||||||
|
+ left->split_node = node;
|
||||||
|
+ if (right)
|
||||||
|
+ right->split_node = node;
|
||||||
|
+ return node;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+destroy_node(LayoutNode *node)
|
||||||
|
+{
|
||||||
|
+ if (!node)
|
||||||
|
+ return;
|
||||||
|
+ if (!node->is_client_node) {
|
||||||
|
+ destroy_node(node->left);
|
||||||
|
+ destroy_node(node->right);
|
||||||
|
+ }
|
||||||
|
+ free(node);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+destroy_tree(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ if (!m || !m->root)
|
||||||
|
+ return;
|
||||||
|
+ destroy_node(m->root);
|
||||||
|
+ m->root = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+find_client_node(LayoutNode *node, Client *c)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *res;
|
||||||
|
+
|
||||||
|
+ if (!node || !c)
|
||||||
|
+ return NULL;
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ return (node->client == c) ? node : NULL;
|
||||||
|
+ }
|
||||||
|
+ res = find_client_node(node->left, c);
|
||||||
|
+ return res ? res : find_client_node(node->right, c);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+find_suitable_split(Monitor *m, LayoutNode *start_node,
|
||||||
|
+ unsigned int need_vertical, int focused_on_left)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *n = start_node, *child = NULL;
|
||||||
|
+
|
||||||
|
+ if (!m)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ if (n && n->is_client_node) {
|
||||||
|
+ child = n;
|
||||||
|
+ n = n->split_node;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ while (n) {
|
||||||
|
+ if (!n->is_client_node && n->is_split_vertically == need_vertical
|
||||||
|
+ && visible_count(n->left, m) > 0
|
||||||
|
+ && visible_count(n->right, m) > 0) {
|
||||||
|
+ if ((focused_on_left && n->left == child) ||
|
||||||
|
+ (!focused_on_left && n->right == child))
|
||||||
|
+ return n;
|
||||||
|
+ }
|
||||||
|
+ child = n;
|
||||||
|
+ n = n->split_node;
|
||||||
|
+ }
|
||||||
|
+ return NULL;
|
||||||
|
+}
|
||||||
|
+void
|
||||||
|
+init_tree(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ if (m)
|
||||||
|
+ m->root = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+insert_client(Monitor *m, Client *focused_client, Client *new_client)
|
||||||
|
+{
|
||||||
|
+ Client *old_client;
|
||||||
|
+ LayoutNode **root = &m->root, *old_root,
|
||||||
|
+ *focused_node, *new_client_node, *old_client_node;
|
||||||
|
+ unsigned int wider, mid_x, mid_y;
|
||||||
|
+
|
||||||
|
+ /* If no root , new client becomes the root. */
|
||||||
|
+ if (!*root) {
|
||||||
|
+ *root = create_client_node(new_client);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Find the focused_client node,
|
||||||
|
+ * if not found split the root. */
|
||||||
|
+ focused_node = focused_client ?
|
||||||
|
+ find_client_node(*root, focused_client) : NULL;
|
||||||
|
+ if (!focused_node) {
|
||||||
|
+ old_root = *root;
|
||||||
|
+ new_client_node = create_client_node(new_client);
|
||||||
|
+ *root = create_split_node(1, old_root, new_client_node);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Turn focused node from a client node into a split node,
|
||||||
|
+ * and attach old_client + new_client. */
|
||||||
|
+ old_client = focused_node->client;
|
||||||
|
+ old_client_node = create_client_node(old_client);
|
||||||
|
+ new_client_node = create_client_node(new_client);
|
||||||
|
+
|
||||||
|
+ /* Decide split direction. */
|
||||||
|
+ wider = (focused_client->geom.width >= focused_client->geom.height);
|
||||||
|
+ focused_node->is_client_node = 0;
|
||||||
|
+ focused_node->client = NULL;
|
||||||
|
+ focused_node->is_split_vertically = (wider ? 1 : 0);
|
||||||
|
+
|
||||||
|
+ /* Pick new_client side depending on the cursor position. */
|
||||||
|
+ mid_x = focused_client->geom.x + focused_client->geom.width / 2;
|
||||||
|
+ mid_y = focused_client->geom.y + focused_client->geom.height / 2;
|
||||||
|
+
|
||||||
|
+ if (wider) {
|
||||||
|
+ /* vertical split => left vs right */
|
||||||
|
+ if (cursor->x <= mid_x) {
|
||||||
|
+ focused_node->left = new_client_node;
|
||||||
|
+ focused_node->right = old_client_node;
|
||||||
|
+ } else {
|
||||||
|
+ focused_node->left = old_client_node;
|
||||||
|
+ focused_node->right = new_client_node;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ /* horizontal split => top vs bottom */
|
||||||
|
+ if (cursor->y <= mid_y) {
|
||||||
|
+ focused_node->left = new_client_node;
|
||||||
|
+ focused_node->right = old_client_node;
|
||||||
|
+ } else {
|
||||||
|
+ focused_node->left = old_client_node;
|
||||||
|
+ focused_node->right = new_client_node;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ old_client_node->split_node = focused_node;
|
||||||
|
+ new_client_node->split_node = focused_node;
|
||||||
|
+ focused_node->split_ratio = 0.5f;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+LayoutNode *
|
||||||
|
+remove_client_node(LayoutNode *node, Client *c)
|
||||||
|
+{
|
||||||
|
+ LayoutNode *tmp;
|
||||||
|
+ if (!node)
|
||||||
|
+ return NULL;
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ /* If this client_node is the client we're removing,
|
||||||
|
+ * return NULL to remove it */
|
||||||
|
+ if (node->client == c) {
|
||||||
|
+ free(node);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+ return node;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ node->left = remove_client_node(node->left, c);
|
||||||
|
+ node->right = remove_client_node(node->right, c);
|
||||||
|
+
|
||||||
|
+ /* If one of the client node is NULL after removal and the other is not,
|
||||||
|
+ * we "lift" the other client node up to replace this split node. */
|
||||||
|
+ if (!node->left && node->right) {
|
||||||
|
+ tmp = node->right;
|
||||||
|
+
|
||||||
|
+ /* Save pointer to split node */
|
||||||
|
+ if (tmp)
|
||||||
|
+ tmp->split_node = node->split_node;
|
||||||
|
+
|
||||||
|
+ free(node);
|
||||||
|
+ return tmp;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!node->right && node->left) {
|
||||||
|
+ tmp = node->left;
|
||||||
|
+
|
||||||
|
+ /* Save pointer to split node */
|
||||||
|
+ if (tmp)
|
||||||
|
+ tmp->split_node = node->split_node;
|
||||||
|
+
|
||||||
|
+ free(node);
|
||||||
|
+ return tmp;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If both children exist or both are NULL (empty tree),
|
||||||
|
+ * return node as is. */
|
||||||
|
+ return node;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+remove_client(Monitor *m, Client *c)
|
||||||
|
+{
|
||||||
|
+ if (!m->root || !c)
|
||||||
|
+ return;
|
||||||
|
+ m->root = remove_client_node(m->root, c);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+setratio(unsigned int need_vertical, const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ Client *sel;
|
||||||
|
+ LayoutNode *client_node, *split_node;
|
||||||
|
+ float new_ratio;
|
||||||
|
+ int focused_on_left;
|
||||||
|
+
|
||||||
|
+ if (!selmon || !selmon->lt[selmon->sellt]->arrange)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ sel = focustop(selmon);
|
||||||
|
+ if (!sel)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ client_node = find_client_node(selmon->root, sel);
|
||||||
|
+ if (!client_node)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ focused_on_left = (arg->f >= 0.0f);
|
||||||
|
+
|
||||||
|
+ split_node = find_suitable_split(selmon, client_node, need_vertical, focused_on_left);
|
||||||
|
+
|
||||||
|
+ if (!split_node)
|
||||||
|
+ split_node = find_suitable_split(selmon, client_node, need_vertical, !focused_on_left);
|
||||||
|
+ if (!split_node)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ new_ratio = (arg->f != 0.0f) ? (split_node->split_ratio + arg->f) : 0.5f;
|
||||||
|
+ if (new_ratio < 0.05f)
|
||||||
|
+ new_ratio = 0.05f;
|
||||||
|
+ if (new_ratio > 0.95f)
|
||||||
|
+ new_ratio = 0.95f;
|
||||||
|
+ split_node->split_ratio = new_ratio;
|
||||||
|
+
|
||||||
|
+ apply_layout(selmon, selmon->root, selmon->w, 1);
|
||||||
|
+ /* Skip the arrange when called from motionnotify; that path calls
|
||||||
|
+ * arrange itself after rate-limiting. */
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+setratio_h(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setratio(1, arg);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+setratio_v(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ setratio(0, arg);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void swapclients(const Arg *arg) {
|
||||||
|
+ Client *c, *tmp, *target = NULL, *sel = focustop(selmon);
|
||||||
|
+ LayoutNode *sel_node, *target_node;
|
||||||
|
+ int closest_dist = INT_MAX, dist, sel_center_x, sel_center_y,
|
||||||
|
+ cand_center_x, cand_center_y;
|
||||||
|
+
|
||||||
|
+ if (!sel || sel->isfullscreen ||
|
||||||
|
+ !selmon->root || !selmon->lt[selmon->sellt]->arrange)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ /* Get the center coordinates of the selected client */
|
||||||
|
+ sel_center_x = sel->geom.x + sel->geom.width / 2;
|
||||||
|
+ sel_center_y = sel->geom.y + sel->geom.height / 2;
|
||||||
|
+
|
||||||
|
+ wl_list_for_each(c, &clients, link) {
|
||||||
|
+ if (!VISIBLEON(c, selmon) || c->isfloating || c->isfullscreen || c == sel)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ /* Get the center of candidate client */
|
||||||
|
+ cand_center_x = c->geom.x + c->geom.width / 2;
|
||||||
|
+ cand_center_y = c->geom.y + c->geom.height / 2;
|
||||||
|
+
|
||||||
|
+ /* Check that the candidate lies in the requested direction. */
|
||||||
|
+ switch (arg->ui) {
|
||||||
|
+ case 0:
|
||||||
|
+ if (cand_center_x >= sel_center_x)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ case 1:
|
||||||
|
+ if (cand_center_x <= sel_center_x)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ case 2:
|
||||||
|
+ if (cand_center_y >= sel_center_y)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ case 3:
|
||||||
|
+ if (cand_center_y <= sel_center_y)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Get distance between the centers */
|
||||||
|
+ dist = abs(sel_center_x - cand_center_x) + abs(sel_center_y - cand_center_y);
|
||||||
|
+ if (dist < closest_dist) {
|
||||||
|
+ closest_dist = dist;
|
||||||
|
+ target = c;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If target is found, swap the two clients’ positions in the layout tree */
|
||||||
|
+ if (target) {
|
||||||
|
+ sel_node = find_client_node(selmon->root, sel);
|
||||||
|
+ target_node = find_client_node(selmon->root, target);
|
||||||
|
+ if (sel_node && target_node) {
|
||||||
|
+ tmp = sel_node->client;
|
||||||
|
+ sel_node->client = target_node->client;
|
||||||
|
+ target_node->client = tmp;
|
||||||
|
+ arrange(selmon);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+unsigned int
|
||||||
|
+visible_count(LayoutNode *node, Monitor *m)
|
||||||
|
+{
|
||||||
|
+ Client *c;
|
||||||
|
+
|
||||||
|
+ if (!node)
|
||||||
|
+ return 0;
|
||||||
|
+ /* Check if this client is visible. */
|
||||||
|
+ if (node->is_client_node) {
|
||||||
|
+ c = node->client;
|
||||||
|
+ if (c && VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen)
|
||||||
|
+ return 1;
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ /* Else it’s a split node. */
|
||||||
|
+ return visible_count(node->left, m) + visible_count(node->right, m);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+Client *
|
||||||
|
+xytoclient(double x, double y) {
|
||||||
|
+ Monitor *m = xytomon(x, y);
|
||||||
|
+ Client *c, *closest = NULL;
|
||||||
|
+ double dist, mindist = INT_MAX, dx, dy;
|
||||||
|
+
|
||||||
|
+ wl_list_for_each_reverse(c, &clients, link) {
|
||||||
|
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen &&
|
||||||
|
+ x >= c->geom.x && x <= (c->geom.x + c->geom.width) &&
|
||||||
|
+ y >= c->geom.y && y <= (c->geom.y + c->geom.height)){
|
||||||
|
+ return c;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If no client was found at cursor position fallback to closest. */
|
||||||
|
+ wl_list_for_each_reverse(c, &clients, link) {
|
||||||
|
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen) {
|
||||||
|
+ dx = 0, dy = 0;
|
||||||
|
+
|
||||||
|
+ if (x < c->geom.x)
|
||||||
|
+ dx = c->geom.x - x;
|
||||||
|
+ else if (x > (c->geom.x + c->geom.width))
|
||||||
|
+ dx = x - (c->geom.x + c->geom.width);
|
||||||
|
+
|
||||||
|
+ if (y < c->geom.y)
|
||||||
|
+ dy = c->geom.y - y;
|
||||||
|
+ else if (y > (c->geom.y + c->geom.height))
|
||||||
|
+ dy = y - (c->geom.y + c->geom.height);
|
||||||
|
+
|
||||||
|
+ dist = dx * dx + dy * dy;
|
||||||
|
+ if (dist < mindist) {
|
||||||
|
+ mindist = dist;
|
||||||
|
+ closest = c;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ return closest;
|
||||||
|
+}
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 8a6eda0..bc04e3f 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -13,7 +13,10 @@ static const float focuscolor[] = COLOR(0x005577ff);
|
||||||
|
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||||
|
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||||
|
static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */
|
||||||
|
+static const float resize_factor = 0.0002f; /* Resize multiplier for mouse resizing, depends on mouse sensivity. */
|
||||||
|
+static const uint32_t resize_interval_ms = 16; /* Resize interval depends on framerate and screen refresh rate. */
|
||||||
|
|
||||||
|
+enum Direction { DIR_LEFT, DIR_RIGHT, DIR_UP, DIR_DOWN };
|
||||||
|
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||||
|
#define TAGCOUNT (9)
|
||||||
|
|
||||||
|
@@ -30,6 +33,7 @@ static const Rule rules[] = {
|
||||||
|
/* layout(s) */
|
||||||
|
static const Layout layouts[] = {
|
||||||
|
/* symbol arrange function */
|
||||||
|
+ { "|w|", btrtile },
|
||||||
|
{ "[]=", tile },
|
||||||
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
@@ -144,6 +148,14 @@ static const Key keys[] = {
|
||||||
|
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Up, swapclients, {.i = DIR_UP} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Down, swapclients, {.i = DIR_DOWN} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Right, swapclients, {.i = DIR_RIGHT} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Left, swapclients, {.i = DIR_LEFT} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Right, setratio_h, {.f = +0.025f} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Left, setratio_h, {.f = -0.025f} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Up, setratio_v, {.f = -0.025f} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Down, setratio_v, {.f = +0.025f} },
|
||||||
|
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
||||||
|
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
||||||
|
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index 8101ffa..bf52c6c 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
/*
|
||||||
|
* See LICENSE file for copyright and license details.
|
||||||
|
*/
|
||||||
|
+#include <limits.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
#include <libinput.h>
|
||||||
|
#include <linux/input-event-codes.h>
|
||||||
|
@@ -104,6 +105,7 @@ typedef struct {
|
||||||
|
const Arg arg;
|
||||||
|
} Button;
|
||||||
|
|
||||||
|
+typedef struct LayoutNode LayoutNode;
|
||||||
|
typedef struct Monitor Monitor;
|
||||||
|
typedef struct {
|
||||||
|
/* Must keep this field first */
|
||||||
|
@@ -141,8 +143,9 @@ typedef struct {
|
||||||
|
#endif
|
||||||
|
unsigned int bw;
|
||||||
|
uint32_t tags;
|
||||||
|
- int isfloating, isurgent, isfullscreen;
|
||||||
|
+ int isfloating, isurgent, isfullscreen, was_tiled;
|
||||||
|
uint32_t resize; /* configure serial of a pending resize */
|
||||||
|
+ struct wlr_box old_geom;
|
||||||
|
} Client;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
@@ -209,6 +212,7 @@ struct Monitor {
|
||||||
|
int nmaster;
|
||||||
|
char ltsymbol[16];
|
||||||
|
int asleep;
|
||||||
|
+ LayoutNode *root;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
@@ -251,6 +255,7 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||||
|
struct wlr_box *usable_area, int exclusive);
|
||||||
|
static void arrangelayers(Monitor *m);
|
||||||
|
static void axisnotify(struct wl_listener *listener, void *data);
|
||||||
|
+static void btrtile(Monitor *m);
|
||||||
|
static void buttonpress(struct wl_listener *listener, void *data);
|
||||||
|
static void chvt(const Arg *arg);
|
||||||
|
static void checkidleinhibitor(struct wlr_surface *exclude);
|
||||||
|
@@ -333,6 +338,9 @@ static void setmon(Client *c, Monitor *m, uint32_t newtags);
|
||||||
|
static void setpsel(struct wl_listener *listener, void *data);
|
||||||
|
static void setsel(struct wl_listener *listener, void *data);
|
||||||
|
static void setup(void);
|
||||||
|
+static void setratio_h(const Arg *arg);
|
||||||
|
+static void setratio_v(const Arg *arg);
|
||||||
|
+static void swapclients(const Arg *arg);
|
||||||
|
static void spawn(const Arg *arg);
|
||||||
|
static void startdrag(struct wl_listener *listener, void *data);
|
||||||
|
static void tag(const Arg *arg);
|
||||||
|
@@ -458,6 +466,7 @@ static struct wlr_xwayland *xwayland;
|
||||||
|
|
||||||
|
/* attempt to encapsulate suck into one file */
|
||||||
|
#include "client.h"
|
||||||
|
+#include "btrtile.c"
|
||||||
|
|
||||||
|
/* function implementations */
|
||||||
|
void
|
||||||
|
@@ -628,7 +637,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
struct wlr_pointer_button_event *event = data;
|
||||||
|
struct wlr_keyboard *keyboard;
|
||||||
|
uint32_t mods;
|
||||||
|
- Client *c;
|
||||||
|
+ Client *c, *target = NULL;
|
||||||
|
const Button *b;
|
||||||
|
|
||||||
|
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||||
|
@@ -649,7 +658,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
mods = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0;
|
||||||
|
for (b = buttons; b < END(buttons); b++) {
|
||||||
|
if (CLEANMASK(mods) == CLEANMASK(b->mod) &&
|
||||||
|
- event->button == b->button && b->func) {
|
||||||
|
+ event->button == b->button && b->func) {
|
||||||
|
b->func(&b->arg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@@ -659,6 +668,21 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
/* If you released any buttons, we exit interactive move/resize mode. */
|
||||||
|
/* TODO: should reset to the pointer focus's current setcursor */
|
||||||
|
if (!locked && cursor_mode != CurNormal && cursor_mode != CurPressed) {
|
||||||
|
+ c = grabc;
|
||||||
|
+ if (c && c->was_tiled && !strcmp(selmon->ltsymbol, "|w|")) {
|
||||||
|
+ if (cursor_mode == CurMove && c->isfloating) {
|
||||||
|
+ target = xytoclient(cursor->x, cursor->y);
|
||||||
|
+
|
||||||
|
+ if (target && !target->isfloating && !target->isfullscreen)
|
||||||
|
+ insert_client(selmon, target, c);
|
||||||
|
+ else
|
||||||
|
+ selmon->root = create_client_node(c);
|
||||||
|
+
|
||||||
|
+ setfloating(c, 0);
|
||||||
|
+ apply_layout(selmon, selmon->root, selmon->w, 1);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ /* Default behaviour */
|
||||||
|
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
||||||
|
cursor_mode = CurNormal;
|
||||||
|
/* Drop the window off on its new monitor */
|
||||||
|
@@ -750,6 +774,7 @@ cleanupmon(struct wl_listener *listener, void *data)
|
||||||
|
wlr_output_layout_remove(output_layout, m->wlr_output);
|
||||||
|
wlr_scene_output_destroy(m->scene_output);
|
||||||
|
|
||||||
|
+ destroy_tree(m);
|
||||||
|
closemon(m);
|
||||||
|
wlr_scene_node_destroy(&m->fullscreen_bg->node);
|
||||||
|
free(m);
|
||||||
|
@@ -1094,6 +1119,7 @@ createmon(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
|
wl_list_insert(&mons, &m->link);
|
||||||
|
printstatus();
|
||||||
|
+ init_tree(m);
|
||||||
|
|
||||||
|
/* The xdg-protocol specifies:
|
||||||
|
*
|
||||||
|
@@ -1333,9 +1359,17 @@ destroynotify(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
/* Called when the xdg_toplevel is destroyed. */
|
||||||
|
Client *c = wl_container_of(listener, c, destroy);
|
||||||
|
+ Monitor *mon;
|
||||||
|
wl_list_remove(&c->destroy.link);
|
||||||
|
wl_list_remove(&c->set_title.link);
|
||||||
|
wl_list_remove(&c->fullscreen.link);
|
||||||
|
+ /* We check if the destroyed client was part of any tiled_list, to catch
|
||||||
|
+ * client removals even if they would not be currently managed by btrtile */
|
||||||
|
+ wl_list_for_each(mon, &mons, link) {
|
||||||
|
+ if (mon->root) {
|
||||||
|
+ remove_client(mon, c);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
#ifdef XWAYLAND
|
||||||
|
if (c->type != XDGShell) {
|
||||||
|
wl_list_remove(&c->activate.link);
|
||||||
|
@@ -1866,7 +1900,8 @@ void
|
||||||
|
motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double dy,
|
||||||
|
double dx_unaccel, double dy_unaccel)
|
||||||
|
{
|
||||||
|
- double sx = 0, sy = 0, sx_confined, sy_confined;
|
||||||
|
+ int tiled = 0;
|
||||||
|
+ double sx = 0, sy = 0, sx_confined, sy_confined, dx_total, dy_total;
|
||||||
|
Client *c = NULL, *w = NULL;
|
||||||
|
LayerSurface *l = NULL;
|
||||||
|
struct wlr_surface *surface = NULL;
|
||||||
|
@@ -1920,18 +1955,55 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
|
||||||
|
/* Update drag icon's position */
|
||||||
|
wlr_scene_node_set_position(&drag_icon->node, (int)round(cursor->x), (int)round(cursor->y));
|
||||||
|
|
||||||
|
- /* If we are currently grabbing the mouse, handle and return */
|
||||||
|
+ /* Skip if internal call */
|
||||||
|
+ if (time == 0)
|
||||||
|
+ goto focus;
|
||||||
|
+
|
||||||
|
+ tiled = grabc && !grabc->isfloating && !grabc->isfullscreen;
|
||||||
|
if (cursor_mode == CurMove) {
|
||||||
|
/* Move the grabbed client to the new position. */
|
||||||
|
- resize(grabc, (struct wlr_box){.x = (int)round(cursor->x) - grabcx, .y = (int)round(cursor->y) - grabcy,
|
||||||
|
- .width = grabc->geom.width, .height = grabc->geom.height}, 1);
|
||||||
|
- return;
|
||||||
|
+ if (grabc && grabc->isfloating) {
|
||||||
|
+ resize(grabc, (struct wlr_box){
|
||||||
|
+ .x = (int)round(cursor->x) - grabcx,
|
||||||
|
+ .y = (int)round(cursor->y) - grabcy,
|
||||||
|
+ .width = grabc->geom.width,
|
||||||
|
+ .height = grabc->geom.height
|
||||||
|
+ }, 1);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
} else if (cursor_mode == CurResize) {
|
||||||
|
- resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y,
|
||||||
|
- .width = (int)round(cursor->x) - grabc->geom.x, .height = (int)round(cursor->y) - grabc->geom.y}, 1);
|
||||||
|
- return;
|
||||||
|
+ if (tiled) {
|
||||||
|
+ dx_total = cursor->x - resize_last_update_x;
|
||||||
|
+ dy_total = cursor->y - resize_last_update_y;
|
||||||
|
+
|
||||||
|
+ if (time - last_resize_time >= resize_interval_ms) {
|
||||||
|
+ Arg a = {0};
|
||||||
|
+ if (fabs(dx_total) > fabs(dy_total)) {
|
||||||
|
+ a.f = (float)(dx_total * resize_factor);
|
||||||
|
+ setratio_h(&a);
|
||||||
|
+ } else {
|
||||||
|
+ a.f = (float)(dy_total * resize_factor);
|
||||||
|
+ setratio_v(&a);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ last_resize_time = time;
|
||||||
|
+ resize_last_update_x = cursor->x;
|
||||||
|
+ resize_last_update_y = cursor->y;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ } else if (grabc && grabc->isfloating) {
|
||||||
|
+ /* Floating resize as original */
|
||||||
|
+ resize(grabc, (struct wlr_box){
|
||||||
|
+ .x = grabc->geom.x,
|
||||||
|
+ .y = grabc->geom.y,
|
||||||
|
+ .width = (int)round(cursor->x) - grabc->geom.x,
|
||||||
|
+ .height = (int)round(cursor->y) - grabc->geom.y
|
||||||
|
+ }, 1);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
+focus:
|
||||||
|
/* If there's no client surface under the cursor, set the cursor image to a
|
||||||
|
* default. This is what makes the cursor image appear when you move it
|
||||||
|
* off of a client or over its border. */
|
||||||
|
@@ -1965,22 +2037,40 @@ moveresize(const Arg *arg)
|
||||||
|
if (!grabc || client_is_unmanaged(grabc) || grabc->isfullscreen)
|
||||||
|
return;
|
||||||
|
|
||||||
|
- /* Float the window and tell motionnotify to grab it */
|
||||||
|
- setfloating(grabc, 1);
|
||||||
|
- switch (cursor_mode = arg->ui) {
|
||||||
|
- case CurMove:
|
||||||
|
- grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||||
|
- grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||||
|
- wlr_cursor_set_xcursor(cursor, cursor_mgr, "all-scroll");
|
||||||
|
- break;
|
||||||
|
- case CurResize:
|
||||||
|
- /* Doesn't work for X11 output - the next absolute motion event
|
||||||
|
- * returns the cursor to where it started */
|
||||||
|
- wlr_cursor_warp_closest(cursor, NULL,
|
||||||
|
- grabc->geom.x + grabc->geom.width,
|
||||||
|
- grabc->geom.y + grabc->geom.height);
|
||||||
|
- wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||||
|
- break;
|
||||||
|
+ cursor_mode = arg->ui;
|
||||||
|
+ grabc->was_tiled = (!grabc->isfloating && !grabc->isfullscreen);
|
||||||
|
+
|
||||||
|
+ if (grabc->was_tiled) {
|
||||||
|
+ switch (cursor_mode) {
|
||||||
|
+ case CurMove:
|
||||||
|
+ setfloating(grabc, 1);
|
||||||
|
+ grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||||
|
+ grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
|
||||||
|
+ break;
|
||||||
|
+ case CurResize:
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||||
|
+ resize_last_update_x = cursor->x;
|
||||||
|
+ resize_last_update_y = cursor->y;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ /* Default floating logic */
|
||||||
|
+ /* Float the window and tell motionnotify to grab it */
|
||||||
|
+ setfloating(grabc, 1);
|
||||||
|
+ switch (cursor_mode) {
|
||||||
|
+ case CurMove:
|
||||||
|
+ grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||||
|
+ grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
|
||||||
|
+ break;
|
||||||
|
+ case CurResize:
|
||||||
|
+ wlr_cursor_warp_closest(cursor, NULL,
|
||||||
|
+ grabc->geom.x + grabc->geom.width,
|
||||||
|
+ grabc->geom.y + grabc->geom.height);
|
||||||
|
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -2833,6 +2923,14 @@ unmapnotify(struct wl_listener *listener, void *data)
|
||||||
|
focusclient(focustop(selmon), 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
+ /* btrtile remove clients for each monitor */
|
||||||
|
+ Monitor *mon;
|
||||||
|
+ wl_list_for_each(mon, &mons, link) {
|
||||||
|
+ if (mon->root) {
|
||||||
|
+ remove_client(mon, c);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
wl_list_remove(&c->link);
|
||||||
|
setmon(c, NULL, 0);
|
||||||
|
wl_list_remove(&c->flink);
|
||||||
|
--
|
||||||
|
2.53.0
|
||||||
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 13 MiB |
@@ -7,7 +7,7 @@ covering the wallpaper more than necessary.
|
|||||||
|
|
||||||
### Download
|
### Download
|
||||||
- [git branch](https://codeberg.org/guidocella/dwl/src/branch/center-terminal)
|
- [git branch](https://codeberg.org/guidocella/dwl/src/branch/center-terminal)
|
||||||
- [2024-02-06](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/center-terminal/center-terminal.patch)
|
- [2026-02-09](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/center-terminal/center-terminal.patch)
|
||||||
|
|
||||||
### Authors
|
### Authors
|
||||||
- [Guido Cella](https://codeberg.org/guidocella)
|
- [Guido Cella](https://codeberg.org/guidocella)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
From 5646d7e7d933a2e7a667767c3fde89c91697c4ea Mon Sep 17 00:00:00 2001
|
From 897765216ac8567a40654b813379a4e074ca6298 Mon Sep 17 00:00:00 2001
|
||||||
From: Guido Cella <guido@guidocella.xyz>
|
From: Guido Cella <guido@guidocella.xyz>
|
||||||
Date: Tue, 6 Feb 2024 09:20:48 +0100
|
Date: Mon, 9 Feb 2026 10:21:33 +0100
|
||||||
Subject: [PATCH] add a keybinding to center the terminal
|
Subject: [PATCH] add a keybinding to center the terminal
|
||||||
|
|
||||||
Add a keybinding that toggles centering the terminally horizontally when
|
Add a keybinding that toggles centering the terminally horizontally when
|
||||||
@@ -10,26 +10,26 @@ This limits the width of long text making it easier to read, and avoids
|
|||||||
covering the wallpaper more than necessary.
|
covering the wallpaper more than necessary.
|
||||||
---
|
---
|
||||||
config.def.h | 1 +
|
config.def.h | 1 +
|
||||||
dwl.c | 19 +++++++++++++++++++
|
dwl.c | 20 ++++++++++++++++++++
|
||||||
2 files changed, 20 insertions(+)
|
2 files changed, 21 insertions(+)
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
diff --git a/config.def.h b/config.def.h
|
||||||
index a85ca27..2055df9 100644
|
index 8a6eda0..8c35c40 100644
|
||||||
--- a/config.def.h
|
--- a/config.def.h
|
||||||
+++ b/config.def.h
|
+++ b/config.def.h
|
||||||
@@ -139,6 +139,7 @@ static const Key keys[] = {
|
@@ -138,6 +138,7 @@ static const Key keys[] = {
|
||||||
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||||
+ { MODKEY, XKB_KEY_v, togglecenter, {0} },
|
+ { MODKEY, XKB_KEY_v, togglecenter, {0} },
|
||||||
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
|
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
|
||||||
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
|
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
|
||||||
diff --git a/dwl.c b/dwl.c
|
diff --git a/dwl.c b/dwl.c
|
||||||
index 002349a..4582413 100644
|
index 44f3ad9..9ee397a 100644
|
||||||
--- a/dwl.c
|
--- a/dwl.c
|
||||||
+++ b/dwl.c
|
+++ b/dwl.c
|
||||||
@@ -7,6 +7,7 @@
|
@@ -8,6 +8,7 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -37,7 +37,7 @@ index 002349a..4582413 100644
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -135,6 +136,7 @@ typedef struct {
|
@@ -138,6 +139,7 @@ typedef struct {
|
||||||
unsigned int bw;
|
unsigned int bw;
|
||||||
uint32_t tags;
|
uint32_t tags;
|
||||||
int isfloating, isurgent, isfullscreen;
|
int isfloating, isurgent, isfullscreen;
|
||||||
@@ -45,7 +45,7 @@ index 002349a..4582413 100644
|
|||||||
uint32_t resize; /* configure serial of a pending resize */
|
uint32_t resize; /* configure serial of a pending resize */
|
||||||
} Client;
|
} Client;
|
||||||
|
|
||||||
@@ -319,6 +321,7 @@ static void startdrag(struct wl_listener *listener, void *data);
|
@@ -334,6 +336,7 @@ static void startdrag(struct wl_listener *listener, void *data);
|
||||||
static void tag(const Arg *arg);
|
static void tag(const Arg *arg);
|
||||||
static void tagmon(const Arg *arg);
|
static void tagmon(const Arg *arg);
|
||||||
static void tile(Monitor *m);
|
static void tile(Monitor *m);
|
||||||
@@ -53,25 +53,26 @@ index 002349a..4582413 100644
|
|||||||
static void togglefloating(const Arg *arg);
|
static void togglefloating(const Arg *arg);
|
||||||
static void togglefullscreen(const Arg *arg);
|
static void togglefullscreen(const Arg *arg);
|
||||||
static void toggletag(const Arg *arg);
|
static void toggletag(const Arg *arg);
|
||||||
@@ -392,6 +395,8 @@ static struct wlr_box sgeom;
|
@@ -436,6 +439,8 @@ static struct wl_listener request_start_drag = {.notify = requeststartdrag};
|
||||||
static struct wl_list mons;
|
static struct wl_listener start_drag = {.notify = startdrag};
|
||||||
static Monitor *selmon;
|
static struct wl_listener new_session_lock = {.notify = locksession};
|
||||||
|
|
||||||
+static bool center;
|
+static bool center;
|
||||||
+
|
+
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
static void activatex11(struct wl_listener *listener, void *data);
|
static void activatex11(struct wl_listener *listener, void *data);
|
||||||
static void associatex11(struct wl_listener *listener, void *data);
|
static void associatex11(struct wl_listener *listener, void *data);
|
||||||
@@ -457,6 +462,8 @@ applyrules(Client *c)
|
@@ -499,6 +504,9 @@ applyrules(Client *c)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ if (!strcasecmp(appid, termcmd[0]))
|
+ if (!strcasecmp(appid, termcmd[0]))
|
||||||
+ c->centered = true;
|
+ c->centered = true;
|
||||||
|
+
|
||||||
|
c->isfloating |= client_is_float_type(c);
|
||||||
setmon(c, mon, newtags);
|
setmon(c, mon, newtags);
|
||||||
}
|
}
|
||||||
|
@@ -2731,6 +2739,11 @@ tile(Monitor *m)
|
||||||
@@ -2519,6 +2526,11 @@ tile(Monitor *m)
|
|
||||||
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||||
continue;
|
continue;
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
@@ -83,7 +84,7 @@ index 002349a..4582413 100644
|
|||||||
resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw,
|
resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw,
|
||||||
.height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0);
|
.height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0);
|
||||||
my += c->geom.height;
|
my += c->geom.height;
|
||||||
@@ -2531,6 +2543,13 @@ tile(Monitor *m)
|
@@ -2743,6 +2756,13 @@ tile(Monitor *m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,5 +99,5 @@ index 002349a..4582413 100644
|
|||||||
togglefloating(const Arg *arg)
|
togglefloating(const Arg *arg)
|
||||||
{
|
{
|
||||||
--
|
--
|
||||||
2.43.0
|
2.52.0
|
||||||
|
|
||||||
|
|||||||
@@ -22,12 +22,16 @@ With one and two clients in master respectively this results in:
|
|||||||
+------------------------------+ +------------------------------+
|
+------------------------------+ +------------------------------+
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Version 0.8 includes `centeredmaster_always` setting to always center a window
|
||||||
|
even if only 1 window is visible on a tag.
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
- [git branch](https://codeberg.org/wochap/dwl/src/branch/v0.5/centeredmaster)
|
- [0.8](/dwl/dwl-patches/raw/branch/main/patches/centeredmaster/centeredmaster-0.8.patch)
|
||||||
|
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/centeredmaster/centeredmaster-0.7.patch)
|
||||||
- [2024-04-11](https://codeberg.org/dwl/dwl-patches/raw/commit/b104a580a80ebaf9f7e8917fe574e3e97ddd019a/centeredmaster/centeredmaster.patch)
|
- [2024-04-11](https://codeberg.org/dwl/dwl-patches/raw/commit/b104a580a80ebaf9f7e8917fe574e3e97ddd019a/centeredmaster/centeredmaster.patch)
|
||||||
- [v0.5](https://codeberg.org/dwl/dwl-patches/raw/commit/0f4e40fee49d1b8b430778e241b29496ae3b3b70/centeredmaster/centeredmaster.patch)
|
- [0.5](https://codeberg.org/dwl/dwl-patches/raw/commit/0f4e40fee49d1b8b430778e241b29496ae3b3b70/centeredmaster/centeredmaster.patch)
|
||||||
|
|
||||||
### Authors
|
### Authors
|
||||||
|
- [Nikita Ivanov](https://codeberg.org/nikitaivanov) ([GitHub](https://github.com/NikitaIvanovV))
|
||||||
- [wochap](https://codeberg.org/wochap)
|
- [wochap](https://codeberg.org/wochap)
|
||||||
- [Nikita Ivanov](https://github.com/NikitaIvanovV)
|
- [metalcranium](https://codeberg.org/metalcranium)
|
||||||
|
|||||||
+36
-17
@@ -1,19 +1,39 @@
|
|||||||
From a9d47325283a55fd299de5bbbab5ab195840c7ca Mon Sep 17 00:00:00 2001
|
From b1ca46930756b59c1ebba0b8c7871b85ff84f62f Mon Sep 17 00:00:00 2001
|
||||||
From: wochap <gean.marroquin@gmail.com>
|
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
|
||||||
Date: Thu, 11 Apr 2024 16:42:25 -0500
|
Date: Sat, 8 Feb 2025 16:10:25 +0100
|
||||||
Subject: [PATCH] implement centeredmaster layout
|
Subject: [PATCH] Add centeredmaster layout
|
||||||
|
|
||||||
inspiration: https://github.com/djpohly/dwl/wiki/centeredmaster
|
This is a port of centeredmaster patch for dwm:
|
||||||
|
https://dwm.suckless.org/patches/centeredmaster
|
||||||
|
|
||||||
|
centeredmaster centers the nmaster area on screen, using mfact * monitor
|
||||||
|
width & height, with the stacked windows distributed to the left and
|
||||||
|
right. It can be selected with [Alt]+[c].
|
||||||
|
|
||||||
|
With one and two clients in master respectively this results in:
|
||||||
|
|
||||||
|
+------------------------------+ +------------------------------+
|
||||||
|
|+--------++--------++--------+| |+--------++--------++--------+|
|
||||||
|
|| || || || || || || ||
|
||||||
|
|| || || || || || M1 || ||
|
||||||
|
|| || || || || || || ||
|
||||||
|
|| S2 || M || S1 || || |+--------+| ||
|
||||||
|
|| || || || || |+--------+| ||
|
||||||
|
|| || || || || || || ||
|
||||||
|
|| || || || || || M2 || ||
|
||||||
|
|| || || || || || || ||
|
||||||
|
|+--------++--------++--------+| |+--------++--------++--------+|
|
||||||
|
+------------------------------+ +------------------------------+
|
||||||
---
|
---
|
||||||
config.def.h | 2 ++
|
config.def.h | 2 ++
|
||||||
dwl.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
dwl.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
2 files changed, 66 insertions(+)
|
2 files changed, 65 insertions(+)
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
diff --git a/config.def.h b/config.def.h
|
||||||
index 8847e58..cfc6e62 100644
|
index 22d2171..9a3b0c5 100644
|
||||||
--- a/config.def.h
|
--- a/config.def.h
|
||||||
+++ b/config.def.h
|
+++ b/config.def.h
|
||||||
@@ -33,6 +33,7 @@ static const Layout layouts[] = {
|
@@ -34,6 +34,7 @@ static const Layout layouts[] = {
|
||||||
{ "[]=", tile },
|
{ "[]=", tile },
|
||||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
{ "[M]", monocle },
|
{ "[M]", monocle },
|
||||||
@@ -21,7 +41,7 @@ index 8847e58..cfc6e62 100644
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* monitors */
|
/* monitors */
|
||||||
@@ -134,6 +135,7 @@ static const Key keys[] = {
|
@@ -139,6 +140,7 @@ static const Key keys[] = {
|
||||||
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
||||||
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||||
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||||
@@ -30,10 +50,10 @@ index 8847e58..cfc6e62 100644
|
|||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||||
diff --git a/dwl.c b/dwl.c
|
diff --git a/dwl.c b/dwl.c
|
||||||
index bf763df..0e84ccf 100644
|
index def2562..c2456dd 100644
|
||||||
--- a/dwl.c
|
--- a/dwl.c
|
||||||
+++ b/dwl.c
|
+++ b/dwl.c
|
||||||
@@ -248,6 +248,7 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
|
@@ -251,6 +251,7 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||||
static void arrangelayers(Monitor *m);
|
static void arrangelayers(Monitor *m);
|
||||||
static void axisnotify(struct wl_listener *listener, void *data);
|
static void axisnotify(struct wl_listener *listener, void *data);
|
||||||
static void buttonpress(struct wl_listener *listener, void *data);
|
static void buttonpress(struct wl_listener *listener, void *data);
|
||||||
@@ -41,15 +61,14 @@ index bf763df..0e84ccf 100644
|
|||||||
static void chvt(const Arg *arg);
|
static void chvt(const Arg *arg);
|
||||||
static void checkidleinhibitor(struct wlr_surface *exclude);
|
static void checkidleinhibitor(struct wlr_surface *exclude);
|
||||||
static void cleanup(void);
|
static void cleanup(void);
|
||||||
@@ -628,6 +629,69 @@ buttonpress(struct wl_listener *listener, void *data)
|
@@ -649,6 +650,68 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
event->time_msec, event->button, event->state);
|
event->time_msec, event->button, event->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
+void
|
+void
|
||||||
+centeredmaster(Monitor *m)
|
+centeredmaster(Monitor *m)
|
||||||
+{
|
+{
|
||||||
+ unsigned int h, mw, mx, my, oty, ety, tw;
|
+ int i, n, h, mw, mx, my, oty, ety, tw;
|
||||||
+ int i, n;
|
|
||||||
+ Client *c;
|
+ Client *c;
|
||||||
+
|
+
|
||||||
+ n = 0;
|
+ n = 0;
|
||||||
@@ -67,7 +86,7 @@ index bf763df..0e84ccf 100644
|
|||||||
+
|
+
|
||||||
+ if (n > m->nmaster) {
|
+ if (n > m->nmaster) {
|
||||||
+ /* go mfact box in the center if more than nmaster clients */
|
+ /* go mfact box in the center if more than nmaster clients */
|
||||||
+ mw = ROUND(m->nmaster ? m->w.width * m->mfact : 0);
|
+ mw = m->nmaster ? (int)roundf(m->w.width * m->mfact) : 0;
|
||||||
+ tw = m->w.width - mw;
|
+ tw = m->w.width - mw;
|
||||||
+
|
+
|
||||||
+ if (n - m->nmaster > 1) {
|
+ if (n - m->nmaster > 1) {
|
||||||
@@ -112,5 +131,5 @@ index bf763df..0e84ccf 100644
|
|||||||
chvt(const Arg *arg)
|
chvt(const Arg *arg)
|
||||||
{
|
{
|
||||||
--
|
--
|
||||||
2.43.2
|
2.48.1
|
||||||
|
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
From d3d0000c3e2baa8c2a4633581186f768c909667a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
|
||||||
|
Date: Mon, 13 Apr 2026 18:24:17 +0200
|
||||||
|
Subject: [PATCH] Add centeredmaster layout
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 3 +++
|
||||||
|
dwl.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 76 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 8a6eda0..15cbe32 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -7,6 +7,7 @@
|
||||||
|
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||||
|
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
|
||||||
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
+static const int centeredmaster_always = 0; /* always center even if only 1 window */
|
||||||
|
static const float rootcolor[] = COLOR(0x222222ff);
|
||||||
|
static const float bordercolor[] = COLOR(0x444444ff);
|
||||||
|
static const float focuscolor[] = COLOR(0x005577ff);
|
||||||
|
@@ -33,6 +34,7 @@ static const Layout layouts[] = {
|
||||||
|
{ "[]=", tile },
|
||||||
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
+ { "|M|", centeredmaster },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* monitors */
|
||||||
|
@@ -135,6 +137,7 @@ static const Key keys[] = {
|
||||||
|
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
||||||
|
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||||
|
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||||
|
+ { MODKEY, XKB_KEY_c, setlayout, {.v = &layouts[3]} },
|
||||||
|
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||||
|
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index 44f3ad9..98ba318 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -248,6 +248,7 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||||
|
static void arrangelayers(Monitor *m);
|
||||||
|
static void axisnotify(struct wl_listener *listener, void *data);
|
||||||
|
static void buttonpress(struct wl_listener *listener, void *data);
|
||||||
|
+static void centeredmaster(Monitor *m);
|
||||||
|
static void chvt(const Arg *arg);
|
||||||
|
static void checkidleinhibitor(struct wlr_surface *exclude);
|
||||||
|
static void cleanup(void);
|
||||||
|
@@ -672,6 +673,78 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
|
event->time_msec, event->button, event->state);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+centeredmaster(Monitor *m)
|
||||||
|
+{
|
||||||
|
+ int i, n, h, mw, mx, my, oty, ety, tw;
|
||||||
|
+ Client *c;
|
||||||
|
+
|
||||||
|
+ n = 0;
|
||||||
|
+ wl_list_for_each(c, &clients, link)
|
||||||
|
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen)
|
||||||
|
+ n++;
|
||||||
|
+ if (n == 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ /* initialize areas */
|
||||||
|
+ if (centeredmaster_always) {
|
||||||
|
+ mw = m->w.width / 2;
|
||||||
|
+ mx = m->w.width / 4;
|
||||||
|
+ } else {
|
||||||
|
+ mw = m->w.width;
|
||||||
|
+ mx = 0;
|
||||||
|
+ }
|
||||||
|
+ my = 0;
|
||||||
|
+ tw = mw;
|
||||||
|
+
|
||||||
|
+ if (n > m->nmaster) {
|
||||||
|
+ /* go mfact box in the center if more than nmaster clients */
|
||||||
|
+ if (centeredmaster_always) {
|
||||||
|
+ mw = m->nmaster ? (int)roundf(m->w.width / 2) : 0;
|
||||||
|
+ tw = mw / 2;
|
||||||
|
+ } else {
|
||||||
|
+ mw = m->nmaster ? (int)roundf(m->w.width * m->mfact) : 0;
|
||||||
|
+ tw = m->w.width - mw;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (n - m->nmaster > 1) {
|
||||||
|
+ /* only one client */
|
||||||
|
+ mx = (m->w.width - mw) / 2;
|
||||||
|
+ tw = (m->w.width - mw) / 2;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ i = 0;
|
||||||
|
+ oty = 0;
|
||||||
|
+ ety = 0;
|
||||||
|
+ wl_list_for_each(c, &clients, link) {
|
||||||
|
+ if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||||
|
+ continue;
|
||||||
|
+ if (i < m->nmaster) {
|
||||||
|
+ /* nmaster clients are stacked vertically, in the center
|
||||||
|
+ * of the screen */
|
||||||
|
+ h = (m->w.height - my) / (MIN(n, m->nmaster) - i);
|
||||||
|
+ resize(c, (struct wlr_box){.x = m->w.x + mx, .y = m->w.y + my, .width = mw,
|
||||||
|
+ .height = h}, 0);
|
||||||
|
+ my += c->geom.height;
|
||||||
|
+ } else {
|
||||||
|
+ /* stack clients are stacked vertically */
|
||||||
|
+ if ((i - m->nmaster) % 2) {
|
||||||
|
+ h = (m->w.height - ety) / ( (1 + n - i) / 2);
|
||||||
|
+ resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + ety, .width = tw,
|
||||||
|
+ .height = h}, 0);
|
||||||
|
+ ety += c->geom.height;
|
||||||
|
+ } else {
|
||||||
|
+ h = (m->w.height - oty) / ((1 + n - i) / 2);
|
||||||
|
+ resize(c, (struct wlr_box){.x = m->w.x + mx + mw, .y = m->w.y + oty, .width = tw,
|
||||||
|
+ .height = h}, 0);
|
||||||
|
+ oty += c->geom.height;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ i++;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
chvt(const Arg *arg)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.53.0
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
### Description
|
|
||||||
Port of the cfact patch for the centeredmaster layout.
|
|
||||||
|
|
||||||
Inspired by the original patch for dwm (https://dwm.suckless.org/patches/cfacts/)
|
|
||||||
|
|
||||||
This patch requires both [cfact](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/cfact) and [centeredmaster](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/centeredmaster) patches.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
|
|
||||||
- [2024-06-26](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/cfact-centeredmaster/cfact-centeredmaster.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [acadmendes](https://codeberg.org/acadmendes)
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
From e3ad25b5149df936155cb51927f16648a9838bc0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: estevao <estevao.mendes@acad.ufsm.br>
|
|
||||||
Date: Thu, 25 Jul 2024 13:20:50 -0300
|
|
||||||
Subject: [PATCH] cfact patch for centeredmaster layout
|
|
||||||
|
|
||||||
---
|
|
||||||
dwl.c | 42 ++++++++++++++++++++++++++++++++++++++----
|
|
||||||
1 file changed, 38 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/dwl.c b/dwl.c
|
|
||||||
index 91c1511..37732c0 100644
|
|
||||||
--- a/dwl.c
|
|
||||||
+++ b/dwl.c
|
|
||||||
@@ -654,6 +656,7 @@ void
|
|
||||||
centeredmaster(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int h, mw, mx, my, oty, ety, tw;
|
|
||||||
+ float mweight = 0, ltweight = 0, rtweight = 0;
|
|
||||||
int i, n;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
@@ -672,7 +675,7 @@ centeredmaster(Monitor *m)
|
|
||||||
|
|
||||||
if (n > m->nmaster) {
|
|
||||||
/* go mfact box in the center if more than nmaster clients */
|
|
||||||
- mw = ROUND(m->nmaster ? m->w.width * m->mfact : 0);
|
|
||||||
+ mw = roundf(m->nmaster ? m->w.width * m->mfact : 0);
|
|
||||||
tw = m->w.width - mw;
|
|
||||||
|
|
||||||
if (n - m->nmaster > 1) {
|
|
||||||
@@ -682,6 +685,20 @@ centeredmaster(Monitor *m)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ i = 0;
|
|
||||||
+ wl_list_for_each(c, &clients, link){
|
|
||||||
+ if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
|
||||||
+ continue;
|
|
||||||
+ if (i < m->nmaster)
|
|
||||||
+ mweight += c->cweight;
|
|
||||||
+ else if ( (i - m->nmaster)%2 ){
|
|
||||||
+ ltweight += c->cweight;
|
|
||||||
+ }else{
|
|
||||||
+ rtweight += c->cweight;
|
|
||||||
+ }
|
|
||||||
+ i++;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
i = 0;
|
|
||||||
oty = 0;
|
|
||||||
ety = 0;
|
|
||||||
@@ -691,22 +708,24 @@ centeredmaster(Monitor *m)
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
/* nmaster clients are stacked vertically, in the center
|
|
||||||
* of the screen */
|
|
||||||
- h = (m->w.height - my) / (MIN(n, m->nmaster) - i);
|
|
||||||
+ h = (m->w.height - my)*(c->cweight/mweight);
|
|
||||||
resize(c, (struct wlr_box){.x = m->w.x + mx, .y = m->w.y + my, .width = mw,
|
|
||||||
.height = h}, 0);
|
|
||||||
my += c->geom.height;
|
|
||||||
+ mweight -= c->cweight;
|
|
||||||
} else {
|
|
||||||
/* stack clients are stacked vertically */
|
|
||||||
if ((i - m->nmaster) % 2) {
|
|
||||||
- h = (m->w.height - ety) / ( (1 + n - i) / 2);
|
|
||||||
+ h = (m->w.height - ety)*(c->cweight/ltweight);
|
|
||||||
resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + ety, .width = tw,
|
|
||||||
.height = h}, 0);
|
|
||||||
ety += c->geom.height;
|
|
||||||
+ ltweight -= c->cweight;
|
|
||||||
} else {
|
|
||||||
- h = (m->w.height - oty) / ((1 + n - i) / 2);
|
|
||||||
+ h = (m->w.height - oty)*(c->cweight/rtweight);
|
|
||||||
resize(c, (struct wlr_box){.x = m->w.x + mx + mw, .y = m->w.y + oty, .width = tw,
|
|
||||||
.height = h}, 0);
|
|
||||||
oty += c->geom.height;
|
|
||||||
+ rtweight -= c->cweight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
--
|
|
||||||
2.45.2
|
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
### Description
|
||||||
|
This patch implements [cfact][cfact] for [snail][snail] layout.
|
||||||
|
This patch must be applied on top of cfact and snail patches.
|
||||||
|
|
||||||
|
[cfact]: /dwl/dwl-patches/src/branch/main/patches/cfact
|
||||||
|
[snail]: /dwl/dwl-patches/src/branch/main/patches/snail
|
||||||
|
|
||||||
|
|
||||||
|
### Download
|
||||||
|
- [v0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/cfact-snail/cfact-snail.patch)
|
||||||
|
|
||||||
|
### Authors
|
||||||
|
- [Nikita Ivanov](https://codeberg.org/nikitaivanov) ([GitHub](https://github.com/NikitaIvanovV))
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
From 9f8109182a7d173d2a2cb30c089a7e7b9ffe0a5e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
|
||||||
|
Date: Tue, 25 Mar 2025 02:24:32 +0100
|
||||||
|
Subject: [PATCH] cfact patch for snail layout
|
||||||
|
|
||||||
|
---
|
||||||
|
dwl.c | 24 ++++++++++++------------
|
||||||
|
1 file changed, 12 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index 4f8c493..37aa935 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -2699,10 +2699,10 @@ snail(Monitor *m)
|
||||||
|
* Split the previous horizontally and put the current window on the right
|
||||||
|
*/
|
||||||
|
} else if (dir == WLR_DIRECTION_RIGHT) {
|
||||||
|
- c->geom = (struct wlr_box){.x = prev->geom.x + prev->geom.width / 2, .y = prev->geom.y,
|
||||||
|
- .width = prev->geom.width / 2, .height = prev->geom.height};
|
||||||
|
+ c->geom = (struct wlr_box){.x = prev->geom.x + (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.width), .y = prev->geom.y,
|
||||||
|
+ .width = (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.width), .height = prev->geom.height};
|
||||||
|
prev->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y,
|
||||||
|
- .width = prev->geom.width / 2, .height = prev->geom.height};
|
||||||
|
+ .width = (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.width), .height = prev->geom.height};
|
||||||
|
/*
|
||||||
|
* If it's a stack window or the first narrow window in the master
|
||||||
|
* area, put the next one below it
|
||||||
|
@@ -2713,28 +2713,28 @@ snail(Monitor *m)
|
||||||
|
* Split the previous vertically and put the current window below it
|
||||||
|
*/
|
||||||
|
} else if (dir == WLR_DIRECTION_DOWN) {
|
||||||
|
- c->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y + prev->geom.height / 2,
|
||||||
|
- .width = prev->geom.width, .height = prev->geom.height / 2};
|
||||||
|
+ c->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y + (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.height),
|
||||||
|
+ .width = prev->geom.width, .height = (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.height)};
|
||||||
|
prev->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y,
|
||||||
|
- .width = prev->geom.width, .height = prev->geom.height / 2};
|
||||||
|
+ .width = prev->geom.width, .height = (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.height)};
|
||||||
|
dir = WLR_DIRECTION_LEFT;
|
||||||
|
/*
|
||||||
|
* Split the previous horizontally and put the current window on the left
|
||||||
|
*/
|
||||||
|
} else if (dir == WLR_DIRECTION_LEFT) {
|
||||||
|
c->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y,
|
||||||
|
- .width = prev->geom.width / 2, .height = prev->geom.height};
|
||||||
|
- prev->geom = (struct wlr_box){.x = prev->geom.x + prev->geom.width / 2, .y = prev->geom.y,
|
||||||
|
- .width = prev->geom.width / 2, .height = prev->geom.height};
|
||||||
|
+ .width = (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.width), .height = prev->geom.height};
|
||||||
|
+ prev->geom = (struct wlr_box){.x = prev->geom.x + (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.width), .y = prev->geom.y,
|
||||||
|
+ .width = (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.width), .height = prev->geom.height};
|
||||||
|
dir = WLR_DIRECTION_UP;
|
||||||
|
/*
|
||||||
|
* Split the previous vertically and put the current window above it
|
||||||
|
*/
|
||||||
|
} else {
|
||||||
|
c->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y,
|
||||||
|
- .width = prev->geom.width, .height = prev->geom.height / 2};
|
||||||
|
- prev->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y + prev->geom.height / 2,
|
||||||
|
- .width = prev->geom.width, .height = prev->geom.height / 2};
|
||||||
|
+ .width = prev->geom.width, .height = (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.height)};
|
||||||
|
+ prev->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y + (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.height),
|
||||||
|
+ .width = prev->geom.width, .height = (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.height)};
|
||||||
|
dir = WLR_DIRECTION_RIGHT;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
--
|
||||||
|
2.49.0
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
### Description
|
||||||
|
This patch is based on the
|
||||||
|
[client-opacity](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/client-opacity/client-opacity.patch)
|
||||||
|
patch. This patch adds differing opacity levels depending upon whether the client is focused or not.
|
||||||
|
|
||||||
|
The opacity levels can be change by short cuts.
|
||||||
|
|
||||||
|
```
|
||||||
|
[MODKEY]+[Ctrl]+[k] -> increase focus opacity unfocused client
|
||||||
|
[MODKEY]+[Ctrl]+[j] -> decrease focus opacity unfocused client
|
||||||
|
[MODKEY]+[Ctrl]+[Shift]+[k] -> increase focus opacity focused client
|
||||||
|
[MODKEY]+[Ctrl]+[Shift]+[j] -> decrease focus opacity focused client
|
||||||
|
```
|
||||||
|
|
||||||
|
### Download
|
||||||
|
- [git branch](https://codeberg.org/Hansvon/dwl/src/branch/client-opacity-focus)
|
||||||
|
- [2026-04-27](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/client-opacity-focus/client-opacity-focus.patch)
|
||||||
|
|
||||||
|
### Authors
|
||||||
|
- [Hansvon](https://codeberg.org/Hansvon)
|
||||||
@@ -0,0 +1,204 @@
|
|||||||
|
From 57c5475d7f715b77ec05d69a2bda808b224cf0b4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Hans von Hohenstaufen <Hans.von.Hohenstaufen@protonmail.com>
|
||||||
|
Date: Mon, 22 Dec 2025 01:43:50 +0000
|
||||||
|
Subject: [PATCH] Add client opacity focus
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 12 +++++++---
|
||||||
|
dwl.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 74 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 95c2afa..55abf84 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -13,6 +13,8 @@ static const float focuscolor[] = COLOR(0x005577ff);
|
||||||
|
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||||
|
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||||
|
static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */
|
||||||
|
+static const float default_opacity_unfocus = 0.70f;
|
||||||
|
+static const float default_opacity_focus = 1.00f;
|
||||||
|
|
||||||
|
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||||
|
#define TAGCOUNT (9)
|
||||||
|
@@ -22,10 +24,10 @@ static int log_level = WLR_ERROR;
|
||||||
|
|
||||||
|
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
|
||||||
|
static const Rule rules[] = {
|
||||||
|
- /* app_id title tags mask isfloating monitor */
|
||||||
|
+ /* app_id title tags mask isfloating alpha focus alpha unfocus monitor */
|
||||||
|
/* examples: */
|
||||||
|
- { "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
|
||||||
|
- { "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
|
||||||
|
+ { "Gimp_EXAMPLE", NULL, 0, 1, 1.00, 0.20, -1 }, /* Start on currently visible tags floating, not tiled */
|
||||||
|
+ { "firefox_EXAMPLE", NULL, 1 << 8, 0, 1.00, 1.00, -1 }, /* Start on ONLY tag "9" */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* layout(s) */
|
||||||
|
@@ -139,6 +141,10 @@ static const Key keys[] = {
|
||||||
|
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
||||||
|
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||||
|
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_k, setopacityunfocus, {.f = +0.1f} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_j, setopacityunfocus, {.f = -0.1f} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT, XKB_KEY_K, setopacityfocus, {.f = +0.1f} },
|
||||||
|
+ { MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT, XKB_KEY_J, setopacityfocus, {.f = -0.1f} },
|
||||||
|
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||||
|
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index 12f441e..e45e420 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -138,6 +138,9 @@ typedef struct {
|
||||||
|
unsigned int bw;
|
||||||
|
uint32_t tags;
|
||||||
|
int isfloating, isurgent, isfullscreen;
|
||||||
|
+ float opacity;
|
||||||
|
+ float opacity_focus;
|
||||||
|
+ float opacity_unfocus;
|
||||||
|
uint32_t resize; /* configure serial of a pending resize */
|
||||||
|
} Client;
|
||||||
|
|
||||||
|
@@ -227,6 +230,8 @@ typedef struct {
|
||||||
|
const char *title;
|
||||||
|
uint32_t tags;
|
||||||
|
int isfloating;
|
||||||
|
+ float opacity_focus;
|
||||||
|
+ float opacity_unfocus;
|
||||||
|
int monitor;
|
||||||
|
} Rule;
|
||||||
|
|
||||||
|
@@ -319,6 +324,7 @@ static void requeststartdrag(struct wl_listener *listener, void *data);
|
||||||
|
static void requestmonstate(struct wl_listener *listener, void *data);
|
||||||
|
static void resize(Client *c, struct wlr_box geo, int interact);
|
||||||
|
static void run(char *startup_cmd);
|
||||||
|
+static void scenebuffersetopacity(struct wlr_scene_buffer *buffer, int sx, int sy, void *user_data);
|
||||||
|
static void setcursor(struct wl_listener *listener, void *data);
|
||||||
|
static void setcursorshape(struct wl_listener *listener, void *data);
|
||||||
|
static void setfloating(Client *c, int floating);
|
||||||
|
@@ -326,6 +332,8 @@ static void setfullscreen(Client *c, int fullscreen);
|
||||||
|
static void setlayout(const Arg *arg);
|
||||||
|
static void setmfact(const Arg *arg);
|
||||||
|
static void setmon(Client *c, Monitor *m, uint32_t newtags);
|
||||||
|
+static void setopacityunfocus(const Arg *arg);
|
||||||
|
+static void setopacityfocus(const Arg *arg);
|
||||||
|
static void setpsel(struct wl_listener *listener, void *data);
|
||||||
|
static void setsel(struct wl_listener *listener, void *data);
|
||||||
|
static void setup(void);
|
||||||
|
@@ -490,6 +498,8 @@ applyrules(Client *c)
|
||||||
|
if ((!r->title || strstr(title, r->title))
|
||||||
|
&& (!r->id || strstr(appid, r->id))) {
|
||||||
|
c->isfloating = r->isfloating;
|
||||||
|
+ c->opacity_unfocus = r->opacity_unfocus;
|
||||||
|
+ c->opacity_focus = r->opacity_focus;
|
||||||
|
newtags |= r->tags;
|
||||||
|
i = 0;
|
||||||
|
wl_list_for_each(m, &mons, link) {
|
||||||
|
@@ -1127,6 +1137,10 @@ createnotify(struct wl_listener *listener, void *data)
|
||||||
|
c = toplevel->base->data = ecalloc(1, sizeof(*c));
|
||||||
|
c->surface.xdg = toplevel->base;
|
||||||
|
c->bw = borderpx;
|
||||||
|
+ /* Set default opacity*/
|
||||||
|
+ c->opacity_unfocus = default_opacity_unfocus;
|
||||||
|
+ c->opacity_focus = default_opacity_focus;
|
||||||
|
+ c->opacity = default_opacity_unfocus;
|
||||||
|
|
||||||
|
LISTEN(&toplevel->base->surface->events.commit, &c->commit, commitnotify);
|
||||||
|
LISTEN(&toplevel->base->surface->events.map, &c->map, mapnotify);
|
||||||
|
@@ -1429,6 +1443,7 @@ focusclient(Client *c, int lift)
|
||||||
|
wl_list_insert(&fstack, &c->flink);
|
||||||
|
selmon = c->mon;
|
||||||
|
c->isurgent = 0;
|
||||||
|
+ c->opacity = c->opacity_focus;
|
||||||
|
|
||||||
|
/* Don't change border color if there is an exclusive focus or we are
|
||||||
|
* handling a drag operation */
|
||||||
|
@@ -1453,6 +1468,7 @@ focusclient(Client *c, int lift)
|
||||||
|
client_set_border_color(old_c, bordercolor);
|
||||||
|
|
||||||
|
client_activate_surface(old, 0);
|
||||||
|
+ old_c->opacity = old_c->opacity_unfocus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printstatus();
|
||||||
|
@@ -2159,6 +2175,7 @@ rendermon(struct wl_listener *listener, void *data)
|
||||||
|
/* Render if no XDG clients have an outstanding resize and are visible on
|
||||||
|
* this monitor. */
|
||||||
|
wl_list_for_each(c, &clients, link) {
|
||||||
|
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
|
||||||
|
if (c->resize && !c->isfloating && client_is_rendered_on_mon(c, m) && !client_is_stopped(c))
|
||||||
|
goto skip;
|
||||||
|
}
|
||||||
|
@@ -2295,6 +2312,15 @@ run(char *startup_cmd)
|
||||||
|
wl_display_run(dpy);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+scenebuffersetopacity(struct wlr_scene_buffer *buffer, int sx, int sy, void *data)
|
||||||
|
+{
|
||||||
|
+ Client *c = data;
|
||||||
|
+ /* xdg-popups are children of Client.scene, we do not have to worry about
|
||||||
|
+ * messing with them. */
|
||||||
|
+ wlr_scene_buffer_set_opacity(buffer, c->isfullscreen ? 1 : c->opacity);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
setcursor(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
@@ -2363,6 +2389,7 @@ setfullscreen(Client *c, int fullscreen)
|
||||||
|
* client positions are set by the user and cannot be recalculated */
|
||||||
|
resize(c, c->prev, 0);
|
||||||
|
}
|
||||||
|
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
|
||||||
|
arrange(c->mon);
|
||||||
|
printstatus();
|
||||||
|
}
|
||||||
|
@@ -2419,6 +2446,44 @@ setmon(Client *c, Monitor *m, uint32_t newtags)
|
||||||
|
focusclient(focustop(selmon), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+setopacityunfocus(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ Client *sel = focustop(selmon);
|
||||||
|
+ if (!sel)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ sel->opacity_unfocus += arg->f;
|
||||||
|
+ if (sel->opacity_unfocus > 1.0)
|
||||||
|
+ sel->opacity_unfocus = 1.0f;
|
||||||
|
+
|
||||||
|
+ if (sel->opacity_unfocus < 0.1)
|
||||||
|
+ sel->opacity_unfocus = 0.1f;
|
||||||
|
+
|
||||||
|
+ wlr_scene_node_for_each_buffer(&sel->scene_surface->node, scenebuffersetopacity, sel);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+setopacityfocus(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ Client *sel = focustop(selmon);
|
||||||
|
+ if (!sel)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ sel->opacity_focus += arg->f;
|
||||||
|
+ if (sel->opacity_focus > 1.0)
|
||||||
|
+ sel->opacity_focus = 1.0f;
|
||||||
|
+
|
||||||
|
+ if (sel->opacity_focus < 0.1)
|
||||||
|
+ sel->opacity_focus = 0.1f;
|
||||||
|
+
|
||||||
|
+ /* Change opacity from current client */
|
||||||
|
+ sel->opacity = sel->opacity_focus;
|
||||||
|
+
|
||||||
|
+ wlr_scene_node_for_each_buffer(&sel->scene_surface->node, scenebuffersetopacity, sel);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
setpsel(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.53.0
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ Additionally, it adds some shortcuts:
|
|||||||
|
|
||||||
### Download
|
### Download
|
||||||
- [git branch](https://codeberg.org/sevz/dwl/src/branch/client-opacity)
|
- [git branch](https://codeberg.org/sevz/dwl/src/branch/client-opacity)
|
||||||
- [2024-06-07](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/client-opacity/client-opacity.patch)
|
- [2025-01-20](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/client-opacity/client-opacity.patch)
|
||||||
|
|
||||||
### Authors
|
### Authors
|
||||||
- [sevz](https://codeberg.org/sevz)
|
- [sevz](https://codeberg.org/sevz)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
From 652fd0f8c03724fc7addaa2822913790cbbe89f0 Mon Sep 17 00:00:00 2001
|
From ba3172875d379ff4f2db69753f50067cecfc8293 Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
|
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
|
||||||
<leohdz172@proton.me>
|
<leohdz172@proton.me>
|
||||||
Date: Tue, 25 Jul 2023 12:48:22 -0600
|
Date: Tue, 25 Jul 2023 12:48:22 -0600
|
||||||
@@ -7,28 +7,29 @@ Subject: [PATCH] add default transparency for windows and rules for override
|
|||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
Content-Type: text/plain; charset=UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
Content-Transfer-Encoding: 8bit
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
|
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
|
||||||
|
Modified-by: Yuki <yukii.senp@gmail.com>
|
||||||
|
|
||||||
---
|
---
|
||||||
config.def.h | 9 ++++++---
|
config.def.h | 9 ++++++---
|
||||||
dwl.c | 38 ++++++++++++++++++++++++++++++++++++++
|
dwl.c | 36 ++++++++++++++++++++++++++++++++++++
|
||||||
2 files changed, 44 insertions(+), 3 deletions(-)
|
2 files changed, 42 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
diff --git a/config.def.h b/config.def.h
|
||||||
index a784eb4f..2e3cdfbb 100644
|
index 95c2afa..808242a 100644
|
||||||
--- a/config.def.h
|
--- a/config.def.h
|
||||||
+++ b/config.def.h
|
+++ b/config.def.h
|
||||||
@@ -13,6 +13,7 @@ static const float focuscolor[] = COLOR(0x005577ff);
|
@@ -13,6 +13,7 @@ static const float focuscolor[] = COLOR(0x005577ff);
|
||||||
static const float urgentcolor[] = COLOR(0xff0000ff);
|
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||||
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||||
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */
|
||||||
+static const float default_opacity = 0.75;
|
+static const float default_opacity = 0.75;
|
||||||
|
|
||||||
/* tagging - TAGCOUNT must be no greater than 31 */
|
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||||
#define TAGCOUNT (9)
|
#define TAGCOUNT (9)
|
||||||
@@ -21,10 +22,10 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
@@ -22,10 +23,10 @@ static int log_level = WLR_ERROR;
|
||||||
static int log_level = WLR_ERROR;
|
|
||||||
|
|
||||||
|
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
|
||||||
static const Rule rules[] = {
|
static const Rule rules[] = {
|
||||||
- /* app_id title tags mask isfloating monitor */
|
- /* app_id title tags mask isfloating monitor */
|
||||||
+ /* app_id title tags mask isfloating alpha monitor */
|
+ /* app_id title tags mask isfloating alpha monitor */
|
||||||
@@ -40,7 +41,7 @@ index a784eb4f..2e3cdfbb 100644
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
@@ -130,6 +131,8 @@ static const Key keys[] = {
|
@@ -133,6 +134,8 @@ static const Key keys[] = {
|
||||||
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
||||||
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
|
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
|
||||||
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
|
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
|
||||||
@@ -50,7 +51,7 @@ index a784eb4f..2e3cdfbb 100644
|
|||||||
{ MODKEY, XKB_KEY_Tab, view, {0} },
|
{ MODKEY, XKB_KEY_Tab, view, {0} },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
|
||||||
diff --git a/dwl.c b/dwl.c
|
diff --git a/dwl.c b/dwl.c
|
||||||
index 6f041a0d..83c3cd23 100644
|
index 12f441e..f547148 100644
|
||||||
--- a/dwl.c
|
--- a/dwl.c
|
||||||
+++ b/dwl.c
|
+++ b/dwl.c
|
||||||
@@ -138,6 +138,7 @@ typedef struct {
|
@@ -138,6 +138,7 @@ typedef struct {
|
||||||
@@ -61,7 +62,7 @@ index 6f041a0d..83c3cd23 100644
|
|||||||
uint32_t resize; /* configure serial of a pending resize */
|
uint32_t resize; /* configure serial of a pending resize */
|
||||||
} Client;
|
} Client;
|
||||||
|
|
||||||
@@ -228,6 +229,7 @@ typedef struct {
|
@@ -227,6 +228,7 @@ typedef struct {
|
||||||
const char *title;
|
const char *title;
|
||||||
uint32_t tags;
|
uint32_t tags;
|
||||||
int isfloating;
|
int isfloating;
|
||||||
@@ -69,7 +70,7 @@ index 6f041a0d..83c3cd23 100644
|
|||||||
int monitor;
|
int monitor;
|
||||||
} Rule;
|
} Rule;
|
||||||
|
|
||||||
@@ -317,6 +319,7 @@ static void requeststartdrag(struct wl_listener *listener, void *data);
|
@@ -319,6 +321,7 @@ static void requeststartdrag(struct wl_listener *listener, void *data);
|
||||||
static void requestmonstate(struct wl_listener *listener, void *data);
|
static void requestmonstate(struct wl_listener *listener, void *data);
|
||||||
static void resize(Client *c, struct wlr_box geo, int interact);
|
static void resize(Client *c, struct wlr_box geo, int interact);
|
||||||
static void run(char *startup_cmd);
|
static void run(char *startup_cmd);
|
||||||
@@ -77,7 +78,7 @@ index 6f041a0d..83c3cd23 100644
|
|||||||
static void setcursor(struct wl_listener *listener, void *data);
|
static void setcursor(struct wl_listener *listener, void *data);
|
||||||
static void setcursorshape(struct wl_listener *listener, void *data);
|
static void setcursorshape(struct wl_listener *listener, void *data);
|
||||||
static void setfloating(Client *c, int floating);
|
static void setfloating(Client *c, int floating);
|
||||||
@@ -325,6 +328,7 @@ static void setgamma(struct wl_listener *listener, void *data);
|
@@ -326,6 +329,7 @@ static void setfullscreen(Client *c, int fullscreen);
|
||||||
static void setlayout(const Arg *arg);
|
static void setlayout(const Arg *arg);
|
||||||
static void setmfact(const Arg *arg);
|
static void setmfact(const Arg *arg);
|
||||||
static void setmon(Client *c, Monitor *m, uint32_t newtags);
|
static void setmon(Client *c, Monitor *m, uint32_t newtags);
|
||||||
@@ -85,7 +86,7 @@ index 6f041a0d..83c3cd23 100644
|
|||||||
static void setpsel(struct wl_listener *listener, void *data);
|
static void setpsel(struct wl_listener *listener, void *data);
|
||||||
static void setsel(struct wl_listener *listener, void *data);
|
static void setsel(struct wl_listener *listener, void *data);
|
||||||
static void setup(void);
|
static void setup(void);
|
||||||
@@ -464,6 +468,7 @@ applyrules(Client *c)
|
@@ -490,6 +494,7 @@ applyrules(Client *c)
|
||||||
if ((!r->title || strstr(title, r->title))
|
if ((!r->title || strstr(title, r->title))
|
||||||
&& (!r->id || strstr(appid, r->id))) {
|
&& (!r->id || strstr(appid, r->id))) {
|
||||||
c->isfloating = r->isfloating;
|
c->isfloating = r->isfloating;
|
||||||
@@ -93,33 +94,24 @@ index 6f041a0d..83c3cd23 100644
|
|||||||
newtags |= r->tags;
|
newtags |= r->tags;
|
||||||
i = 0;
|
i = 0;
|
||||||
wl_list_for_each(m, &mons, link) {
|
wl_list_for_each(m, &mons, link) {
|
||||||
@@ -472,6 +477,7 @@ applyrules(Client *c)
|
@@ -1127,6 +1132,7 @@ createnotify(struct wl_listener *listener, void *data)
|
||||||
}
|
c = toplevel->base->data = ecalloc(1, sizeof(*c));
|
||||||
}
|
c->surface.xdg = toplevel->base;
|
||||||
}
|
|
||||||
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
|
|
||||||
setmon(c, mon, newtags);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -773,6 +779,9 @@ commitnotify(struct wl_listener *listener, void *data)
|
|
||||||
if (client_surface(c)->mapped && c->mon)
|
|
||||||
resize(c, c->geom, (c->isfloating && !c->isfullscreen));
|
|
||||||
|
|
||||||
+ if (c->scene_surface)
|
|
||||||
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
|
|
||||||
+
|
|
||||||
/* mark a pending resize as completed */
|
|
||||||
if (c->resize && c->resize <= c->surface.xdg->current.configure_serial)
|
|
||||||
c->resize = 0;
|
|
||||||
@@ -1024,6 +1033,7 @@ createnotify(struct wl_listener *listener, void *data)
|
|
||||||
c = xdg_surface->data = ecalloc(1, sizeof(*c));
|
|
||||||
c->surface.xdg = xdg_surface;
|
|
||||||
c->bw = borderpx;
|
c->bw = borderpx;
|
||||||
+ c->opacity = default_opacity;
|
+ c->opacity = default_opacity;
|
||||||
|
|
||||||
wlr_xdg_toplevel_set_wm_capabilities(xdg_surface->toplevel,
|
LISTEN(&toplevel->base->surface->events.commit, &c->commit, commitnotify);
|
||||||
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN);
|
LISTEN(&toplevel->base->surface->events.map, &c->map, mapnotify);
|
||||||
@@ -2173,6 +2183,15 @@ run(char *startup_cmd)
|
@@ -2159,6 +2165,8 @@ rendermon(struct wl_listener *listener, void *data)
|
||||||
|
/* Render if no XDG clients have an outstanding resize and are visible on
|
||||||
|
* this monitor. */
|
||||||
|
wl_list_for_each(c, &clients, link) {
|
||||||
|
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
|
||||||
|
+
|
||||||
|
if (c->resize && !c->isfloating && client_is_rendered_on_mon(c, m) && !client_is_stopped(c))
|
||||||
|
goto skip;
|
||||||
|
}
|
||||||
|
@@ -2295,6 +2303,15 @@ run(char *startup_cmd)
|
||||||
wl_display_run(dpy);
|
wl_display_run(dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +127,7 @@ index 6f041a0d..83c3cd23 100644
|
|||||||
void
|
void
|
||||||
setcursor(struct wl_listener *listener, void *data)
|
setcursor(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
@@ -2241,6 +2260,7 @@ setfullscreen(Client *c, int fullscreen)
|
@@ -2363,6 +2380,7 @@ setfullscreen(Client *c, int fullscreen)
|
||||||
* client positions are set by the user and cannot be recalculated */
|
* client positions are set by the user and cannot be recalculated */
|
||||||
resize(c, c->prev, 0);
|
resize(c, c->prev, 0);
|
||||||
}
|
}
|
||||||
@@ -143,7 +135,7 @@ index 6f041a0d..83c3cd23 100644
|
|||||||
arrange(c->mon);
|
arrange(c->mon);
|
||||||
printstatus();
|
printstatus();
|
||||||
}
|
}
|
||||||
@@ -2308,6 +2328,23 @@ setmon(Client *c, Monitor *m, uint32_t newtags)
|
@@ -2419,6 +2437,23 @@ setmon(Client *c, Monitor *m, uint32_t newtags)
|
||||||
focusclient(focustop(selmon), 1);
|
focusclient(focustop(selmon), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,10 +148,10 @@ index 6f041a0d..83c3cd23 100644
|
|||||||
+
|
+
|
||||||
+ sel->opacity += arg->f;
|
+ sel->opacity += arg->f;
|
||||||
+ if (sel->opacity > 1.0)
|
+ if (sel->opacity > 1.0)
|
||||||
+ sel->opacity = 1.0;
|
+ sel->opacity = 1.0f;
|
||||||
+
|
+
|
||||||
+ if (sel->opacity < 0.1)
|
+ if (sel->opacity < 0.1)
|
||||||
+ sel->opacity = 0.1;
|
+ sel->opacity = 0.1f;
|
||||||
+
|
+
|
||||||
+ wlr_scene_node_for_each_buffer(&sel->scene_surface->node, scenebuffersetopacity, sel);
|
+ wlr_scene_node_for_each_buffer(&sel->scene_surface->node, scenebuffersetopacity, sel);
|
||||||
+}
|
+}
|
||||||
@@ -167,14 +159,14 @@ index 6f041a0d..83c3cd23 100644
|
|||||||
void
|
void
|
||||||
setpsel(struct wl_listener *listener, void *data)
|
setpsel(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
@@ -2997,6 +3034,7 @@ createnotifyx11(struct wl_listener *listener, void *data)
|
@@ -3130,6 +3165,7 @@ createnotifyx11(struct wl_listener *listener, void *data)
|
||||||
c->surface.xwayland = xsurface;
|
c->surface.xwayland = xsurface;
|
||||||
c->type = X11;
|
c->type = X11;
|
||||||
c->bw = borderpx;
|
c->bw = client_is_unmanaged(c) ? 0 : borderpx;
|
||||||
+ c->opacity = default_opacity;
|
+ c->opacity = default_opacity;
|
||||||
|
|
||||||
/* Listen to the various events it can emit */
|
/* Listen to the various events it can emit */
|
||||||
LISTEN(&xsurface->events.associate, &c->associate, associatex11);
|
LISTEN(&xsurface->events.associate, &c->associate, associatex11);
|
||||||
--
|
--
|
||||||
2.45.2
|
2.51.0
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
### Description
|
||||||
|
Adds simple support for color management using `wp_color_manager_v1`.
|
||||||
|
|
||||||
|
### Download
|
||||||
|
- [git branch](/caskd/dwl/src/branch/patches/color-management)
|
||||||
|
- [main 2025-06-18](/dwl/dwl-patches/raw/branch/main/patches/color_manager/color_manager.patch)
|
||||||
|
### Authors
|
||||||
|
- [caskd](https://codeberg.org/caskd)
|
||||||
|
caskd@redxen.eu
|
||||||
|
caskd at [Libera IRC dwl channel](https://web.libera.chat/?channels=#dwl)
|
||||||
@@ -0,0 +1,178 @@
|
|||||||
|
From 54ad3a9005a127a957bf081b0be765dcaff18c5d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alex Denes <caskd@redxen.eu>
|
||||||
|
Date: Thu, 10 Jul 2025 12:01:29 +0000
|
||||||
|
Subject: [PATCH] Implement color manager
|
||||||
|
|
||||||
|
---
|
||||||
|
Makefile | 9 ++++++++-
|
||||||
|
config.def.h | 24 ++++++++++++++++++++----
|
||||||
|
dwl.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
3 files changed, 79 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 3981fbb..190f29c 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -22,7 +22,8 @@ dwl: dwl.o util.o
|
||||||
|
dwl.o: dwl.c client.h config.h config.mk cursor-shape-v1-protocol.h \
|
||||||
|
ext-image-copy-capture-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
|
||||||
|
+ wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h \
|
||||||
|
+ color-management-v1-protocol.h color-representation-v1-protocol.h
|
||||||
|
util.o: util.c util.h
|
||||||
|
|
||||||
|
# wayland-scanner is a tool which generates C headers and rigging for Wayland
|
||||||
|
@@ -43,6 +44,12 @@ pointer-constraints-unstable-v1-protocol.h:
|
||||||
|
wlr-layer-shell-unstable-v1-protocol.h:
|
||||||
|
$(WAYLAND_SCANNER) enum-header \
|
||||||
|
protocols/wlr-layer-shell-unstable-v1.xml $@
|
||||||
|
+color-management-v1-protocol.h:
|
||||||
|
+ $(WAYLAND_SCANNER) enum-header \
|
||||||
|
+ $(WAYLAND_PROTOCOLS)/staging/color-management/color-management-v1.xml $@
|
||||||
|
+color-representation-v1-protocol.h:
|
||||||
|
+ $(WAYLAND_SCANNER) enum-header \
|
||||||
|
+ $(WAYLAND_PROTOCOLS)/staging/color-representation/color-representation-v1.xml $@
|
||||||
|
wlr-output-power-management-unstable-v1-protocol.h:
|
||||||
|
$(WAYLAND_SCANNER) server-header \
|
||||||
|
protocols/wlr-output-power-management-unstable-v1.xml $@
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 8a6eda0..d203edc 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -35,15 +35,31 @@ static const Layout layouts[] = {
|
||||||
|
{ "[M]", monocle },
|
||||||
|
};
|
||||||
|
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+static struct wlr_output_image_description generic_bt2020_pq = {
|
||||||
|
+ .primaries = WLR_COLOR_NAMED_PRIMARIES_BT2020,
|
||||||
|
+ .transfer_function = WLR_COLOR_TRANSFER_FUNCTION_ST2084_PQ,
|
||||||
|
+ .max_cll = 10000,
|
||||||
|
+ .max_fall = 400,
|
||||||
|
+ .mastering_luminance = {
|
||||||
|
+ .min = 0,
|
||||||
|
+ .max = 10000,
|
||||||
|
+ },
|
||||||
|
+};
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
/* monitors */
|
||||||
|
/* (x=-1, y=-1) is reserved as an "autoconfigure" monitor position indicator
|
||||||
|
* WARNING: negative values other than (-1, -1) cause problems with Xwayland clients due to
|
||||||
|
* https://gitlab.freedesktop.org/xorg/xserver/-/issues/899 */
|
||||||
|
static const MonitorRule monrules[] = {
|
||||||
|
- /* name mfact nmaster scale layout rotate/reflect x y
|
||||||
|
- * example of a HiDPI laptop monitor:
|
||||||
|
- { "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 }, */
|
||||||
|
- { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
||||||
|
+ /* name mfact nmaster scale layout rotate/reflect x y image_desc pixel_format
|
||||||
|
+ * example of a HiDPI laptop monitor:
|
||||||
|
+ { "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1, NULL, DRM_FORMAT_XRGB8888 },
|
||||||
|
+ * HDR Example
|
||||||
|
+ { NULL, 0.5f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1, &generic_bt2020_pq, DRM_FORMAT_XRGB2101010 }, */
|
||||||
|
+ { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1, NULL, DRM_FORMAT_XRGB8888 },
|
||||||
|
/* default monitor rule: can be changed but cannot be eliminated; at least one monitor rule must exist */
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index 8101ffa..4c3f12a 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -4,6 +4,7 @@
|
||||||
|
#include <getopt.h>
|
||||||
|
#include <libinput.h>
|
||||||
|
#include <linux/input-event-codes.h>
|
||||||
|
+#include <drm_fourcc.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
@@ -18,6 +19,8 @@
|
||||||
|
#include <wlr/render/wlr_renderer.h>
|
||||||
|
#include <wlr/types/wlr_alpha_modifier_v1.h>
|
||||||
|
#include <wlr/types/wlr_compositor.h>
|
||||||
|
+#include <wlr/types/wlr_color_management_v1.h>
|
||||||
|
+#include <wlr/types/wlr_color_representation_v1.h>
|
||||||
|
#include <wlr/types/wlr_cursor.h>
|
||||||
|
#include <wlr/types/wlr_cursor_shape_v1.h>
|
||||||
|
#include <wlr/types/wlr_data_control_v1.h>
|
||||||
|
@@ -219,6 +222,9 @@ typedef struct {
|
||||||
|
const Layout *lt;
|
||||||
|
enum wl_output_transform rr;
|
||||||
|
int x, y;
|
||||||
|
+
|
||||||
|
+ struct wlr_output_image_description *image_desc;
|
||||||
|
+ uint32_t render_format;
|
||||||
|
} MonitorRule;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
@@ -386,6 +392,7 @@ static struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard_mgr;
|
||||||
|
static struct wlr_virtual_pointer_manager_v1 *virtual_pointer_mgr;
|
||||||
|
static struct wlr_cursor_shape_manager_v1 *cursor_shape_mgr;
|
||||||
|
static struct wlr_output_power_manager_v1 *power_mgr;
|
||||||
|
+static struct wlr_color_manager_v1 *color_mgr;
|
||||||
|
|
||||||
|
static struct wlr_pointer_constraints_v1 *pointer_constraints;
|
||||||
|
static struct wlr_relative_pointer_manager_v1 *relative_pointer_mgr;
|
||||||
|
@@ -1088,6 +1095,20 @@ createmon(struct wl_listener *listener, void *data)
|
||||||
|
LISTEN(&wlr_output->events.destroy, &m->destroy, cleanupmon);
|
||||||
|
LISTEN(&wlr_output->events.request_state, &m->request_state, requestmonstate);
|
||||||
|
|
||||||
|
+ /* Enable HDR if supported and desired */
|
||||||
|
+ if ((r->image_desc) && (drw->features.output_color_transform) &&
|
||||||
|
+ (wlr_output->supported_primaries & r->image_desc->primaries) &&
|
||||||
|
+ (wlr_output->supported_transfer_functions & r->image_desc->transfer_function)) {
|
||||||
|
+ // Set framebuffer pixel format to one requested
|
||||||
|
+ wlr_output_state_set_render_format(&state, r->render_format);
|
||||||
|
+ // Check if unset and use default well-known primaries (white point will never be 0.0 if set)
|
||||||
|
+ struct wlr_color_primaries *prim = &r->image_desc->mastering_display_primaries;
|
||||||
|
+ if (prim->white.x == 0.0 && prim->white.y == 0.0) {
|
||||||
|
+ wlr_color_primaries_from_named (&r->image_desc->mastering_display_primaries, r->image_desc->primaries);
|
||||||
|
+ }
|
||||||
|
+ wlr_output_state_set_image_description(&state, r->image_desc);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
wlr_output_state_set_enabled(&state, 1);
|
||||||
|
wlr_output_commit_state(wlr_output, &state);
|
||||||
|
wlr_output_state_finish(&state);
|
||||||
|
@@ -2653,6 +2674,36 @@ setup(void)
|
||||||
|
wl_signal_add(&output_mgr->events.apply, &output_mgr_apply);
|
||||||
|
wl_signal_add(&output_mgr->events.test, &output_mgr_test);
|
||||||
|
|
||||||
|
+ if (drw->features.input_color_transform) {
|
||||||
|
+ struct wlr_color_manager_v1_options *color_mgr_options;
|
||||||
|
+ color_mgr_options = ecalloc(1, sizeof(*color_mgr_options));
|
||||||
|
+
|
||||||
|
+ // Enable only supported wlroots features
|
||||||
|
+ color_mgr_options->features = (struct wlr_color_manager_v1_features){
|
||||||
|
+ .parametric = true,
|
||||||
|
+ .set_mastering_display_primaries = true,
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ color_mgr_options->render_intents_len = 1;
|
||||||
|
+ enum wp_color_manager_v1_render_intent *render_intents = ecalloc(color_mgr_options->render_intents_len, sizeof(*render_intents));
|
||||||
|
+ render_intents[0] = WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL;
|
||||||
|
+ color_mgr_options->render_intents = render_intents;
|
||||||
|
+
|
||||||
|
+ enum wp_color_manager_v1_primaries *primaries = wlr_color_manager_v1_primaries_list_from_renderer(drw, &color_mgr_options->primaries_len);
|
||||||
|
+ color_mgr_options->primaries = primaries;
|
||||||
|
+
|
||||||
|
+ enum wp_color_manager_v1_transfer_function *transfer_functions = wlr_color_manager_v1_transfer_function_list_from_renderer(drw, &color_mgr_options->transfer_functions_len);
|
||||||
|
+ color_mgr_options->transfer_functions = transfer_functions;
|
||||||
|
+
|
||||||
|
+ color_mgr = wlr_color_manager_v1_create(dpy, 2, color_mgr_options);
|
||||||
|
+ wlr_scene_set_color_manager_v1(scene, color_mgr);
|
||||||
|
+
|
||||||
|
+ wlr_color_representation_manager_v1_create_with_renderer(dpy, 1, drw);
|
||||||
|
+
|
||||||
|
+ free(transfer_functions);
|
||||||
|
+ free(primaries);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* Make sure XWayland clients don't connect to the parent X server,
|
||||||
|
* e.g when running in the x11 backend or the wayland backend and the
|
||||||
|
* compositor has Xwayland support */
|
||||||
|
--
|
||||||
|
2.54.0
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
### Description
|
||||||
|
This patch allows a window to adjust its layout as if it was fullscreen, but it won't change its size and position, and it will stays under the control of dwl. For example a video on a browser can occupy the whole space reserved to the window, but we can still resize it and move it and see the status bar.
|
||||||
|
|
||||||
|
### Download
|
||||||
|
- [dwl 0.8](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/controlled_fullscreen/controlled_fullscreen.patch)
|
||||||
|
- [2025-11-13](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/controlled_fullscreen/controlled_fullscreen_2025_11_13.patch)
|
||||||
|
|
||||||
|
- [2025-10-08](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/controlled_fullscreen/controlled_fullscreen_2025_10_08.patch)
|
||||||
|
|
||||||
|
### Authors
|
||||||
|
- [André Desgualdo Pereira](https://codeberg.org/Kana)
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user