init: working version

This commit is contained in:
Kiana Sheibani 2025-10-07 19:43:46 -04:00
commit 7d8d7dacae
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
109 changed files with 15066 additions and 0 deletions

674
LICENSE Normal file
View file

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

9
README.md Normal file
View file

@ -0,0 +1,9 @@
# Quickshell Desktop - `toki-night`
This is my desktop environment, built using [Quickshell](https://quickshell.org/).
Some other Quickshell projects that inspired this one (and that I borrowed some code from):
- [caelestia-shell](https://github.com/caelestia-dots/shell)
- [illogical-impulse](https://github.com/end-4/dots-hyprland)

277
assets/nixos-logo.svg Normal file
View file

@ -0,0 +1,277 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
inkscape:export-ydpi="600"
inkscape:export-xdpi="600"
inkscape:export-filename="/Users/samuel/Projects/nixos/nixos-artwork/logo/white.png"
sodipodi:docname="nix-snowflake-rainbow.svg"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"
version="1.1"
id="svg2"
viewBox="0 0 501.56252 501.56251"
height="535"
width="535"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs4">
<linearGradient
inkscape:collect="always"
id="linearGradient15">
<stop
style="stop-color:#0c401a;stop-opacity:1;"
offset="0"
id="stop13" />
<stop
id="stop14"
offset="0.23168644"
style="stop-color:#008026;stop-opacity:1;" />
<stop
style="stop-color:#1f9943;stop-opacity:1;"
offset="1"
id="stop15" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient12">
<stop
style="stop-color:#2d1433;stop-opacity:1;"
offset="0"
id="stop10" />
<stop
id="stop11"
offset="0.23168644"
style="stop-color:#732982;stop-opacity:1;" />
<stop
style="stop-color:#9853a6;stop-opacity:1;"
offset="1"
id="stop12" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient9">
<stop
style="stop-color:#151c33;stop-opacity:1;"
offset="0"
id="stop7" />
<stop
id="stop8"
offset="0.23168644"
style="stop-color:#24408e;stop-opacity:1;" />
<stop
style="stop-color:#4763b2;stop-opacity:1;"
offset="1"
id="stop9" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient6">
<stop
style="stop-color:#8c0e0e;stop-opacity:1;"
offset="0"
id="stop4" />
<stop
id="stop5"
offset="0.23168644"
style="stop-color:#e40303;stop-opacity:1;" />
<stop
style="stop-color:#e45050;stop-opacity:1;"
offset="1"
id="stop6" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3">
<stop
style="stop-color:#b26a13;stop-opacity:1;"
offset="0"
id="stop1" />
<stop
id="stop2"
offset="0.23168644"
style="stop-color:#ff8c00;stop-opacity:1;" />
<stop
style="stop-color:#ffae4d;stop-opacity:1;"
offset="1"
id="stop3" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="main">
<stop
style="stop-color:#d4c829;stop-opacity:1;"
offset="0"
id="stop915" />
<stop
id="stop917"
offset="0.23168644"
style="stop-color:#ffed00;stop-opacity:1;" />
<stop
style="stop-color:#ffff4d;stop-opacity:1;"
offset="1"
id="stop919" />
</linearGradient>
<linearGradient
y2="880.37714"
x2="-414.38654"
y1="782.33563"
x1="-584.19934"
gradientTransform="translate(864.69589,-1491.3405)"
gradientUnits="userSpaceOnUse"
id="linearGradient1299"
xlink:href="#linearGradient3"
inkscape:collect="always" />
<linearGradient
y2="460.51822"
x2="389.57562"
y1="351.41116"
x1="200.59668"
gradientTransform="translate(210.82018,-765.27605)"
gradientUnits="userSpaceOnUse"
id="linearGradient1713"
xlink:href="#main"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6"
id="linearGradient4"
gradientUnits="userSpaceOnUse"
gradientTransform="rotate(60,1285.574,-127.0267)"
x1="200.59668"
y1="351.41116"
x2="389.57562"
y2="460.51822" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient9"
id="linearGradient7"
gradientUnits="userSpaceOnUse"
gradientTransform="rotate(180,372.09351,-188.18095)"
x1="200.59668"
y1="351.41116"
x2="389.57562"
y2="460.51822" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient12"
id="linearGradient10"
gradientUnits="userSpaceOnUse"
gradientTransform="rotate(120,405.50413,279.20289)"
x1="-584.19934"
y1="782.33563"
x2="-414.38654"
y2="880.37714" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient15"
id="linearGradient13"
gradientUnits="userSpaceOnUse"
gradientTransform="rotate(-120,-455.57263,-219.8159)"
x1="-584.19934"
y1="782.33563"
x2="-414.38654"
y2="880.37714" />
</defs>
<sodipodi:namedview
inkscape:showpageshadow="false"
borderlayer="true"
inkscape:pagecheckerboard="false"
units="px"
inkscape:document-rotation="0"
fit-margin-bottom="0"
fit-margin-right="0"
fit-margin-left="0"
fit-margin-top="0"
inkscape:snap-global="true"
inkscape:window-maximized="1"
inkscape:window-y="30"
inkscape:window-x="1920"
inkscape:window-height="1050"
inkscape:window-width="1920"
showgrid="false"
inkscape:current-layer="layer3"
inkscape:document-units="px"
inkscape:cy="474.1579"
inkscape:cx="21"
inkscape:zoom="0.45238095"
inkscape:pageshadow="2"
inkscape:pageopacity="1"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#ffffff"
id="base"
inkscape:deskcolor="#d1d1d1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-156.48372,537.56136)"
style="display:inline;opacity:1"
inkscape:label="gradient-logo"
id="layer3"
inkscape:groupmode="layer">
<g
style="stroke-width:11.0512"
transform="matrix(0.09048806,0,0,0.09048806,142.32381,-419.8252)"
id="g955">
<g
transform="matrix(11.047619,0,0,11.047619,-1572.2888,9377.7107)"
id="g869">
<g
transform="rotate(-60,226.35754,-449.37199)"
id="g932"
style="stroke-width:11.0512">
<path
sodipodi:nodetypes="cccccccccc"
inkscape:connector-curvature="0"
id="path3336-6"
d="m 449.71876,-420.51322 122.19683,211.67512 -56.15706,0.5268 -32.6236,-56.8692 -32.85645,56.5653 -27.90237,-0.011 -14.29086,-24.6896 46.81047,-80.4901 -33.22946,-57.8257 z"
style="opacity:1;fill:url(#linearGradient1713);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:33.1535;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<path
sodipodi:nodetypes="cccccccccc"
inkscape:connector-curvature="0"
id="path4260-0"
d="m 309.54892,-710.38827 122.19683,211.67512 -56.15706,0.5268 -32.6236,-56.8692 -32.85645,56.5653 -27.90237,-0.011 -14.29086,-24.6896 46.81047,-80.4901 -33.22946,-57.8256 z"
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#linearGradient1299);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:33.1535;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
<path
sodipodi:nodetypes="cccccccccc"
inkscape:connector-curvature="0"
id="use3439-6"
d="m 353.65459,-797.57947 -122.21762,211.66311 -28.53475,-48.37004 32.93837,-56.68746 -65.41521,-0.17187 -13.94166,-24.16966 14.23639,-24.72105 93.11171,0.294 33.46379,-57.6904 z"
style="fill:url(#linearGradient4);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:33.1535;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cccccccccc"
inkscape:connector-curvature="0"
id="use3449-5"
d="m 505.28844,-721.12474 -122.19683,-211.67512 56.15706,-0.5268 32.6236,56.8692 32.85645,-56.5653 27.90237,0.011 14.29086,24.6896 -46.81047,80.4901 33.22946,57.8257 z"
style="fill:url(#linearGradient7);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:33.1535;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cccccccccc"
inkscape:connector-curvature="0"
id="use4354-5"
d="m 451.30201,-803.62004 -244.41444,-0.012 27.62231,-48.89684 65.56197,0.18174 -32.55876,-56.73718 13.96071,-24.15866 28.52725,-0.0314 46.30123,80.7841 66.69317,0.13525 z"
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#linearGradient10);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:33.1535;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
<path
sodipodi:nodetypes="cccccccccc"
inkscape:connector-curvature="0"
id="use4362-2"
d="m 460.90516,-633.96606 122.21762,-211.66312 28.53475,48.37004 -32.93837,56.68746 65.41521,0.17187 13.94166,24.16966 -14.23639,24.72105 -93.11171,-0.294 -33.46371,57.69035 z"
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#linearGradient13);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:33.1535;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

186
config/Config.qml Normal file
View file

@ -0,0 +1,186 @@
pragma Singleton
import QtQuick
import Quickshell
Singleton {
readonly property list<string> terminalCommand: ["alacritty", "-e"]
readonly property QtObject anim: QtObject {
readonly property QtObject durations: QtObject {
readonly property int small: 200
readonly property int normal: 400
readonly property int large: 600
readonly property int extraLarge: 1000
readonly property int expressiveFastSpatial: 350
readonly property int expressiveDefaultSpatial: 500
readonly property int expressiveEffects: 200
}
readonly property QtObject curves: QtObject {
readonly property list<real> emphasized: [0.05, 0, 2 / 15, 0.06, 1 / 6, 0.4, 5 / 24, 0.82, 0.25, 1, 1, 1]
readonly property list<real> emphasizedAccel: [0.3, 0, 0.8, 0.15, 1, 1]
readonly property list<real> emphasizedDecel: [0.05, 0.7, 0.1, 1, 1, 1]
readonly property list<real> standard: [0.2, 0, 0, 1, 1, 1]
readonly property list<real> standardAccel: [0.3, 0, 1, 1, 1, 1]
readonly property list<real> standardDecel: [0, 0, 0, 1, 1, 1]
readonly property list<real> expressiveFastSpatial: [0.42, 1.67, 0.21, 0.9, 1, 1]
readonly property list<real> expressiveDefaultSpatial: [0.38, 1.21, 0.22, 1, 1, 1]
readonly property list<real> expressiveEffects: [0.34, 0.8, 0.34, 1, 1, 1]
}
}
readonly property QtObject colors: QtObject {
// Base colors
readonly property color red: "#f7768e"
readonly property color orange: "#ff9e64"
readonly property color yellow: "#e0af68"
readonly property color turqoise: "#73daca"
readonly property color green: "#9ece6a"
readonly property color cyan: "#b4f9f8"
readonly property color blue: "#7aa2f7"
readonly property color purple: "#bb9af7"
readonly property color magenta: "#d291ea"
readonly property color violet: "#9a94ce"
readonly property color brown: "#cfc9c2"
readonly property color pink: "#f6a8cf"
// Background
readonly property color bg: "#161621"
readonly property color container: "#202330"
readonly property color containerDash: "#1e202e"
readonly property color containerAlt: "#262a3b"
readonly property color overlay: "#030305"
// Foreground
readonly property color primary: "#a9b1d6"
readonly property color secondary: "#c0caf5"
readonly property color tertiary: "#787c99"
readonly property color inactive: "#42465d"
readonly property color primaryDark: "#343b58"
// Highlight
readonly property color highlight: "#c4feff"
readonly property color error: red
readonly property color errorBg: "#3f2536"
// By section
readonly property color dashboard: magenta
readonly property color mixer: cyan
readonly property color media: blue
readonly property color performance: orange
readonly property color workspaces: pink
readonly property color workspaceMove: red
readonly property color launcherApps: pink
readonly property color launcherActions: power
readonly property color activeWindow: pink
readonly property color calendar: turqoise
readonly property color network: purple
readonly property color idle: orange
readonly property color battery: green
readonly property color batteryWarning: error
readonly property color power: red
readonly property color osd: violet
readonly property color volume: cyan
readonly property color mic: blue
readonly property color brightness: yellow
readonly property color notification: magenta
readonly property color nixos: "#7dcfff"
}
readonly property QtObject font: QtObject {
readonly property QtObject family: QtObject {
readonly property string sans: "Rubik"
readonly property string mono: "JetBrains Mono Nerd Font"
readonly property string material: "Material Symbols Rounded"
}
readonly property QtObject size: QtObject {
readonly property int small: 8
readonly property int smaller: 10
readonly property int normal: 12
readonly property int larger: 15
readonly property int large: 20
readonly property int largest: 28
}
}
readonly property QtObject border: QtObject {
readonly property int thickness: 6
readonly property int rounding: 12
}
readonly property QtObject bar: QtObject {
readonly property int height: 40
readonly property int containerHeight: 30
readonly property int workspaceMargin: 2
}
readonly property QtObject osd: QtObject {
readonly property real volumeIncrement: 0.04
readonly property real micIncrement: 0.04
readonly property real brightnessIncrement: 0.05
readonly property int hideDelay: 1500
readonly property int sliderLength: 200
readonly property int sliderWidth: 30
}
readonly property QtObject notifs: QtObject {
readonly property bool expire: true
readonly property int defaultExpireTimeout: 5000
readonly property real clearThreshold: 0.3
readonly property int width: 350
readonly property int imageSize: 36
readonly property int badgeSize: 24
}
readonly property QtObject dashboard: QtObject {
readonly property int timeWidth: 240
readonly property int timeHeight: 100
readonly property int weatherWidth: 280
readonly property real mixerWidth: 360
readonly property real mixerHeight: 480
readonly property real mediaCoverArtWidth: 240
readonly property real mediaCoverArtHeight: 180
readonly property int mediaUpdateInterval: 500
readonly property real workspaceWidth: 280
}
readonly property QtObject launcher: QtObject {
readonly property int dragThreshold: 32
readonly property string actionPrefix: ">"
readonly property string specialPrefix: "@"
readonly property int itemWidth: 600
readonly property int itemHeight: 50
readonly property int maxItemCount: 8
}
readonly property QtObject services: QtObject {
readonly property string weatherLocation: ""
readonly property bool useFahrenheit: [Locale.ImperialUSSystem, Locale.ImperialSystem].includes(Qt.locale().measurementSystem)
readonly property string defaultPlayer: "Spotify"
readonly property string sunsetFrom: "21:00"
readonly property string sunsetTo: "9:00"
readonly property int sunsetTemperature: 4500
}
readonly property QtObject session: QtObject {
readonly property real buttonSize: 64
property list<string> logout: ["hyprctl", "dispatch", "exit"]
property list<string> lock: ["hyprlock", "--immediate"]
property list<string> suspend: ["systemctl", "suspend"]
property list<string> hibernate: ["systemctl", "suspend-then-hibernate"]
property list<string> sleep: suspend
property list<string> reboot: ["systemctl", "reboot"]
property list<string> shutdown: ["systemctl", "poweroff"]
}
}

8
custom/Anim.qml Normal file
View file

@ -0,0 +1,8 @@
import qs.config
import QtQuick
NumberAnimation {
duration: Config.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Config.anim.curves.standard
}

8
custom/CAnim.qml Normal file
View file

@ -0,0 +1,8 @@
import qs.config
import QtQuick
ColorAnimation {
duration: Config.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Config.anim.curves.standard
}

29
custom/ColoredIcon.qml Normal file
View file

@ -0,0 +1,29 @@
pragma ComponentBehavior: Bound
import Quickshell.Widgets
import QtQuick
IconImage {
id: root
required property color color
property color dominantColor
asynchronous: true
/* layer.enabled: true */
/* layer.effect: Colouriser { */
/* sourceColor: root.dominantColour */
/* colorizationColor: root.colour */
/* } */
/* layer.onEnabledChanged: { */
/* if (layer.enabled && status === Image.Ready) */
/* CUtils.getDominantColour(this, c => dominantColour = c); */
/* } */
/* onStatusChanged: { */
/* if (layer.enabled && status === Image.Ready) */
/* CUtils.getDominantColour(this, c => dominantColour = c); */
/* } */
}

View file

@ -0,0 +1,82 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.services
import QtQuick
import QtQuick.Controls
import QtQuick.Shapes
BusyIndicator {
id: root
property color fg: Config.colors.primary
property color bg: Config.colors.container
background: null
contentItem: Shape {
id: shape
preferredRendererType: Shape.CurveRenderer
asynchronous: true
RotationAnimator on rotation {
from: 0
to: 180
running: root.visible && root.running
loops: Animation.Infinite
duration: Config.anim.durations.extraLarge
easing.type: Easing.Linear
easing.bezierCurve: Config.anim.curves.expressiveDefaultSpatial
}
ShapePath {
strokeWidth: Math.min(root.implicitWidth, root.implicitHeight) * 0.18
strokeColor: root.bg
fillColor: "transparent"
capStyle: ShapePath.RoundCap
PathAngleArc {
centerX: shape.width / 2
centerY: shape.height / 2
radiusX: root.implicitWidth / 2
radiusY: root.implicitHeight / 2
startAngle: 0
sweepAngle: 360
}
Behavior on strokeColor {
CAnim {}
}
}
ShapePath {
strokeWidth: Math.min(root.implicitWidth, root.implicitHeight) * 0.18
strokeColor: root.fg
fillColor: "transparent"
capStyle: ShapePath.RoundCap
PathAngleArc {
centerX: shape.width / 2
centerY: shape.height / 2
radiusX: root.implicitWidth / 2
radiusY: root.implicitHeight / 2
startAngle: -sweepAngle / 2
sweepAngle: 60
}
PathAngleArc {
centerX: shape.width / 2
centerY: shape.height / 2
radiusX: root.implicitWidth / 2
radiusY: root.implicitHeight / 2
startAngle: 180 - sweepAngle / 2
sweepAngle: 60
}
Behavior on strokeColor {
CAnim {}
}
}
}
}

View file

@ -0,0 +1,8 @@
import QtQuick
import Quickshell.Widgets
import qs.config
ClippingRectangle {
color: "transparent"
}

View file

@ -0,0 +1,156 @@
import qs.services
import qs.config
import QtQuick
import QtQuick.Controls
Slider {
id: root
required property string icon
required property color color
property real oldValue
property bool initializing: true
Timer {
id: initDelay
running: true
interval: 100
onTriggered: root.initializing = false
}
orientation: Qt.Vertical
background: CustomRect {
color: Config.colors.container
radius: 1000
CustomRect {
implicitWidth: root.orientation === Qt.Horizontal ? root.handle.x + root.handle.width : root.handle.width
y: root.orientation === Qt.Vertical ? root.handle.y : 0
implicitHeight: root.orientation === Qt.Vertical ? parent.height - y : root.handle.height
color: root.color
opacity: 0.8
radius: parent.radius
}
}
handle: Item {
id: handle
property bool moving: false
x: root.orientation === Qt.Horizontal ? root.visualPosition * (root.availableWidth - width) : 0
y: root.orientation === Qt.Vertical ? root.visualPosition * (root.availableHeight - height) : 0
implicitWidth: root.orientation === Qt.Horizontal ? root.height : root.width
implicitHeight: implicitWidth
Elevation {
anchors.fill: parent
radius: rect.radius
level: handleInteraction.containsMouse ? 2 : 1
}
CustomRect {
id: rect
anchors.fill: parent
color: root.color
radius: 1000
MouseArea {
id: handleInteraction
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.NoButton
}
MaterialIcon {
id: icon
property bool moving: handle.moving
property bool stoppingMove: false
function update(): void {
text = moving ? Qt.binding(() => Math.round(root.value * 100)) : Qt.binding(() => root.icon);
font.family = moving ? Config.font.family.sans : Config.font.family.material;
font.pointSize = moving ? Config.font.size.smaller : Config.font.size.larger;
}
animate: !moving && !stoppingMove
animateDuration: Config.anim.durations.small
text: root.icon
font.pointSize: Config.font.size.larger
color: Config.colors.primaryDark
anchors.centerIn: parent
Behavior on moving {
enabled: icon.moving !== targetValue
SequentialAnimation {
PropertyAction {
target: icon
property: "stoppingMove"
value: true
}
Anim {
target: icon
property: "scale"
from: 1
to: 0
duration: Config.anim.durations.small / 2
easing.bezierCurve: Config.anim.curves.standardAccel
}
ScriptAction {
script: icon.update()
}
Anim {
target: icon
property: "scale"
from: 0
to: 1
duration: Config.anim.durations.small / 2
easing.bezierCurve: Config.anim.curves.standardDecel
}
PropertyAction {
target: icon
property: "stoppingMove"
value: false
}
}
}
}
}
}
onPressedChanged: handle.moving = pressed
onValueChanged: {
if (Math.abs(value - oldValue) < 0.01)
return;
if (!initializing) {
oldValue = value;
handle.moving = true;
stateChangeDelay.restart();
}
}
Timer {
id: stateChangeDelay
interval: 600
onTriggered: {
if (!root.pressed)
handle.moving = false;
}
}
Behavior on value {
enabled: !root.initializing
Anim {
duration: Config.anim.durations.normal
}
}
}

14
custom/CustomListView.qml Normal file
View file

@ -0,0 +1,14 @@
import qs.custom
import QtQuick
ListView {
id: root
maximumFlickVelocity: 3000
rebound: Transition {
Anim {
properties: "x,y"
}
}
}

View file

@ -0,0 +1,22 @@
import QtQuick
MouseArea {
property int scrollAccumulatedY: 0
property int scrollThreshold: 160
function onWheel(event: WheelEvent): void {
}
onWheel: event => {
// Update accumulated scroll
if (Math.sign(event.angleDelta.y) !== Math.sign(scrollAccumulatedY))
scrollAccumulatedY = 0;
scrollAccumulatedY += event.angleDelta.y;
// Trigger handler and reset if above threshold
if (Math.abs(scrollAccumulatedY) >= scrollThreshold) {
onWheel(event);
scrollAccumulatedY = 0;
}
}
}

7
custom/CustomRect.qml Normal file
View file

@ -0,0 +1,7 @@
import QtQuick
import qs.config
Rectangle {
color: "transparent"
}

107
custom/CustomScrollBar.qml Normal file
View file

@ -0,0 +1,107 @@
import qs.services
import qs.config
import QtQuick
import QtQuick.Templates
ScrollBar {
id: root
required property Flickable flickable
property bool shouldBeActive
property real nonAnimPosition
property bool animating
onHoveredChanged: {
if (hovered)
shouldBeActive = true;
else
shouldBeActive = flickable.moving;
}
onPositionChanged: {
if (position === nonAnimPosition)
animating = false;
else if (!animating)
nonAnimPosition = position;
}
position: nonAnimPosition
implicitWidth: 5
contentItem: CustomRect {
anchors.left: parent.left
anchors.right: parent.right
opacity: {
if (root.size === 1)
return 0;
if (fullMouse.pressed)
return 0.8;
if (mouse.containsMouse)
return 0.6;
if (root.policy === ScrollBar.AlwaysOn || root.shouldBeActive)
return 0.4;
return 0;
}
radius: 1000
color: Config.colors.secondary
MouseArea {
id: mouse
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
acceptedButtons: Qt.NoButton
}
Behavior on opacity {
Anim {}
}
}
Connections {
target: root.flickable
function onMovingChanged(): void {
if (root.flickable.moving)
root.shouldBeActive = true;
else
hideDelay.restart();
}
}
Timer {
id: hideDelay
interval: 600
onTriggered: root.shouldBeActive = root.flickable.moving || root.hovered
}
CustomMouseArea {
id: fullMouse
anchors.fill: parent
preventStealing: true
onPressed: event => {
root.animating = true;
root.nonAnimPosition = Math.max(0, Math.min(1 - root.size, event.y / root.height - root.size / 2));
}
onPositionChanged: event => root.nonAnimPosition = Math.max(0, Math.min(1 - root.size, event.y / root.height - root.size / 2))
function onWheel(event: WheelEvent): void {
root.animating = true;
if (event.angleDelta.y > 0)
root.nonAnimPosition = Math.max(0, root.nonAnimPosition - 0.1);
else if (event.angleDelta.y < 0)
root.nonAnimPosition = Math.min(1 - root.size, root.nonAnimPosition + 0.1);
}
}
Behavior on position {
enabled: !fullMouse.pressed
Anim {}
}
}

View file

@ -0,0 +1,5 @@
import Quickshell.Hyprland
GlobalShortcut {
appid: "quickshell"
}

59
custom/CustomSlider.qml Normal file
View file

@ -0,0 +1,59 @@
import qs.config
import qs.custom
import qs.services
import QtQuick
import QtQuick.Controls
Slider {
id: root
property color progressColor: Config.colors.primary
background: Item {
CustomRect {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.topMargin: root.implicitHeight / 4
anchors.bottomMargin: root.implicitHeight / 4
implicitWidth: root.handle.x - root.implicitHeight / 6
color: root.progressColor
radius: 1000
topRightRadius: root.implicitHeight / 15
bottomRightRadius: root.implicitHeight / 15
}
CustomRect {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.topMargin: root.implicitHeight / 4
anchors.bottomMargin: root.implicitHeight / 4
implicitWidth: parent.width - root.handle.x - root.handle.implicitWidth - root.implicitHeight / 6
color: Config.colors.container
radius: 1000
topLeftRadius: root.implicitHeight / 15
bottomLeftRadius: root.implicitHeight / 15
}
}
handle: CustomRect {
x: root.visualPosition * root.availableWidth - implicitWidth / 2
implicitWidth: root.implicitHeight / 3
implicitHeight: root.implicitHeight
color: Config.colors.secondary
radius: 1000
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
cursorShape: Qt.PointingHandCursor
}
}
}

155
custom/CustomSwitch.qml Normal file
View file

@ -0,0 +1,155 @@
import qs.config
import qs.custom
import qs.services
import qs.util
import QtQuick
import QtQuick.Controls
import QtQuick.Shapes
Switch {
id: root
property real size: Config.font.size.normal * 1.5
property color bg: Config.colors.container
property color accent: Color.mute(Config.colors.accent)
implicitWidth: implicitIndicatorWidth
implicitHeight: implicitIndicatorHeight
indicator: CustomRect {
radius: 1000
color: root.checked ? root.accent : root.bg
implicitWidth: implicitHeight * 1.7
implicitHeight: size
CustomRect {
readonly property real nonAnimWidth: root.pressed ? implicitHeight * 1.3 : implicitHeight
radius: 1000
color: root.checked ? Config.colors.secondary : Config.colors.tertiary
x: root.checked ? parent.implicitWidth - nonAnimWidth : 0
implicitWidth: nonAnimWidth
implicitHeight: parent.implicitHeight
anchors.verticalCenter: parent.verticalCenter
CustomRect {
anchors.fill: parent
radius: parent.radius
color: root.checked ? Config.colors.tertiary : Config.colors.secondary
opacity: root.pressed ? 0.4 : root.hovered ? 0.2 : 0
Behavior on opacity {
Anim {}
}
}
Shape {
id: icon
property point start1: {
if (root.pressed)
return Qt.point(width * 0.2, height / 2);
if (root.checked)
return Qt.point(width * 0.2, height / 2);
return Qt.point(width * 0.15, height * 0.15);
}
property point end1: {
if (root.pressed) {
if (root.checked)
return Qt.point(width * 0.4, height / 2);
return Qt.point(width * 0.8, height / 2);
}
if (root.checked)
return Qt.point(width * 0.45, height * 0.7);
return Qt.point(width * 0.85, height * 0.85);
}
property point start2: {
if (root.pressed) {
if (root.checked)
return Qt.point(width * 0.4, height / 2);
return Qt.point(width * 0.2, height / 2);
}
if (root.checked)
return Qt.point(width * 0.45, height * 0.7);
return Qt.point(width * 0.15, height * 0.85);
}
property point end2: {
if (root.pressed)
return Qt.point(width * 0.8, height / 2);
if (root.checked)
return Qt.point(width * 0.9, height * 0.2);
return Qt.point(width * 0.85, height * 0.15);
}
anchors.centerIn: parent
width: height
height: parent.implicitHeight * 0.45
preferredRendererType: Shape.CurveRenderer
asynchronous: true
ShapePath {
strokeWidth: root.size * 0.1
strokeColor: Config.colors.primaryDark
fillColor: "transparent"
capStyle: ShapePath.RoundCap
startX: icon.start1.x
startY: icon.start1.y
PathLine {
x: icon.end1.x
y: icon.end1.y
}
PathMove {
x: icon.start2.x
y: icon.start2.y
}
PathLine {
x: icon.end2.x
y: icon.end2.y
}
Behavior on strokeColor {
CAnim {}
}
}
Behavior on start1 {
PropAnim {}
}
Behavior on end1 {
PropAnim {}
}
Behavior on start2 {
PropAnim {}
}
Behavior on end2 {
PropAnim {}
}
}
Behavior on x {
Anim {}
}
Behavior on implicitWidth {
Anim {}
}
}
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
enabled: false
}
component PropAnim: PropertyAnimation {
duration: Config.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Config.anim.curves.standard
}
}

46
custom/CustomText.qml Normal file
View file

@ -0,0 +1,46 @@
import QtQuick
import Quickshell
import qs.config
Text {
id: root
// Either boolean or function taking old and new text
property var animate: false
property string animateProp: "opacity"
property real animateFrom: 0
property real animateTo: 1
property int animateDuration: Config.anim.durations.normal
renderType: Text.NativeRendering
textFormat: Text.PlainText
color: Config.colors.primary
linkColor: Config.colors.highlight
font.family: Config.font.family.sans
font.pointSize: Config.font.size.smaller
Behavior on text {
enabled: typeof root.animate === "boolean"
? root.animate : root.animate(root.text, targetValue)
SequentialAnimation {
Anim {
to: root.animateFrom
easing.bezierCurve: Config.anim.curves.standardAccel
}
PropertyAction {}
Anim {
to: root.animateTo
easing.bezierCurve: Config.anim.curves.standardDecel
}
}
}
component Anim: NumberAnimation {
target: root
property: root.animateProp
duration: root.animateDuration / 2
easing.type: Easing.BezierSpline
}
}

View file

@ -0,0 +1,68 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import qs.services
import QtQuick
import QtQuick.Controls
TextField {
id: root
color: Config.colors.secondary
placeholderTextColor: Config.colors.tertiary
font.family: Config.font.family.sans
font.pointSize: Config.font.size.smaller
renderType: TextField.NativeRendering
cursorVisible: !readOnly
background: null
cursorDelegate: CustomRect {
id: cursor
property bool disableBlink
implicitWidth: 2
color: Config.colors.primary
radius: 20
Connections {
target: root
function onCursorPositionChanged(): void {
if (root.activeFocus && root.cursorVisible) {
cursor.opacity = 1;
cursor.disableBlink = true;
enableBlink.restart();
}
}
}
Timer {
id: enableBlink
interval: 100
onTriggered: cursor.disableBlink = false
}
Timer {
running: root.activeFocus && root.cursorVisible && !cursor.disableBlink
repeat: true
triggeredOnStart: true
interval: 500
onTriggered: parent.opacity = parent.opacity === 1 ? 0 : 1
}
Binding {
when: !root.activeFocus || !root.cursorVisible
cursor.opacity: 0
}
Behavior on opacity {
Anim {
duration: Config.anim.durations.small
}
}
}
}

10
custom/CustomWindow.qml Normal file
View file

@ -0,0 +1,10 @@
import Quickshell
import Quickshell.Wayland
PanelWindow {
required property string name
WlrLayershell.namespace: `quickshell-${name}`
color: "transparent"
}

17
custom/Elevation.qml Normal file
View file

@ -0,0 +1,17 @@
import qs.config
import QtQuick
import QtQuick.Effects
RectangularShadow {
property int level
property real dp: [0, 1, 3, 6, 8, 12][level]
color: Qt.alpha(Config.colors.bg, 0.9)
blur: (dp * 5) ** 0.7
spread: -dp * 0.3 + (dp * 0.1) ** 2
offset.y: dp / 2
Behavior on dp {
Anim {}
}
}

49
custom/ExtraIndicator.qml Normal file
View file

@ -0,0 +1,49 @@
import qs.services
import qs.config
import QtQuick
CustomRect {
required property int extra
anchors.right: parent.right
anchors.margins: 12
color: Config.colors.inactive
radius: 12
implicitWidth: count.implicitWidth + 20
implicitHeight: count.implicitHeight + 10
opacity: extra > 0 ? 1 : 0
scale: extra > 0 ? 1 : 0.5
Elevation {
anchors.fill: parent
radius: parent.radius
opacity: parent.opacity
z: -1
level: 2
}
CustomText {
id: count
anchors.centerIn: parent
animate: false
text: qsTr("+%1").arg(parent.extra)
color: Config.colors.secondary
}
Behavior on opacity {
Anim {
duration: Config.anim.durations.expressiveFastSpatial
}
}
Behavior on scale {
Anim {
duration: Config.anim.durations.expressiveFastSpatial
easing.bezierCurve: Config.anim.curves.expressiveFastSpatial
}
}
}

18
custom/GlowEffect.qml Normal file
View file

@ -0,0 +1,18 @@
import QtQuick
import QtQuick.Effects
MultiEffect {
id: root
anchors.fill: source
property alias glowColor: root.shadowColor
shadowEnabled: true
blurMultiplier: 0.3
blurMax: 30
Behavior on shadowColor {
CAnim {}
}
}

32
custom/MaterialIcon.qml Normal file
View file

@ -0,0 +1,32 @@
import qs.config
import QtQuick
CustomText {
id: root
property real fill
property int grade: -25
property bool animateAxes: true
Behavior on font.variableAxes {
enabled: root.animateAxes && root.animate
SequentialAnimation {
PauseAnimation {
duration: root.animateDuration / 2
}
PropertyAction {}
}
}
color: Config.colors.secondary
animateProp: "scale"
font.family: "Material Symbols Rounded"
font.pointSize: Config.font.size.normal
font.variableAxes: ({
FILL: fill,
GRAD: grade,
opsz: fontInfo.pixelSize,
wght: fontInfo.weight
})
}

101
custom/StateLayer.qml Normal file
View file

@ -0,0 +1,101 @@
import QtQuick
import qs.config
import qs.custom
import qs.services
MouseArea {
id: root
property bool disabled
property color color: Config.colors.primary
property real radius: 1000
function onClicked(): void {}
cursorShape: disabled ? undefined : Qt.PointingHandCursor
hoverEnabled: true
onPressed: event => {
rippleAnim.x = event.x;
rippleAnim.y = event.y;
const dist = (ox, oy) => ox * ox + oy * oy;
rippleAnim.radius = Math.sqrt(Math.max(dist(0, 0), dist(0, width), dist(width, 0), dist(width, height)));
rippleAnim.restart();
}
onClicked: event => !disabled && onClicked(event)
SequentialAnimation {
id: rippleAnim
property real x
property real y
property real radius
PropertyAction {
target: ripple
property: "x"
value: rippleAnim.x
}
PropertyAction {
target: ripple
property: "y"
value: rippleAnim.y
}
PropertyAction {
target: ripple
property: "opacity"
value: 0.1
}
ParallelAnimation {
Anim {
target: ripple
properties: "implicitWidth,implicitHeight"
from: 0
to: rippleAnim.radius * 2
duration: Config.anim.durations.large
easing.bezierCurve: Config.anim.curves.standardDecel
}
Anim {
target: ripple
property: "opacity"
to: 0
duration: Config.anim.durations.large
easing.type: Easing.BezierSpline
easing.bezierCurve: Config.anim.curves.standardDecel
}
}
}
CustomClippingRect {
id: hoverLayer
anchors.fill: parent
property real alpha: root.disabled ? 0 : root.pressed ? 0.1 : root.containsMouse ? 0.05 : 0
color: Qt.alpha(root.color, alpha)
radius: root.radius
Behavior on alpha {
Anim {
duration: Config.anim.durations.small
}
}
CustomRect {
id: ripple
radius: 1000
color: root.color
opacity: 0
transform: Translate {
x: -ripple.width / 2
y: -ripple.height / 2
}
}
}
}

64
flake.lock generated Normal file
View file

@ -0,0 +1,64 @@
{
"nodes": {
"nix-systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1759386674,
"narHash": "sha256-wg1Lz/1FC5Q13R+mM5a2oTV9TA9L/CHHTm3/PiLayfA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "625ad6366178f03acd79f9e3822606dd7985b657",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"quickshell": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1759303785,
"narHash": "sha256-EUXrK7pUIzOQWR1dquZh26A6W8lsY2oiHEEZzQnsarM=",
"ref": "refs/heads/master",
"rev": "9662234759eb57f2a1057f2a1c667da1bf128c1c",
"revCount": 686,
"type": "git",
"url": "https://git.outfoxxed.me/outfoxxed/quickshell"
},
"original": {
"type": "git",
"url": "https://git.outfoxxed.me/outfoxxed/quickshell"
}
},
"root": {
"inputs": {
"nix-systems": "nix-systems",
"nixpkgs": "nixpkgs",
"quickshell": "quickshell"
}
}
},
"root": "root",
"version": 7
}

45
flake.nix Normal file
View file

@ -0,0 +1,45 @@
{
description = "My personal desktop shell, made with Quickshell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-systems.url = "github:nix-systems/default";
quickshell = {
url = "git+https://git.outfoxxed.me/outfoxxed/quickshell";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nix-systems, quickshell, ... } @ inputs:
let
inherit (nixpkgs) lib;
eachSystem = lib.genAttrs (import nix-systems);
fonts = pkgs: with pkgs; [ material-symbols rubik nerd-fonts.jetbrains-mono ];
in {
packages = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in rec {
toki-quickshell = pkgs.callPackage ./package.nix {
quickshell = quickshell.packages.${system}.default.override {
withX11 = false;
withI3 = false;
};
fonts = fonts pkgs;
};
default = toki-quickshell;
});
devShells = eachSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
shell = self.packages.${system}.default;
in {
default = pkgs.mkShell {
inputsFrom = [ shell ];
packages = [ pkgs.clazy ] ++ fonts pkgs;
};
});
};
}

145
modules/Commands.qml Normal file
View file

@ -0,0 +1,145 @@
import qs.config
import qs.custom
import qs.services
import qs.util
import Quickshell
import QtQuick
Scope {
id: root
// Workspace Handling
function allWorkspaces(): list<int> {
let ids = [];
States.screens.forEach((uiState, _, _) => {
for (let i = 0; i < uiState.workspaces.count; i++) {
ids.push(uiState.workspaces.get(i).workspace.id);
}
})
return ids;
}
function nextWorkspace(): int {
let id = 1;
const ws = allWorkspaces();
while (ws.includes(id)) id++;
return id;
}
// Workspace Commands
function newWorkspace(): void {
Hypr.dispatch(`focusworkspaceoncurrentmonitor ${nextWorkspace()}`);
}
CustomShortcut {
name: "newWorkspace"
description: "Go to a new workspace"
onPressed: root.newWorkspace();
}
Timer {
id: newWorkspaceTimer
running: false
interval: Hypr.arbitraryRaceConditionDelay
onTriggered: {
const uiState = States.getForActive();
const workspace = Hypr.focusedWorkspace;
// Add workspace if not already added during delay
let found = false;
for (let i = 0; i < uiState.workspaces.count; i++) {
if (uiState.workspaces.get(i).workspace.id === workspace.id)
found = true;
}
if (!found)
uiState.workspaces.append({"workspace": workspace});
}
}
function goToWorkspace(index: int): void {
const uiState = States.getForActive();
if (index > uiState.workspaces.count) return;
let id;
if (index === uiState.workspaces.count) {
id = root.nextWorkspace();
} else {
id = uiState.workspaces.get(index).workspace.id;
}
Hypr.dispatch(`workspace ${id}`);
}
Instantiator {
model: [...Array(10).keys()]
delegate: CustomShortcut {
required property int modelData
name: `workspace${modelData + 1}`
description: `Go to workspace ${modelData + 1}`
onPressed: root.goToWorkspace(modelData)
}
}
function moveToWorkspace(index: int): void {
const uiState = States.getForActive();
if (index > uiState.workspaces.count) return;
let id;
if (index === uiState.workspaces.count) {
id = nextWorkspace();
} else {
id = uiState.workspaces.get(index).workspace.id;
}
Hypr.dispatch(`movetoworkspace ${id}`);
}
Instantiator {
model: [...Array(10).keys()]
delegate: CustomShortcut {
required property int modelData
name: `movetoworkspace${modelData + 1}`
description: `Move the focused window to workspace ${modelData + 1}`
onPressed: root.moveToWorkspace(modelData)
}
}
// Panels
CustomShortcut {
name: "dashboard"
description: "Toggle dashboard"
onPressed: {
const uiState = States.getForActive();
uiState.dashboard = !uiState.dashboard;
}
}
CustomShortcut {
name: "launcher"
description: "Toggle launcher"
onPressed: {
const uiState = States.getForActive();
uiState.laucher = !uiState.launcher;
}
}
CustomShortcut {
name: "session"
description: "Toggle session menu"
onPressed: {
const uiState = States.getForActive();
uiState.session = !uiState.session;
}
}
CustomShortcut {
name: "escape"
description: "Close every panel"
onPressed: {
States.screens.forEach((uiState, _, _) => {
uiState.dashboard = false;
uiState.launcher = false;
uiState.osd = false;
uiState.session = false;
uiState.blockScreen = false;
});
}
}
}

137
modules/bar/Bar.qml Normal file
View file

@ -0,0 +1,137 @@
import QtQuick
import Quickshell
import qs.config
import qs.custom
import qs.services
import "modules"
import "popouts" as BarPopouts
Item {
id: root
required property PersistentProperties uiState
required property ShellScreen screen
required property BarPopouts.Wrapper popouts
anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right
implicitHeight: Config.bar.height
// Modules
NixOS {
id: nixos
objectName: "nixos"
anchors.left: parent.left
}
Workspaces {
id: workspaces
anchors.left: nixos.right
workspaces: root.uiState.workspaces
}
Window {
id: window
objectName: "window"
// Expand window title from center as much as possible
// without intersecting other modules
anchors.centerIn: parent
implicitWidth: 2 * Math.min(
(parent.width / 2) - workspaces.x - workspaces.width,
tray.x - (parent.width / 2)) - 40
}
Tray {
id: tray
objectName: "tray"
anchors.right: clock.left
anchors.rightMargin: 8
}
Clock {
id: clock
objectName: "clock"
anchors.right: statusIcons.left
anchors.rightMargin: 12
}
StatusIcons {
id: statusIcons
objectName: "statusIcons"
anchors.right: power.left
anchors.rightMargin: 6
}
Power {
id: power
uiState: root.uiState
anchors.right: parent.right
anchors.rightMargin: 6
}
// Popout Interactions
function checkPopout(x: real): void {
const ch = childAt(x, height / 2);
if (!ch) {
popouts.hasCurrent = false;
return;
}
const name = ch.objectName;
const left = ch.x;
const chWidth = ch.implicitWidth;
if (name === "nixos") {
popouts.currentName = "nixos";
popouts.currentCenter = 0;
popouts.hasCurrent = true;
} else if (name === "statusIcons") {
const layout = ch.children[0];
const icon = layout.childAt(mapToItem(layout, x, 0).x, layout.height / 2);
if (icon && icon.objectName) {
popouts.currentName = icon.objectName;
popouts.currentCenter = Qt.binding(() =>
icon.mapToItem(root, 0, icon.implicitWidth / 2).x);
popouts.hasCurrent = true;
} else if (icon && !icon.objectName) {
popouts.hasCurrent = false;
}
} else if (name === "tray") {
const index = Math.floor(((x - left) / chWidth) * tray.repeater.count);
const trayItem = tray.repeater.itemAt(index);
if (trayItem) {
popouts.currentName = `traymenu${index}`;
popouts.currentCenter = Qt.binding(() =>
trayItem.mapToItem(root, 0, trayItem.implicitWidth / 2).x);
popouts.hasCurrent = true;
}
} else if (name === "clock") {
popouts.currentName = "calendar";
popouts.currentCenter = ch.mapToItem(root, chWidth / 2, 0).x;
popouts.hasCurrent = true;
} else if (name === "window" && Hypr.activeToplevel) {
const inner = ch.childAt(mapToItem(ch, x, 0).x, height / 2)
if (inner) {
popouts.currentName = "activewindow";
popouts.currentCenter = ch.mapToItem(root, chWidth / 2, 0).x;
popouts.hasCurrent = true;
} else {
popouts.hasCurrent = false;
}
} else {
popouts.hasCurrent = false;
}
}
}

15
modules/bar/Container.qml Normal file
View file

@ -0,0 +1,15 @@
import QtQuick
import Quickshell
import qs.config
import qs.custom
CustomRect {
color: Config.colors.container
implicitWidth: Math.max(childrenRect.width, height)
implicitHeight: Config.bar.containerHeight
anchors.verticalCenter: parent.verticalCenter
radius: 1000
}

View file

@ -0,0 +1,35 @@
import QtQuick
import qs.services
import qs.config
import qs.custom
Row {
id: root
anchors.verticalCenter: parent.verticalCenter
property color color: Config.colors.turqoise
spacing: 4
MaterialIcon {
id: icon
text: "calendar_month"
font.pointSize: Config.font.size.normal + 1
color: root.color
anchors.verticalCenter: parent.verticalCenter
}
CustomText {
id: text
anchors.verticalCenter: parent.verticalCenter
text: Time.format("hh:mm")
font.pointSize: Config.font.size.smaller
font.family: Config.font.family.mono
color: root.color
}
}

View file

@ -0,0 +1,15 @@
import qs.config
import qs.custom
import QtQuick
CustomText {
anchors.verticalCenter: parent.verticalCenter
text: ""
width: implicitWidth + 32
horizontalAlignment: Text.AlignHCenter
font.family: Config.font.family.mono
font.pointSize: Config.font.size.normal
color: Config.colors.nixos
}

View file

@ -0,0 +1,29 @@
import Quickshell
import qs.config
import qs.custom
import qs.services
StateLayer {
required property PersistentProperties uiState
anchors.verticalCenter: parent.verticalCenter
implicitWidth: icon.implicitHeight + 10
implicitHeight: implicitWidth
function onClicked(): void {
uiState.session = !uiState.session;
}
MaterialIcon {
id: icon
anchors.centerIn: parent
anchors.horizontalCenterOffset: 0.5
text: "power_settings_new"
color: Config.colors.error
font.bold: true
font.pointSize: Config.font.size.smaller
}
}

View file

@ -0,0 +1,166 @@
import Quickshell
import Quickshell.Services.UPower
import QtQuick
import QtQuick.Layouts
import qs.services
import qs.config
import qs.custom
import qs.util
import qs.modules.bar
Container {
id: root
implicitWidth: layout.width + 20
RowLayout {
id: layout
anchors.centerIn: parent
spacing: 10
MaterialIcon {
id: network
objectName: "network"
Layout.alignment: Qt.AlignVCenter
text: Network.active ? Icons.getNetworkIcon(Network.active.strength ?? 0) : "wifi_off"
color: text !== "wifi_off" ? Config.colors.secondary : Config.colors.tertiary
animate: (from, to) => from === "wifi_off" || to === "wifi_off"
MouseArea {
anchors.fill: parent
onClicked: Network.toggleWifi()
}
}
/* MaterialIcon { */
/* id: bluetooth */
/* objectName: "bluetooth" */
/* anchors.verticalCenter: parent.verticalCenter */
/* animate: true */
/* text: Bluetooth.powered ? "bluetooth" : "bluetooth_disabled" */
/* } */
/* Row { */
/* id: devices */
/* objectName: "devices" */
/* anchors.verticalCenter: parent.verticalCenter */
/* Repeater { */
/* id: repeater */
/* model: ScriptModel { */
/* values: Bluetooth.devices.filter(d => d.connected) */
/* } */
/* MaterialIcon { */
/* required property Bluetooth.Device modelData */
/* animate: true */
/* text: Icons.getBluetoothIcon(modelData.icon) */
/* fill: 1 */
/* } */
/* } */
/* } */
MaterialIcon {
id: idleinhibit
objectName: "idleinhibit"
Layout.alignment: Qt.AlignVCenter
text: Idle.inhibit ? "visibility" : "visibility_off"
color: text === "visibility" ? Config.colors.secondary : Config.colors.tertiary
fill: Idle.inhibit ? 1 : 0
animate: true
MouseArea {
anchors.fill: parent
onClicked: Idle.inhibit = !Idle.inhibit
}
}
MaterialIcon {
id: battery
objectName: "battery"
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: hasBattery ? -2 : 0
Layout.topMargin: hasBattery ? 0.5 : 2
readonly property bool hasBattery: UPower.displayDevice.isLaptopBattery
readonly property real percentage: UPower.displayDevice.percentage
readonly property bool charging: !UPower.onBattery && batteryText.text !== "100"
readonly property bool warning: UPower.onBattery && percentage < 0.15
text: {
if (!hasBattery) {
if (PowerProfiles.profile === PowerProfile.PowerSaver)
return "energy_savings_leaf";
if (PowerProfiles.profile === PowerProfile.Performance)
return "rocket_launch";
return "balance";
}
return `battery_android_full`;
}
fill: 1
font.pointSize: hasBattery ? 18 : Config.font.size.normal
grade: 50
font.weight: 100
color: !hasBattery ? Config.colors.secondary :
warning ? Config.colors.errorBg :
batteryText.text === "100" ? Config.colors.battery :
Color.mute(Config.colors.battery, 0.6, 1.5)
CustomRect {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.topMargin: 9
anchors.bottomMargin: 9
anchors.leftMargin: 3
width: (battery.width - 7) * battery.percentage
radius: 2
visible: battery.hasBattery
color: battery.warning ? Config.colors.batteryWarning : Config.colors.battery
}
Row {
anchors.centerIn: parent
anchors.horizontalCenterOffset: battery.charging ? width / 20 : -width / 15
visible: battery.hasBattery
spacing: -1
CustomText {
id: batteryText
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: 0.5
text: Math.round(battery.percentage * 100)
color: battery.warning ? Config.colors.batteryWarning : Config.colors.bg
font.family: Config.font.family.mono
font.pointSize: 6
font.weight: 800
}
MaterialIcon {
anchors.verticalCenter: parent.verticalCenter
visible: battery.charging
text: "bolt"
fill: 1
color: Config.colors.bg
font.pointSize: 7
font.weight: 300
}
}
}
}
}

View file

@ -0,0 +1,92 @@
pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Quickshell.Widgets
import Quickshell.Services.SystemTray
import qs.config
import qs.custom
Item {
id: root
clip: true
anchors.verticalCenter: parent.verticalCenter
implicitWidth: layout.implicitWidth
implicitHeight: layout.implicitHeight
// To avoid warnings about being visible with no size
visible: width > 0 && height > 0
readonly property Item repeater: repeater
Row {
id: layout
add: Transition {
Anim {
property: "scale"
from: 0
to: 1
easing.bezierCurve: Config.anim.curves.standardDecel
}
}
move: Transition {
Anim {
property: "scale"
to: 1
easing.bezierCurve: Config.anim.curves.standardDecel
}
Anim {
properties: "x,y"
easing.bezierCurve: Config.anim.curves.standard
}
}
Repeater {
id: repeater
model: SystemTray.items
MouseArea {
id: trayItem
required property SystemTrayItem modelData
implicitWidth: icon.implicitWidth + 10
implicitHeight: icon.implicitHeight
onClicked: modelData.activate()
IconImage {
id: icon
anchors.centerIn: parent
source: {
let icon = trayItem.modelData.icon;
if (icon.includes("?path=")) {
const [name, path] = icon.split("?path=");
icon = `file://${path}/${name.slice(name.lastIndexOf("/") + 1)}`;
}
return icon;
}
asynchronous: true
implicitSize: Config.font.size.larger
}
}
}
}
Behavior on implicitWidth {
Anim {
easing.bezierCurve: Config.anim.curves.emphasized
}
}
Behavior on implicitHeight {
Anim {
easing.bezierCurve: Config.anim.curves.emphasized
}
}
}

View file

@ -0,0 +1,96 @@
pragma ComponentBehavior: Bound
import QtQuick
import qs.config
import qs.custom
import qs.services
import qs.util
Item {
id: root
property color color: Config.colors.primary
implicitHeight: child.implicitHeight
Item {
id: child
anchors.centerIn: parent
implicitWidth: icon.implicitWidth + current.implicitWidth + current.anchors.leftMargin
implicitHeight: Math.max(icon.implicitHeight, current.implicitHeight)
clip: true
property Item current: text1
MaterialIcon {
id: icon
animate: true
text: {
const cls = Hypr.activeToplevel?.lastIpcObject.class;
if (!cls) return "desktop_windows";
Icons.getAppCategoryIcon(cls, "ad")
}
color: root.color
font.pointSize: Config.font.size.larger
anchors.verticalCenter: parent.verticalCenter
}
Title {
id: text1
}
Title {
id: text2
}
TextMetrics {
id: metrics
text: Hypr.activeToplevel?.title ?? qsTr("Desktop")
font.pointSize: Config.font.size.smaller
font.family: Config.font.family.mono
elide: Qt.ElideRight
elideWidth: root.width - icon.width
onTextChanged: {
const next = child.current === text1 ? text2 : text1;
next.text = elidedText;
child.current = next;
}
onElideWidthChanged: child.current.text = elidedText
}
Behavior on implicitWidth {
Anim {
easing.bezierCurve: Config.anim.curves.emphasized
}
}
Behavior on implicitHeight {
Anim {
easing.bezierCurve: Config.anim.curves.emphasized
}
}
}
component Title: CustomText {
id: text
anchors.verticalCenter: icon.verticalCenter
anchors.left: icon.right
anchors.leftMargin: 8
font.pointSize: metrics.font.pointSize
font.family: metrics.font.family
color: root.color
opacity: child.current === this ? 1 : 0
Behavior on opacity {
Anim {}
}
}
}

View file

@ -0,0 +1,234 @@
pragma ComponentBehavior: Bound
import qs.services
import qs.config
import qs.custom
import qs.util
import qs.modules.bar
import QtQuick
import QtQuick.Effects
import QtQuick.Layouts
import Quickshell
import Quickshell.Hyprland
Container {
id: root
required property ListModel workspaces
readonly property HyprlandMonitor monitor: Hypr.monitorFor(QsWindow.window.screen)
// Workspace Layout
implicitWidth: Math.max(list.width + Config.bar.workspaceMargin * 2, height)
Behavior on implicitWidth {
Anim {
easing.bezierCurve: Config.anim.curves.emphasized
}
}
readonly property real workspaceSize: Config.bar.containerHeight - Config.bar.workspaceMargin * 2
Item {
id: listWrapper
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: Config.bar.workspaceMargin
width: list.width
height: list.height
layer.enabled: true
layer.smooth: true
ListView {
id: list
anchors.centerIn: parent
width: contentWidth
height: root.workspaceSize
acceptedButtons: Qt.NoButton
boundsBehavior: Flickable.StopAtBounds
spacing: Config.bar.workspaceMargin
orientation: ListView.Horizontal
model: root.workspaces
delegate: Item {
id: buttonWrapper
required property int index
required property HyprlandWorkspace workspace
width: button.width
height: button.height
readonly property Item button: button
StateLayer {
id: button
anchors.horizontalCenter: buttonWrapper.horizontalCenter
anchors.verticalCenter: buttonWrapper.verticalCenter
width: height
height: root.workspaceSize
drag.target: this
drag.axis: Drag.XAxis
drag.threshold: 2
drag.minimumX: list.x
drag.maximumX: list.x + list.width - root.workspaceSize
states: State {
name: "dragging"
when: button.drag.active
ParentChange {
target: button
parent: listWrapper
}
AnchorChanges {
target: button
anchors.horizontalCenter: undefined
}
}
transitions: Transition {
from: "dragging"
to: ""
ParentAnimation {
AnchorAnimation {
duration: Config.anim.durations.small
easing.type: Easing.BezierSpline
easing.bezierCurve: Config.anim.curves.standardDecel
}
}
}
function onClicked(): void {
if (root.monitor.activeWorkspace !== workspace)
Hypr.dispatch(`workspace ${workspace.id}`);
}
onXChanged: {
if (!drag.active) return;
const wsx = x / (width + list.spacing);
root.workspaces.move(index, Math.round(wsx), 1);
}
MaterialIcon {
anchors.centerIn: parent
text: Icons.getWorkspaceIcon(buttonWrapper.workspace)
color: Config.colors.primary
font.pointSize: Config.font.size.larger
animate: true
animateDuration: Config.anim.durations.small
}
}
}
add: Transition {
Anim {
property: "opacity"
from: 0
to: 1
}
}
remove: Transition {
Anim {
property: "opacity"
from: 1
to: 0
}
}
move: Transition {
Anim {
property: "x"
}
Anim {
properties: "opacity"
to: 1
}
}
displaced: Transition {
Anim {
property: "x"
}
Anim {
properties: "opacity"
to: 1
}
}
}
}
// Active Indicator
CustomRect {
id: activeInd
readonly property Item active: {
list.count;
const activeWorkspace = root.monitor.activeWorkspace;
for (let i = 0; i < (root.workspaces?.count ?? 0); i++) {
if (root.workspaces.get(i).workspace === activeWorkspace)
return list.itemAtIndex(i);
}
return null;
}
x: active ? (active.button.drag.active ? active.button.x : active.x) + Config.bar.workspaceMargin : 0
y: Config.bar.workspaceMargin
width: active?.width ?? workspaceSize
height: active?.height ?? workspaceSize
radius: 1000
color: Config.colors.workspaces
clip: true
property bool transition: false
onActiveChanged: transition = true
Behavior on x {
enabled: activeInd.transition
SequentialAnimation {
Anim {
easing.bezierCurve: Config.anim.curves.emphasized
}
PropertyAction {
target: activeInd
property: "transition"
value: false
}
}
}
CustomRect {
id: base
visible: false
anchors.fill: parent
color: Config.colors.primaryDark
}
MultiEffect {
source: base
maskSource: listWrapper
maskEnabled: true
maskSpreadAtMin: 1
maskThresholdMin: 0.5
x: -parent.x + Config.bar.workspaceMargin
implicitWidth: listWrapper.width
implicitHeight: listWrapper.height
anchors.verticalCenter: parent.verticalCenter
}
}
}

View file

@ -0,0 +1,425 @@
import qs.config
import qs.custom
import qs.services
import qs.util
import Quickshell
import Quickshell.Widgets
import Quickshell.Hyprland
import Quickshell.Wayland
import QtQuick
import QtQuick.Layouts
Item {
id: root
required property PersistentProperties uiState
required property Item wrapper
required property HyprlandToplevel window
property HyprlandToplevel toplevel: Hypr.activeToplevel
property var screen: QsWindow.window.screen
property bool pinned: false
implicitWidth: childrenRect.width
implicitHeight: childrenRect.height
Component.onCompleted: {
if (window) {
state = "detail";
pinned = true;
toplevel = window;
}
wrapper.window = null;
}
// States
states: [
State {
name: "detail"
StateChangeScript {
script: root.wrapper.persistent = true
}
ParentChange {
target: header
parent: infobox
}
PropertyChanges {
infobox { visible: true }
preview { visible: true }
pin { visible: true }
visit { visible: true }
del { visible: true }
expand { rotation: -90 }
title { maximumLineCount: 1 }
}
}
]
transitions: Transition {
Anim {
targets: [infobox, preview]
property: "scale"
from: 0; to: 1
}
Anim {
target: buttons
property: "opacity"
from: 0; to: 1
duration: Config.anim.durations.large * 2
}
Anim {
targets: header
property: "scale"
to: 1
}
}
// Reveal on window title change
// (or close if window is invalid)
Anim on opacity {
id: reveal
from: 0
to: 1
}
onToplevelChanged: {
root.opacity = 0;
if (!toplevel) {
root.wrapper.hasCurrent = false;
} else if (!root.pinned) {
reveal.restart();
} else {
root.opacity = 1;
}
}
RowLayout {
id: layout
spacing: 15
RowLayout {
id: header
spacing: 12
Binding {
when: infobox.visible
header {
anchors.left: infobox.left
anchors.right: infobox.right
anchors.top: infobox.top
anchors.margins: 12
}
}
IconImage {
id: icon
Layout.alignment: Qt.AlignVCenter
implicitSize: 36
source: Icons.getAppIcon(toplevel?.lastIpcObject.class ?? "", "")
}
ColumnLayout {
id: names
spacing: 0
Layout.fillWidth: true
Layout.maximumWidth: 400
CustomText {
id: title
Layout.fillWidth: true
text: toplevel?.title ?? ""
color: Config.colors.secondary
elide: Text.ElideRight
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
Behavior on text {
Anim {
target: names
property: "opacity"
from: 0
to: 1
}
}
}
CustomText {
Layout.fillWidth: true
text: toplevel?.lastIpcObject.class ?? ""
font.pointSize: Config.font.size.small
color: Config.colors.tertiary
elide: Text.ElideRight
Behavior on text {
Anim {
target: names
property: "opacity"
from: 0
to: 1
}
}
}
}
}
CustomRect {
id: infobox
visible: false
transformOrigin: Item.TopRight
implicitWidth: 300
implicitHeight: 240
color: Config.colors.container
radius: 17
ColumnLayout {
id: infolayout
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 48
anchors.margins: 12
spacing: 3
CustomRect {
color: Config.colors.inactive
Layout.fillWidth: true
Layout.preferredHeight: 1
Layout.topMargin: 8
Layout.bottomMargin: 6
Layout.leftMargin: 5
Layout.rightMargin: 5
}
Detail {
icon: "workspaces"
text: {
for (let i = 0; i < root.uiState.workspaces.count; i++) {
if (root.uiState.workspaces.get(i).workspace === root.toplevel?.workspace)
return qsTr("Workspace: %1").arg(i + 1)
}
return qsTr("Workspace unknown")
}
}
Detail {
icon: "desktop_windows"
text: {
const mon = root.toplevel?.monitor;
mon ? qsTr("Monitor: %1 (%2)").arg(mon.name).arg(mon.id) : qsTr("Monitor: unknown")
}
}
Detail {
icon: "location_on"
text: qsTr("Address: %1").arg(`0x${root.toplevel?.address}` ?? "unknown")
}
Detail {
icon: "location_searching"
text: qsTr("Position: %1, %2").arg(root.toplevel?.lastIpcObject.at[0] ?? -1).arg(root.toplevel?.lastIpcObject.at[1] ?? -1)
}
Detail {
icon: "resize"
text: qsTr("Size: %1 %2").arg(root.toplevel?.lastIpcObject.size[0] ?? -1).arg(root.toplevel?.lastIpcObject.size[1] ?? -1)
color: Config.colors.tertiary
}
Detail {
icon: "account_tree"
text: qsTr("Process id: %1").arg(Number(root.toplevel?.lastIpcObject.pid ?? -1).toLocaleString(undefined, "f"))
color: Config.colors.primary
}
Detail {
icon: "gradient"
text: qsTr("Xwayland: %1").arg(root.toplevel?.lastIpcObject.xwayland ? "yes" : "no")
}
Detail {
icon: "picture_in_picture_center"
text: qsTr("Floating: %1").arg(root.toplevel?.lastIpcObject.floating ? "yes" : "no")
color: Config.colors.secondary
}
}
}
ClippingWrapperRectangle {
id: preview
visible: false
Layout.alignment: Qt.AlignVCenter
transformOrigin: Item.TopLeft
color: "transparent"
radius: 12
ScreencopyView {
captureSource: root.toplevel?.wayland ?? null
live: true
constraintSize.width: 375
constraintSize.height: 240
}
}
Item {
id: buttons
Layout.fillHeight: true
width: buttonTopLayout.width
property real buttonSize: 37
ColumnLayout {
id: buttonTopLayout
spacing: 2
anchors.top: parent.top
StateLayer {
id: expand
implicitWidth: buttons.buttonSize
implicitHeight: buttons.buttonSize
function onClicked(): void {
if (root.state === "")
root.state = "detail";
else
root.wrapper.hasCurrent = false;
}
MaterialIcon {
anchors.centerIn: parent
anchors.horizontalCenterOffset: font.pointSize * 0.05
text: "chevron_right"
font.pointSize: Config.font.size.large
}
}
StateLayer {
id: pin
visible: false
implicitWidth: buttons.buttonSize
implicitHeight: buttons.buttonSize
function onClicked(): void {
if (root.pinned) {
root.pinned = false;
root.toplevel = Qt.binding(() => Hypr.activeToplevel);
} else {
root.pinned = true;
root.toplevel = root.toplevel;
}
}
MaterialIcon {
anchors.centerIn: parent
text: "keep"
fill: root.pinned
font.pointSize: Config.font.size.large - 3
}
}
}
ColumnLayout {
id: buttonBottomLayout
anchors.bottom: parent.bottom
spacing: 2
StateLayer {
id: visit
visible: false
implicitWidth: buttons.buttonSize
implicitHeight: buttons.buttonSize
disabled: Hypr.activeToplevel === root.toplevel
function onClicked(): void {
if (root.toplevel)
Hypr.dispatch(`focuswindow address:0x${root.toplevel.address}`);
}
MaterialIcon {
anchors.centerIn: parent
text: "flip_to_front"
color: parent.disabled ? Config.colors.inactive : Config.colors.primary
font.pointSize: Config.font.size.large - 3
Behavior on color {
CAnim {}
}
}
}
StateLayer {
id: del
visible: false
Layout.bottomMargin: 8
color: Config.colors.error
implicitWidth: buttons.buttonSize
implicitHeight: buttons.buttonSize
function onClicked(): void {
if (root.toplevel)
Hypr.dispatch(`killwindow address:0x${root.toplevel.address}`);
root.wrapper.hasCurrent = false;
}
MaterialIcon {
anchors.centerIn: parent
text: "delete"
color: Config.colors.error
font.pointSize: Config.font.size.large - 3
}
}
}
}
}
component Detail: RowLayout {
id: detail
required property string icon
required property string text
property alias color: icon.color
Layout.fillWidth: true
spacing: 7
MaterialIcon {
id: icon
Layout.alignment: Qt.AlignVCenter
font.pointSize: Config.font.size.smaller
text: detail.icon
}
CustomText {
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
text: detail.text
elide: Text.ElideRight
font.family: Config.font.family.mono
font.pointSize: Config.font.size.smaller
}
}
}

View file

@ -0,0 +1,80 @@
import qs.config
import qs.custom
import qs.services
import QtQuick
import QtQuick.Shapes
Shape {
id: root
required property Item wrapper
readonly property bool invertLeftRounding: wrapper.x <= 2
readonly property bool invertRightRounding: wrapper.x + wrapper.width >= wrapper.parent.width - 2
readonly property real rounding: Config.border.rounding
readonly property bool flatten: wrapper.height < rounding * 2
readonly property real roundingY: flatten ? wrapper.height / 2 : rounding
property real ilr: invertLeftRounding ? -1 : 1
property real irr: invertRightRounding ? -1 : 1
property real sideRounding: wrapper.y > 0 ? -1 : 1
ShapePath {
startX: -root.rounding * root.sideRounding + (invertRightRounding ? 1 : 0)
startY: -1
strokeWidth: -1
fillColor: Config.colors.bg
PathArc {
relativeX: root.rounding * root.sideRounding
relativeY: root.roundingY
radiusX: root.rounding
radiusY: Math.min(root.rounding, root.wrapper.height)
direction: root.sideRounding < 0 ? PathArc.Counterclockwise : PathArc.Clockwise
}
PathLine {
relativeX: 0
relativeY: root.wrapper.height - root.roundingY - root.roundingY * root.ilr
}
PathArc {
relativeX: root.rounding
relativeY: root.roundingY * root.ilr
radiusX: root.rounding
radiusY: Math.min(root.rounding, root.wrapper.height)
direction: root.ilr < 0 ? PathArc.Clockwise : PathArc.Counterclockwise
}
PathLine {
relativeX: root.wrapper.width - root.rounding * 2
relativeY: 0
}
PathArc {
relativeX: root.rounding
relativeY: -root.roundingY * root.irr
radiusX: root.rounding
radiusY: Math.min(root.rounding, root.wrapper.height)
direction: root.irr < 0 ? PathArc.Clockwise : PathArc.Counterclockwise
}
PathLine {
relativeX: 0
relativeY: -(root.wrapper.height - root.roundingY - root.roundingY * root.irr)
}
PathArc {
relativeX: root.rounding * root.sideRounding
relativeY: -root.roundingY
radiusX: root.rounding
radiusY: Math.min(root.rounding, root.wrapper.height)
direction: root.sideRounding < 0 ? PathArc.Counterclockwise : PathArc.Clockwise
}
}
Behavior on ilr {
Anim {}
}
Behavior on irr {
Anim {}
}
Behavior on sideRounding {
Anim {}
}
}

View file

@ -0,0 +1,351 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import qs.services
import Quickshell.Services.UPower
import QtQuick
import QtQuick.Shapes
import QtQuick.Layouts
ColumnLayout {
id: root
spacing: 4
readonly property color color: UPower.onBattery && UPower.displayDevice.percentage < 0.15 ?
Config.colors.batteryWarning :
Config.colors.battery
Loader {
Layout.alignment: Qt.AlignHCenter
active: UPower.displayDevice.isLaptopBattery
asynchronous: true
height: active ? (item?.implicitHeight ?? 0) : 0
sourceComponent: Item {
anchors.horizontalCenter: parent.horizontalCenter
implicitWidth: meter.width
implicitHeight: meter.height + estimate.height + 8
Shape {
id: meter
preferredRendererType: Shape.CurveRenderer
visible: false
readonly property real size: 96
readonly property real padding: 8
readonly property real thickness: 8
readonly property real angle: 280
ShapePath {
id: path
fillColor: "transparent"
strokeColor: Qt.alpha(root.color, 0.1)
strokeWidth: meter.thickness
capStyle: ShapePath.RoundCap
PathAngleArc {
centerX: detail.x + detail.width / 2
centerY: detail.y + detail.height / 2
radiusX: (meter.size + meter.thickness) / 2 + meter.padding
radiusY: radiusX
startAngle: -90 - meter.angle / 2
sweepAngle: meter.angle
}
Behavior on strokeColor {
CAnim {}
}
}
ShapePath {
fillColor: "transparent"
strokeColor: root.color
strokeWidth: meter.thickness
capStyle: ShapePath.RoundCap
PathAngleArc {
centerX: detail.x + detail.width / 2
centerY: detail.y + detail.height / 2
radiusX: (meter.size + meter.thickness) / 2 + meter.padding
radiusY: radiusX
startAngle: -90 - meter.angle / 2
sweepAngle: meter.angle * UPower.displayDevice.percentage
}
Behavior on strokeColor {
CAnim {}
}
}
}
Column {
id: detail
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: (meter.size + meter.thickness - height) / 2 + meter.padding
spacing: -6
// HACK: Prevent load order issues
Component.onCompleted: meter.visible = true;
CustomText {
anchors.horizontalCenter: parent.horizontalCenter
text: Math.round(UPower.displayDevice.percentage * 100) + "%"
font.pointSize: Config.font.size.largest
}
CustomText {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: 10
text: UPowerDeviceState.toString(UPower.displayDevice.state)
animate: true
font.pointSize: Config.font.size.smaller
height: implicitHeight * 1.4
}
}
Column {
id: estimate
anchors.top: meter.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 3
spacing: -3
CustomText {
id: estimateTime
anchors.horizontalCenter: parent.horizontalCenter
text: UPower.onBattery ? Time.formatSeconds(UPower.displayDevice.timeToEmpty) || "--"
: Time.formatSeconds(UPower.displayDevice.timeToFull) || "--"
animate: (from, to) => from === "--" || to === "--"
font.family: Config.font.family.mono
font.pointSize: Config.font.size.normal
}
CustomText {
anchors.horizontalCenter: parent.horizontalCenter
text: UPower.onBattery ? "remaining" : "to full"
animate: true
font.family: Config.font.family.mono
font.pointSize: Config.font.size.small
}
}
}
}
Loader {
Layout.alignment: Qt.AlignHCenter
active: PowerProfiles.degradationReason !== PerformanceDegradationReason.None
asynchronous: true
height: active ? (item?.implicitHeight ?? 0) : 0
sourceComponent: CustomRect {
implicitWidth: child.implicitWidth + 20
implicitHeight: child.implicitHeight + 20
color: Config.colors.errorBg
border.color: Config.colors.error
radius: 12
Column {
id: child
anchors.centerIn: parent
Row {
anchors.horizontalCenter: parent.horizontalCenter
spacing: 7
MaterialIcon {
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -font.pointSize / 10
text: "warning"
color: Config.colors.error
}
CustomText {
anchors.verticalCenter: parent.verticalCenter
text: qsTr("Performance Degraded")
color: Config.colors.error
font.family: Config.font.family.mono
font.weight: 500
}
MaterialIcon {
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -font.pointSize / 10
text: "warning"
color: Config.colors.error
}
}
CustomText {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Reason: %1").arg(PerformanceDegradationReason.toString(PowerProfiles.degradationReason))
color: Config.colors.secondary
}
}
}
}
CustomRect {
id: profiles
Layout.topMargin: 4
property string current: {
const p = PowerProfiles.profile;
if (p === PowerProfile.PowerSaver)
return saver.icon;
if (p === PowerProfile.Performance)
return perf.icon;
return balance.icon;
}
Layout.alignment: Qt.AlignHCenter
Layout.leftMargin: 10
Layout.rightMargin: 10
implicitWidth: saver.implicitHeight + balance.implicitHeight + perf.implicitHeight + 60
implicitHeight: Math.max(saver.implicitHeight, balance.implicitHeight, perf.implicitHeight) + 8
color: Config.colors.container
radius: 1000
CustomRect {
id: indicator
color: root.color
radius: 1000
state: profiles.current
states: [
State {
name: saver.icon
Fill {
item: saver
}
},
State {
name: balance.icon
Fill {
item: balance
}
},
State {
name: perf.icon
Fill {
item: perf
}
}
]
transitions: Transition {
AnchorAnimation {
duration: Config.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Config.anim.curves.emphasized
}
}
}
Profile {
id: saver
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 4
profile: PowerProfile.PowerSaver
icon: "energy_savings_leaf"
}
Profile {
id: balance
anchors.centerIn: parent
profile: PowerProfile.Balanced
icon: "balance"
}
Profile {
id: perf
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 4
profile: PowerProfile.Performance
icon: "rocket_launch"
}
}
CustomText {
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: -2
text: "Performance: " + PowerProfile.toString(PowerProfiles.profile)
animate: true
color: Config.colors.secondary
font.pointSize: Config.font.size.small
font.weight: 500
}
component Fill: AnchorChanges {
required property Item item
target: indicator
anchors.left: item.left
anchors.right: item.right
anchors.top: item.top
anchors.bottom: item.bottom
}
component Profile: StateLayer {
required property string icon
required property int profile
implicitWidth: icon.implicitHeight + 5
implicitHeight: icon.implicitHeight + 5
function onClicked(): void {
PowerProfiles.profile = profile;
}
MaterialIcon {
id: icon
anchors.centerIn: parent
text: parent.icon
font.pointSize: Config.font.size.larger
color: profiles.current === text ? Config.colors.primaryDark : Config.colors.primary
fill: profiles.current === text ? 1 : 0
Behavior on fill {
Anim {}
}
}
}
}

View file

@ -0,0 +1,289 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import qs.services
import qs.util
import Quickshell
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
ColumnLayout {
id: root
spacing: 4
property date currentDate: new Date()
property int currentYear: currentDate.getFullYear()
property int currentMonth: currentDate.getMonth()
RowLayout {
Layout.alignment: Qt.AlignHCenter
MaterialIcon {
Layout.bottomMargin: 1
text: "calendar_month"
color: Config.colors.primary
font.pointSize: Config.font.size.large
}
CustomText {
text: Time.format("hh:mm:ss")
color: Config.colors.primary
font.weight: 600
font.pointSize: Config.font.size.large
font.family: Config.font.family.mono
}
ColumnLayout {
Layout.fillWidth: true
Layout.leftMargin: 10
Layout.rightMargin: 4
spacing: 0
CustomText {
text: Time.format("dddd, MMMM d")
font.weight: 600
font.pointSize: Config.font.size.normal
}
CustomText {
text: Time.format("yyyy-MM-dd")
color: Config.colors.tertiary
font.pointSize: Config.font.size.smaller
}
}
}
// Calendar grid
GridLayout {
id: calendarGrid
Layout.fillWidth: true
Layout.margins: 10
rowSpacing: 7
columnSpacing: 2
// Month navigation
RowLayout {
Layout.fillWidth: true
Layout.bottomMargin: 7
Layout.columnSpan: 2
CustomRect {
implicitWidth: implicitHeight
implicitHeight: prevIcon.implicitHeight + 8
radius: 1000
color: Config.colors.container
StateLayer {
anchors.fill: parent
function onClicked(): void {
if (root.currentMonth !== 0) {
root.currentMonth = root.currentMonth - 1;
} else {
root.currentMonth = 11;
root.currentYear = root.currentYear - 1;
}
}
}
MaterialIcon {
id: prevIcon
anchors.centerIn: parent
text: "chevron_left"
color: Config.colors.secondary
}
}
CustomText {
Layout.fillWidth: true
readonly property list<string> monthNames:
Array.from({ length: 12 }, (_, i) => Qt.locale().monthName(i, Qt.locale().LongFormat))
text: monthNames[root.currentMonth] + " " + root.currentYear
horizontalAlignment: Text.AlignHCenter
font.weight: 600
font.pointSize: Config.font.size.normal
}
CustomRect {
implicitWidth: implicitHeight
implicitHeight: nextIcon.implicitHeight + 8
radius: 1000
color: Config.colors.container
StateLayer {
anchors.fill: parent
function onClicked(): void {
if (root.currentMonth !== 11) {
root.currentMonth = root.currentMonth + 1;
} else {
root.currentMonth = 0;
root.currentYear = root.currentYear + 1;
}
}
}
MaterialIcon {
id: nextIcon
anchors.centerIn: parent
text: "chevron_right"
color: Config.colors.primary
}
}
}
// Day headers
DayOfWeekRow {
Layout.row: 1
Layout.column: 1
Layout.fillWidth: true
Layout.preferredHeight: Config.font.size.largest
delegate: CustomText {
required property var model
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: model.shortName
color: Config.colors.tertiary
font.pointSize: Config.font.size.small
font.weight: 500
}
}
CustomText {
Layout.row: 1
Layout.leftMargin: -2
text: "Week"
color: Config.colors.tertiary
font.pointSize: Config.font.size.small
font.weight: 500
font.italic: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
// ISO week markers
WeekNumberColumn {
Layout.row: 2
Layout.fillHeight: true
Layout.rightMargin: 15
height: 240
month: root.currentMonth
year: root.currentYear
delegate: CustomText {
required property var model
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: model.weekNumber
color: Config.colors.tertiary
font.pointSize: Config.font.size.small
font.weight: 600
font.italic: true
}
}
// Calendar days grid
MonthGrid {
Layout.row: 2
Layout.column: 1
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.preferredHeight: implicitHeight
Layout.margins: 6
month: root.currentMonth
year: root.currentYear
spacing: 20
delegate: Item {
id: dayItem
required property var model
implicitWidth: implicitHeight
implicitHeight: dayText.implicitHeight + 10
CustomRect {
anchors.centerIn: parent
implicitWidth: parent.implicitHeight
implicitHeight: parent.implicitHeight
radius: 1000
color: dayItem.model.today ? Config.colors.calendar : "transparent"
StateLayer {
anchors.fill: parent
visible: dayItem.model.month === root.currentMonth
function onClicked(): void {}
}
CustomText {
id: dayText
anchors.centerIn: parent
anchors.verticalCenterOffset: 0.5
horizontalAlignment: Text.AlignHCenter
text: Qt.formatDate(dayItem.model.date, "d")
color: dayItem.model.today ? Config.colors.primaryDark :
dayItem.model.month === root.currentMonth ? Config.colors.primary : Config.colors.inactive
font.pointSize: Config.font.size.small
font.weight: dayItem.model.today ? 600 : 400
}
}
}
}
}
// Today button
CustomRect {
Layout.fillWidth: true
implicitHeight: todayBtn.implicitHeight + 10
radius: 25
color: Config.colors.calendar
StateLayer {
anchors.fill: parent
color: Config.colors.secondary
function onClicked(): void {
const today = new Date();
root.currentYear = today.getFullYear();
root.currentMonth = today.getMonth();
}
}
Row {
id: todayBtn
anchors.centerIn: parent
spacing: 7
MaterialIcon {
anchors.verticalCenter: parent.verticalCenter
text: "today"
color: Config.colors.primaryDark
font.pointSize: Config.font.size.normal
}
CustomText {
anchors.verticalCenter: parent.verticalCenter
text: qsTr("Today")
color: Config.colors.primaryDark
}
}
}
}

View file

@ -0,0 +1,157 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import Quickshell
import Quickshell.Hyprland
import Quickshell.Services.SystemTray
import Quickshell.Services.UPower
import QtQuick
Item {
id: root
required property PersistentProperties uiState
required property Item wrapper
required property HyprlandToplevel window
anchors.centerIn: parent
implicitWidth: (content.children.find(c => c.shouldBeActive)?.implicitWidth ?? 0) + 30
implicitHeight: (content.children.find(c => c.shouldBeActive)?.implicitHeight ?? 0) + 20
readonly property color color: content.children.find(c => c.active)?.color ?? "transparent"
clip: true
Item {
id: content
anchors.fill: parent
anchors.margins: 15
Popout {
name: "nixos"
source: "NixOS.qml"
color: Config.colors.nixos
}
Popout {
name: "activewindow"
sourceComponent: ActiveWindow {
uiState: root.uiState
wrapper: root.wrapper
window: root.window
}
color: Config.colors.activeWindow
}
Popout {
name: "calendar"
source: "Calendar.qml"
color: Config.colors.calendar
}
Popout {
name: "network"
source: "Network.qml"
color: Config.colors.network
}
Popout {
name: "idleinhibit"
source: "IdleInhibit.qml"
color: Config.colors.idle
}
Popout {
name: "battery"
source: "Battery.qml"
color: UPower.displayDevice.isLaptopBattery &&
UPower.onBattery && UPower.displayDevice.percentage < 0.15 ?
Config.colors.batteryWarning :
Config.colors.battery
}
Repeater {
model: SystemTray.items
Popout {
id: trayMenu
required property SystemTrayItem modelData
required property int index
anchors.verticalCenterOffset: -5
name: `traymenu${index}`
sourceComponent: trayMenuComp
color: Qt.tint(Config.colors.brown, Qt.alpha(Config.colors.yellow, Math.min(index / 8, 1)))
Connections {
target: root.wrapper
function onHasCurrentChanged(): void {
if (root.wrapper.hasCurrent && trayMenu.shouldBeActive) {
trayMenu.sourceComponent = null;
trayMenu.sourceComponent = trayMenuComp;
}
}
}
Component {
id: trayMenuComp
TrayMenu {
popouts: root.wrapper
trayItem: trayMenu.modelData.menu
}
}
}
}
}
component Popout: Loader {
id: popout
required property string name
property bool shouldBeActive: root.wrapper.currentName === name
property color color
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -3
anchors.right: parent.right
opacity: 0
scale: 0.8
active: false
asynchronous: true
states: State {
name: "active"
when: popout.shouldBeActive
PropertyChanges {
popout.active: true
popout.opacity: 1
popout.scale: 1
}
}
transitions: [
Transition {
from: ""
to: "active"
SequentialAnimation {
PropertyAction {
target: popout
property: "active"
}
Anim {
properties: "opacity,scale"
}
}
}
]
}
}

View file

@ -0,0 +1,48 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import qs.services
import qs.util
import Quickshell
import QtQuick
import QtQuick.Layouts
ColumnLayout {
id: root
spacing: 15
Toggle {
label.text: qsTr("Idle Inhibitor")
label.font.weight: 500
checked: Idle.inhibit
toggle.onToggled: Idle.inhibit = !Idle.inhibit
}
Toggle {
label.text: qsTr("Inhibit While Playing Audio")
checked: Idle.inhibitPipewire
toggle.onToggled: Idle.toggleInhibitPipewire()
}
component Toggle: RowLayout {
property alias checked: toggle.checked
property alias label: label
property alias toggle: toggle
Layout.fillWidth: true
Layout.rightMargin: 5
spacing: 15
CustomText {
id: label
Layout.fillWidth: true
}
CustomSwitch {
id: toggle
accent: Color.mute(Config.colors.idle, 1.1)
}
}
}

View file

@ -0,0 +1,259 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import qs.services
import qs.util
import Quickshell
import QtQuick
import QtQuick.Layouts
ColumnLayout {
id: root
property string connectingToSsid: ""
spacing: 5
width: 320
Toggle {
label.text: qsTr("Wifi %1".arg(Network.wifiEnabled ? "Enabled" : "Disabled"))
label.font.weight: 500
checked: Network.wifiEnabled
toggle.onToggled: Network.enableWifi(checked)
}
CustomText {
Layout.topMargin: 7
text: qsTr("%1 networks available").arg(Network.networks.length)
color: Config.colors.primary
font.pointSize: Config.font.size.small
}
CustomListView {
id: list
Layout.fillWidth: true
Layout.preferredHeight: Math.min(contentHeight, 240)
spacing: 5
clip: true
CustomScrollBar.vertical: CustomScrollBar {
flickable: list
}
model: ScriptModel {
values: [...Network.networks].sort((a, b) => {
if (a.active !== b.active)
return b.active - a.active;
return b.strength - a.strength;
})
}
delegate: RowLayout {
id: networkItem
required property Network.AccessPoint modelData
readonly property bool isConnecting: root.connectingToSsid === modelData.ssid
readonly property bool loading: networkItem.isConnecting
readonly property color iconColor: networkItem.modelData.active ? Config.colors.primary : Config.colors.inactive
width: list.width - 8
spacing: 5
MaterialIcon {
text: Icons.getNetworkIcon(networkItem.modelData.strength)
color: iconColor
MouseArea {
width: networkItem.width
height: networkItem.height
onClicked: {
if (Network.wifiEnabled && !networkItem.loading) {
if (networkItem.modelData.active) {
Network.disconnectFromNetwork();
} else {
root.connectingToSsid = networkItem.modelData.ssid;
Network.connectToNetwork(networkItem.modelData.ssid, "");
}
}
}
}
}
MaterialIcon {
opacity: networkItem.modelData.isSecure ? 1 : 0
text: "lock"
font.pointSize: Config.font.size.smaller
color: iconColor
}
CustomText {
Layout.fillWidth: true
Layout.rightMargin: 10
text: networkItem.modelData.ssid
elide: Text.ElideRight
font.weight: networkItem.modelData.active ? 500 : 400
color: networkItem.modelData.active ? Config.colors.secondary : Config.colors.tertiary
}
CustomBusyIndicator {
implicitWidth: implicitHeight
implicitHeight: Config.font.size.normal
running: opacity > 0
opacity: networkItem.loading ? 1 : 0
Behavior on opacity {
Anim {}
}
}
}
add: Transition {
Anim {
property: "opacity"
from: 0
to: 1
}
Anim {
property: "scale"
from: 0.7
to: 1
}
}
remove: Transition {
Anim {
property: "opacity"
from: 1
to: 0
}
Anim {
property: "scale"
from: 1
to: 0.7
}
}
addDisplaced: Transition {
Anim {
property: "y"
duration: Config.anim.durations.small
}
Anim {
properties: "opacity,scale"
to: 1
}
}
displaced: Transition {
Anim {
property: "y"
}
Anim {
properties: "opacity,scale"
to: 1
}
}
}
// Rescan button
CustomRect {
Layout.topMargin: 8
Layout.fillWidth: true
implicitHeight: rescanBtn.implicitHeight + 10
radius: 17
color: !Network.wifiEnabled ? Config.colors.inactive : Qt.alpha(Config.colors.network, Network.scanning ? 0.8 : 1)
Behavior on color {
CAnim { duration: Config.anim.durations.small }
}
StateLayer {
id: layer
anchors.fill: parent
color: Config.colors.primaryDark
disabled: Network.scanning || !Network.wifiEnabled
function onClicked(): void {
Network.rescanWifi();
}
}
Row {
id: rescanBtn
anchors.centerIn: parent
spacing: 7
property color color: layer.disabled ? Config.colors.bg : Config.colors.primaryDark
Behavior on color {
CAnim { duration: Config.anim.durations.small }
}
MaterialIcon {
id: scanIcon
anchors.verticalCenter: parent.verticalCenter
animate: true
text: Network.scanning ? "refresh" : "wifi_find"
color: parent.color
RotationAnimation on rotation {
running: Network.scanning
loops: Animation.Infinite
from: 0
to: 360
duration: 1000
}
}
CustomText {
anchors.verticalCenter: parent.verticalCenter
text: Network.scanning ? qsTr("Scanning...") : qsTr("Rescan networks")
color: parent.color
}
}
}
// Reset connecting state when network changes
Connections {
target: Network
function onActiveChanged(): void {
if (Network.active && root.connectingToSsid === Network.active.ssid) {
root.connectingToSsid = "";
}
}
function onScanningChanged(): void {
if (!Network.scanning)
scanIcon.rotation = 0;
}
}
component Toggle: RowLayout {
property alias checked: toggle.checked
property alias label: label
property alias toggle: toggle
Layout.fillWidth: true
Layout.rightMargin: 5
spacing: 15
CustomText {
id: label
Layout.fillWidth: true
}
CustomSwitch {
id: toggle
accent: Color.mute(Config.colors.network)
}
}
}

View file

@ -0,0 +1,161 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import qs.services
import qs.util
import Quickshell
import QtQuick
import QtQuick.Layouts
ColumnLayout {
id: root
spacing: 7
width: 340
function nixosVersionShort(version: string): string {
const parts = version.split('.');
return `${parts[0]}.${parts[1]}`;
}
Row {
spacing: 12
Image {
anchors.verticalCenter: parent.verticalCenter
readonly property real size: 72
source: "root:/assets/nixos-logo.svg"
width: size
height: size
sourceSize.width: size
sourceSize.height: size
}
CustomText {
anchors.verticalCenter: parent.verticalCenter
text: "NixOS"
color: Config.colors.secondary
font.pointSize: Config.font.size.largest * 1.3
}
Column {
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -2
CustomText {
text: "v" + root.nixosVersionShort(NixOS.currentGen?.nixosVersion)
font.pointSize: Config.font.size.larger
}
CustomText {
text: "Nix " + NixOS.nixVersion
}
}
}
CustomRect {
Layout.topMargin: 5
Layout.fillWidth: true
height: 180
radius: 17
color: Config.colors.container
CustomText {
id: genText
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 7
text: "Generations"
color: Config.colors.secondary
font.pointSize: Config.font.size.normal
font.weight: 500
}
CustomListView {
id: list
anchors.top: genText.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 6
anchors.topMargin: 8
spacing: 6
clip: true
model: ScriptModel {
values: [...NixOS.generations]
objectProp: "id"
}
CustomScrollBar.vertical: CustomScrollBar {
flickable: list
}
delegate: CustomRect {
required property NixOS.Generation modelData
width: list.width
height: 42
radius: 12
color: modelData.current ?
Qt.tint(Config.colors.container, Qt.alpha(Config.colors.nixos, 0.2)) :
Config.colors.containerAlt
Item {
anchors.fill: parent
anchors.margins: 7
anchors.topMargin: 2
anchors.bottomMargin: 1
CustomText {
anchors.top: parent.top
anchors.left: parent.left
anchors.topMargin: 2
text: `Generation ${modelData.id}`
color: modelData.current ? Config.colors.nixos : Config.colors.secondary
}
CustomText {
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 6
text: modelData.revision !== "Unknown" ? modelData.revision : ""
elide: Text.ElideRight
font.family: Config.font.family.mono
color: modelData.current ? Config.colors.secondary : Config.colors.primary
}
CustomText {
anchors.top: parent.top
anchors.right: parent.right
text: `NixOS ${root.nixosVersionShort(modelData.nixosVersion)} 🞄 Linux ${modelData.kernelVersion}`
color: modelData.current ? Config.colors.secondary : Config.colors.primary
}
CustomText {
anchors.bottom: parent.bottom
anchors.right: parent.right
text: Qt.formatDateTime(modelData.date, "yyyy-MM-dd ddd hh:mm")
font.family: Config.font.family.mono
color: modelData.current ? Config.colors.secondary : Config.colors.primary
}
}
}
}
}
}

View file

@ -0,0 +1,231 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import qs.services
import Quickshell
import Quickshell.Widgets
import Quickshell.Hyprland
import QtQuick
import QtQuick.Controls
StackView {
id: root
required property Item popouts
required property QsMenuHandle trayItem
implicitWidth: currentItem.implicitWidth
implicitHeight: currentItem.implicitHeight
initialItem: SubMenu {
handle: root.trayItem
}
pushEnter: NoAnim {}
pushExit: NoAnim {}
popEnter: NoAnim {}
popExit: NoAnim {}
component NoAnim: Transition {
NumberAnimation {
duration: 0
}
}
component SubMenu: Column {
id: menu
required property QsMenuHandle handle
property bool isSubMenu
property bool shown
spacing: 7
opacity: shown ? 1 : 0
scale: shown ? 1 : 0.8
Component.onCompleted: shown = true
StackView.onActivating: shown = true
StackView.onDeactivating: shown = false
StackView.onRemoved: destroy()
Behavior on opacity {
Anim {}
}
Behavior on scale {
Anim {}
}
QsMenuOpener {
id: menuOpener
menu: menu.handle
}
Repeater {
model: menuOpener.children
CustomRect {
id: item
required property QsMenuEntry modelData
implicitWidth: 200
implicitHeight: modelData.isSeparator ? 1 : children.implicitHeight
radius: 100
color: modelData.isSeparator ? Config.colors.inactive : "transparent"
Loader {
id: children
anchors.left: parent.left
anchors.right: parent.right
active: !item.modelData.isSeparator
asynchronous: true
sourceComponent: Item {
implicitHeight: label.implicitHeight
StateLayer {
anchors.fill: parent
anchors.margins: -2
anchors.leftMargin: -7
anchors.rightMargin: -7
radius: item.radius
disabled: !item.modelData.enabled
function onClicked(): void {
const entry = item.modelData;
if (entry.hasChildren)
root.push(subMenuComp.createObject(null, {
handle: entry,
isSubMenu: true
}));
else {
item.modelData.triggered();
root.popouts.hasCurrent = false;
}
}
}
Loader {
id: icon
anchors.left: parent.left
active: item.modelData.icon !== ""
asynchronous: true
sourceComponent: IconImage {
implicitSize: label.implicitHeight
source: item.modelData.icon
}
}
CustomText {
id: label
anchors.left: icon.right
anchors.leftMargin: icon.active ? 10 : 0
text: labelMetrics.elidedText
color: item.modelData.enabled ? Config.colors.primary : Config.colors.tertiary
}
TextMetrics {
id: labelMetrics
text: item.modelData.text
font.pointSize: label.font.pointSize
font.family: label.font.family
elide: Text.ElideRight
elideWidth: 200 - (icon.active ? icon.implicitWidth + label.anchors.leftMargin : 0) - (expand.active ? expand.implicitWidth + 12 : 0)
}
Loader {
id: expand
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
active: item.modelData.hasChildren
asynchronous: true
sourceComponent: MaterialIcon {
text: "chevron_right"
color: item.modelData.enabled ? Config.colors.primary : Config.colors.tertiary
}
}
}
}
}
}
Loader {
active: menu.isSubMenu
asynchronous: true
sourceComponent: Item {
implicitWidth: back.implicitWidth
implicitHeight: back.implicitHeight + Appearance.spacing.small / 2
Item {
anchors.bottom: parent.bottom
implicitWidth: back.implicitWidth
implicitHeight: back.implicitHeight
CustomRect {
anchors.fill: parent
anchors.margins: -7
anchors.leftMargin: -7
anchors.rightMargin: -14
radius: 1000
color: Config.colors.container
StateLayer {
anchors.fill: parent
radius: parent.radius
color: Config.colors.primary
function onClicked(): void {
root.pop();
}
}
}
Row {
id: back
anchors.verticalCenter: parent.verticalCenter
MaterialIcon {
anchors.verticalCenter: parent.verticalCenter
text: "chevron_left"
color: Config.colors.primary
}
CustomText {
anchors.verticalCenter: parent.verticalCenter
text: qsTr("Back")
color: Config.colors.primary
}
}
}
}
}
}
Component {
id: subMenuComp
SubMenu {}
}
}

View file

@ -0,0 +1,156 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import qs.services
import Quickshell
import Quickshell.Wayland
import Quickshell.Hyprland
import QtQuick
import QtQuick.Effects
Item {
id: root
required property PersistentProperties uiState
required property ShellScreen screen
readonly property real nonAnimWidth: content.implicitWidth
readonly property real nonAnimHeight: y > 0 || hasCurrent ? content.implicitHeight : 0
property string currentName
property real currentCenter
property bool hasCurrent
property real currentCenterBounded: Math.min(Math.max(currentCenter, nonAnimWidth / 2),
parent.width - nonAnimWidth / 2)
x: currentCenterBounded - implicitWidth / 2
property HyprlandToplevel window
property bool persistent
visible: width > 0 && height > 0
implicitWidth: nonAnimWidth
implicitHeight: nonAnimHeight
Background {
id: background
visible: false
wrapper: root
}
MultiEffect {
anchors.fill: background
source: background
shadowEnabled: true
blurMultiplier: 0.3
blurMax: 30
shadowColor: content.active ? content.item.color : "transparent"
Behavior on shadowColor {
CAnim {}
}
}
Item {
anchors.fill: parent
clip: true
Comp {
id: content
shouldBeActive: root.hasCurrent
asynchronous: true
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
sourceComponent: Content {
id: content
wrapper: root
uiState: root.uiState
window: root.window
}
}
}
Behavior on currentCenterBounded {
enabled: root.implicitHeight > 0
Anim {
easing.bezierCurve: Config.anim.curves.emphasized
}
}
Behavior on implicitWidth {
enabled: root.implicitHeight > 0
Anim {
easing.bezierCurve: Config.anim.curves.emphasized
}
}
Behavior on implicitHeight {
Anim {
easing.bezierCurve: Config.anim.curves.emphasized
}
}
component Comp: Loader {
id: comp
property bool shouldBeActive
asynchronous: true
active: false
opacity: 0
states: State {
name: "active"
when: comp.shouldBeActive
PropertyChanges {
comp.opacity: 1
comp.active: true
}
}
transitions: [
Transition {
from: ""
to: "active"
SequentialAnimation {
PropertyAction {
property: "active"
}
Anim {
property: "opacity"
easing.bezierCurve: Config.anim.curves.standard
}
}
},
Transition {
from: "active"
to: ""
SequentialAnimation {
Anim {
property: "opacity"
easing.bezierCurve: Config.anim.curves.standard
}
PropertyAction {
property: "active"
}
PropertyAction {
target: root
property: "persistent"
value: false
}
}
}
]
}
}

View file

@ -0,0 +1,59 @@
import qs.config
import qs.services
import QtQuick
import QtQuick.Shapes
Shape {
id: root
required property Item wrapper
readonly property real rounding: Config.border.rounding
readonly property bool flatten: wrapper.width < rounding * 2
readonly property real roundingX: flatten ? wrapper.width / 2 : rounding
ShapePath {
startX: -0.5
startY: -root.rounding
strokeWidth: -1
fillColor: Config.colors.bg
PathArc {
relativeX: root.roundingX
relativeY: root.rounding
radiusX: Math.min(root.rounding, root.wrapper.width)
radiusY: root.rounding
direction: PathArc.Counterclockwise
}
PathLine {
relativeX: root.wrapper.width - root.roundingX * 2
relativeY: 0
}
PathArc {
relativeX: root.roundingX
relativeY: root.rounding
radiusX: Math.min(root.rounding, root.wrapper.width)
radiusY: root.rounding
}
PathLine {
relativeX: 0
relativeY: root.wrapper.height - root.rounding * 2
}
PathArc {
relativeX: -root.roundingX
relativeY: root.rounding
radiusX: Math.min(root.rounding, root.wrapper.width)
radiusY: root.rounding
}
PathLine {
relativeX: -(root.wrapper.width - root.roundingX * 2)
relativeY: 0
}
PathArc {
relativeX: -root.roundingX
relativeY: root.rounding
radiusX: Math.min(root.rounding, root.wrapper.width)
radiusY: root.rounding
direction: PathArc.Counterclockwise
}
}
}

View file

@ -0,0 +1,124 @@
pragma ComponentBehavior: Bound
import qs.modules.bar.popouts as BarPopouts
import qs.config
import qs.custom
import Quickshell
import Quickshell.Widgets
import QtQuick
import QtQuick.Layouts
Item {
id: root
required property PersistentProperties uiState
required property BarPopouts.Wrapper popouts
readonly property color color: tabs.color
readonly property real nonAnimHeight: view.implicitHeight + viewWrapper.anchors.margins * 2
implicitWidth: tabs.implicitWidth + tabs.anchors.leftMargin + view.implicitWidth + viewWrapper.anchors.margins * 2
implicitHeight: nonAnimHeight
Tabs {
id: tabs
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.leftMargin: 10
anchors.margins: 15
nonAnimHeight: root.nonAnimHeight - anchors.margins * 2
uiState: root.uiState
}
CustomClippingRect {
id: viewWrapper
anchors.left: tabs.right
anchors.top: parent.top
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 15
radius: 17
color: "transparent"
Item {
id: view
readonly property int currentIndex: root.uiState.dashboardTab
readonly property Item currentItem: column.children[currentIndex]
anchors.fill: parent
implicitWidth: currentItem.implicitWidth
implicitHeight: currentItem.implicitHeight
ColumnLayout {
id: column
y: -view.currentItem.y
spacing: 8
Pane {
sourceComponent: Dash {
uiState: root.uiState
}
}
Pane {
sourceComponent: Mixer {
uiState: root.uiState
index: 1
}
}
Pane {
sourceComponent: Media {
uiState: root.uiState
}
}
Pane {
source: "Performance.qml"
}
Pane {
sourceComponent: Workspaces {
uiState: root.uiState
popouts: root.popouts
}
}
Behavior on y {
Anim {}
}
}
}
}
Behavior on implicitWidth {
Anim {
duration: Config.anim.durations.large
easing.bezierCurve: Config.anim.curves.emphasized
}
}
Behavior on implicitHeight {
Anim {
duration: Config.anim.durations.large
easing.bezierCurve: Config.anim.curves.emphasized
}
}
component Pane: Loader {
Layout.alignment: Qt.AlignLeft
property real bufferY: 5
Component.onCompleted: active = Qt.binding(() => {
const vy = Math.floor(-column.y);
const vey = Math.floor(vy + view.height);
return (vy >= y - bufferY && vy <= y + implicitHeight) || (vey >= y + bufferY && vey <= y + implicitHeight);
})
}
}

View file

@ -0,0 +1,65 @@
import qs.config
import qs.custom
import qs.services
import Quickshell
import QtQuick.Layouts
import "dash"
GridLayout {
id: root
required property PersistentProperties uiState
rowSpacing: 10
columnSpacing: 10
Rect {
Layout.fillWidth: true
Layout.preferredWidth: Config.dashboard.timeWidth
Layout.preferredHeight: Config.dashboard.timeHeight
DateTime {}
}
Rect {
Layout.row: 1
Layout.fillWidth: true
Layout.preferredHeight: 70
User {}
}
Rect {
Layout.row: 2
Layout.fillWidth: true
Layout.preferredHeight: 110
Weather {}
}
Rect {
Layout.row: 0
Layout.column: 1
Layout.rowSpan: 3
Layout.preferredWidth: 200
Layout.preferredHeight: 300
Layout.fillWidth: true
Media {}
}
Rect {
Layout.row: 3
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.fillHeight: true
Layout.preferredHeight: 300
Notifs {}
}
component Rect: CustomRect {
radius: 12
color: Config.colors.containerDash
}
}

532
modules/dashboard/Media.qml Normal file
View file

@ -0,0 +1,532 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import qs.services
import qs.util
import Quickshell
import Quickshell.Widgets
import Quickshell.Services.Mpris
import QtQuick
import QtQuick.Layouts
import QtQuick.Shapes
Item {
id: root
required property PersistentProperties uiState
property real playerProgress: {
const active = Players.active;
return active?.length ? active.position / active.length : 0;
}
function lengthStr(length: int): string {
if (length < 0)
return "-1:-1";
const hours = Math.floor(length / 3600);
const mins = Math.floor((length % 3600) / 60);
const secs = Math.floor(length % 60).toString().padStart(2, "0");
if (hours > 0)
return `${hours}:${mins.toString().padStart(2, "0")}:${secs}`;
return `${mins}:${secs}`;
}
implicitWidth: slider.width + 32
implicitHeight: childrenRect.height
Timer {
running: Players.active?.isPlaying ?? false
interval: Config.dashboard.mediaUpdateInterval
triggeredOnStart: true
repeat: true
onTriggered: Players.active?.positionChanged()
}
Item {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: Config.dashboard.mediaCoverArtHeight
CustomClippingRect {
id: cover
anchors.horizontalCenter: parent.horizontalCenter
anchors.leftMargin: 12
anchors.rightMargin: 12
anchors.verticalCenter: parent.top
anchors.verticalCenterOffset: Config.dashboard.mediaCoverArtHeight / 2
implicitWidth: image.paintedWidth > 0 ? image.paintedWidth : Config.dashboard.mediaCoverArtHeight
implicitHeight: image.paintedHeight > 0 ? image.paintedHeight : Config.dashboard.mediaCoverArtHeight
color: Config.colors.containerDash
radius: 12
MaterialIcon {
anchors.centerIn: parent
grade: 200
text: "art_track"
color: Config.colors.tertiary
font.pointSize: (parent.width * 0.4) || 1
}
Image {
id: image
anchors.centerIn: parent
width: Config.dashboard.mediaCoverArtWidth
height: Config.dashboard.mediaCoverArtHeight
source: Players.active?.trackArtUrl ?? ""
asynchronous: true
fillMode: Image.PreserveAspectFit
sourceSize.width: width
sourceSize.height: height
}
}
}
ColumnLayout {
id: details
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 12 + Config.dashboard.mediaCoverArtHeight
spacing: 8
CustomText {
id: title
Layout.fillWidth: true
Layout.maximumWidth: parent.implicitWidth
animate: true
horizontalAlignment: Text.AlignHCenter
text: (Players.active?.trackTitle ?? qsTr("No media")) || qsTr("Unknown title")
color: Config.colors.secondary
font.pointSize: Config.font.size.normal
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
}
CustomText {
id: artist
Layout.fillWidth: true
visible: Players.active
animate: true
horizontalAlignment: Text.AlignHCenter
text: Players.active?.trackArtist || qsTr("Unknown artist")
opacity: Players.active ? 1 : 0
color: Config.colors.primary
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
}
CustomText {
id: album
Layout.fillWidth: true
Layout.topMargin: -5
visible: text !== ""
animate: true
horizontalAlignment: Text.AlignHCenter
text: Players.active?.trackAlbum ?? ""
color: Config.colors.tertiary
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
}
RowLayout {
id: controls
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 12
Layout.bottomMargin: 10
spacing: 7
PlayerControl {
icon.text: "skip_previous"
canUse: Players.active?.canGoPrevious ?? false
function onClicked(): void {
Players.active?.previous();
}
}
CustomRect {
id: playBtn
implicitWidth: Math.max(playIcon.implicitWidth, playIcon.implicitHeight)
implicitHeight: implicitWidth
radius: Players.active?.isPlaying ? 12 : implicitHeight / 2
color: {
if (!Players.active?.canTogglePlaying)
return "transparent";
return Players.active?.isPlaying ? Config.colors.media : Config.colors.container;
}
StateLayer {
anchors.fill: parent
disabled: !Players.active?.canTogglePlaying
color: Players.active?.isPlaying ? Config.colors.primaryDark : Config.colors.primary
radius: parent.radius
function onClicked(): void {
Players.active?.togglePlaying();
}
}
MaterialIcon {
id: playIcon
anchors.centerIn: parent
anchors.horizontalCenterOffset: -font.pointSize * 0.02
anchors.verticalCenterOffset: font.pointSize * 0.02
animate: true
fill: 1
text: Players.active?.isPlaying ? "pause" : "play_arrow"
color: {
if (!Players.active?.canTogglePlaying)
return Config.colors.inactive;
return Players.active?.isPlaying ? Config.colors.primaryDark : Config.colors.media;
}
font.pointSize: Config.font.size.largest
}
Behavior on radius {
Anim {}
}
}
PlayerControl {
icon.text: "skip_next"
canUse: Players.active?.canGoNext ?? false
function onClicked(): void {
Players.active?.next();
}
}
}
CustomSlider {
id: slider
enabled: !!Players.active
progressColor: Config.colors.media
implicitWidth: controls.implicitWidth * 1.5
implicitHeight: 20
onMoved: {
const active = Players.active;
if (active?.canSeek && active?.positionSupported)
active.position = value * active.length;
}
Binding {
target: slider
property: "value"
value: root.playerProgress
when: !slider.pressed
}
CustomMouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
function onWheel(event: WheelEvent) {
const active = Players.active;
if (!active?.canSeek || !active?.positionSupported)
return;
event.accepted = true;
const delta = event.angleDelta.y > 0 ? 10 : -10; // Time 10 seconds
Qt.callLater(() => {
active.position = Math.max(0, Math.min(active.length, active.position + delta));
});
}
}
}
Item {
Layout.fillWidth: true
Layout.topMargin: -6
implicitHeight: Math.max(position.implicitHeight, length.implicitHeight)
opacity: Players.active ? 1 : 0
visible: opacity > 0
CustomText {
id: position
anchors.left: parent.left
text: root.lengthStr(Players.active?.position ?? 0)
color: Config.colors.primary
font.pointSize: Config.font.size.small
}
CustomText {
id: length
anchors.right: parent.right
text: root.lengthStr(Players.active?.length ?? 0)
color: Config.colors.primary
font.pointSize: Config.font.size.small
}
Behavior on opacity {
Anim { duration: Config.anim.durations.small }
}
}
RowLayout {
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 12
spacing: 7
PlayerControl {
icon.text: "flip_to_front"
canUse: Players.active?.canRaise ?? false
fontSize: Config.font.size.larger
size: playerSelector.height
fill: 0
color: Config.colors.container
activeColor: Config.colors.secondary
function onClicked(): void {
Players.active?.raise();
root.uiState.dashboard = false;
}
}
CustomRect {
id: playerSelector
property bool expanded
Layout.alignment: Qt.AlignVCenter
implicitWidth: slider.implicitWidth * 0.6
implicitHeight: currentPlayer.implicitHeight + 14
radius: 17
color: Config.colors.container
z: 1
StateLayer {
anchors.fill: parent
disabled: Players.list.length <= 1
function onClicked(): void {
playerSelector.expanded = !playerSelector.expanded;
}
}
RowLayout {
id: currentPlayer
anchors.centerIn: parent
spacing: 7
PlayerIcon {
player: Players.active
}
CustomText {
Layout.fillWidth: true
Layout.maximumWidth: playerSelector.implicitWidth - implicitHeight - parent.spacing - 20
text: Players.active ? Players.getName(Players.active) : qsTr("No players")
color: Players.active ? Config.colors.primary : Config.colors.tertiary
elide: Text.ElideRight
}
}
Elevation {
anchors.fill: playerSelectorBg
radius: playerSelectorBg.radius
opacity: playerSelector.expanded ? 1 : 0
level: 2
Behavior on opacity {
Anim {
duration: Config.anim.durations.expressiveDefaultSpatial
}
}
}
CustomClippingRect {
id: playerSelectorBg
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
implicitWidth: playerSelector.expanded ? playerList.implicitWidth : playerSelector.implicitWidth
implicitHeight: playerSelector.expanded ? playerList.implicitHeight : playerSelector.implicitHeight
color: Config.colors.containerAlt
radius: 17
opacity: playerSelector.expanded ? 1 : 0
ColumnLayout {
id: playerList
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
spacing: 0
Repeater {
model: [...Players.list].sort((a, b) => (a === Players.active) - (b === Players.active))
Item {
id: player
required property MprisPlayer modelData
Layout.fillWidth: true
Layout.minimumWidth: playerSelector.implicitWidth
implicitWidth: playerInner.implicitWidth + 20
implicitHeight: playerInner.implicitHeight + 14
StateLayer {
disabled: !playerSelector.expanded
function onClicked(): void {
playerSelector.expanded = false;
Players.manualActive = player.modelData;
}
}
RowLayout {
id: playerInner
anchors.centerIn: parent
spacing: 7
PlayerIcon {
player: player.modelData
}
CustomText {
text: Players.getName(player.modelData)
color: Config.colors.primary
}
}
}
}
}
Behavior on opacity {
Anim {
duration: Config.anim.durations.expressiveDefaultSpatial
}
}
Behavior on implicitWidth {
Anim {
duration: Config.anim.durations.expressiveDefaultSpatial
easing.bezierCurve: Config.anim.curves.expressiveDefaultSpatial
}
}
Behavior on implicitHeight {
Anim {
duration: Config.anim.durations.expressiveDefaultSpatial
easing.bezierCurve: Config.anim.curves.expressiveDefaultSpatial
}
}
}
}
PlayerControl {
icon.text: "close"
icon.anchors.horizontalCenterOffset: 0
canUse: Players.active?.canQuit ?? false
size: playerSelector.height
fontSize: Config.font.size.larger
fill: 1
color: Config.colors.container
activeColor: Config.colors.error
function onClicked(): void {
Players.active?.quit();
}
}
}
}
component PlayerIcon: Loader {
id: loader
required property MprisPlayer player
readonly property string icon: player ? Icons.getAppIcon(Players.getIdentity(player)) : ""
Layout.fillHeight: true
sourceComponent: !player || icon === "image://icon/" ? fallbackIcon : playerImage
Component {
id: playerImage
IconImage {
implicitWidth: height
source: loader.icon
}
}
Component {
id: fallbackIcon
MaterialIcon {
text: loader.player ? "animated_images" : "music_off"
}
}
}
component PlayerControl: CustomRect {
id: control
required property bool canUse
property alias icon: icon
property int fontSize: Config.font.size.largest
property int size: Math.max(icon.implicitWidth, icon.implicitHeight)
property real fill: 1
property color activeColor: Config.colors.media
function onClicked() {}
implicitWidth: size
implicitHeight: implicitWidth
radius: 1000
StateLayer {
anchors.fill: parent
disabled: !control.canUse
function onClicked(): void {
control.onClicked();
}
}
MaterialIcon {
id: icon
anchors.centerIn: parent
anchors.horizontalCenterOffset: -font.pointSize * 0.02
anchors.verticalCenterOffset: font.pointSize * 0.02
animate: true
fill: control.fill
text: control.icon
color: control.canUse ? control.activeColor : Config.colors.inactive
font.pointSize: control.fontSize
}
}
}

208
modules/dashboard/Mixer.qml Normal file
View file

@ -0,0 +1,208 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import qs.services
import qs.util
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import Quickshell.Widgets
import Quickshell.Services.Pipewire
Item {
id: root
required property PersistentProperties uiState
required property int index
readonly property list<PwNode> nodes: Pipewire.nodes.values.filter(node => node.isSink && node.isStream)
width: Config.dashboard.mixerWidth
height: Config.dashboard.mixerHeight
PwObjectTracker {
objects: root.nodes
}
Binding {
target: root.uiState
when: root.uiState.dashboardTab === root.index
property: "osdVolumeReact"
value: false
}
ColumnLayout {
id: layout
anchors.fill: parent
spacing: 7
CustomText {
Layout.topMargin: 6
text: qsTr("Master Volume")
color: Config.colors.secondary
}
CustomMouseArea {
Layout.fillWidth: true
implicitHeight: Config.osd.sliderWidth
function onWheel(event: WheelEvent) {
if (event.angleDelta.y > 0)
Audio.increaseVolume();
else if (event.angleDelta.y < 0)
Audio.decreaseVolume();
}
acceptedButtons: Qt.RightButton
onClicked: Audio.sink.audio.muted = !Audio.muted
CustomFilledSlider {
anchors.fill: parent
orientation: Qt.Horizontal
color: Audio.muted ? Config.colors.error : Config.colors.volume
icon: Icons.getVolumeIcon(value, Audio.muted)
value: Audio.volume
onMoved: Audio.setVolume(value)
Behavior on color {
CAnim {
duration: Config.anim.durations.small
}
}
}
}
CustomRect {
Layout.fillWidth: true
Layout.topMargin: 5
Layout.bottomMargin: 5
height: 1
color: Config.colors.inactive
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
CustomListView {
id: list
anchors.fill: parent
spacing: 12
model: ScriptModel {
values: [...root.nodes]
objectProp: "id"
}
CustomScrollBar.vertical: CustomScrollBar {
flickable: list
}
delegate: RowLayout {
id: entry
required property PwNode modelData
spacing: 6
width: root.width
IconImage {
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
visible: source != ""
implicitSize: slider.height * 1.4
source: {
const icon = entry.modelData.properties["application.icon-name"];
if (icon)
return Icons.getAppIcon(icon, "image-missing");
Icons.getAppIcon(entry.modelData.name, "image-missing")
}
}
ColumnLayout {
Layout.fillWidth: true
spacing: 6
CustomText {
Layout.fillWidth: true
elide: Text.ElideRight
text: {
// application.name -> description -> name
const app = entry.modelData.properties["application.name"]
?? (entry.modelData.description != "" ? entry.modelData.description : entry.modelData.name);
const media = entry.modelData.properties["media.name"];
return media != undefined ? `${app} 🞄 ${media}` : app;
}
color: Config.colors.secondary
}
CustomMouseArea {
id: slider
Layout.fillWidth: true
implicitHeight: Config.osd.sliderWidth
acceptedButtons: Qt.RightButton
onClicked: entry.modelData.audio.muted = !entry.modelData.audio.muted
CustomFilledSlider {
anchors.fill: parent
orientation: Qt.Horizontal
color: entry.modelData.audio.muted ? Config.colors.error : Config.colors.volume
icon: Icons.getVolumeIcon(value, entry.modelData.audio.muted)
value: entry.modelData.audio.volume
onMoved: {
if (entry.modelData.ready)
entry.modelData.audio.volume = Math.max(0, Math.min(1, value));
}
Behavior on color {
CAnim {
duration: Config.anim.durations.small
}
}
}
}
}
}
}
CustomText {
anchors.centerIn: parent
opacity: list.count === 0 ? 1 : 0
visible: opacity > 0
text: qsTr("No audio sources")
color: Config.colors.tertiary
font.pointSize: Config.font.size.normal
Behavior on opacity {
Anim {}
}
}
}
/* RowLayout { */
/* id: deviceSelectorRowLayout */
/* Layout.fillWidth: true */
/* uniformCellSizes: true */
/* AudioDeviceSelectorButton { */
/* Layout.fillWidth: true */
/* input: false */
/* onClicked: root.showDeviceSelectorDialog(input) */
/* } */
/* AudioDeviceSelectorButton { */
/* Layout.fillWidth: true */
/* input: true */
/* onClicked: root.showDeviceSelectorDialog(input) */
/* } */
/* } */
}
}

View file

@ -0,0 +1,234 @@
import qs.config
import qs.custom
import qs.services
import qs.util
import QtQuick
import QtQuick.Layouts
ColumnLayout {
id: root
function displayTemp(temp: real): string {
return `${Math.ceil(Config.services.useFahrenheit ? temp * 1.8 + 32 : temp)}°${Config.services.useFahrenheit ? "F" : "C"}`;
}
readonly property int padding: 20
spacing: 28
Component.onCompleted: SystemUsage.refCount++;
Component.onDestruction: SystemUsage.refCount--;
Resource {
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: root.padding
Layout.leftMargin: root.padding
Layout.rightMargin: root.padding
value1: SystemUsage.gpuPerc
label1: `${Math.round(SystemUsage.gpuPerc * 100)}%`
sublabel1: qsTr("GPU Usage")
value2: Math.min(1, SystemUsage.gpuTemp / 90)
label2: root.displayTemp(SystemUsage.gpuTemp)
sublabel2: qsTr("Temp")
warning2: value2 > 0.75
}
Resource {
Layout.alignment: Qt.AlignHCenter
Layout.leftMargin: root.padding
Layout.rightMargin: root.padding
primary: true
value1: SystemUsage.cpuPerc
label1: `${Math.round(SystemUsage.cpuPerc * 100)}%`
sublabel1: qsTr("CPU Usage")
value2: Math.min(1, SystemUsage.cpuTemp / 90)
label2: root.displayTemp(SystemUsage.cpuTemp)
sublabel2: qsTr("Temp")
warning2: value2 > 0.75
}
Resource {
Layout.alignment: Qt.AlignHCenter
Layout.leftMargin: root.padding
Layout.rightMargin: root.padding
Layout.bottomMargin: root.padding
value1: SystemUsage.memPerc
label1: {
const fmt = SystemUsage.formatKib(SystemUsage.memUsed);
return `${+fmt.value.toFixed(1)}${fmt.unit}`;
}
sublabel1: qsTr("Memory")
value2: SystemUsage.storagePerc
label2: {
const fmt = SystemUsage.formatKib(SystemUsage.storageUsed);
return `${Math.floor(fmt.value)}${fmt.unit}`;
}
sublabel2: qsTr("Storage")
}
component Resource: Item {
id: res
required property real value1
required property string label1
required property string sublabel1
property bool warning1: value1 > 0.9
required property real value2
required property string label2
required property string sublabel2
property bool warning2: value2 > 0.9
property bool primary
readonly property real primaryMult: primary ? 1.2 : 1
readonly property real thickness: 10 * primaryMult
property color fg1: warning1 ? Config.colors.error : Color.mute(Config.colors.performance)
property color fg2: warning2 ? Config.colors.error : Color.mute(Config.colors.performance, 1.5, 1.6)
property color bg1: Qt.alpha(warning1 ? Config.colors.error : Config.colors.performance, 0.1)
property color bg2: Qt.alpha(warning2 ? Config.colors.error : Config.colors.performance, 0.05)
implicitWidth: implicitHeight
implicitHeight: 175 * primaryMult
onValue1Changed: canvas.requestPaint()
onValue2Changed: canvas.requestPaint()
onFg1Changed: canvas.requestPaint()
onFg2Changed: canvas.requestPaint()
onBg1Changed: canvas.requestPaint()
onBg2Changed: canvas.requestPaint()
Column {
anchors.centerIn: parent
readonly property color color: res.warning1 ? Config.colors.error :
res.value1 === 0 ? Config.colors.inactive : Config.colors.primary
CustomText {
anchors.horizontalCenter: parent.horizontalCenter
text: res.label1
color: parent.color
font.pointSize: Config.font.size.largest * res.primaryMult
}
CustomText {
anchors.horizontalCenter: parent.horizontalCenter
text: res.sublabel1
color: parent.color
font.pointSize: Config.font.size.smaller * res.primaryMult
}
}
Column {
anchors.horizontalCenter: parent.right
anchors.top: parent.verticalCenter
anchors.horizontalCenterOffset: -res.thickness / 2
anchors.topMargin: res.thickness / 2 + 7
readonly property color color: res.warning2 ? Config.colors.error :
res.value2 === 0 ? Config.colors.inactive : Config.colors.primary
CustomText {
anchors.horizontalCenter: parent.horizontalCenter
text: res.label2
color: parent.color
font.pointSize: Config.font.size.smaller * res.primaryMult
}
CustomText {
anchors.horizontalCenter: parent.horizontalCenter
text: res.sublabel2
color: parent.color
font.pointSize: Config.font.size.small * res.primaryMult
}
}
Canvas {
id: canvas
readonly property real centerX: width / 2
readonly property real centerY: height / 2
readonly property real arc1Start: degToRad(45)
readonly property real arc1End: degToRad(270)
readonly property real arc2Start: degToRad(360)
readonly property real arc2End: degToRad(280)
function degToRad(deg: int): real {
return deg * Math.PI / 180;
}
anchors.fill: parent
onPaint: {
const ctx = getContext("2d");
ctx.reset();
ctx.lineWidth = res.thickness;
ctx.lineCap = "round";
const radius = (Math.min(width, height) - ctx.lineWidth) / 2;
const cx = centerX;
const cy = centerY;
const a1s = arc1Start;
const a1e = arc1End;
const a2s = arc2Start;
const a2e = arc2End;
ctx.beginPath();
ctx.arc(cx, cy, radius, a1s, a1e, false);
ctx.strokeStyle = res.bg1;
ctx.stroke();
ctx.beginPath();
ctx.arc(cx, cy, radius, a1s, (a1e - a1s) * res.value1 + a1s, false);
ctx.strokeStyle = res.fg1;
ctx.stroke();
ctx.beginPath();
ctx.arc(cx, cy, radius, a2s, a2e, true);
ctx.strokeStyle = res.bg2;
ctx.stroke();
ctx.beginPath();
ctx.arc(cx, cy, radius, a2s, (a2e - a2s) * res.value2 + a2s, true);
ctx.strokeStyle = res.fg2;
ctx.stroke();
}
}
Behavior on value1 {
Anim {}
}
Behavior on value2 {
Anim {}
}
Behavior on fg1 {
CAnim {}
}
Behavior on fg2 {
CAnim {}
}
Behavior on bg1 {
CAnim {}
}
Behavior on bg2 {
CAnim {}
}
}
}

269
modules/dashboard/Tabs.qml Normal file
View file

@ -0,0 +1,269 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import qs.services
import Quickshell
import Quickshell.Widgets
import QtQuick
import QtQuick.Layouts
Item {
id: root
required property real nonAnimHeight
required property PersistentProperties uiState
readonly property int count: repeater.model.count
readonly property color color: indicator.currentItem.color
implicitWidth: childrenRect.width
ColumnLayout {
id: bar
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
spacing: 16
width: 100
Repeater {
id: repeater
model: ListModel {}
Component.onCompleted: {
model.append({
text: qsTr("Dashboard"),
iconName: "dashboard",
color: Config.colors.dashboard
});
model.append({
text: qsTr("Mixer"),
iconName: "tune",
color: Config.colors.mixer
});
model.append({
text: qsTr("Media"),
iconName: "queue_music",
color: Config.colors.media
});
model.append({
text: qsTr("Performance"),
iconName: "speed",
color: Config.colors.performance
});
model.append({
text: qsTr("Workspaces"),
iconName: "workspaces",
color: Config.colors.workspaces
});
}
delegate: Tab {}
}
}
Item {
id: indicator
anchors.left: bar.right
anchors.leftMargin: 8
property int currentIndex: root.uiState.dashboardTab
property Item currentItem: {
repeater.count;
repeater.itemAt(currentIndex)
}
implicitWidth: 2
implicitHeight: currentItem.implicitHeight
y: currentItem ? currentItem.y + bar.y + (currentItem.height - implicitHeight) / 2 : 0
clip: true
CustomRect {
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: parent.implicitWidth * 2
color: indicator.currentItem?.color ?? "transparent"
radius: 1000
}
Behavior on currentIndex {
SequentialAnimation {
Anim {
target: indicator
property: "implicitHeight"
to: 0
duration: Config.anim.durations.small / 2
}
PropertyAction {}
Anim {
target: indicator
property: "implicitHeight"
from: 0
to: bar.children[root.uiState.dashboardTab].height
duration: Config.anim.durations.small / 2
}
}
}
}
CustomRect {
id: separator
anchors.left: indicator.right
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: 1
color: Config.colors.inactive
}
component Tab: CustomMouseArea {
id: tab
required property int index
required property string text
required property string iconName
required property color color
readonly property bool isCurrentItem: root.uiState.dashboardTab === index
implicitHeight: icon.height + label.height + 8
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: event => {
root.uiState.dashboardTab = tab.index;
const stateY = stateWrapper.y;
rippleAnim.x = event.x;
rippleAnim.y = event.y - stateY;
const dist = (ox, oy) => ox * ox + oy * oy;
rippleAnim.radius = Math.sqrt(Math.max(dist(event.x, event.y + stateY),
dist(event.x, stateWrapper.height - event.y),
dist(width - event.x, event.y + stateY),
dist(width - event.x, stateWrapper.height - event.y)));
rippleAnim.restart();
}
function onWheel(event: WheelEvent): void {
if (event.angleDelta.y < 0)
root.uiState.dashboardTab = Math.min(root.uiState.dashboardTab + 1, root.count - 1);
else if (event.angleDelta.y > 0)
root.uiState.dashboardTab = Math.max(root.uiState.dashboardTab - 1, 0);
}
SequentialAnimation {
id: rippleAnim
property real x
property real y
property real radius
PropertyAction {
target: ripple
property: "x"
value: rippleAnim.x
}
PropertyAction {
target: ripple
property: "y"
value: rippleAnim.y
}
PropertyAction {
target: ripple
property: "opacity"
value: 0.08
}
Anim {
target: ripple
properties: "implicitWidth,implicitHeight"
from: 0
to: rippleAnim.radius * 2
easing.bezierCurve: Config.anim.curves.standardDecel
}
Anim {
target: ripple
property: "opacity"
to: 0
}
}
ClippingRectangle {
id: stateWrapper
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
implicitHeight: parent.height
color: "transparent"
radius: 12
CustomRect {
id: stateLayer
anchors.fill: parent
color: tab.isCurrentItem ? tab.color : Config.colors.primary
opacity: tab.pressed ? 0.1 : tab.containsMouse ? 0.08 : 0
Behavior on opacity {
Anim {}
}
}
CustomRect {
id: ripple
radius: 1000
color: tab.isCurrentItem ? tab.color : Config.colors.primary
opacity: 0
transform: Translate {
x: -ripple.width / 2
y: -ripple.height / 2
}
}
}
MaterialIcon {
id: icon
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: label.top
text: tab.iconName
color: tab.isCurrentItem ? tab.color : Config.colors.primary
fill: tab.isCurrentItem ? 1 : 0
font.pointSize: Config.font.size.large
Behavior on fill {
Anim {
duration: Config.anim.durations.small
}
}
}
CustomText {
id: label
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 5
text: tab.text
color: tab.isCurrentItem ? tab.color : Config.colors.primary
}
}
}

View file

@ -0,0 +1,496 @@
import qs.modules.bar.popouts as BarPopouts
import qs.config
import qs.custom
import qs.services
import qs.util
import Quickshell
import Quickshell.Wayland
import Quickshell.Hyprland
import Quickshell.Widgets
import QtQuick
import QtQuick.Controls
import QtQuick.Effects
import QtQuick.Layouts
Item {
id: root
required property PersistentProperties uiState
required property BarPopouts.Wrapper popouts
width: Config.dashboard.workspaceWidth + 32
height: 750
property HyprlandWorkspace dragSourceWorkspace: null
property HyprlandWorkspace dragTargetWorkspace: null
// Controls scrolling at edge of panel while dragging
property real dragScrollVelocity: 0
CustomListView {
id: list
anchors.fill: parent
anchors.margins: 12
anchors.rightMargin: 0
spacing: 12
clip: true
CustomScrollBar.vertical: CustomScrollBar {
flickable: list
}
model: Hypr.monitors
delegate: Item {
id: monitor
required property int index
required property HyprlandMonitor modelData
readonly property ListModel workspaces: States.screens.get(modelData).workspaces
width: list.width - 20
height: childrenRect.height
Item {
id: monitorHeader
anchors.left: parent.left
anchors.right: parent.right
height: monIcon.height
MaterialIcon {
id: monIcon
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
text: "desktop_windows"
color: Config.colors.tertiary
}
CustomText {
id: monText
anchors.verticalCenter: parent.verticalCenter
anchors.left: monIcon.right
anchors.leftMargin: 4
text: monitor.modelData.name
color: Config.colors.tertiary
font.family: Config.font.family.mono
font.pointSize: Config.font.size.smaller
}
CustomRect {
anchors.verticalCenter: parent.verticalCenter
anchors.left: monText.right
anchors.right: parent.right
anchors.leftMargin: 8
anchors.rightMargin: 18
height: 1
color: Config.colors.inactive
}
}
ListView {
id: workspaceList
anchors.top: monitorHeader.bottom
anchors.topMargin: 8
width: list.width - 20
spacing: 22
height: contentHeight
acceptedButtons: Qt.NoButton
boundsBehavior: Flickable.StopAtBounds
model: monitor.workspaces
delegate: Column {
id: entry
required property int index
required property HyprlandWorkspace workspace
width: list.width - 20
spacing: 5
property bool hoveredWhileDragging: false
z: root.dragSourceWorkspace === workspace ? 10 : 0
Item {
id: header
anchors.left: parent.left
anchors.right: parent.right
implicitHeight: labelState.height
property color nonAnimColor: entry.hoveredWhileDragging ? Config.colors.workspaceMove :
entry.workspace?.active ? Config.colors.workspaces : Config.colors.primary
property color color: nonAnimColor
Behavior on color {
CAnim {}
}
StateLayer {
id: labelState
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
implicitWidth: label.width + 20
implicitHeight: label.height + 8
color: Config.colors.secondary
function onClicked(): void {
Hypr.dispatch(`workspace ${entry.workspace.id}`)
}
Row {
id: label
anchors.centerIn: parent
spacing: 7
MaterialIcon {
text: Icons.getWorkspaceIcon(entry.workspace)
color: header.color
font.pointSize: Config.font.size.larger
animate: true
animateDuration: Config.anim.durations.small
}
CustomText {
anchors.top: parent.top
anchors.topMargin: 1
text: qsTr("Workspace %1").arg(index + 1)
font.family: Config.font.family.mono
font.pointSize: Config.font.size.normal
color: header.color
}
}
}
StateLayer {
anchors.verticalCenter: parent.verticalCenter
anchors.right: downArrow.left
anchors.rightMargin: 2
implicitWidth: implicitHeight
implicitHeight: upIcon.height + 6
disabled: entry.index === 0 && monitor.index === 0
function onClicked(): void {
if (entry.index !== 0) {
monitor.workspaces.move(entry.index, entry.index - 1, 1)
} else {
const workspace = entry.workspace;
monitor.workspaces.remove(entry.index, 1);
const otherWorkspaces = list.itemAtIndex(monitor.index - 1).workspaces;
otherWorkspaces.insert(0, {"workspace": workspace});
}
}
MaterialIcon {
id: upIcon
anchors.centerIn: parent
text: "keyboard_arrow_up"
color: parent.disabled ? Config.colors.inactive : header.nonAnimColor
font.pointSize: Config.font.size.larger
Behavior on color {
CAnim {}
}
}
}
StateLayer {
id: downArrow
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
implicitWidth: implicitHeight
implicitHeight: downIcon.height + 6
disabled: entry.index === monitor.workspaces.count - 1 && monitor.index === list.count - 1
function onClicked(): void {
if (entry.index !== monitor.workspaces.count - 1) {
root.uiState.workspaces.move(entry.index, entry.index + 1, 1)
} else {
const workspace = entry.workspace;
monitor.workspaces.remove(entry.index, 1);
const otherWorkspaces = list.itemAtIndex(monitor.index + 1).workspaces;
otherWorkspaces.append({"workspace": workspace});
}
}
MaterialIcon {
id: downIcon
anchors.centerIn: parent
text: "keyboard_arrow_down"
color: parent.disabled ? Config.colors.inactive : header.nonAnimColor
font.pointSize: Config.font.size.larger
Behavior on color {
CAnim {}
}
}
}
}
CustomRect {
id: preview
anchors.left: parent.left
anchors.right: parent.right
readonly property HyprlandMonitor mon: entry.workspace.monitor
// Exclude UI border and apply monitor scale
readonly property real monX: Config.border.thickness
readonly property real monY: Config.bar.height
readonly property real monWidth: (mon.width / mon.scale) - 2 * Config.border.thickness
readonly property real monHeight: (mon.height / mon.scale) - Config.bar.height - Config.border.thickness
readonly property real aspectRatio: monHeight / monWidth
readonly property real sizeRatio: Config.dashboard.workspaceWidth / monWidth
width: Config.dashboard.workspaceWidth
height: aspectRatio * width
radius: 7
color: entry.hoveredWhileDragging ? Config.colors.workspaceMove :
entry.workspace?.active ? Color.mute(Config.colors.workspaces, 1.5, 1.1) : Config.colors.container
Behavior on color {
CAnim {}
}
DropArea {
anchors.fill: parent
onEntered: {
root.dragTargetWorkspace = entry.workspace;
entry.hoveredWhileDragging = true;
}
onExited: {
if (root.draggingTargetWorkspace === entry.workspace)
root.draggingTargetWorkspace = null;
entry.hoveredWhileDragging = false;
}
}
Repeater {
anchors.fill: parent
model: entry.workspace?.toplevels
delegate: Item {
id: window
required property HyprlandToplevel modelData
property var ipc: modelData.lastIpcObject
opacity: ipc && ipc.at && !ipc.hidden ? 1 : 0
property real nonAnimX: ipc?.at ? (ipc.at[0] - preview.monX) * preview.sizeRatio : 0
property real nonAnimY: ipc?.at ? (ipc.at[1] - preview.monY) * preview.sizeRatio : 0
property real nonAnimWidth: ipc?.size ? ipc.size[0] * preview.sizeRatio : 0
property real nonAnimHeight: ipc?.size ? ipc.size[1] * preview.sizeRatio : 0
x: nonAnimX
y: nonAnimY
width: nonAnimWidth
height: nonAnimHeight
z: nonAnimX !== x || nonAnimY !== y ? 10 : 0
Behavior on x {
enabled: window.x !== 0
Anim {}
}
Behavior on y {
enabled: window.y !== 0
Anim {}
}
Behavior on width {
enabled: window.width !== 0
Anim {}
}
Behavior on height {
enabled: window.height !== 0
Anim {}
}
Behavior on opacity { Anim {} }
ScreencopyView {
id: view
visible: false
anchors.left: parent.left
anchors.top: parent.top
layer.enabled: true
// NOTE: Simulates cropping fill (which ScreencopyView does not natively support)
readonly property real aspectRatio: sourceSize.height / sourceSize.width
width: Math.max(window.nonAnimWidth, window.nonAnimHeight / aspectRatio)
height: Math.max(window.nonAnimHeight, window.nonAnimWidth * aspectRatio)
captureSource: window.modelData.wayland
live: true
CustomRect {
anchors.fill: parent
color: mouse.drag.active ?
Qt.tint(Qt.alpha(Config.colors.overlay, 0.7), Qt.alpha(Config.colors.workspaceMove, 0.2)) :
mouse.pressed ?
Qt.tint(Qt.alpha(Config.colors.overlay, 0.7), Qt.alpha(Config.colors.workspaces, 0.2)) :
mouse.containsMouse ?
Qt.tint(Qt.alpha(Config.colors.overlay, 0.5), Qt.alpha(Config.colors.workspaces, 0.1)) :
Qt.alpha(Config.colors.overlay, 0.5)
Behavior on color {
CAnim { duration: Config.anim.durations.small }
}
}
}
Item {
id: mask
visible: false
anchors.fill: view
layer.enabled: true
Rectangle {
width: window.width
height: window.height
radius: 8
}
}
MultiEffect {
anchors.fill: view
source: view
maskEnabled: true
maskSource: mask
}
IconImage {
id: icon
anchors.centerIn: parent
implicitSize: Math.min(48, window.width * 0.5, window.height * 0.5)
source: Icons.getAppIcon(window.ipc?.class ?? "", "")
}
// Interactions
Drag.active: mouse.drag.active
Drag.source: window
Drag.hotSpot.x: nonAnimWidth / 2
Drag.hotSpot.y: nonAnimHeight / 2
MouseArea {
id: mouse
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.AllButtons
drag.target: parent
onPressed: event => {
root.dragSourceWorkspace = entry.workspace;
window.Drag.hotSpot.x = event.x;
window.Drag.hotSpot.y = event.y;
}
onReleased: event => {
const targetWorkspace = root.dragTargetWorkspace;
root.dragSourceWorkspace = null;
root.dragScrollVelocity = 0;
if (targetWorkspace !== null && targetWorkspace !== entry.workspace) {
Hyprland.dispatch(`movetoworkspacesilent ${targetWorkspace.id}, address:0x${window.modelData.address}`)
} else {
window.x = Qt.binding(() => window.nonAnimX);
window.y = Qt.binding(() => window.nonAnimY);
}
}
onClicked: event => {
if (event.button === Qt.LeftButton) {
root.uiState.dashboard = false;
Hypr.dispatch(`focuswindow address:0x${window.modelData.address}`);
} else if (event.button === Qt.MiddleButton) {
Hypr.dispatch(`closewindow address:0x${window.modelData.address}`);
} else if (event.button === Qt.RightButton) {
root.uiState.dashboard = false;
popouts.currentName = "activewindow";
popouts.currentCenter = QsWindow.window.width / 2;
popouts.window = window.modelData;
popouts.hasCurrent = true;
}
}
onPositionChanged: event => {
if (!drag.active) return;
const y = root.mapFromItem(this, 0, event.y).y;
if (y < 100) {
root.dragScrollVelocity = (y - 100) / 25;
} else if (y > root.height - 100) {
root.dragScrollVelocity = (y - root.height + 100) / 25;
} else {
root.dragScrollVelocity = 0;
}
}
}
}
}
}
}
add: Transition {
Anim {
property: "opacity"
from: 0
to: 1
}
}
remove: Transition {
Anim {
property: "opacity"
from: 1
to: 0
}
}
move: Transition {
Anim {
property: "y"
}
Anim {
properties: "opacity"
to: 1
}
}
displaced: Transition {
Anim {
property: "y"
}
Anim {
properties: "opacity"
to: 1
}
}
}
}
}
Timer {
running: root.dragScrollVelocity !== 0
repeat: true
interval: 10
onTriggered: {
list.contentY += root.dragScrollVelocity;
list.returnToBounds();
}
}
}

View file

@ -0,0 +1,78 @@
pragma ComponentBehavior: Bound
import qs.modules.bar.popouts as BarPopouts
import qs.config
import qs.custom
import qs.util
import Quickshell
import Quickshell.Hyprland
import QtQuick
Item {
id: root
required property PersistentProperties uiState
required property BarPopouts.Wrapper popouts
visible: width > 0
implicitWidth: 0
implicitHeight: content.implicitHeight
states: State {
name: "visible"
when: root.uiState.dashboard
PropertyChanges {
root.implicitWidth: content.implicitWidth
}
}
transitions: [
Transition {
from: ""
to: "visible"
Anim {
target: root
property: "implicitWidth"
duration: Config.anim.durations.expressiveDefaultSpatial
easing.bezierCurve: Config.anim.curves.expressiveDefaultSpatial
}
},
Transition {
from: "visible"
to: ""
Anim {
target: root
property: "implicitWidth"
easing.bezierCurve: Config.anim.curves.emphasized
}
}
]
Background {
id: background
visible: false
wrapper: root
}
GlowEffect {
source: background
glowColor: content.active ? content.item.color : "transparent"
}
Loader {
id: content
Component.onCompleted: active = Qt.binding(() => root.uiState.dashboard || root.visible)
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
sourceComponent: Content {
uiState: root.uiState
popouts: root.popouts
}
}
}

View file

@ -0,0 +1,29 @@
pragma ComponentBehavior: Bound
import qs.services
import qs.config
import qs.custom
import QtQuick
import QtQuick.Layouts
ColumnLayout {
anchors.centerIn: parent
anchors.verticalCenterOffset: -2
spacing: -6
CustomText {
Layout.alignment: Qt.AlignHCenter
text: Time.format("hh:mm:ss")
color: Config.colors.secondary
font.family: Config.font.family.mono
font.pointSize: Config.font.size.largest
font.weight: 600
}
CustomText {
Layout.alignment: Qt.AlignHCenter
text: Time.format("dddd, yyyy-MM-dd")
color: Config.colors.tertiary
font.pointSize: Config.font.size.normal
}
}

View file

@ -0,0 +1,243 @@
import qs.config
import qs.custom
import qs.services
import qs.util
import QtQuick
import QtQuick.Shapes
Item {
id: root
anchors.fill: parent
property real playerProgress: {
const active = Players.active;
return active?.length ? active.position / active.length : 0;
}
Behavior on playerProgress {
Anim {
duration: Config.anim.durations.large
}
}
Timer {
running: Players.active?.isPlaying ?? false
interval: 400
triggeredOnStart: true
repeat: true
onTriggered: Players.active?.positionChanged()
}
Shape {
id: progress
preferredRendererType: Shape.CurveRenderer
readonly property int thickness: 8
readonly property int angle: 300
ShapePath {
id: path
fillColor: "transparent"
strokeColor: Qt.alpha(Config.colors.media, 0.2)
strokeWidth: progress.thickness
capStyle: ShapePath.RoundCap
PathAngleArc {
centerX: cover.x + cover.width / 2
centerY: cover.y + cover.height / 2
radiusX: (cover.width + progress.thickness) / 2 + 7
radiusY: (cover.height + progress.thickness) / 2 + 7
startAngle: -90 - progress.angle / 2
sweepAngle: progress.angle
}
Behavior on strokeColor {
CAnim {}
}
}
ShapePath {
fillColor: "transparent"
strokeColor: Config.colors.media
strokeWidth: progress.thickness
capStyle: ShapePath.RoundCap
PathAngleArc {
centerX: cover.x + cover.width / 2
centerY: cover.y + cover.height / 2
radiusX: (cover.width + progress.thickness) / 2 + 7
radiusY: (cover.height + progress.thickness) / 2 + 7
startAngle: -90 - progress.angle / 2
// NOTE: Cap progress angle to account for bad MPRIS players
sweepAngle: progress.angle * Math.min(root.playerProgress, 1)
}
Behavior on strokeColor {
CAnim {}
}
}
}
CustomClippingRect {
id: cover
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 18 + progress.thickness
implicitHeight: width
color: Config.colors.inactive
radius: Infinity
MaterialIcon {
anchors.centerIn: parent
grade: 200
text: "art_track"
color: Config.colors.tertiary
font.pointSize: (parent.width * 0.4) || 1
}
Image {
id: image
anchors.fill: parent
source: Players.active?.trackArtUrl ?? ""
asynchronous: true
fillMode: Image.PreserveAspectCrop
sourceSize.width: width
sourceSize.height: height
}
}
CustomText {
id: title
anchors.top: cover.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: album.text === "" ? 24 : 18
anchors.leftMargin: 15
anchors.rightMargin: 15
animate: true
horizontalAlignment: Text.AlignHCenter
text: (Players.active?.trackTitle ?? qsTr("No media")) || qsTr("Unknown title")
color: Config.colors.secondary
font.pointSize: Config.font.size.normal
elide: Text.ElideRight
}
CustomText {
id: artist
anchors.top: title.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 15
anchors.rightMargin: 15
animate: true
horizontalAlignment: Text.AlignHCenter
text: (Players.active?.trackArtist ?? qsTr("No media")) || qsTr("Unknown artist")
opacity: Players.active ? 1 : 0
color: Config.colors.primary
elide: Text.ElideRight
}
CustomText {
id: album
anchors.top: artist.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 15
anchors.rightMargin: 15
animate: true
horizontalAlignment: Text.AlignHCenter
text: Players.active?.trackAlbum ?? ""
opacity: Players.active ? 1 : 0
color: Config.colors.tertiary
font.pointSize: Config.font.size.small
elide: Text.ElideRight
}
Row {
id: controls
anchors.top: album.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: album.text === "" ? -4 : 2
spacing: 7
Control {
icon: "skip_previous"
canUse: Players.active?.canGoPrevious ?? false
function onClicked(): void {
Players.active?.previous();
}
}
Control {
icon: Players.active?.isPlaying ? "pause" : "play_arrow"
canUse: Players.active?.canTogglePlaying ?? false
function onClicked(): void {
Players.active?.togglePlaying();
}
}
Control {
icon: "skip_next"
canUse: Players.active?.canGoNext ?? false
function onClicked(): void {
Players.active?.next();
}
}
}
component Control: CustomRect {
id: control
required property string icon
required property bool canUse
function onClicked(): void {
}
implicitWidth: Math.max(icon.implicitHeight, icon.implicitHeight) + 12
implicitHeight: implicitWidth
StateLayer {
anchors.fill: parent
disabled: !control.canUse
radius: 1000
function onClicked(): void {
control.onClicked();
}
}
MaterialIcon {
id: icon
anchors.centerIn: parent
anchors.verticalCenterOffset: font.pointSize * 0.05
animate: true
text: control.icon
color: control.canUse ? Config.colors.media : Config.colors.inactive
font.pointSize: Config.font.size.large
}
}
}

View file

@ -0,0 +1,264 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import qs.services
import qs.util
import Quickshell
import Quickshell.Services.Notifications
import QtQuick
import QtQuick.Layouts
import qs.modules.notifications as N
ColumnLayout {
id: root
anchors.fill: parent
spacing: 7
readonly property int notifCount:
(Notifs.list && Notifs.list.length !== undefined) ? Notifs.list.length :
((Notifs.list && Notifs.list.count !== undefined) ? Notifs.list.count : 0)
function notifAt(i) {
if (!Notifs.list)
return undefined;
if (typeof Notifs.list.get === 'function')
return Notifs.list.get(i);
return Notifs.list[i];
}
function scrollToTop(): void {
if (notifScroll && notifScroll.contentItem && notifScroll.contentItem.contentY !== undefined) {
notifScroll.contentItem.contentY = 0;
}
}
RowLayout {
Layout.alignment: Qt.AlignTop
Layout.margins: 10
Layout.fillWidth: true
spacing: 7
MaterialIcon {
Layout.alignment: Qt.AlignVCenter
id: icon
text: {
if (Notifs.dnd)
return "notifications_off";
if (notifCount > 0)
return "notifications_active";
return "notifications";
}
fill: {
if (Notifs.dnd)
return 0;
if (notifCount > 0)
return 1;
return 0;
}
color: Notifs.dnd ? Config.colors.error : Config.colors.notification
font.pointSize: Config.font.size.larger
animate: true
Behavior on color {
SequentialAnimation {
PauseAnimation {
duration: icon.animateDuration / 2
}
PropertyAction {}
}
}
}
CustomText {
Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
text: notifCount > 0 ? qsTr("%1 notifications").arg(notifCount) : qsTr("No notifications")
font.weight: 600
font.pointSize: Config.font.size.normal
animate: true
}
CustomText {
Layout.alignment: Qt.AlignVCenter
text: qsTr("Do Not Disturb")
}
CustomSwitch {
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: 5
Layout.rightMargin: 5
bg: Config.colors.containerAlt
accent: Color.mute(Config.colors.notification)
checked: Notifs.dnd
onToggled: Notifs.toggleDnd()
}
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.leftMargin: 10
Layout.rightMargin: 10
Layout.bottomMargin: 10
CustomListView {
id: notifScroll
anchors.fill: parent
anchors.margins: 10
anchors.rightMargin: 5
spacing: 12
clip: true
CustomScrollBar.vertical: CustomScrollBar {
flickable: notifScroll
}
model: ScriptModel {
values: [...Notifs.list].reverse()
}
delegate: Item {
id: wrapper
required property int index
required property var modelData
readonly property alias nonAnimHeight: notif.nonAnimHeight
width: 405
height: notif.implicitHeight
ListView.onRemove: removeAnim.start()
SequentialAnimation {
id: removeAnim
PropertyAction {
target: wrapper
property: "ListView.delayRemove"
value: true
}
PropertyAction {
target: wrapper
property: "enabled"
value: false
}
PropertyAction {
target: wrapper
property: "implicitHeight"
value: 0
}
PropertyAction {
target: wrapper
property: "z"
value: 1
}
Anim {
target: notif
property: "x"
to: (notif.x >= 0 ? Config.notifs.width : -Config.notifs.width) * 2
easing.bezierCurve: Config.anim.curves.emphasized
}
PropertyAction {
target: wrapper
property: "ListView.delayRemove"
value: false
}
}
N.Notification {
id: notif
width: parent.width
notif: wrapper.modelData
color: wrapper.modelData.urgency === NotificationUrgency.Critical ? Config.colors.errorBg : Config.colors.containerAlt
inPopup: false
}
}
add: Transition {
Anim {
property: "x"
from: Config.notifs.width
to: 0
easing.bezierCurve: Config.anim.curves.emphasizedDecel
}
}
move: Transition {
NotifAnim {
property: "y"
}
}
displaced: Transition {
NotifAnim {
property: "y"
}
}
}
}
Item {
Layout.alignment: Qt.AlignBottom
Layout.fillWidth: true
height: 0
CustomRect {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: bottomMargin
property real bottomMargin: notifCount > 0 ? 12 : -4
opacity: notifCount > 0 ? 1 : 0
visible: opacity > 0
implicitWidth: clearBtn.implicitWidth + 32
implicitHeight: clearBtn.implicitHeight + 20
radius: 25
color: Config.colors.inactive
Behavior on opacity {
Anim {}
}
Behavior on bottomMargin {
Anim {}
}
StateLayer {
anchors.fill: parent
function onClicked(): void {
for (let i = root.notifCount - 1; i >= 0; i--) {
const n = root.notifAt(i);
n?.notification?.dismiss();
}
}
}
RowLayout {
id: clearBtn
anchors.centerIn: parent
spacing: 7
MaterialIcon {
id: clearIcon
text: "clear_all"
color: Config.colors.secondary
}
CustomText {
text: qsTr("Clear all")
color: Config.colors.secondary
}
}
}
}
component NotifAnim: Anim {
duration: Config.anim.durations.expressiveDefaultSpatial
easing.bezierCurve: Config.anim.curves.expressiveDefaultSpatial
}
}

View file

@ -0,0 +1,73 @@
import qs.config
import qs.custom
import qs.services
import qs.util
import Quickshell
import QtQuick
Column {
id: root
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 24
Item {
id: userLine
implicitWidth: childrenRect.width
implicitHeight: childrenRect.height
MaterialIcon {
id: userIcon
anchors.left: parent.left
text: "account_circle"
fill: 1
color: Config.colors.primary
font.pointSize: Config.font.size.larger
}
CustomText {
id: userText
anchors.verticalCenter: userIcon.verticalCenter
anchors.left: userIcon.right
anchors.leftMargin: 7
text: qsTr("User: %1").arg(User.user)
color: Config.colors.secondary
}
}
Item {
id: uptimeLine
implicitWidth: childrenRect.width
implicitHeight: childrenRect.height
MaterialIcon {
id: uptimeIcon
anchors.left: parent.left
text: "timer"
fill: 1
color: Config.colors.primary
font.pointSize: Config.font.size.larger
}
CustomText {
id: uptimeText
anchors.verticalCenter: uptimeIcon.verticalCenter
anchors.left: uptimeIcon.right
anchors.verticalCenterOffset: 1
anchors.leftMargin: 7
text: qsTr("Uptime: %1").arg(User.uptime)
color: Config.colors.secondary
}
}
}

View file

@ -0,0 +1,129 @@
import qs.config
import qs.custom
import qs.services
import qs.util
import QtQuick
import QtQuick.Layouts
Item {
id: root
anchors.fill: parent
anchors.margins: 16
anchors.topMargin: 6
Component.onCompleted: Weather.reload()
CustomText {
id: city
anchors.top: parent.top
anchors.left: parent.left
text: Weather.city
color: Config.colors.tertiary
}
MaterialIcon {
id: icon
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: font.pointSize * 0.25
animate: true
animateProp: "opacity"
text: Weather.icon
color: Weather.iconColor
font.pointSize: Config.font.size.largest * 1.8
Behavior on color {
SequentialAnimation {
PauseAnimation {
duration: icon.animateDuration / 2
}
PropertyAction {}
}
}
}
Column {
id: info
anchors.left: icon.right
anchors.verticalCenter: icon.verticalCenter
anchors.verticalCenterOffset: -3
anchors.leftMargin: 14
spacing: 1
opacity: Weather.available ? 1 : 0
Behavior on opacity {
SequentialAnimation {
PauseAnimation {
duration: temp.animateDuration / 2
}
PropertyAction {}
}
}
CustomText {
id: temp
animate: true
text: Weather.temp
color: Config.colors.primary
font.pointSize: Config.font.size.large
font.weight: 500
// Reduce padding at bottom of text
height: implicitHeight * 0.9
CustomText {
anchors.left: parent.right
anchors.bottom: parent.bottom
anchors.leftMargin: 12
anchors.bottomMargin: 1
animate: true
text: Weather.feelsLike
color: Config.colors.tertiary
font.pointSize: Config.font.size.larger
}
}
CustomText {
animate: true
text: Weather.description
color: Config.colors.secondary
elide: Text.ElideRight
width: Math.min(implicitWidth, root.parent.width - icon.implicitWidth - info.anchors.leftMargin - 30)
}
Item {
implicitWidth: childrenRect.width
implicitHeight: childrenRect.height
MaterialIcon {
id: humidityIcon
animate: true
text: Weather.humidityIcon
color: Config.colors.primary
font.pointSize: Config.font.size.normal
}
CustomText {
anchors.left: humidityIcon.right
anchors.verticalCenter: humidityIcon.verticalCenter
anchors.leftMargin: 2
animate: true
text: `${Math.round(Weather.humidity * 100)}% Humidity`
color: Config.colors.primary
}
}
}
}

View file

@ -0,0 +1,59 @@
import qs.config
import QtQuick
import QtQuick.Shapes
Shape {
id: root
required property Item wrapper
readonly property real rounding: Config.border.rounding
readonly property bool flatten: wrapper.height < rounding * 2
readonly property real roundingY: flatten ? wrapper.height / 2 : rounding
ShapePath {
startX: (root.parent.width - root.wrapper.width) / 2 - rounding
startY: root.parent.height + 0.5
strokeWidth: -1
fillColor: Config.colors.bg
PathArc {
relativeX: root.rounding
relativeY: -root.roundingY
radiusX: root.rounding
radiusY: Math.min(root.rounding, root.wrapper.height)
direction: PathArc.Counterclockwise
}
PathLine {
relativeX: 0
relativeY: -(root.wrapper.height - root.roundingY * 2)
}
PathArc {
relativeX: root.rounding
relativeY: -root.roundingY
radiusX: root.rounding
radiusY: Math.min(root.rounding, root.wrapper.height)
}
PathLine {
relativeX: root.wrapper.width - root.rounding * 2
relativeY: 0
}
PathArc {
relativeX: root.rounding
relativeY: root.roundingY
radiusX: root.rounding
radiusY: Math.min(root.rounding, root.wrapper.height)
}
PathLine {
relativeX: 0
relativeY: root.wrapper.height - root.roundingY * 2
}
PathArc {
relativeX: root.rounding
relativeY: root.roundingY
radiusX: root.rounding
radiusY: Math.min(root.rounding, root.wrapper.height)
direction: PathArc.Counterclockwise
}
}
}

View file

@ -0,0 +1,167 @@
pragma ComponentBehavior: Bound
import "services"
import qs.services
import qs.config
import qs.custom
import Quickshell
import QtQuick
Item {
id: root
required property PersistentProperties uiState
required property var wrapper
required property var panels
readonly property color color: list.color
readonly property int padding: 15
readonly property int rounding: 25
implicitWidth: listWrapper.width + padding * 2
implicitHeight: searchWrapper.height + listWrapper.height + padding * 2
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
Item {
id: listWrapper
implicitWidth: list.width
implicitHeight: list.height + root.padding
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: searchWrapper.top
anchors.bottomMargin: root.padding
ContentList {
id: list
uiState: root.uiState
wrapper: root.wrapper
panels: root.panels
search: search
padding: root.padding
rounding: root.rounding
}
}
CustomRect {
id: searchWrapper
color: Config.colors.container
radius: 1000
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: root.padding
implicitHeight: Math.max(searchIcon.implicitHeight, search.implicitHeight, clearIcon.implicitHeight)
MaterialIcon {
id: searchIcon
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: root.padding
text: "search"
color: Config.colors.tertiary
}
CustomTextField {
id: search
anchors.left: searchIcon.right
anchors.right: clearBtn.left
anchors.leftMargin: 7
anchors.rightMargin: 7
topPadding: 12
bottomPadding: 12
placeholderText: qsTr("Type \"%1\" for commands").arg(Config.launcher.actionPrefix)
onAccepted: {
const currentItem = list.list?.currentItem;
if (currentItem) {
if (text.startsWith(Config.launcher.actionPrefix)) {
currentItem.modelData.onClicked(root.uiState);
} else {
Apps.launch(currentItem.modelData);
root.uiState.launcher = false;
}
}
}
Keys.onUpPressed: list.list?.decrementCurrentIndex()
Keys.onDownPressed: list.list?.incrementCurrentIndex()
Keys.onPressed: event => {
if (event.modifiers & Qt.ControlModifier) {
if (event.key === Qt.Key_J) {
list.list?.incrementCurrentIndex();
event.accepted = true;
} else if (event.key === Qt.Key_K) {
list.list?.decrementCurrentIndex();
event.accepted = true;
}
} else if (event.key === Qt.Key_Tab) {
list.list?.incrementCurrentIndex();
event.accepted = true;
} else if (event.key === Qt.Key_Backtab || (event.key === Qt.Key_Tab && (event.modifiers & Qt.ShiftModifier))) {
list.list?.decrementCurrentIndex();
event.accepted = true;
}
}
Connections {
target: root.uiState
function onLauncherChanged(): void {
if (root.uiState.launcher)
search.focus = true;
else {
search.text = "";
list.list.currentIndex = 0;
}
}
}
}
StateLayer {
id: clearBtn
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: root.padding
implicitWidth: 24
implicitHeight: 24
disabled: search.text === ""
onClicked: search.text = ""
opacity: disabled ? 0 : 1
MaterialIcon {
id: clearIcon
anchors.centerIn: parent
width: search.text ? implicitWidth : implicitWidth / 2
text: "close"
color: Config.colors.tertiary
Behavior on width {
Anim { duration: Config.anim.durations.small }
}
}
Behavior on opacity {
Anim { duration: Config.anim.durations.small }
}
}
}
}

View file

@ -0,0 +1,293 @@
pragma ComponentBehavior: Bound
import "items"
import "services"
import qs.config
import qs.custom
import qs.services
import qs.util
import Quickshell
import QtQuick
import QtQuick.Controls
Item {
id: root
required property PersistentProperties uiState
required property var wrapper
required property var panels
required property TextField search
required property int padding
required property int rounding
readonly property Item list: list
readonly property color color: list.color
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
implicitWidth: Config.launcher.itemWidth
implicitHeight: list.implicitHeight > 0 ? list.implicitHeight : empty.implicitHeight
clip: true
CustomListView {
id: list
model: ScriptModel {
id: model
onValuesChanged: list.currentIndex = 0
}
anchors.left: parent.left
anchors.right: parent.right
spacing: 7
orientation: Qt.Vertical
implicitHeight: (Config.launcher.itemHeight + spacing) * Math.min(Config.launcher.maxItemCount, count) - spacing
highlightMoveDuration: Config.anim.durations.normal
highlightResizeDuration: 0
keyNavigationWraps: true
property color color
highlight: CustomRect {
radius: 1000
color: list.color
opacity: 0.1
}
state: {
const text = root.search.text;
const prefix = Config.launcher.actionPrefix;
if (text.startsWith(prefix)) {
return "actions";
}
return "apps";
}
states: [
State {
name: "apps"
PropertyChanges {
model.values: Apps.search(root.search.text)
list.delegate: appItem
list.color: Config.colors.launcherApps
}
},
State {
name: "actions"
PropertyChanges {
model.values: Actions.query(root.search.text)
list.delegate: actionItem
list.color: Config.colors.launcherActions
}
}
]
// Disable animations before transition starts
onStateChanged: {
// NOTE: uiState check is necessary because this handler runs on startup
if (root.uiState.launcher) {
list.add.enabled = false;
list.remove.enabled = false;
}
}
transitions: Transition {
SequentialAnimation {
ParallelAnimation {
Anim {
target: list
property: "opacity"
from: 1
to: 0
duration: Config.anim.durations.small
easing.bezierCurve: Config.anim.curves.standardAccel
}
Anim {
target: list
property: "scale"
from: 1
to: 0.9
duration: Config.anim.durations.small
easing.bezierCurve: Config.anim.curves.standardAccel
}
}
PropertyAction {
targets: [model, list]
properties: "values,delegate,color"
}
ParallelAnimation {
Anim {
target: list
property: "opacity"
from: 0
to: 1
duration: Config.anim.durations.small
easing.bezierCurve: Config.anim.curves.standardDecel
}
Anim {
target: list
property: "scale"
from: 0.9
to: 1
duration: Config.anim.durations.small
easing.bezierCurve: Config.anim.curves.standardDecel
}
}
PropertyAction {
targets: [list.add, list.remove]
property: "enabled"
value: true
}
}
}
CustomScrollBar.vertical: CustomScrollBar {
flickable: list
}
add: Transition {
Anim {
property: "opacity"
from: 0
to: 1
}
Anim {
property: "scale"
from: 0.8
to: 1
}
}
remove: Transition {
Anim {
property: "opacity"
from: 1
to: 0
}
Anim {
property: "scale"
from: 1
to: 0.8
}
}
move: Transition {
Anim {
property: "y"
}
Anim {
properties: "opacity,scale"
to: 1
}
}
addDisplaced: Transition {
Anim {
property: "y"
duration: Config.anim.durations.small
}
Anim {
properties: "opacity,scale"
to: 1
}
}
displaced: Transition {
Anim {
property: "y"
}
Anim {
properties: "opacity,scale"
to: 1
}
}
Component {
id: appItem
AppItem {
uiState: root.uiState
}
}
Component {
id: actionItem
ActionItem {
uiState: root.uiState
list: list
}
}
}
Row {
id: empty
opacity: root.list?.count === 0 ? 1 : 0
scale: root.list?.count === 0 ? 1 : 0.5
spacing: 12
padding: 15
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
MaterialIcon {
text: "manage_search"
color: Config.colors.tertiary
font.pointSize: Config.font.size.largest
anchors.verticalCenter: parent.verticalCenter
}
Column {
anchors.verticalCenter: parent.verticalCenter
CustomText {
text: qsTr("No results")
color: Config.colors.tertiary
font.pointSize: Config.font.size.larger
font.weight: 500
}
CustomText {
text: qsTr("Try searching for something else")
color: Config.colors.tertiary
font.pointSize: Config.font.size.normal
}
}
Behavior on opacity {
Anim {}
}
Behavior on scale {
Anim {}
}
}
Behavior on implicitWidth {
enabled: root.uiState.launcher
Anim {
duration: Config.anim.durations.large
easing.bezierCurve: Config.anim.curves.emphasizedDecel
}
}
Behavior on implicitHeight {
enabled: root.uiState.launcher
Anim {
duration: Config.anim.durations.large
easing.bezierCurve: Config.anim.curves.emphasizedDecel
}
}
}

View file

@ -0,0 +1,75 @@
import qs.config
import qs.custom
import Quickshell
import Quickshell.Hyprland
import QtQuick
Item {
id: root
required property PersistentProperties uiState
required property Item panels
visible: height > 0
implicitHeight: 0
implicitWidth: content.implicitWidth
states: State {
name: "visible"
when: root.uiState.launcher
PropertyChanges {
root.implicitHeight: content.implicitHeight
}
}
transitions: [
Transition {
from: ""
to: "visible"
Anim {
target: root
property: "implicitHeight"
duration: Config.anim.durations.expressiveDefaultSpatial
easing.bezierCurve: Config.anim.curves.expressiveDefaultSpatial
}
},
Transition {
from: "visible"
to: ""
Anim {
target: root
property: "implicitHeight"
duration: Config.anim.durations.normal
easing.bezierCurve: Config.anim.curves.emphasized
}
}
]
HyprlandFocusGrab {
active: root.uiState.launcher
windows: [QsWindow.window]
onCleared: root.uiState.launcher = false
}
Background {
id: background
visible: false
wrapper: root
}
GlowEffect {
source: background
glowColor: content.color
}
Content {
id: content
uiState: root.uiState
wrapper: root
panels: root.panels
}
}

View file

@ -0,0 +1,80 @@
import "../services"
import qs.config
import qs.custom
import qs.services
import qs.util
import QtQuick
import Quickshell
Item {
id: root
required property Actions.Action modelData
required property PersistentProperties uiState
required property var list
implicitHeight: Config.launcher.itemHeight
anchors.left: parent?.left
anchors.right: parent?.right
StateLayer {
radius: 1000
anchors.fill: parent
function onClicked(): void {
root.uiState.launcher = false;
root.modelData?.onClicked(root.uiState);
}
}
Item {
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: 12
anchors.margins: 7
MaterialIcon {
id: icon
text: root.modelData?.icon ?? ""
font.pointSize: Config.font.size.largest
anchors.verticalCenter: parent.verticalCenter
}
Item {
anchors.left: icon.right
anchors.leftMargin: 12
anchors.verticalCenter: icon.verticalCenter
implicitWidth: parent.width - icon.width
implicitHeight: name.implicitHeight + desc.implicitHeight
CustomText {
id: name
text: root.modelData?.name ?? ""
font.pointSize: Config.font.size.normal
color: root.ListView.isCurrentItem ? Color.mute(Config.colors.launcherActions, 1.1) : Config.colors.primary
Behavior on color {
CAnim {}
}
}
CustomText {
id: desc
text: root.modelData?.desc ?? ""
font.pointSize: Config.font.size.small
color: Config.colors.tertiary
elide: Text.ElideRight
width: root.width - icon.width - 34
anchors.top: name.bottom
}
}
}
}

View file

@ -0,0 +1,80 @@
import "../services"
import qs.config
import qs.custom
import qs.services
import qs.util
import Quickshell
import Quickshell.Widgets
import QtQuick
Item {
id: root
required property DesktopEntry modelData
required property PersistentProperties uiState
implicitHeight: Config.launcher.itemHeight
anchors.left: parent?.left
anchors.right: parent?.right
StateLayer {
radius: 1000
anchors.fill: parent
function onClicked(): void {
Apps.launch(root.modelData);
root.uiState.launcher = false;
}
}
Item {
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: 12
anchors.margins: 7
IconImage {
id: icon
source: Quickshell.iconPath(root.modelData?.icon, "image-missing")
implicitSize: parent.height * 0.9
anchors.verticalCenter: parent.verticalCenter
}
Item {
anchors.left: icon.right
anchors.leftMargin: 12
anchors.verticalCenter: icon.verticalCenter
implicitWidth: parent.width - icon.width
implicitHeight: name.implicitHeight + comment.implicitHeight
CustomText {
id: name
text: root.modelData?.name ?? ""
font.pointSize: Config.font.size.normal
color: root.ListView.isCurrentItem ? Color.mute(Config.colors.launcherApps) : Config.colors.primary
Behavior on color {
CAnim {}
}
}
CustomText {
id: comment
text: (root.modelData?.comment || root.modelData?.genericName || root.modelData?.name) ?? ""
font.pointSize: Config.font.size.small
color: Config.colors.tertiary
elide: Text.ElideRight
width: root.width - icon.width - 34
anchors.top: name.bottom
}
}
}
}

View file

@ -0,0 +1,86 @@
pragma Singleton
import ".."
import qs.config
import qs.services
import qs.util
import Quickshell
import QtQuick
Searcher {
id: root
readonly property list<Action> actions: [
Action {
name: qsTr("Shutdown")
desc: qsTr("Shutdown the system")
icon: "power_settings_new"
function onClicked(uiState: PersistentProperties): void {
Quickshell.execDetached(Config.session.shutdown);
}
},
Action {
name: qsTr("Reboot")
desc: qsTr("Reboot the system")
icon: "cached"
function onClicked(uiState: PersistentProperties): void {
Quickshell.execDetached(Config.session.reboot);
}
},
Action {
name: qsTr("Logout")
desc: qsTr("Log out of the session and go back to the startup screen")
icon: "logout"
function onClicked(uiState: PersistentProperties): void {
Quickshell.execDetached(Config.session.logout);
}
},
Action {
name: qsTr("Lock")
desc: qsTr("Activate the lock screen (hyprlock)")
icon: "lock"
function onClicked(uiState: PersistentProperties): void {
Quickshell.execDetached(Config.session.lock);
}
},
Action {
name: qsTr("Suspend")
desc: qsTr("Suspend the system")
icon: "bedtime"
function onClicked(uiState: PersistentProperties): void {
Quickshell.execDetached(Config.session.suspend);
}
},
Action {
name: qsTr("Hibernate")
desc: qsTr("Suspend, then hibernate the system")
icon: "downloading"
function onClicked(uiState: PersistentProperties): void {
Quickshell.execDetached(Config.session.hibernate);
}
}
]
function transformSearch(search: string): string {
return search.slice(Config.launcher.actionPrefix.length);
}
list: actions.filter(a => !a.disabled)
useFuzzy: true
component Action: QtObject {
required property string name
required property string desc
required property string icon
property bool disabled
function onClicked(uiState: PersistentProperties): void {
}
}
}

View file

@ -0,0 +1,86 @@
pragma Singleton
import qs.config
import qs.util
import Quickshell
import QtQuick
Searcher {
id: root
function launch(entry: DesktopEntry): void {
if (entry.runInTerminal)
Quickshell.execDetached({
command: [...Config.terminalCommand, ...entry.command],
workingDirectory: entry.workingDirectory
});
else
Quickshell.execDetached({
command: entry.command,
workingDirectory: entry.workingDirectory
});
}
function search(search: string): list<var> {
const prefix = Config.launcher.specialPrefix;
if (search.startsWith(`${prefix}i `)) {
keys = ["id", "name"];
weights = [0.9, 0.1];
} else if (search.startsWith(`${prefix}c `)) {
keys = ["categories", "name"];
weights = [0.9, 0.1];
} else if (search.startsWith(`${prefix}d `)) {
keys = ["desc", "name"];
weights = [0.9, 0.1];
} else if (search.startsWith(`${prefix}e `)) {
keys = ["execString", "name"];
weights = [0.9, 0.1];
} else if (search.startsWith(`${prefix}w `)) {
keys = ["wmClass", "name"];
weights = [0.9, 0.1];
} else if (search.startsWith(`${prefix}g `)) {
keys = ["genericName", "name"];
weights = [0.9, 0.1];
} else if (search.startsWith(`${prefix}k `)) {
keys = ["keywords", "name"];
weights = [0.9, 0.1];
} else {
keys = ["name"];
weights = [1];
if (!search.startsWith(`${prefix}t `))
return query(search).map(e => e.modelData);
}
const results = query(search.slice(prefix.length + 2)).map(e => e.modelData);
if (search.startsWith(`${prefix}t `))
return results.filter(a => a.runInTerminal);
return results;
}
function selector(item: var): string {
return keys.map(k => item[k]).join(" ");
}
list: variants.instances
useFuzzy: true
Variants {
id: variants
model: [...DesktopEntries.applications.values].sort((a, b) => a.name.localeCompare(b.name))
QtObject {
required property DesktopEntry modelData
readonly property string id: modelData.id
readonly property string name: modelData.name
readonly property string desc: modelData.comment
readonly property string execString: modelData.execString
readonly property string wmClass: modelData.startupClass
readonly property string genericName: modelData.genericName
readonly property string categories: modelData.categories.join(" ")
readonly property string keywords: modelData.keywords.join(" ")
}
}
}

View file

@ -0,0 +1,61 @@
import qs.config
import qs.custom
import qs.services
import Quickshell
import QtQuick
import QtQuick.Shapes
Shape {
id: root
required property Item wrapper
readonly property real rounding: Config.border.rounding
readonly property bool flatten: wrapper.height < rounding * 2
readonly property real roundingY: flatten ? wrapper.height / 2 : rounding
property real fullHeightRounding: wrapper.height >= QsWindow.window?.height - Config.border.thickness * 2 ? -rounding : rounding
ShapePath {
startX: root.wrapper.width + 0.5
startY: root.wrapper.height + 0.5
strokeWidth: -1
fillColor: Config.colors.bg
PathLine {
relativeX: -(root.wrapper.width + root.rounding)
relativeY: 0
}
PathArc {
relativeX: root.rounding
relativeY: -root.roundingY
radiusX: root.rounding
radiusY: Math.min(root.rounding, root.wrapper.height)
direction: PathArc.Counterclockwise
}
PathLine {
relativeX: 0
relativeY: -root.wrapper.height + root.roundingY * 2
}
PathArc {
relativeX: root.fullHeightRounding
relativeY: -root.roundingY
radiusX: Math.abs(root.fullHeightRounding)
radiusY: Math.min(root.rounding, root.wrapper.height)
direction: root.fullHeightRounding < 0 ? PathArc.Counterclockwise : PathArc.Clockwise
}
PathLine {
relativeX: root.wrapper.height > 0 ? root.wrapper.width - root.rounding - root.fullHeightRounding : root.wrapper.width
relativeY: 0
}
PathArc {
relativeX: root.rounding
relativeY: -root.rounding
radiusX: root.rounding
radiusY: root.rounding
direction: PathArc.Counterclockwise
}
}
Behavior on fullHeightRounding {
Anim {}
}
}

View file

@ -0,0 +1,195 @@
import qs.config
import qs.custom
import qs.services
import Quickshell
import Quickshell.Widgets
import QtQuick
Item {
id: root
required property PersistentProperties uiState
required property Item panels
readonly property int padding: 15
readonly property var monitor: Hypr.monitorFor(QsWindow.window.screen)
readonly property var notifs: Notifs.list.filter(n => n.popup === monitor)
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
implicitWidth: implicitHeight > 0 ? Config.notifs.width + padding * 2 : 0
implicitHeight: {
const count = list.count;
if (count === 0)
return 0;
let height = (count - 1) * 10 + padding * 2;
for (let i = 0; i < count; i++)
height += list.itemAtIndex(i)?.nonAnimHeight ?? 0;
if (uiState.osd) {
const h = panels.osd.y - Config.border.rounding * 2;
if (height > h)
height = h;
}
return Math.min((QsWindow.window?.screen?.height ?? 0) - Config.bar.height - Config.border.thickness - padding, height);
}
ClippingWrapperRectangle {
anchors.fill: parent
anchors.margins: root.padding
color: "transparent"
radius: 17
CustomListView {
id: list
model: ScriptModel {
values: root.notifs
}
anchors.fill: parent
orientation: Qt.Vertical
spacing: 0
cacheBuffer: QsWindow.window?.screen.height ?? 0
delegate: Item {
id: wrapper
required property Notifs.Notif modelData
required property int index
readonly property alias nonAnimHeight: notif.nonAnimHeight
property int idx
onIndexChanged: {
if (index !== -1)
idx = index;
}
implicitWidth: notif.implicitWidth
implicitHeight: notif.implicitHeight + (idx === 0 ? 0 : 10)
ListView.onRemove: removeAnim.start()
SequentialAnimation {
id: removeAnim
PropertyAction {
target: wrapper
property: "ListView.delayRemove"
value: true
}
PropertyAction {
target: wrapper
property: "enabled"
value: false
}
PropertyAction {
target: wrapper
property: "implicitHeight"
value: 0
}
PropertyAction {
target: wrapper
property: "z"
value: 1
}
Anim {
target: notif
property: "x"
to: (notif.x >= 0 ? Config.notifs.width : -Config.notifs.width) * 2
easing.bezierCurve: Config.anim.curves.emphasized
}
PropertyAction {
target: wrapper
property: "ListView.delayRemove"
value: false
}
}
ClippingRectangle {
anchors.top: parent.top
anchors.topMargin: wrapper.idx === 0 ? 0 : 10
color: "transparent"
radius: notif.radius
implicitWidth: notif.implicitWidth
implicitHeight: notif.implicitHeight
Notification {
id: notif
notif: wrapper.modelData
}
}
}
move: Transition {
NotifAnim {
property: "y"
}
}
displaced: Transition {
NotifAnim {
property: "y"
}
}
ExtraIndicator {
anchors.top: parent.top
extra: {
const count = list.count;
if (count === 0)
return 0;
const scrollY = list.contentY;
let height = 0;
for (let i = 0; i < count; i++) {
height += (list.itemAtIndex(i)?.nonAnimHeight ?? 0) + 10;
if (height - 10 >= scrollY)
return i;
}
return count;
}
}
ExtraIndicator {
anchors.bottom: parent.bottom
extra: {
const count = list.count;
if (count === 0)
return 0;
const scrollY = list.contentHeight - (list.contentY + list.height);
let height = 0;
for (let i = count - 1; i >= 0; i--) {
height += (list.itemAtIndex(i)?.nonAnimHeight ?? 0) + 10;
if (height - 10 >= scrollY)
return count - i - 1;
}
return 0;
}
}
}
}
Behavior on implicitHeight {
NotifAnim {}
}
component NotifAnim: Anim {
duration: Config.anim.durations.expressiveDefaultSpatial
easing.bezierCurve: Config.anim.curves.expressiveDefaultSpatial
}
}

View file

@ -0,0 +1,599 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import qs.services
import qs.util
import Quickshell
import Quickshell.Widgets
import Quickshell.Services.Notifications
import QtQuick
import QtQuick.Layouts
import QtQuick.Shapes
CustomRect {
id: root
required property Notifs.Notif notif
readonly property bool hasImage: notif.image.length > 0
readonly property bool hasAppIcon: notif.appIcon.length > 0
readonly property int nonAnimHeight: inner.nonAnimHeight + inner.anchors.margins * 2
property bool inPopup: true
property bool expanded: false
color: root.notif.urgency === NotificationUrgency.Critical ? Config.colors.errorBg : Config.colors.container
radius: 12
implicitWidth: Config.notifs.width
implicitHeight: inner.implicitHeight + inner.anchors.margins * 2
onExpandedChanged: {
if (root.inPopup && expanded)
root.notif.timer.stop();
}
x: inPopup ? Config.notifs.width : 0
Component.onCompleted: x = 0
Behavior on x {
Anim {
easing.bezierCurve: Config.anim.curves.emphasizedDecel
}
}
RetainableLock {
object: root.notif.notification
locked: true
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: root.expanded && body.hoveredLink ? Qt.PointingHandCursor : pressed ? Qt.ClosedHandCursor : undefined
acceptedButtons: Qt.AllButtons
preventStealing: true
onEntered: {
if (root.inPopup)
root.notif.timer.stop();
}
onExited: {
if (root.inPopup && !pressed && !root.expanded)
root.notif.timer.start();
}
drag.target: parent
drag.axis: Drag.XAxis
onPressed: event => {
if (event.button === Qt.MiddleButton)
root.notif.notification.dismiss();
}
onReleased: event => {
if (root.inPopup && !containsMouse && !root.expanded)
root.notif.timer.start();
if (Math.abs(root.x) < Config.notifs.width * Config.notifs.clearThreshold)
root.x = 0;
else if (root.inPopup)
root.notif.popup = null;
else
root.notif.notification.dismiss();
}
onClicked: event => {
if (event.button === Qt.LeftButton) {
const actions = root.notif.actions;
if (actions?.length === 1)
actions[0].invoke();
else
root.expanded = !root.expanded;
} else if (event.button === Qt.RightButton) {
root.expanded = !root.expanded;
}
}
Item {
id: inner
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 8
readonly property real nonAnimHeight: root.expanded ? summary.height + appName.height + body.height + actions.height + 16
: Config.notifs.imageSize
implicitHeight: nonAnimHeight
Behavior on implicitHeight {
Anim {
duration: Config.anim.durations.expressiveDefaultSpatial
easing.bezierCurve: Config.anim.curves.expressiveDefaultSpatial
}
}
Loader {
id: image
active: root.hasImage
asynchronous: true
anchors.left: parent.left
anchors.top: parent.top
width: Config.notifs.imageSize
height: Config.notifs.imageSize
visible: root.hasImage || root.hasAppIcon
sourceComponent: ClippingRectangle {
radius: 1000
implicitWidth: Config.notifs.imageSize
implicitHeight: Config.notifs.imageSize
Image {
anchors.fill: parent
source: Qt.resolvedUrl(root.notif.image)
fillMode: Image.PreserveAspectCrop
cache: false
asynchronous: true
}
}
}
Loader {
id: appIcon
active: root.hasAppIcon || !root.hasImage
asynchronous: true
anchors.horizontalCenter: root.hasImage ? undefined : image.horizontalCenter
anchors.verticalCenter: root.hasImage ? undefined : image.verticalCenter
anchors.right: root.hasImage ? image.right : undefined
anchors.bottom: root.hasImage ? image.bottom : undefined
sourceComponent: CustomRect {
radius: 1000
color: root.notif.urgency === NotificationUrgency.Critical ? Config.colors.error
: root.notif.urgency === NotificationUrgency.Low ? Config.colors.inactive
: Config.colors.notification
implicitWidth: root.hasImage ? Config.notifs.badgeSize : Config.notifs.imageSize
implicitHeight: root.hasImage ? Config.notifs.badgeSize : Config.notifs.imageSize
Loader {
id: icon
active: root.hasAppIcon
asynchronous: true
anchors.centerIn: parent
width: Math.round(parent.width * 0.6)
height: Math.round(parent.width * 0.6)
sourceComponent: IconImage {
anchors.fill: parent
source: Quickshell.iconPath(root.notif.appIcon)
asynchronous: true
}
}
Loader {
active: !root.hasAppIcon
asynchronous: true
anchors.centerIn: parent
sourceComponent: MaterialIcon {
text: Icons.getNotifIcon(root.notif.summary, root.notif.urgency)
color: root.notif.urgency === NotificationUrgency.Low ? Config.colors.primary
: Config.colors.primaryDark
font.pointSize: Config.font.size.larger
}
}
}
}
CustomText {
id: appName
anchors.top: parent.top
anchors.left: image.right
anchors.leftMargin: 10
animate: true
text: appNameMetrics.elidedText
maximumLineCount: 1
color: root.notif.urgency === NotificationUrgency.Critical ? Config.colors.primary : Config.colors.tertiary
font.pointSize: Config.font.size.small
opacity: root.expanded ? 1 : 0
visible: opacity > 0
Behavior on opacity {
Anim {}
}
}
TextMetrics {
id: appNameMetrics
text: root.notif.appName
font.family: appName.font.family
font.pointSize: appName.font.pointSize
elide: Text.ElideRight
elideWidth: closeBtn.x - timeDetail.width - time.width - timeSep.width - summaryPreview.x - 21
}
CustomText {
id: summaryPreview
anchors.top: parent.top
anchors.left: image.right
anchors.leftMargin: 10
anchors.topMargin: 2
animate: true
text: summaryPreviewMetrics.elidedText
color: root.notif.urgency === NotificationUrgency.Low ? Config.colors.primary : Config.colors.secondary
opacity: root.expanded ? 0 : 1
visible: opacity > 0
states: State {
name: "expanded"
when: root.expanded
AnchorChanges {
target: summaryPreview
anchors.top: appName.bottom
}
}
transitions: Transition {
AnchorAnimation {
duration: Config.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Config.anim.curves.standard
}
}
Behavior on opacity {
Anim {}
}
}
TextMetrics {
id: summaryPreviewMetrics
text: root.notif.summary
font.family: summaryPreview.font.family
font.pointSize: summaryPreview.font.pointSize
elide: Text.ElideRight
elideWidth: closeBtn.x - time.width - timeSep.width - summaryPreview.x - 21
}
CustomText {
id: summary
anchors.top: parent.top
anchors.left: image.right
anchors.right: parent.right
anchors.leftMargin: 10
anchors.topMargin: 5
anchors.rightMargin: 10
animate: true
text: root.notif.summary
color: root.notif.urgency === NotificationUrgency.Low ? Config.colors.primary : Config.colors.secondary
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
states: State {
name: "expanded"
when: root.expanded
AnchorChanges {
target: summary
anchors.top: appName.bottom
}
}
transitions: Transition {
AnchorAnimation {
duration: Config.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Config.anim.curves.standard
}
}
opacity: root.expanded ? 1 : 0
visible: opacity > 0
Behavior on opacity {
Anim {}
}
}
CustomText {
id: timeSep
anchors.top: parent.top
anchors.left: summaryPreview.right
anchors.leftMargin: 7
anchors.topMargin: root.expanded ? 0 : 3
text: "•"
color: root.notif.urgency === NotificationUrgency.Critical ? Config.colors.primary : Config.colors.tertiary
font.pointSize: Config.font.size.small
states: State {
name: "expanded"
when: root.expanded
AnchorChanges {
target: timeSep
anchors.left: appName.right
}
}
transitions: Transition {
AnchorAnimation {
duration: Config.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Config.anim.curves.standard
}
}
}
CustomText {
id: time
anchors.top: parent.top
anchors.left: timeSep.right
anchors.leftMargin: 7
anchors.topMargin: root.expanded ? 0 : 2
animate: true
horizontalAlignment: Text.AlignLeft
text: root.notif.timeSince
color: root.notif.urgency === NotificationUrgency.Critical ? Config.colors.primary : Config.colors.tertiary
font.pointSize: Config.font.size.small
}
CustomText {
id: timeDetail
anchors.verticalCenter: time.verticalCenter
anchors.left: time.right
anchors.leftMargin: 5
horizontalAlignment: Text.AlignLeft
text: `(${root.notif.timeStr})`
color: root.notif.urgency === NotificationUrgency.Critical ? Config.colors.primary : Config.colors.tertiary
font.pointSize: Config.font.size.small
opacity: root.expanded ? 1 : 0
Behavior on opacity {
Anim {}
}
}
StateLayer {
id: closeBtn
anchors.right: expandBtn.left
anchors.top: parent.top
implicitWidth: 20
implicitHeight: 20
function onClicked() {
root.notif.notification.dismiss();
}
MaterialIcon {
id: closeIcon
anchors.centerIn: parent
animate: true
text: "close"
font.pointSize: Config.font.size.normal
}
}
StateLayer {
id: expandBtn
anchors.right: parent.right
anchors.top: parent.top
implicitWidth: 20
implicitHeight: 20
color: root.notif.urgency === NotificationUrgency.Critical ? Config.colors.secondary : Config.colors.primary
radius: 1000
function onClicked() {
root.expanded = !root.expanded
}
MaterialIcon {
id: expandIcon
anchors.centerIn: parent
anchors.verticalCenterOffset: text === "expand_more" ? 1 : 0
animate: true
text: root.expanded ? "expand_less" : "expand_more"
font.pointSize: Config.font.size.normal
}
}
CustomText {
id: bodyPreview
anchors.left: summaryPreview.left
anchors.right: parent.right
anchors.top: summaryPreview.bottom
anchors.topMargin: 3
anchors.rightMargin: 7
animate: true
textFormat: Text.MarkdownText
text: bodyPreviewMetrics.elidedText
color: root.notif.urgency === NotificationUrgency.Low ? Config.colors.tertiary : Config.colors.primary
font.pointSize: Config.font.size.small
opacity: root.expanded ? 0 : 1
visible: opacity > 0
Behavior on opacity {
Anim {}
}
}
TextMetrics {
id: bodyPreviewMetrics
text: root.notif.bodyOneLine
font.family: bodyPreview.font.family
font.pointSize: bodyPreview.font.pointSize
elide: Text.ElideRight
elideWidth: bodyPreview.width
}
CustomText {
id: body
anchors.left: summary.left
anchors.right: parent.right
anchors.top: summary.bottom
anchors.rightMargin: 7
anchors.topMargin: 3
animate: true
textFormat: Text.MarkdownText
text: root.notif.body
color: root.notif.urgency === NotificationUrgency.Low ? Config.colors.tertiary : Config.colors.primary
font.pointSize: Config.font.size.small
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
height: text ? implicitHeight : 0
onLinkActivated: link => {
if (!root.expanded)
return;
Quickshell.execDetached(["xdg-open", link]);
root.notif.notification.dismiss(); // TODO: change back to popup when notif dock impled
}
opacity: root.expanded ? 1 : 0
visible: opacity > 0
Behavior on opacity {
Anim {}
}
}
RowLayout {
id: actions
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: body.bottom
anchors.topMargin: 10
spacing: 10
opacity: root.expanded ? 1 : 0
Behavior on opacity {
Anim {}
}
Action {
modelData: QtObject {
readonly property string text: qsTr("Close")
function invoke(): void {
root.notif.notification.dismiss();
}
}
}
Repeater {
model: root.notif.actions
delegate: Component {
Action {}
}
}
}
}
}
CustomRect {
id: progressBar
visible: root.inPopup
anchors.bottom: parent.bottom
height: 2
color: root.notif.urgency === NotificationUrgency.Critical ? Config.colors.error : Config.colors.inactive
opacity: root.notif.timer.running ? 1 : 0
NumberAnimation on implicitWidth {
from: root.width
to: 0
duration: Config.notifs.defaultExpireTimeout
running: root.notif.timer.running
}
Behavior on opacity {
Anim { duration: Config.anim.durations.small }
}
}
component Action: CustomRect {
id: action
required property var modelData
radius: 1000
color: root.notif.urgency === NotificationUrgency.Critical ? Config.colors.error : Config.colors.inactive
implicitWidth: actionText.width + 20
implicitHeight: actionText.height + 10
Layout.preferredWidth: implicitWidth
Layout.preferredHeight: implicitHeight
StateLayer {
anchors.fill: parent
radius: 1000
color: root.notif.urgency === NotificationUrgency.Critical ? "#ffffff" : Config.colors.primary
function onClicked(): void {
action.modelData.invoke();
}
}
CustomText {
id: actionText
anchors.centerIn: parent
text: actionTextMetrics.elidedText
color: root.notif.urgency === NotificationUrgency.Critical ? Config.colors.primaryDark
: root.notif.urgency === NotificationUrgency.Low ? Config.colors.primary : Config.colors.secondary
font.pointSize: Config.font.size.small
}
TextMetrics {
id: actionTextMetrics
text: action.modelData.text
font.family: actionText.font.family
font.pointSize: actionText.font.pointSize
elide: Text.ElideRight
elideWidth: {
const numActions = root.notif.actions.length + 1;
return (inner.width - actions.spacing * (numActions - 1)) / numActions - 20;
}
}
}
}

View file

@ -0,0 +1,34 @@
import qs.config
import qs.custom
import Quickshell
import Quickshell.Services.Notifications
import QtQuick
Item {
id: root
required property PersistentProperties uiState
required property Item panels
implicitHeight: content.implicitHeight
implicitWidth: content.implicitWidth
Background {
id: background
visible: false
wrapper: root
}
GlowEffect {
source: background
glowColor: content.notifs.find(n => n.urgency === NotificationUrgency.Critical) ?
Config.colors.error : Config.colors.notification
}
Content {
id: content
uiState: root.uiState
panels: root.panels
}
}

View file

@ -0,0 +1,59 @@
import qs.config
import qs.services
import QtQuick
import QtQuick.Shapes
Shape {
id: root
required property Item wrapper
readonly property real rounding: Config.border.rounding
readonly property bool flatten: wrapper.width < rounding * 2
readonly property real roundingX: flatten ? wrapper.width / 2 : rounding
ShapePath {
startX: root.wrapper.width + 0.5
startY: -root.rounding
strokeWidth: -1
fillColor: Config.colors.bg
PathArc {
relativeX: -root.roundingX
relativeY: root.rounding
radiusX: Math.min(root.rounding, root.wrapper.width)
radiusY: root.rounding
}
PathLine {
relativeX: -(root.wrapper.width - root.roundingX * 2)
relativeY: 0
}
PathArc {
relativeX: -root.roundingX
relativeY: root.rounding
radiusX: Math.min(root.rounding, root.wrapper.width)
radiusY: root.rounding
direction: PathArc.Counterclockwise
}
PathLine {
relativeX: 0
relativeY: root.wrapper.height - root.rounding * 2
}
PathArc {
relativeX: root.roundingX
relativeY: root.rounding
radiusX: Math.min(root.rounding, root.wrapper.width)
radiusY: root.rounding
direction: PathArc.Counterclockwise
}
PathLine {
relativeX: root.wrapper.width - root.roundingX * 2
relativeY: 0
}
PathArc {
relativeX: root.roundingX
relativeY: root.rounding
radiusX: Math.min(root.rounding, root.wrapper.width)
radiusY: root.rounding
}
}
}

161
modules/osd/Content.qml Normal file
View file

@ -0,0 +1,161 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import qs.services
import qs.util
import QtQuick
import QtQuick.Layouts
Item {
id: root
required property var uiState
required property Brightness.Monitor monitor
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
implicitWidth: layout.implicitWidth + 30
implicitHeight: layout.implicitHeight + sunset.height + 40
RowLayout {
id: layout
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 15
spacing: 10
// Speaker volume
CustomMouseArea {
implicitWidth: Config.osd.sliderWidth
implicitHeight: Config.osd.sliderLength
function onWheel(event: WheelEvent) {
if (event.angleDelta.y > 0)
Audio.increaseVolume();
else if (event.angleDelta.y < 0)
Audio.decreaseVolume();
}
acceptedButtons: Qt.RightButton
onClicked: Audio.sink.audio.muted = !Audio.muted
CustomFilledSlider {
anchors.fill: parent
color: Audio.muted ? Config.colors.error : Config.colors.volume
icon: Icons.getVolumeIcon(value, Audio.muted)
value: Audio.volume
onMoved: Audio.setVolume(value)
Behavior on color {
CAnim {
duration: Config.anim.durations.small
}
}
}
}
// Microphone
CustomMouseArea {
implicitWidth: Config.osd.sliderWidth
implicitHeight: Config.osd.sliderLength
function onWheel(event: WheelEvent) {
if (event.angleDelta.y > 0)
Audio.incrementSourceVolume();
else if (event.angleDelta.y < 0)
Audio.decrementSourceVolume();
}
acceptedButtons: Qt.RightButton
onClicked: Audio.source.audio.muted = !Audio.sourceMuted
CustomFilledSlider {
anchors.fill: parent
color: Audio.sourceMuted ? Config.colors.error : Config.colors.mic
icon: Icons.getMicVolumeIcon(value, Audio.sourceMuted)
value: Audio.sourceVolume
onMoved: Audio.setSourceVolume(value)
Behavior on color {
CAnim {
duration: Config.anim.durations.small
}
}
}
}
// Brightness
CustomMouseArea {
implicitWidth: Config.osd.sliderWidth
implicitHeight: Config.osd.sliderLength
function onWheel(event: WheelEvent) {
const monitor = root.monitor;
if (!monitor)
return;
if (event.angleDelta.y > 0)
monitor.setBrightness(monitor.brightness + 0.1);
else if (event.angleDelta.y < 0)
monitor.setBrightness(monitor.brightness - 0.1);
}
CustomFilledSlider {
anchors.fill: parent
color: Config.colors.brightness
icon: Icons.getBrightnessIcon(value)
value: root.monitor?.brightness ?? 0
onMoved: root.monitor?.setBrightness(value)
}
}
}
CustomRect {
id: sunset
anchors.top: layout.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 10
width: layout.width
height: 40
color: Hyprsunset.active ? Config.colors.brightness : Config.colors.container
radius: 7
Behavior on color {
CAnim { duration: Config.anim.durations.small }
}
StateLayer {
anchors.fill: parent
radius: parent.radius
color: Config.colors.secondary
function onClicked() {
if (Hyprsunset.active)
Hyprsunset.disable();
else
Hyprsunset.enable();
}
}
MaterialIcon {
anchors.centerIn: parent
text: "dark_mode"
font.pointSize: Config.font.size.large
color: Hyprsunset.active ? Config.colors.primaryDark : Config.colors.secondary
fill: Hyprsunset.active ? 1 : 0
Behavior on color {
CAnim { duration: Config.anim.durations.small }
}
}
}
}

View file

@ -0,0 +1,54 @@
import qs.services
import qs.config
import Quickshell
import QtQuick
Scope {
id: root
required property PersistentProperties uiState
required property ShellScreen screen
required property bool hovered
required property bool suppressed
readonly property Brightness.Monitor monitor: Brightness.getMonitorForScreen(screen)
function show(): void {
if (!root.suppressed) {
root.uiState.osd = true;
timer.restart();
}
}
Connections {
target: Audio
function onMutedChanged(): void {
if (root.uiState.osdVolumeReact)
root.show();
}
function onVolumeChanged(): void {
if (root.uiState.osdVolumeReact)
root.show();
}
}
Connections {
target: root.monitor
function onBrightnessChanged(): void {
if (root.uiState.osdBrightnessReact)
root.show();
}
}
Timer {
id: timer
interval: Config.osd.hideDelay
onTriggered: {
if (!root.hovered)
root.uiState.osd = false;
}
}
}

66
modules/osd/Wrapper.qml Normal file
View file

@ -0,0 +1,66 @@
import qs.config
import qs.custom
import qs.services
import Quickshell
import QtQuick
Item {
id: root
required property var uiState
required property ShellScreen screen
visible: width > 0
implicitWidth: 0
implicitHeight: content.implicitHeight
states: State {
name: "visible"
when: root.uiState.osd
PropertyChanges {
root.implicitWidth: content.implicitWidth
}
}
transitions: [
Transition {
from: ""
to: "visible"
Anim {
target: root
property: "implicitWidth"
easing.bezierCurve: Config.anim.curves.expressiveDefaultSpatial
}
},
Transition {
from: "visible"
to: ""
Anim {
target: root
property: "implicitWidth"
easing.bezierCurve: Config.anim.curves.emphasized
}
}
]
Background {
id: background
visible: false
wrapper: root
}
GlowEffect {
source: background
glowColor: Config.colors.osd
}
Content {
id: content
uiState: root.uiState
monitor: Brightness.getMonitorForScreen(root.screen)
}
}

View file

@ -0,0 +1,51 @@
import qs.config
import QtQuick
import QtQuick.Shapes
Shape {
id: root
required property Item wrapper
readonly property real rounding: Config.border.rounding
readonly property bool flatten: wrapper.height < rounding * 2
readonly property real roundingY: flatten ? wrapper.height / 2 : rounding
ShapePath {
startX: -root.rounding + 0.5
startY: -0.5
strokeWidth: -1
fillColor: Config.colors.bg
PathArc {
relativeX: root.rounding
relativeY: root.roundingY
radiusX: root.rounding
radiusY: Math.min(root.rounding, root.wrapper.height)
}
PathLine {
relativeX: 0
relativeY: root.wrapper.height - root.roundingY * 2
}
PathArc {
relativeX: root.rounding
relativeY: root.roundingY
radiusX: root.rounding
radiusY: Math.min(root.rounding, root.wrapper.height)
direction: PathArc.Counterclockwise
}
PathLine {
relativeX: root.wrapper.width - root.rounding * 2
relativeY: 0
}
PathArc {
relativeX: root.rounding
relativeY: root.rounding
radiusX: root.rounding
radiusY: root.rounding
}
PathLine {
relativeX: 0
relativeY: -root.wrapper.height - root.rounding
}
}
}

131
modules/session/Content.qml Normal file
View file

@ -0,0 +1,131 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import qs.services
import qs.util
import Quickshell
import QtQuick
Row {
id: root
required property PersistentProperties uiState
padding: 12
spacing: 12
SessionButton {
id: sleep
icon: "bedtime"
iconColor: Config.colors.violet
command: Config.session.sleep
KeyNavigation.right: lock
Component.onCompleted: forceActiveFocus()
}
SessionButton {
id: lock
icon: "lock"
iconColor: Config.colors.brown
command: Config.session.lock
KeyNavigation.left: sleep
KeyNavigation.right: logout
}
SessionButton {
id: logout
icon: "logout"
iconColor: Config.colors.cyan
command: Config.session.logout
KeyNavigation.left: lock
KeyNavigation.right: reboot
}
SessionButton {
id: reboot
icon: "cached"
iconColor: Config.colors.yellow
command: Config.session.reboot
KeyNavigation.left: logout
KeyNavigation.right: shutdown
}
SessionButton {
id: shutdown
icon: "power_settings_new"
iconColor: Config.colors.red
command: Config.session.shutdown
KeyNavigation.left: reboot
}
component SessionButton: CustomRect {
id: button
required property string icon
required property color iconColor
required property list<string> command
implicitWidth: Config.session.buttonSize
implicitHeight: Config.session.buttonSize
radius: 22
color: button.activeFocus ? Config.colors.containerAlt : Config.colors.container
Behavior on color {
CAnim {}
}
Keys.onEnterPressed: layer.onClicked()
Keys.onReturnPressed: layer.onClicked()
Keys.onPressed: event => {
if (event.modifiers & Qt.ControlModifier) {
if (event.key === Qt.Key_L && KeyNavigation.right) {
KeyNavigation.right.focus = true;
event.accepted = true;
} else if (event.key === Qt.Key_H && KeyNavigation.left) {
KeyNavigation.left.focus = true;
event.accepted = true;
}
} else if (event.key === Qt.Key_Tab && KeyNavigation.right) {
KeyNavigation.right.focus = true;
event.accepted = true;
} else if (event.key === Qt.Key_Backtab || (event.key === Qt.Key_Tab && (event.modifiers & Qt.ShiftModifier))) {
if (KeyNavigation.left) {
KeyNavigation.left.focus = true;
event.accepted = true;
}
}
}
StateLayer {
id: layer
anchors.fill: parent
radius: parent.radius
function onClicked(): void {
root.uiState.session = false;
Quickshell.execDetached(button.command);
}
}
MaterialIcon {
anchors.centerIn: parent
text: button.icon
color: button.iconColor
font.pointSize: Config.font.size.largest
font.weight: 500
}
}
}

View file

@ -0,0 +1,80 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import Quickshell
import QtQuick
Item {
id: root
required property PersistentProperties uiState
required property var panels
readonly property real nonAnimHeight: content.implicitHeight
visible: height > 0
implicitWidth: content.implicitWidth
implicitHeight: 0
states: State {
name: "visible"
when: root.uiState.session
PropertyChanges {
root.implicitHeight: root.nonAnimHeight
}
}
transitions: [
Transition {
from: ""
to: "visible"
Anim {
target: root
property: "implicitHeight"
easing.bezierCurve: Config.anim.curves.expressiveDefaultSpatial
}
},
Transition {
from: "visible"
to: ""
Anim {
target: root
property: "implicitHeight"
easing.bezierCurve: Config.anim.curves.expressiveDefaultSpatial
}
}
]
Binding {
target: root.uiState
property: "blockScreen"
value: true
when: root.uiState.session
}
Background {
id: background
visible: false
wrapper: root
}
GlowEffect {
source: background
glowColor: Config.colors.power
}
Loader {
id: content
anchors.bottom: parent.bottom
Component.onCompleted: active = Qt.binding(() => root.uiState.session || root.visible)
sourceComponent: Content {
uiState: root.uiState
}
}
}

45
modules/ui/Border.qml Normal file
View file

@ -0,0 +1,45 @@
import QtQuick
import QtQuick.Effects
import Quickshell
import qs.config
import qs.custom
Item {
id: root
anchors.fill: parent
CustomRect {
id: rect
anchors.fill: parent
color: Config.colors.bg
visible: false
}
Item {
id: mask
anchors.fill: parent
layer.enabled: true
visible: false
Rectangle {
anchors.fill: parent
anchors.margins: Config.border.thickness
anchors.topMargin: Config.bar.height
radius: Config.border.rounding
}
}
MultiEffect {
anchors.fill: parent
maskEnabled: true
maskInverted: true
maskSource: mask
source: rect
maskThresholdMin: 0.5
maskSpreadAtMin: 1
}
}

36
modules/ui/Exclusion.qml Normal file
View file

@ -0,0 +1,36 @@
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import Quickshell
import QtQuick
Scope {
id: root
required property ShellScreen screen
ExclusionZone {
anchors.left: true
}
ExclusionZone {
anchors.top: true
exclusiveZone: Config.bar.height
}
ExclusionZone {
anchors.right: true
}
ExclusionZone {
anchors.bottom: true
}
component ExclusionZone: CustomWindow {
screen: root.screen
name: "border-exclusion"
exclusiveZone: Config.border.thickness
mask: Region {}
}
}

163
modules/ui/Interactions.qml Normal file
View file

@ -0,0 +1,163 @@
import qs.config
import qs.custom
import qs.services
import qs.modules.bar.popouts as BarPopouts
import qs.modules.osd as Osd
import Quickshell
import QtQuick
CustomMouseArea {
id: root
required property ShellScreen screen
required property PersistentProperties uiState
required property Panels panels
required property Item bar
readonly property BarPopouts.Wrapper popouts: panels.popouts
property bool osdHovered
property bool osdShortcutActive
property bool dashboardShortcutActive
anchors.fill: parent
hoverEnabled: true
function withinPanelWidth(panel: Item, x: real): bool {
const panelX = panel.x;
return x >= panelX - Config.border.rounding && x <= panelX + panel.width + Config.border.rounding;
}
function withinPanelHeight(panel: Item, y: real): bool {
const panelY = panel.y;
return y >= panelY + Config.bar.height - Config.border.rounding
&& y <= panelY + panel.height + Config.bar.height + Config.border.rounding;
}
function inBottomPanel(panel: Item, x: real, y: real): bool {
return y > root.height - Config.border.thickness - panel.height - Config.border.rounding && withinPanelWidth(panel, x);
}
function inLeftPanel(panel: Item, x: real, y: real): bool {
return x < Config.border.thickness + panel.x + panel.width && withinPanelHeight(panel, y);
}
function inRightPanel(panel: Item, x: real, y: real): bool {
return x > Config.border.thickness + panel.x && withinPanelHeight(panel, y);
}
// Handling Mouse Input
property point dragStart
onPressed: event => dragStart = Qt.point(event.x, event.y)
onPositionChanged: event => {
const x = event.x;
const y = event.y;
// Show bar popouts on hover
if (y < Config.bar.height && !popoutsSuppressed && !popouts.persistent) {
bar.checkPopout(x);
}
// Show osd on hover
const showOsd = inRightPanel(panels.osd, x, y);
// Always update visibility based on hover if not in shortcut mode
if (!osdShortcutActive) {
uiState.osd = showOsd && !osdSuppressed;
osdHovered = showOsd && !osdSuppressed;
} else if (showOsd) {
// If hovering over OSD area while in shortcut mode, transition to hover control
osdShortcutActive = false;
osdHovered = true;
}
// Show dashboard on hover
const showDashboard = !dashboardSuppressed && inLeftPanel(panels.dashboard, x, y);
// Always update visibility based on hover if not in shortcut mode
if (!dashboardShortcutActive) {
uiState.dashboard = showDashboard;
} else if (showDashboard) {
// If hovering over dashboard area while in shortcut mode, transition to hover control
dashboardShortcutActive = false;
}
// Show launcher on drag
if (pressed && inBottomPanel(panels.launcher, dragStart.x, dragStart.y) && withinPanelWidth(panels.launcher, x, y)) {
const dragY = y - dragStart.y;
if (dragY < -Config.launcher.dragThreshold && !launcherSuppressed)
uiState.launcher = true;
else if (dragY > Config.launcher.dragThreshold)
uiState.launcher = false;
}
}
Connections {
target: root.uiState
function onOsdChanged() {
if (root.uiState.osd) {
// OSD became visible, immediately check if this should be shortcut mode
const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY);
if (!inOsdArea) {
root.osdShortcutActive = true;
}
} else {
// OSD hidden, clear shortcut flag
root.osdShortcutActive = false;
}
}
}
Osd.Interactions {
uiState: root.uiState
screen: root.screen
hovered: root.osdHovered
suppressed: root.osdSuppressed
}
onContainsMouseChanged: {
if (!containsMouse) {
if (!popouts.persistent)
popouts.hasCurrent = false;
if(!osdShortcutActive) {
uiState.osd = false;
osdHovered = false;
}
if (!dashboardShortcutActive)
uiState.dashboard = false;
}
}
// Suppressing Panels
property bool popoutsSuppressed: uiState.dashboard || uiState.session
property bool dashboardSuppressed: uiState.launcher
property bool launcherSuppressed: uiState.dashboard
property bool osdSuppressed: popouts.hasCurrent
onPopoutsSuppressedChanged: {
if (popoutsSuppressed && popouts.hasCurrent) {
popouts.hasCurrent = false;
}
}
onDashboardSuppressed: {
if (dashboardSuppressed && uiState.dashboard) {
uiState.dashboard = false;
}
}
onLauncherSuppressedChanged: {
if (launcherSuppressed && uiState.launcher) {
uiState.launcher = false;
}
}
onOsdSuppressedChanged: {
if (osdSuppressed && uiState.osd) {
uiState.osd = false;
}
}
}

86
modules/ui/Panels.qml Normal file
View file

@ -0,0 +1,86 @@
import qs.config
import qs.services
import qs.modules.bar.popouts as BarPopouts
import qs.modules.osd as Osd
import qs.modules.notifications as Notifications
import qs.modules.dashboard as Dashboard
import qs.modules.launcher as Launcher
import qs.modules.session as Session
import Quickshell
import QtQuick
Item {
id: root
required property PersistentProperties uiState
required property ShellScreen screen
required property Item bar
readonly property alias popouts: popouts
readonly property alias osd: osd
readonly property alias notifications: notifications
readonly property alias dashboard: dashboard
readonly property alias launcher: launcher
readonly property alias session: session
anchors.fill: parent
anchors.margins: Config.border.thickness
anchors.topMargin: Config.bar.height
BarPopouts.Wrapper {
id: popouts
uiState: root.uiState
screen: root.screen
}
Osd.Wrapper {
id: osd
uiState: root.uiState
screen: root.screen
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
}
Notifications.Wrapper {
id: notifications
uiState: root.uiState
panels: root
anchors.right: parent.right
anchors.bottom: parent.bottom
}
Dashboard.Wrapper {
id: dashboard
uiState: root.uiState
popouts: popouts
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
}
Launcher.Wrapper {
id: launcher
uiState: root.uiState
panels: root
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
}
Session.Wrapper {
id: session
uiState: root.uiState
panels: root
anchors.top: parent.top
anchors.right: parent.right
}
}

122
modules/ui/UI.qml Normal file
View file

@ -0,0 +1,122 @@
import qs.config
import qs.custom
import qs.modules.bar
import QtQuick
import Quickshell
import Quickshell.Wayland
Variants {
model: Quickshell.screens
Scope {
id: scope
required property ShellScreen modelData
Exclusion {
screen: scope.modelData
}
CustomWindow {
id: window
name: "ui"
screen: scope.modelData
anchors.top: true
anchors.left: true
anchors.bottom: true
anchors.right: true
// UI State
UIState {
id: uiState
screen: scope.modelData
}
// Exclusion
exclusionMode: ExclusionMode.Ignore
mask: uiState.uiState.blockScreen ? exclusionBlock : exclusion
WlrLayershell.keyboardFocus: uiState.uiState.blockScreen ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
Region {
id: exclusionBlock
intersection: Intersection.Xor
}
Region {
id: exclusion
x: Config.border.thickness
y: Config.bar.height
width: window.width - 2 * Config.border.thickness
height: window.height - Config.bar.height - Config.border.thickness
intersection: Intersection.Xor
regions: regions.instances
}
Variants {
id: regions
model: panels.children
Region {
required property Item modelData
x: modelData.x + Config.border.thickness
y: modelData.y + Config.bar.height
width: modelData.width
height: modelData.height
intersection: Intersection.Subtract
}
}
// Visual Content
CustomRect {
anchors.fill: parent
color: Config.colors.overlay
opacity: uiState.uiState.blockScreen ? 0.5 : 0
visible: opacity > 0
Behavior on opacity {
Anim {}
}
}
GlowEffect {
source: border
blurMax: 25
blurMultiplier: 0
glowColor: Config.colors.highlight
}
Interactions {
uiState: uiState.uiState
bar: bar
panels: panels
screen: scope.modelData
Panels {
id: panels
uiState: uiState.uiState
screen: scope.modelData
bar: bar
}
}
Border {
id: border
}
Bar {
id: bar
uiState: uiState.uiState
screen: scope.modelData
popouts: panels.popouts
}
}
}
}

96
modules/ui/UIState.qml Normal file
View file

@ -0,0 +1,96 @@
import qs.services
import qs.util
import QtQuick
import Quickshell
import Quickshell.Hyprland
Scope {
id: root
required property ShellScreen screen
property alias uiState: uiState
PersistentProperties {
id: uiState
reloadableId: `uiState-${QsWindow.window.screen.name}`
// Open panels
property bool dashboard
property bool launcher
property bool osd
property bool session
property bool blockScreen
// Other state
property ListModel workspaces
property int dashboardTab: 0
property bool osdVolumeReact: true
property bool osdBrightnessReact: true
Component.onCompleted: {
workspaces = listModelComp.createObject(this);
States.load(root.screen, this);
}
}
// Workspace Handling
Component {
id: listModelComp
ListModel {}
}
// Initialize workspace list
Timer {
running: true
interval: Hypr.arbitraryRaceConditionDelay
onTriggered: {
// NOTE: Reinitialize workspace list on reload because persistence doesn't work
uiState.workspaces = listModelComp.createObject(uiState);
Hypr.workspaces.values.forEach(w => {
if (w.monitor === Hypr.monitorFor(root.screen))
uiState.workspaces.append({"workspace": w});
})
}
}
// Remove deleted workspaces
Connections {
target: Hypr.workspaces
function onObjectRemovedPost(workspace, index) {
root.removeWorkspace(workspace);
}
}
// Update workspaces moved between monitors
// (also handles initialized workspaces)
Instantiator {
model: Hypr.workspaces
delegate: Connections {
required property HyprlandWorkspace modelData
target: modelData
function onMonitorChanged() {
if (modelData.monitor === Hypr.monitorFor(root.screen)) {
uiState.workspaces.append({"workspace": modelData});
} else {
root.removeWorkspace(modelData);
}
}
}
}
function removeWorkspace(workspace: HyprlandWorkspace): void {
let i = 0;
while (i < uiState.workspaces.count) {
const w = uiState.workspaces.get(i).workspace;
if (w === workspace) {
uiState.workspaces.remove(i);
} else {
i++;
}
}
}
}

72
package.nix Normal file
View file

@ -0,0 +1,72 @@
{
lib,
stdenv,
quickshell,
makeWrapper,
makeFontsConf,
qt6,
fonts ? [],
hyprland,
ddcutil,
brightnessctl,
networkmanager,
lm_sensors,
hyprsunset
}:
let
pname = "toki-quickshell";
version = "0.1.0";
runtimeDeps = [
hyprland
ddcutil
brightnessctl
networkmanager
lm_sensors
hyprsunset
];
fontconfig = makeFontsConf {
fontDirectories = fonts;
};
in stdenv.mkDerivation {
inherit pname version;
src = ./.;
nativeBuildInputs = [ makeWrapper qt6.wrapQtAppsHook ];
buildInputs = [ quickshell qt6.qtbase ] ++ runtimeDeps;
# Inhibit file watching
prePatch = ''
substituteInPlace shell.qml \
--replace-fail 'ShellRoot {' 'ShellRoot { settings.watchFiles: false'
'';
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mkdir -p $out/share
cp -R . $out/share/${pname}
makeWrapper ${quickshell}/bin/qs $out/bin/${pname} \
--prefix PATH : "${lib.makeBinPath runtimeDeps}" \
--set FONTCONFIG_FILE "${fontconfig}" \
--add-flags "-p $out/share/${pname}"
runHook postInstall
'';
meta = {
description = "My personal desktop shell, made using Quickshell";
homepage = "https://git.tokinanpa.dev/toki/quickshell";
license = lib.licenses.gpl3Only;
mainProgram = pname;
};
}

85
services/Audio.qml Normal file
View file

@ -0,0 +1,85 @@
pragma Singleton
import qs.config
import qs.custom
import Quickshell
import Quickshell.Services.Pipewire
Singleton {
id: root
readonly property PwNode sink: Pipewire.defaultAudioSink
readonly property PwNode source: Pipewire.defaultAudioSource
PwObjectTracker {
objects: [root.sink, root.source]
}
readonly property bool muted: !!sink?.audio?.muted
readonly property real volume: sink?.audio?.volume ?? 0
readonly property bool sourceMuted: !!source?.audio?.muted
readonly property real sourceVolume: source?.audio?.volume ?? 0
function setVolume(newVolume: real, s: PwNode): void {
if (!s) s = sink;
if (s?.ready && s?.audio) {
s.audio.volume = Math.max(0, Math.min(1, newVolume));
}
}
function increaseVolume(amount: real, s: PwNode): void {
setVolume(volume + (amount || Config.osd.volumeIncrement), s);
}
function decreaseVolume(amount: real, s: PwNode): void {
setVolume(volume - (amount || Config.osd.volumeIncrement), s);
}
CustomShortcut {
name: "volumeUp"
description: "Increase volume"
onPressed: root.increaseVolume()
}
CustomShortcut {
name: "volumeDown"
description: "Decrease volume"
onPressed: root.decreaseVolume()
}
CustomShortcut {
name: "mute"
description: "Toggle muting of output (Pipewire default audio sink)"
onPressed: root.sink.audio.muted = !root.muted
}
CustomShortcut {
name: "muteMic"
description: "Toggle muting of input (Pipewire default audio source)"
onPressed: root.source.audio.muted = !root.sourceMuted
}
function setSourceVolume(newVolume: real, s: PwNode): void {
if (!s) s = source;
if (s?.ready && s?.audio) {
s.audio.volume = Math.max(0, Math.min(1, newVolume));
}
}
function incrementSourceVolume(amount: real, s: PwNode): void {
setSourceVolume(sourceVolume + (amount || Config.osd.micIncrement), s);
}
function decrementSourceVolume(amount: real, s: PwNode): void {
setSourceVolume(sourceVolume - (amount || Config.osd.micIncrement), s);
}
function setAudioSink(newSink: PwNode): void {
Pipewire.preferredDefaultAudioSink = newSink;
}
function setAudioSource(newSource: PwNode): void {
Pipewire.preferredDefaultAudioSource = newSource;
}
}

104
services/Bluetooth.qml Normal file
View file

@ -0,0 +1,104 @@
pragma Singleton
import Quickshell
import Quickshell.Io
import QtQuick
Singleton {
id: root
property bool powered
property bool discovering
readonly property list<Device> devices: []
Process {
running: true
command: ["bluetoothctl"]
stdout: SplitParser {
onRead: {
getInfo.running = true;
getDevices.running = true;
}
}
}
Process {
id: getInfo
running: true
command: ["bluetoothctl", "show"]
environment: ({
LANG: "C",
LC_ALL: "C"
})
stdout: StdioCollector {
onStreamFinished: {
root.powered = text.includes("Powered: yes");
root.discovering = text.includes("Discovering: yes");
}
}
}
Process {
id: getDevices
running: true
command: ["fish", "-c", `
for a in (bluetoothctl devices)
if string match -q 'Device *' $a
bluetoothctl info $addr (string split ' ' $a)[2]
echo
end
end`]
environment: ({
LANG: "C",
LC_ALL: "C"
})
stdout: StdioCollector {
onStreamFinished: {
const devices = text.trim().split("\n\n").map(d => ({
name: d.match(/Name: (.*)/)[1],
alias: d.match(/Alias: (.*)/)[1],
address: d.match(/Device ([0-9A-Z:]{17})/)[1],
icon: d.match(/Icon: (.*)/)[1],
connected: d.includes("Connected: yes"),
paired: d.includes("Paired: yes"),
trusted: d.includes("Trusted: yes")
}));
const rDevices = root.devices;
const destroyed = rDevices.filter(rd => !devices.find(d => d.address === rd.address));
for (const device of destroyed)
rDevices.splice(rDevices.indexOf(device), 1).forEach(d => d.destroy());
for (const device of devices) {
const match = rDevices.find(d => d.address === device.address);
if (match) {
match.lastIpcObject = device;
} else {
rDevices.push(deviceComp.createObject(root, {
lastIpcObject: device
}));
}
}
}
}
}
component Device: QtObject {
required property var lastIpcObject
readonly property string name: lastIpcObject.name
readonly property string alias: lastIpcObject.alias
readonly property string address: lastIpcObject.address
readonly property string icon: lastIpcObject.icon
readonly property bool connected: lastIpcObject.connected
readonly property bool paired: lastIpcObject.paired
readonly property bool trusted: lastIpcObject.trusted
}
Component {
id: deviceComp
Device {}
}
}

153
services/Brightness.qml Normal file
View file

@ -0,0 +1,153 @@
pragma Singleton
pragma ComponentBehavior: Bound
import qs.custom
import Quickshell
import Quickshell.Io
import QtQuick
Singleton {
id: root
reloadableId: "brightness"
property list<var> ddcMonitors: []
readonly property list<Monitor> monitors: variants.instances
property bool appleDisplayPresent: false
function getMonitorForScreen(screen: ShellScreen): var {
return monitors.find(m => m.modelData === screen);
}
function increaseBrightness(): void {
const focusedName = Hypr.focusedMonitor.name;
const monitor = monitors.find(m => focusedName === m.modelData.name);
if (monitor)
monitor.setBrightness(monitor.brightness + Config.osd.brightnessIncrement);
}
function decreaseBrightness(): void {
const focusedName = Hypr.focusedMonitor.name;
const monitor = monitors.find(m => focusedName === m.modelData.name);
if (monitor)
monitor.setBrightness(monitor.brightness - Config.osd.brightnessIncrement);
}
onMonitorsChanged: {
ddcMonitors = [];
ddcProc.running = true;
}
Variants {
id: variants
model: Quickshell.screens
Monitor {}
}
Process {
running: true
command: ["sh", "-c", "asdbctl get"] // To avoid warnings if asdbctl is not installed
stdout: StdioCollector {
onStreamFinished: root.appleDisplayPresent = text.trim().length > 0
}
}
Process {
id: ddcProc
command: ["ddcutil", "detect", "--brief"]
stdout: StdioCollector {
onStreamFinished: root.ddcMonitors = text.trim().split("\n\n").filter(d => d.startsWith("Display ")).map(d => ({
model: d.match(/Monitor:.*:(.*):.*/)[1],
busNum: d.match(/I2C bus:[ ]*\/dev\/i2c-([0-9]+)/)[1]
}))
}
}
CustomShortcut {
name: "brightnessUp"
description: "Increase brightness"
onPressed: root.increaseBrightness()
}
CustomShortcut {
name: "brightnessDown"
description: "Decrease brightness"
onPressed: root.decreaseBrightness()
}
component Monitor: QtObject {
id: monitor
required property ShellScreen modelData
readonly property bool isDdc: root.ddcMonitors.some(m => m.model === modelData.model)
readonly property string busNum: root.ddcMonitors.find(m => m.model === modelData.model)?.busNum ?? ""
readonly property bool isAppleDisplay: root.appleDisplayPresent && modelData.model.startsWith("StudioDisplay")
property real brightness
property real queuedBrightness: NaN
readonly property Process initProc: Process {
stdout: StdioCollector {
onStreamFinished: {
if (monitor.isAppleDisplay) {
const val = parseInt(text.trim());
monitor.brightness = val / 101;
} else {
const [, , , cur, max] = text.split(" ");
monitor.brightness = parseInt(cur) / parseInt(max);
}
}
}
}
readonly property Timer timer: Timer {
interval: 500
onTriggered: {
if (!isNaN(monitor.queuedBrightness)) {
monitor.setBrightness(monitor.queuedBrightness);
monitor.queuedBrightness = NaN;
}
}
}
function setBrightness(value: real): void {
value = Math.max(0, Math.min(1, value));
const rounded = Math.round(value * 100);
if (Math.round(brightness * 100) === rounded)
return;
if (isDdc && timer.running) {
queuedBrightness = value;
return;
}
brightness = value;
if (isAppleDisplay)
Quickshell.execDetached(["asdbctl", "set", rounded]);
else if (isDdc)
Quickshell.execDetached(["ddcutil", "-b", busNum, "setvcp", "10", rounded]);
else
Quickshell.execDetached(["brightnessctl", "s", `${rounded}%`]);
if (isDdc)
timer.restart();
}
function initBrightness(): void {
if (isAppleDisplay)
initProc.command = ["asdbctl", "get"];
else if (isDdc)
initProc.command = ["ddcutil", "-b", busNum, "getvcp", "10", "--brief"];
else
initProc.command = ["sh", "-c", "echo a b c $(brightnessctl g) $(brightnessctl m)"];
initProc.running = true;
}
onBusNumChanged: initBrightness()
Component.onCompleted: initBrightness()
}
}

86
services/Hypr.qml Normal file
View file

@ -0,0 +1,86 @@
pragma Singleton
import Quickshell
import Quickshell.Hyprland
import Quickshell.Io
import QtQuick
Singleton {
id: root
readonly property var toplevels: Hyprland.toplevels
readonly property var workspaces: Hyprland.workspaces
readonly property var monitors: Hyprland.monitors
property HyprlandToplevel activeToplevel: null
readonly property HyprlandWorkspace focusedWorkspace: Hyprland.focusedWorkspace
readonly property HyprlandMonitor focusedMonitor: Hyprland.focusedMonitor
property string kbLayout: "?"
readonly property int arbitraryRaceConditionDelay: 50
function dispatch(request: string): void {
Hyprland.dispatch(request);
}
function monitorFor(screen: ShellScreen): HyprlandMonitor {
return Hyprland.monitorFor(screen);
}
Connections {
target: Hyprland
function onRawEvent(event: HyprlandEvent): void {
const n = event.name;
if (n.endsWith("v2"))
return;
if (n === "activelayout") {
root.kbLayout = event.parse(2)[1].slice(0, 2).toLowerCase();
} else if (["workspace", "moveworkspace", "activespecial", "focusedmon"].includes(n)) {
Hyprland.refreshWorkspaces();
Hyprland.refreshMonitors();
} else if (["openwindow", "closewindow", "movewindow"].includes(n)) {
Hyprland.refreshToplevels();
Hyprland.refreshWorkspaces();
} else if (n.includes("mon")) {
Hyprland.refreshMonitors();
} else if (n.includes("workspace")) {
Hyprland.refreshWorkspaces();
} else if (n.includes("window") || n.includes("group") || ["pin", "fullscreen", "changefloatingmode", "minimize"].includes(n)) {
Hyprland.refreshToplevels();
}
}
function onActiveToplevelChanged() {
toplevelTimer.start();
}
}
onFocusedWorkspaceChanged: toplevelTimer.start()
// Delay update to account for Hyprland's processing delay
// (Prevent false null reports)
Timer {
id: toplevelTimer
interval: root.arbitraryRaceConditionDelay
repeat: false
onTriggered: {
const toplevel = Hyprland.activeToplevel;
// Invalidate active toplevel if in different workspace
if (toplevel && toplevel?.workspace === focusedWorkspace) {
root.activeToplevel = toplevel;
} else {
root.activeToplevel = null;
}
}
}
Process {
running: true
command: ["hyprctl", "-j", "devices"]
stdout: StdioCollector {
onStreamFinished: root.kbLayout = JSON.parse(text).keyboards.find(k => k.main).active_keymap.slice(0, 2).toLowerCase()
}
}
}

103
services/Hyprsunset.qml Normal file
View file

@ -0,0 +1,103 @@
pragma Singleton
import qs.config
import QtQuick
import Quickshell
import Quickshell.Io
Singleton {
id: root
property var manualActive
property string from: Config.services.sunsetFrom
property string to: Config.services.sunsetTo
property bool automatic: from !== to
property bool shouldBeOn
property bool firstEvaluation: true
property bool active: false
property int fromHour: Number(from.split(":")[0])
property int fromMinute: Number(from.split(":")[1])
property int toHour: Number(to.split(":")[0])
property int toMinute: Number(to.split(":")[1])
property int clockHour: Time.hours
property int clockMinute: Time.minutes
onClockMinuteChanged: reEvaluate()
onAutomaticChanged: {
root.manualActive = undefined;
root.firstEvaluation = true;
reEvaluate();
}
function reEvaluate() {
const t = clockHour * 60 + clockMinute;
const from = fromHour * 60 + fromMinute;
const to = toHour * 60 + toMinute;
if (from < to) {
root.shouldBeOn = t >= from && t <= to;
} else {
// Wrapped around midnight
root.shouldBeOn = t >= from || t <= to;
}
if (firstEvaluation) {
firstEvaluation = false;
root.ensureState();
}
}
onShouldBeOnChanged: ensureState()
function ensureState() {
if (!root.automatic || root.manualActive !== undefined)
return;
if (root.shouldBeOn) {
root.enable();
} else {
root.disable();
}
}
function load() { } // Dummy to force init
function enable() {
root.active = true;
Quickshell.execDetached(["hyprsunset", "--temperature", Config.services.sunsetTemperature]);
}
function disable() {
root.active = false;
Quickshell.execDetached(["pkill", "hyprsunset"]);
}
function fetchState() {
fetchProc.running = true;
}
Process {
id: fetchProc
running: true
command: ["hyprctl", "hyprsunset", "temperature"]
stdout: StdioCollector {
id: stateCollector
onStreamFinished: {
const output = stateCollector.text.trim();
if (output.length == 0 || output.startsWith("Couldn't"))
root.active = false;
else
root.active = (output != "6500");
}
}
}
function toggle() {
if (root.manualActive === undefined)
root.manualActive = root.active;
root.manualActive = !root.manualActive;
if (root.manualActive) {
root.enable();
} else {
root.disable();
}
}
}

47
services/Idle.qml Normal file
View file

@ -0,0 +1,47 @@
pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Io
Singleton {
id: root
property alias inhibit: inhibitor.running
property bool inhibitPipewire
function toggleInhibitPipewire() {
root.inhibitPipewire = !root.inhibitPipewire;
pipewireInhibitor.running = true;
}
// Idle Inhibitor
Process {
id: inhibitor
command: ["wayland-idle-inhibitor"]
}
// Idle Inhibit on Pipewire
readonly property string pipewireInhibitorService: "wayland-pipewire-idle-inhibit.service"
Timer {
id: pipewireInhibitorTimer
running: true
repeat: true
triggeredOnStart: true
onTriggered: pipewireInhibitorCheck.running = true
}
Process {
id: pipewireInhibitorCheck
command: ["systemctl", "status", "--user", root.pipewireInhibitorService]
onExited: (code, _) => root.inhibitPipewire = (code === 0)
}
Process {
id: pipewireInhibitor
command: ["systemctl", root.inhibitPipewire ? "start" : "stop", "--user", root.pipewireInhibitorService]
}
}

192
services/Network.qml Normal file
View file

@ -0,0 +1,192 @@
pragma Singleton
import Quickshell
import Quickshell.Io
import QtQuick
Singleton {
id: root
readonly property list<AccessPoint> networks: []
readonly property AccessPoint active: networks.find(n => n.active) ?? null
property bool wifiEnabled: true
readonly property bool scanning: rescanProc.running
reloadableId: "network"
function enableWifi(enabled: bool): void {
const cmd = enabled ? "on" : "off";
enableWifiProc.exec(["nmcli", "radio", "wifi", cmd]);
}
function toggleWifi(): void {
const cmd = wifiEnabled ? "off" : "on";
enableWifiProc.exec(["nmcli", "radio", "wifi", cmd]);
}
function rescanWifi(): void {
rescanProc.running = true;
}
function connectToNetwork(ssid: string, password: string): void {
// TODO: Implement password
connectProc.exec(["nmcli", "conn", "up", ssid]);
}
function disconnectFromNetwork(): void {
if (active) {
disconnectProc.exec(["nmcli", "connection", "down", active.ssid]);
}
}
function getWifiStatus(): void {
wifiStatusProc.running = true;
}
Process {
running: true
command: ["nmcli", "m"]
stdout: SplitParser {
onRead: getNetworks.running = true
}
}
Process {
id: wifiStatusProc
running: true
command: ["nmcli", "radio", "wifi"]
environment: ({
LANG: "C",
LC_ALL: "C"
})
stdout: StdioCollector {
onStreamFinished: {
root.wifiEnabled = text.trim() === "enabled";
}
}
}
Process {
id: enableWifiProc
onExited: {
root.getWifiStatus();
getNetworks.running = true;
}
}
Process {
id: rescanProc
command: ["nmcli", "dev", "wifi", "list", "--rescan", "yes"]
onExited: {
getNetworks.running = true;
}
}
Process {
id: connectProc
stdout: SplitParser {
onRead: getNetworks.running = true
}
stderr: StdioCollector {
onStreamFinished: console.warn("Network connection error:", text)
}
}
Process {
id: disconnectProc
stdout: SplitParser {
onRead: getNetworks.running = true
}
}
Process {
id: getNetworks
running: true
command: ["nmcli", "-g", "ACTIVE,SIGNAL,FREQ,SSID,BSSID,SECURITY", "d", "w"]
environment: ({
LANG: "C",
LC_ALL: "C"
})
stdout: StdioCollector {
onStreamFinished: {
const PLACEHOLDER = "STRINGWHICHHOPEFULLYWONTBEUSED";
const rep = new RegExp("\\\\:", "g");
const rep2 = new RegExp(PLACEHOLDER, "g");
const allNetworks = text.trim().split("\n").map(n => {
const net = n.replace(rep, PLACEHOLDER).split(":");
return {
active: net[0] === "yes",
strength: parseInt(net[1]),
frequency: parseInt(net[2]),
ssid: net[3],
bssid: net[4]?.replace(rep2, ":") ?? "",
security: net[5] || ""
};
}).filter(n => n.ssid && n.ssid.length > 0);
// Group networks by SSID and prioritize connected ones
const networkMap = new Map();
for (const network of allNetworks) {
const existing = networkMap.get(network.ssid);
if (!existing) {
networkMap.set(network.ssid, network);
} else {
// Prioritize active/connected networks
if (network.active && !existing.active) {
networkMap.set(network.ssid, network);
} else if (!network.active && !existing.active) {
// If both are inactive, keep the one with better signal
if (network.strength > existing.strength) {
networkMap.set(network.ssid, network);
}
}
// If existing is active and new is not, keep existing
}
}
const networks = Array.from(networkMap.values());
const rNetworks = root.networks;
const destroyed = rNetworks.filter(rn => !networks.find(n => n.frequency === rn.frequency && n.ssid === rn.ssid && n.bssid === rn.bssid));
for (const network of destroyed)
rNetworks.splice(rNetworks.indexOf(network), 1).forEach(n => n.destroy());
for (const network of networks) {
const match = rNetworks.find(n => n.frequency === network.frequency && n.ssid === network.ssid && n.bssid === network.bssid);
if (match) {
match.lastIpcObject = network;
} else {
rNetworks.push(apComp.createObject(root, {
lastIpcObject: network
}));
}
}
}
}
}
component AccessPoint: QtObject {
required property var lastIpcObject
readonly property string ssid: lastIpcObject.ssid
readonly property string bssid: lastIpcObject.bssid
readonly property int strength: lastIpcObject.strength
readonly property int frequency: lastIpcObject.frequency
readonly property bool active: lastIpcObject.active
readonly property string security: lastIpcObject.security
readonly property bool isSecure: security.length > 0
}
Component {
id: apComp
AccessPoint {}
}
}

60
services/NixOS.qml Normal file
View file

@ -0,0 +1,60 @@
pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Io
Singleton {
id: root
readonly property string nixVersion: nixVersionProc.nixVersion
readonly property list<Generation> generations: nixosGenerationsProc.generations
readonly property Generation currentGen: generations.find(g => g.current) ?? null
Timer {
running: true
repeat: true
triggeredOnStart: true
interval: 60000
onTriggered: {
nixVersionProc.running = true;
nixosGenerationsProc.running = true;
}
}
Process {
id: nixVersionProc
command: ["nix", "--version"]
property string nixVersion: ""
stdout: StdioCollector {
onStreamFinished: nixVersionProc.nixVersion = this.text.split(" ")[2].trim()
}
}
Process {
id: nixosGenerationsProc
command: ["nixos-rebuild", "list-generations", "--json"]
property list<Generation> generations: []
stdout: StdioCollector {
onStreamFinished: {
const json = JSON.parse(this.text);
nixosGenerationsProc.generations = json.map(o => genComp.createObject(root, { ipcObject: o }));
}
}
}
component Generation: QtObject {
required property var ipcObject
readonly property int id: ipcObject.generation
readonly property date date: ipcObject.date
readonly property string nixosVersion: ipcObject.nixosVersion
readonly property string kernelVersion: ipcObject.kernelVersion
readonly property string revision: ipcObject.configurationRevision
readonly property bool current: ipcObject.current
}
Component {
id: genComp
Generation {}
}
}

132
services/Notifs.qml Normal file
View file

@ -0,0 +1,132 @@
pragma Singleton
pragma ComponentBehavior: Bound
import qs.config
import qs.custom
import Quickshell
import Quickshell.Io
import Quickshell.Hyprland
import Quickshell.Services.Notifications
import QtQuick
Singleton {
id: root
readonly property list<Notif> list: []
property bool dnd: false
function toggleDnd(): void {
dnd = !dnd
}
NotificationServer {
id: server
keepOnReload: false
actionsSupported: true
bodyHyperlinksSupported: true
bodyImagesSupported: true
bodyMarkupSupported: true
imageSupported: true
persistenceSupported: true
onNotification: notif => {
notif.tracked = true;
root.list.push(notifComp.createObject(root, {
popup: root.dnd ? null : Hypr.focusedMonitor,
notification: notif
}));
}
}
CustomShortcut {
name: "clearNotifs"
description: "Clear all notifications"
onPressed: {
for (const notif of root.list)
notif.popup = null;
}
}
CustomShortcut {
name: "dismissNotifs"
description: "Dismiss all notifications"
onPressed: {
for (const notif of root.list)
notif.popup = null;
}
}
IpcHandler {
target: "notifs"
function clear(): void {
for (const notif of root.list)
notif.popup = null;
}
}
component Notif: QtObject {
id: notif
// Monitor to display popup in (typically the focused monitor when received)
property HyprlandMonitor popup: null
readonly property date time: new Date()
readonly property string timeStr: Qt.formatTime(time, "hh:mm:ss")
readonly property string timeSince: {
const diff = Time.date.getTime() - time.getTime();
const m = Math.floor(diff / 60000);
const h = Math.floor(m / 60);
const d = Math.floor(h / 24);
if (m < 1)
return "now";
if (h < 1)
return `${m}m`;
if (d < 1)
return `${h}h`;
return `${d}d`;
}
required property Notification notification
readonly property string summary: notification.summary
readonly property string appIcon: notification.appIcon
readonly property string appName: notification.appName
readonly property string image: notification.image
readonly property int urgency: notification.urgency
readonly property list<NotificationAction> actions: notification.actions
// Split body text into lines parseable by StyledText format
readonly property string body: notification.body.replace("\n", "<br/>")
// One-line version (for non-expanded notifications)
readonly property string bodyOneLine: notification.body.replace("\n", " ")
readonly property Timer timer: Timer {
running: true
interval: notif.notification.expireTimeout > 0 ? notif.notification.expireTimeout : Config.notifs.defaultExpireTimeout
onTriggered: {
if (Config.notifs.expire)
notif.popup = null;
}
}
readonly property Connections conn: Connections {
target: notif.notification.Retainable
function onDropped(): void {
root.list.splice(root.list.indexOf(notif), 1);
}
function onAboutToDestroy(): void {
notif.destroy();
}
}
}
Component {
id: notifComp
Notif {}
}
}

123
services/Players.qml Normal file
View file

@ -0,0 +1,123 @@
pragma Singleton
import qs.config
import qs.custom
import Quickshell
import Quickshell.Io
import Quickshell.Services.Mpris
Singleton {
id: root
readonly property list<MprisPlayer> list: Mpris.players.values
readonly property MprisPlayer active: manualActive ?? list.find(p => getIdentity(p) === Config.services.defaultPlayer) ?? list[0] ?? null
property MprisPlayer manualActive
// Alias IDs (for looking up icons)
readonly property list<var> idAliases: [
{
"from": "Mozilla firefox",
"to": "Firefox"
}
]
// Alias names (for displaying)
readonly property list<var> nameAliases: [
{
"from": "com.github.th_ch.youtube_music",
"to": "YT Music"
}
]
function getIdentity(player: MprisPlayer): string {
const alias = idAliases.find(a => a.from === player.identity);
return alias?.to ?? player.identity;
}
function getName(player: MprisPlayer): string {
const alias = nameAliases.find(a => a.from === player.identity);
return alias?.to ?? getIdentity(player);
}
CustomShortcut {
name: "mediaToggle"
description: "Toggle media playback"
onPressed: {
const active = root.active;
if (active && active.canTogglePlaying)
active.togglePlaying();
}
}
CustomShortcut {
name: "mediaPrev"
description: "Previous track"
onPressed: {
const active = root.active;
if (active && active.canGoPrevious)
active.previous();
}
}
CustomShortcut {
name: "mediaNext"
description: "Next track"
onPressed: {
const active = root.active;
if (active && active.canGoNext)
active.next();
}
}
CustomShortcut {
name: "mediaStop"
description: "Stop media playback"
onPressed: root.active?.stop()
}
IpcHandler {
target: "mpris"
function getActive(prop: string): string {
const active = root.active;
return active ? active[prop] ?? "Invalid property" : "No active player";
}
function list(): string {
return root.list.map(p => root.get(p)).join("\n");
}
function play(): void {
const active = root.active;
if (active?.canPlay)
active.play();
}
function pause(): void {
const active = root.active;
if (active?.canPause)
active.pause();
}
function playPause(): void {
const active = root.active;
if (active?.canTogglePlaying)
active.togglePlaying();
}
function previous(): void {
const active = root.active;
if (active?.canGoPrevious)
active.previous();
}
function next(): void {
const active = root.active;
if (active?.canGoNext)
active.next();
}
function stop(): void {
root.active?.stop();
}
}
}

36
services/Requests.qml Normal file
View file

@ -0,0 +1,36 @@
pragma Singleton
import qs.config
import qs.util
import Quickshell
Singleton {
id: root
function get(url: string, callback: var): void {
const xhr = new XMLHttpRequest();
const cleanup = () => {
xhr.abort();
xhr.onreadystatechange = null;
xhr.onerror = null;
};
xhr.open("GET", url, true);
xhr.onreadystatechange = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200)
callback(xhr.responseText);
else
console.warn(`[REQUESTS] GET request to ${url} failed with status ${xhr.status}`);
cleanup();
}
};
xhr.onerror = () => {
console.warn(`[REQUESTS] GET request to ${url} failed`);
cleanup();
};
xhr.send();
}
}

222
services/SystemUsage.qml Normal file
View file

@ -0,0 +1,222 @@
pragma Singleton
import qs.config
import Quickshell
import Quickshell.Io
import QtQuick
Singleton {
id: root
property real cpuPerc
property real cpuTemp
readonly property string gpuType: Config.services.gpuType.toUpperCase() || autoGpuType
property string autoGpuType: "NONE"
property real gpuPerc
property real gpuTemp
property real memUsed
property real memTotal
readonly property real memPerc: memTotal > 0 ? memUsed / memTotal : 0
property real storageUsed
property real storageTotal
property real storagePerc: storageTotal > 0 ? storageUsed / storageTotal : 0
property real lastCpuIdle
property real lastCpuTotal
property int refCount
function formatKib(kib: real): var {
const mib = 1024;
const gib = 1024 ** 2;
const tib = 1024 ** 3;
if (kib >= tib)
return {
value: kib / tib,
unit: "TiB"
};
if (kib >= gib)
return {
value: kib / gib,
unit: "GiB"
};
if (kib >= mib)
return {
value: kib / mib,
unit: "MiB"
};
return {
value: kib,
unit: "KiB"
};
}
Timer {
running: root.refCount > 0
interval: 3000
repeat: true
triggeredOnStart: true
onTriggered: {
stat.reload();
meminfo.reload();
storage.running = true;
gpuUsage.running = true;
sensors.running = true;
}
}
FileView {
id: stat
path: "/proc/stat"
onLoaded: {
const data = text().match(/^cpu\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/);
if (data) {
const stats = data.slice(1).map(n => parseInt(n, 10));
const total = stats.reduce((a, b) => a + b, 0);
const idle = stats[3] + (stats[4] ?? 0);
const totalDiff = total - root.lastCpuTotal;
const idleDiff = idle - root.lastCpuIdle;
root.cpuPerc = totalDiff > 0 ? (1 - idleDiff / totalDiff) : 0;
root.lastCpuTotal = total;
root.lastCpuIdle = idle;
}
}
}
FileView {
id: meminfo
path: "/proc/meminfo"
onLoaded: {
const data = text();
root.memTotal = parseInt(data.match(/MemTotal: *(\d+)/)[1], 10) || 1;
root.memUsed = (root.memTotal - parseInt(data.match(/MemAvailable: *(\d+)/)[1], 10)) || 0;
}
}
Process {
id: storage
command: ["sh", "-c", "df | grep '^/dev/' | awk '{print $1, $3, $4}'"]
stdout: StdioCollector {
onStreamFinished: {
const deviceMap = new Map();
for (const line of text.trim().split("\n")) {
if (line.trim() === "")
continue;
const parts = line.trim().split(/\s+/);
if (parts.length >= 3) {
const device = parts[0];
const used = parseInt(parts[1], 10) || 0;
const avail = parseInt(parts[2], 10) || 0;
// Only keep the entry with the largest total space for each device
if (!deviceMap.has(device) || (used + avail) > (deviceMap.get(device).used + deviceMap.get(device).avail)) {
deviceMap.set(device, {
used: used,
avail: avail
});
}
}
}
let totalUsed = 0;
let totalAvail = 0;
for (const [device, stats] of deviceMap) {
totalUsed += stats.used;
totalAvail += stats.avail;
}
root.storageUsed = totalUsed;
root.storageTotal = totalUsed + totalAvail;
}
}
}
Process {
id: gpuTypeCheck
running: !Config.services.gpuType
command: ["sh", "-c", "if command -v nvidia-smi &>/dev/null && nvidia-smi -L &>/dev/null; then echo NVIDIA; elif ls /sys/class/drm/card*/device/gpu_busy_percent 2>/dev/null | grep -q .; then echo GENERIC; else echo NONE; fi"]
stdout: StdioCollector {
onStreamFinished: root.autoGpuType = text.trim()
}
}
Process {
id: gpuUsage
command: root.gpuType === "GENERIC" ? ["sh", "-c", "cat /sys/class/drm/card*/device/gpu_busy_percent"] : root.gpuType === "NVIDIA" ? ["nvidia-smi", "--query-gpu=utilization.gpu,temperature.gpu", "--format=csv,noheader,nounits"] : ["echo"]
stdout: StdioCollector {
onStreamFinished: {
if (root.gpuType === "GENERIC") {
const percs = text.trim().split("\n");
const sum = percs.reduce((acc, d) => acc + parseInt(d, 10), 0);
root.gpuPerc = sum / percs.length / 100;
} else if (root.gpuType === "NVIDIA") {
const [usage, temp] = text.trim().split(",");
root.gpuPerc = parseInt(usage, 10) / 100;
root.gpuTemp = parseInt(temp, 10);
} else {
root.gpuPerc = 0;
root.gpuTemp = 0;
}
}
}
}
Process {
id: sensors
command: ["sensors"]
environment: ({
LANG: "C.UTF-8",
LC_ALL: "C.UTF-8"
})
stdout: StdioCollector {
onStreamFinished: {
let cpuTemp = text.match(/(?:Package id [0-9]+|Tdie):\s+((\+|-)[0-9.]+)(°| )C/);
if (!cpuTemp)
// If AMD Tdie pattern failed, try fallback on Tctl
cpuTemp = text.match(/Tctl:\s+((\+|-)[0-9.]+)(°| )C/);
if (cpuTemp)
root.cpuTemp = parseFloat(cpuTemp[1]);
if (root.gpuType !== "GENERIC")
return;
let eligible = false;
let sum = 0;
let count = 0;
for (const line of text.trim().split("\n")) {
if (line === "Adapter: PCI adapter")
eligible = true;
else if (line === "")
eligible = false;
else if (eligible) {
let match = line.match(/^(temp[0-9]+|GPU core|edge)+:\s+\+([0-9]+\.[0-9]+)(°| )C/);
if (!match)
// Fall back to junction/mem if GPU doesn't have edge temp (for AMD GPUs)
match = line.match(/^(junction|mem)+:\s+\+([0-9]+\.[0-9]+)(°| )C/);
if (match) {
sum += parseFloat(match[2]);
count++;
}
}
}
root.gpuTemp = count > 0 ? sum / count : 0;
}
}
}
}

52
services/Time.qml Normal file
View file

@ -0,0 +1,52 @@
pragma Singleton
import Quickshell
Singleton {
property alias enabled: clock.enabled
readonly property date date: clock.date
readonly property int hours: clock.hours
readonly property int minutes: clock.minutes
readonly property int seconds: clock.seconds
SystemClock {
id: clock
precision: SystemClock.Seconds
}
function format(fmt: string): string {
return Qt.formatDateTime(clock.date, fmt);
}
function formatSeconds(s: int, includeSecs = false): string {
let min = Math.floor(s / 60);
let hr = Math.floor(min / 60);
let day = Math.floor(hr / 24);
let week = Math.floor(day / 7);
let year = Math.floor(day / 365);
s = s % 60;
min = min % 60;
hr = hr % 24;
day = day % 7;
week = week % 52;
let comps = [];
if (year > 0)
comps.push(`${year}y`);
if (week > 0)
comps.push(`${week}w`);
if (day > 0)
comps.push(`${day}d`);
if (hr > 0)
comps.push(`${hr}h`);
if (min > 0)
comps.push(`${min}m`);
if (includeSecs && s > 0)
comps.push(`${s}s`);
if (comps.length === 0)
return "";
else
return comps.join(" ");
}
}

Some files were not shown because too many files have changed in this diff Show more