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

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> The overhaul is finished!
|
||||||
|
> Installation is now via an [install script](https://github.com/caelestia-dots/caelestia/blob/main/install.fish) in the
|
||||||
|
> [`caelestia` repo](https://github.com/caelestia-dots/caelestia).
|
||||||
|
>
|
||||||
|
> Anyone with an existing installation, please reinstall via the install script.
|
||||||
|
>
|
||||||
|
> Some breaking changes:
|
||||||
|
> - Rename the `scripts` repo -> `cli`
|
||||||
|
> - Rename the `hypr` repo -> `caelestia`
|
||||||
|
> - Merge all other repos (except this and `cli`) into `caelestia`
|
||||||
|
> - Installation for the `shell` and `cli` will be done via AUR packages; `caelestia` will have a meta package and an install script (should fix most installation issues)
|
||||||
|
> - Overhaul the scheme system (should fix a few bugs with that and make it cleaner in general)
|
||||||
|
|
||||||
|
https://github.com/user-attachments/assets/0840f496-575c-4ca6-83a8-87bb01a85c5f
|
||||||
|
|
||||||
|
## Components
|
||||||
|
|
||||||
|
- Widgets: [`Quickshell`](https://quickshell.outfoxxed.me)
|
||||||
|
- Window manager: [`Hyprland`](https://hyprland.org)
|
||||||
|
- Dots: [`caelestia`](https://github.com/caelestia-dots)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
This is not implemented as of now.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The shell can be started in two ways: via systemd or manually running `caelestia shell`.
|
||||||
|
|
||||||
|
### Via systemd
|
||||||
|
|
||||||
|
The install script creates and enables the systemd service `caelestia-shell.service` which should automatically start the
|
||||||
|
shell on login.
|
||||||
|
|
||||||
|
### Via command
|
||||||
|
|
||||||
|
If not on a system that uses systemd, you can manually start the shell via `caelestia-shell`.
|
||||||
|
To autostart it on login, you can use an `exec-once` rule in your Hyprland config:
|
||||||
|
```
|
||||||
|
exec-once = caelestia shell
|
||||||
|
```
|
||||||
|
|
||||||
|
### Shortcuts/IPC
|
||||||
|
|
||||||
|
All keybinds are accessible via Hyprland [global shortcuts](https://wiki.hyprland.org/Configuring/Binds/#dbus-global-shortcuts).
|
||||||
|
For a preconfigured setup, install [`caelestia-hypr`](https://github.com/caelestia-dots/hypr) via `caelestia install hypr` or see
|
||||||
|
[this file](https://github.com/caelestia-dots/hypr/blob/main/hyprland/keybinds.conf#L1-L29) for an example on how to use global
|
||||||
|
shortcuts.
|
||||||
|
|
||||||
|
All IPC commands can be accessed via `caelestia shell ...`. For example
|
||||||
|
```sh
|
||||||
|
caelestia shell mpris getActive trackTitle
|
||||||
|
```
|
||||||
|
|
||||||
|
The list of IPC commands can be shown via `caelestia shell help`:
|
||||||
|
```
|
||||||
|
> caelestia shell help
|
||||||
|
target mpris
|
||||||
|
function stop(): void
|
||||||
|
function play(): void
|
||||||
|
function next(): void
|
||||||
|
function getActive(prop: string): string
|
||||||
|
function list(): string
|
||||||
|
function playPause(): void
|
||||||
|
function pause(): void
|
||||||
|
function previous(): void
|
||||||
|
target drawers
|
||||||
|
function list(): string
|
||||||
|
function toggle(drawer: string): void
|
||||||
|
target wallpaper
|
||||||
|
function list(): string
|
||||||
|
function get(): string
|
||||||
|
function set(path: string): void
|
||||||
|
target notifs
|
||||||
|
function clear(): void
|
||||||
|
```
|
||||||
|
|
||||||
|
### PFP/Wallpapers
|
||||||
|
|
||||||
|
The profile picture for the dashboard is read from the file `~/.face`, so to set it just put your image there.
|
||||||
|
|
||||||
|
The wallpapers for the wallpaper switcher are read from `~/Pictures/Wallpapers`, so put your wallpapers there for
|
||||||
|
them to show up in the switcher (you need to restart the shell after changing stuff in `~/Pictures/Wallpapers` sadly,
|
||||||
|
no watching for changes yet).
|
||||||
|
|
||||||
|
To set the wallpaper, you can use the command `caelestia wallpaper`. Use `caelestia wallpaper -h` for more info about
|
||||||
|
the command.
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
Thanks to the Hyprland discord community (especially the homies in #rice-discussion) for all the help and suggestions
|
||||||
|
for improving these dots!
|
||||||
|
|
||||||
|
A special thanks to [@outfoxxed](https://github.com/outfoxxed) for making Quickshell and the effort put into fixing issues
|
||||||
|
and implementing various feature requests.
|
||||||
|
|
||||||
|
Another special thanks to [@end_4](https://github.com/end-4) for his [config](https://github.com/end-4/dots-hyprland)
|
||||||
|
which helped me a lot with learning how to use Quickshell.
|
||||||
|
|
||||||
|
Finally another thank you to all the configs I took inspiration from (only one for now):
|
||||||
|
- [Axenide/Ax-Shell](https://github.com/Axenide/Ax-Shell)
|
||||||
|
|
||||||
|
## Stonks 📈
|
||||||
|
|
||||||
|
<a href="https://www.star-history.com/#caelestia-dots/shell&Date">
|
||||||
|
<picture>
|
||||||
|
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=caelestia-dots/shell&type=Date&theme=dark" />
|
||||||
|
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=caelestia-dots/shell&type=Date" />
|
||||||
|
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=caelestia-dots/shell&type=Date" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
568
dots/quickshell/assets/beat_detector.cpp
Executable file
568
dots/quickshell/assets/beat_detector.cpp
Executable file
@@ -0,0 +1,568 @@
|
|||||||
|
#include <algorithm>
|
||||||
|
#include <pipewire/pipewire.h>
|
||||||
|
#include <spa/param/audio/format-utils.h>
|
||||||
|
#include <spa/param/props.h>
|
||||||
|
#include <aubio/aubio.h>
|
||||||
|
#include <memory>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <csignal>
|
||||||
|
#include <atomic>
|
||||||
|
#include <vector>
|
||||||
|
#include <cstring>
|
||||||
|
#include <chrono>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <sstream>
|
||||||
|
#include <thread>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
class EnhancedBeatDetector {
|
||||||
|
private:
|
||||||
|
static constexpr uint32_t SAMPLE_RATE = 44100;
|
||||||
|
static constexpr uint32_t CHANNELS = 1;
|
||||||
|
|
||||||
|
// PipeWire objects
|
||||||
|
pw_main_loop* main_loop_;
|
||||||
|
pw_context* context_;
|
||||||
|
pw_core* core_;
|
||||||
|
pw_stream* stream_;
|
||||||
|
|
||||||
|
// Aubio objects
|
||||||
|
std::unique_ptr<aubio_tempo_t, decltype(&del_aubio_tempo)> tempo_;
|
||||||
|
std::unique_ptr<fvec_t, decltype(&del_fvec)> input_buffer_;
|
||||||
|
std::unique_ptr<fvec_t, decltype(&del_fvec)> output_buffer_;
|
||||||
|
|
||||||
|
// Additional aubio objects for enhanced features
|
||||||
|
std::unique_ptr<aubio_onset_t, decltype(&del_aubio_onset)> onset_;
|
||||||
|
std::unique_ptr<aubio_pitch_t, decltype(&del_aubio_pitch)> pitch_;
|
||||||
|
std::unique_ptr<fvec_t, decltype(&del_fvec)> pitch_buffer_;
|
||||||
|
|
||||||
|
const uint32_t buf_size_;
|
||||||
|
const uint32_t fft_size_;
|
||||||
|
|
||||||
|
static std::atomic<bool> should_quit_;
|
||||||
|
static EnhancedBeatDetector* instance_;
|
||||||
|
|
||||||
|
// Enhanced features
|
||||||
|
std::ofstream log_file_;
|
||||||
|
bool enable_logging_;
|
||||||
|
bool enable_performance_stats_;
|
||||||
|
bool enable_pitch_detection_;
|
||||||
|
bool enable_visual_feedback_;
|
||||||
|
|
||||||
|
// Performance tracking
|
||||||
|
std::chrono::high_resolution_clock::time_point last_process_time_;
|
||||||
|
std::vector<double> process_times_;
|
||||||
|
uint64_t total_beats_;
|
||||||
|
uint64_t total_onsets_;
|
||||||
|
std::chrono::steady_clock::time_point start_time_;
|
||||||
|
|
||||||
|
// Beat analysis
|
||||||
|
std::vector<float> recent_bpms_;
|
||||||
|
static constexpr size_t BPM_HISTORY_SIZE = 10;
|
||||||
|
float last_bpm_;
|
||||||
|
std::chrono::steady_clock::time_point last_beat_time_;
|
||||||
|
|
||||||
|
// Useless Visual feedback
|
||||||
|
std::string generate_beat_visual(float bpm, bool is_beat) {
|
||||||
|
if (!enable_visual_feedback_) return "";
|
||||||
|
|
||||||
|
std::stringstream ss;
|
||||||
|
if (is_beat) {
|
||||||
|
// Useless Animated beat indicator based on BPM intensity
|
||||||
|
int intensity = static_cast<int>(std::min(bpm / 20.0f, 10.0f));
|
||||||
|
ss << "\r ";
|
||||||
|
for (int i = 0; i < intensity; ++i) ss << "█";
|
||||||
|
for (int i = intensity; i < 10; ++i) ss << "░";
|
||||||
|
ss << " BPM: " << std::fixed << std::setprecision(1) << bpm;
|
||||||
|
ss << " | Avg: " << get_average_bpm();
|
||||||
|
}
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit EnhancedBeatDetector(uint32_t buf_size = 512,
|
||||||
|
bool enable_logging = true,
|
||||||
|
bool enable_performance_stats = true,
|
||||||
|
bool enable_pitch_detection = false,
|
||||||
|
bool enable_visual_feedback = true)
|
||||||
|
: main_loop_(nullptr)
|
||||||
|
, context_(nullptr)
|
||||||
|
, core_(nullptr)
|
||||||
|
, stream_(nullptr)
|
||||||
|
, tempo_(nullptr, &del_aubio_tempo)
|
||||||
|
, input_buffer_(nullptr, &del_fvec)
|
||||||
|
, output_buffer_(nullptr, &del_fvec)
|
||||||
|
, onset_(nullptr, &del_aubio_onset)
|
||||||
|
, pitch_(nullptr, &del_aubio_pitch)
|
||||||
|
, pitch_buffer_(nullptr, &del_fvec)
|
||||||
|
, buf_size_(buf_size)
|
||||||
|
, fft_size_(buf_size * 2)
|
||||||
|
, enable_logging_(enable_logging)
|
||||||
|
, enable_performance_stats_(enable_performance_stats)
|
||||||
|
, enable_pitch_detection_(enable_pitch_detection)
|
||||||
|
, enable_visual_feedback_(enable_visual_feedback)
|
||||||
|
, total_beats_(0)
|
||||||
|
, total_onsets_(0)
|
||||||
|
, last_bpm_(0.0f)
|
||||||
|
{
|
||||||
|
instance_ = this;
|
||||||
|
recent_bpms_.reserve(BPM_HISTORY_SIZE);
|
||||||
|
if (enable_performance_stats_) {
|
||||||
|
process_times_.reserve(1000); // Reserve space for performance data
|
||||||
|
}
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
~EnhancedBeatDetector() {
|
||||||
|
print_final_stats();
|
||||||
|
cleanup();
|
||||||
|
instance_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete copy constructor and assignment operator
|
||||||
|
EnhancedBeatDetector(const EnhancedBeatDetector&) = delete;
|
||||||
|
EnhancedBeatDetector& operator=(const EnhancedBeatDetector&) = delete;
|
||||||
|
|
||||||
|
bool initialize() {
|
||||||
|
start_time_ = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
|
// Useless Initialize logging (actually useful)
|
||||||
|
if (enable_logging_) {
|
||||||
|
auto now = std::chrono::system_clock::now();
|
||||||
|
auto time_t = std::chrono::system_clock::to_time_t(now);
|
||||||
|
std::stringstream filename;
|
||||||
|
filename << "beat_log_" << std::put_time(std::localtime(&time_t), "%Y%m%d_%H%M%S") << ".txt";
|
||||||
|
log_file_.open(filename.str());
|
||||||
|
if (log_file_.is_open()) {
|
||||||
|
log_file_ << "# Beat Detection Log - " << std::put_time(std::localtime(&time_t), "%Y-%m-%d %H:%M:%S") << "\n";
|
||||||
|
log_file_ << "# Timestamp,BPM,Onset,Pitch(Hz),ProcessTime(ms)\n";
|
||||||
|
std::cout << " Logging to: " << filename.str() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize PipeWire
|
||||||
|
pw_init(nullptr, nullptr);
|
||||||
|
|
||||||
|
main_loop_ = pw_main_loop_new(nullptr);
|
||||||
|
if (!main_loop_) {
|
||||||
|
std::cerr << " Failed to create main loop" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
context_ = pw_context_new(pw_main_loop_get_loop(main_loop_), nullptr, 0);
|
||||||
|
if (!context_) {
|
||||||
|
std::cerr << " Failed to create context" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
core_ = pw_context_connect(context_, nullptr, 0);
|
||||||
|
if (!core_) {
|
||||||
|
std::cerr << " Failed to connect to PipeWire" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize Aubio objects
|
||||||
|
tempo_.reset(new_aubio_tempo("default", fft_size_, buf_size_, SAMPLE_RATE));
|
||||||
|
if (!tempo_) {
|
||||||
|
std::cerr << " Failed to create aubio tempo detector" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
input_buffer_.reset(new_fvec(buf_size_));
|
||||||
|
output_buffer_.reset(new_fvec(1));
|
||||||
|
|
||||||
|
if (!input_buffer_ || !output_buffer_) {
|
||||||
|
std::cerr << " Failed to create aubio buffers" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize onset detection
|
||||||
|
onset_.reset(new_aubio_onset("default", fft_size_, buf_size_, SAMPLE_RATE));
|
||||||
|
if (!onset_) {
|
||||||
|
std::cerr << " Failed to create aubio onset detector" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize pitch detection if enabled
|
||||||
|
if (enable_pitch_detection_) {
|
||||||
|
pitch_.reset(new_aubio_pitch("default", fft_size_, buf_size_, SAMPLE_RATE));
|
||||||
|
pitch_buffer_.reset(new_fvec(1));
|
||||||
|
if (!pitch_ || !pitch_buffer_) {
|
||||||
|
std::cerr << " Failed to create aubio pitch detector" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
aubio_pitch_set_unit(pitch_.get(), "Hz");
|
||||||
|
}
|
||||||
|
|
||||||
|
return setup_stream();
|
||||||
|
}
|
||||||
|
|
||||||
|
void run() {
|
||||||
|
if (!main_loop_) return;
|
||||||
|
|
||||||
|
print_startup_info();
|
||||||
|
pw_main_loop_run(main_loop_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void stop() {
|
||||||
|
should_quit_ = true;
|
||||||
|
if (main_loop_) {
|
||||||
|
pw_main_loop_quit(main_loop_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void signal_handler(int sig) {
|
||||||
|
if (instance_) {
|
||||||
|
std::cout << "\n Received signal " << sig << ", stopping gracefullllly..." << std::endl;
|
||||||
|
instance_->stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void print_startup_info() {
|
||||||
|
std::cout << "\n Beat Detector Started!" << std::endl;
|
||||||
|
std::cout << " Buffer size: " << buf_size_ << " samples" << std::endl;
|
||||||
|
std::cout << " Sample rate: " << SAMPLE_RATE << " Hz" << std::endl;
|
||||||
|
std::cout << " Features enabled:" << std::endl;
|
||||||
|
std::cout << " Logging: " << (enable_logging_ ? " " : "") << std::endl;
|
||||||
|
std::cout << " Performance stats: " << (enable_performance_stats_ ? " " : "") << std::endl;
|
||||||
|
std::cout << " Pitch detection: " << (enable_pitch_detection_ ? " " : "") << std::endl;
|
||||||
|
std::cout << "\n Listening for beats... Press Ctrl+C to stop.\n" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void print_final_stats() {
|
||||||
|
if (!enable_performance_stats_) return;
|
||||||
|
|
||||||
|
auto end_time = std::chrono::steady_clock::now();
|
||||||
|
auto duration = std::chrono::duration_cast<std::chrono::seconds>(end_time - start_time_);
|
||||||
|
|
||||||
|
std::cout << "\n Final Statistics:" << std::endl;
|
||||||
|
std::cout << " Total runtime: " << duration.count() << " seconds" << std::endl;
|
||||||
|
std::cout << " Total beats detected: " << total_beats_ << std::endl;
|
||||||
|
std::cout << " Total onsets detected: " << total_onsets_ << std::endl;
|
||||||
|
|
||||||
|
if (!process_times_.empty()) {
|
||||||
|
double avg_time = 0;
|
||||||
|
for (double t : process_times_) avg_time += t;
|
||||||
|
avg_time /= process_times_.size();
|
||||||
|
|
||||||
|
auto max_time = *std::max_element(process_times_.begin(), process_times_.end());
|
||||||
|
auto min_time = *std::min_element(process_times_.begin(), process_times_.end());
|
||||||
|
|
||||||
|
std::cout << " ⚡ Average processing time: " << std::fixed << std::setprecision(3)
|
||||||
|
<< avg_time << " ms" << std::endl;
|
||||||
|
std::cout << " 📈 Max processing time: " << max_time << " ms" << std::endl;
|
||||||
|
std::cout << " 📉 Min processing time: " << min_time << " ms" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!recent_bpms_.empty()) {
|
||||||
|
std::cout << " Final average BPM: " << get_average_bpm() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_average_bpm() const {
|
||||||
|
if (recent_bpms_.empty()) return 0.0f;
|
||||||
|
float sum = 0;
|
||||||
|
for (float bpm : recent_bpms_) sum += bpm;
|
||||||
|
return sum / recent_bpms_.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool setup_stream() {
|
||||||
|
// Stream events
|
||||||
|
static const pw_stream_events stream_events = {
|
||||||
|
.version = PW_VERSION_STREAM_EVENTS,
|
||||||
|
.destroy = nullptr,
|
||||||
|
.state_changed = on_state_changed,
|
||||||
|
.control_info = nullptr,
|
||||||
|
.io_changed = nullptr,
|
||||||
|
.param_changed = nullptr,
|
||||||
|
.add_buffer = nullptr,
|
||||||
|
.remove_buffer = nullptr,
|
||||||
|
.process = on_process,
|
||||||
|
.drained = nullptr,
|
||||||
|
.command = nullptr,
|
||||||
|
.trigger_done = nullptr,
|
||||||
|
};
|
||||||
|
|
||||||
|
stream_ = pw_stream_new_simple(
|
||||||
|
pw_main_loop_get_loop(main_loop_),
|
||||||
|
"enhanced-beat-detector",
|
||||||
|
pw_properties_new(
|
||||||
|
PW_KEY_MEDIA_TYPE, "Audio",
|
||||||
|
PW_KEY_MEDIA_CATEGORY, "Capture",
|
||||||
|
PW_KEY_MEDIA_ROLE, "Music",
|
||||||
|
nullptr
|
||||||
|
),
|
||||||
|
&stream_events,
|
||||||
|
this
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!stream_) {
|
||||||
|
std::cerr << " Failed to create stream" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Audio format parameters
|
||||||
|
uint8_t buffer[1024];
|
||||||
|
spa_pod_builder pod_builder = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||||
|
|
||||||
|
struct spa_audio_info_raw audio_info = {};
|
||||||
|
audio_info.format = SPA_AUDIO_FORMAT_F32_LE;
|
||||||
|
audio_info.channels = CHANNELS;
|
||||||
|
audio_info.rate = SAMPLE_RATE;
|
||||||
|
audio_info.flags = 0;
|
||||||
|
|
||||||
|
const spa_pod* params[1];
|
||||||
|
params[0] = spa_format_audio_raw_build(&pod_builder, SPA_PARAM_EnumFormat, &audio_info);
|
||||||
|
|
||||||
|
if (pw_stream_connect(stream_,
|
||||||
|
PW_DIRECTION_INPUT,
|
||||||
|
PW_ID_ANY,
|
||||||
|
static_cast<pw_stream_flags>(
|
||||||
|
PW_STREAM_FLAG_AUTOCONNECT |
|
||||||
|
PW_STREAM_FLAG_MAP_BUFFERS |
|
||||||
|
PW_STREAM_FLAG_RT_PROCESS),
|
||||||
|
params, 1) < 0) {
|
||||||
|
std::cerr << " Failed to connect stream" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void on_state_changed(void* userdata, enum pw_stream_state /* old_state */,
|
||||||
|
enum pw_stream_state state, const char* error) {
|
||||||
|
auto* detector = static_cast<EnhancedBeatDetector*>(userdata);
|
||||||
|
|
||||||
|
const char* state_emoji = " ";
|
||||||
|
switch (state) {
|
||||||
|
case PW_STREAM_STATE_CONNECTING: state_emoji = " "; break;
|
||||||
|
case PW_STREAM_STATE_PAUSED: state_emoji = ""; break;
|
||||||
|
case PW_STREAM_STATE_STREAMING: state_emoji = " "; break;
|
||||||
|
case PW_STREAM_STATE_ERROR: state_emoji = ""; break;
|
||||||
|
case PW_STREAM_STATE_UNCONNECTED: state_emoji = " "; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << state_emoji << " Stream state: " << pw_stream_state_as_string(state) << std::endl;
|
||||||
|
|
||||||
|
if (state == PW_STREAM_STATE_ERROR) {
|
||||||
|
std::cerr << " Stream error: " << (error ? error : "unknown") << std::endl;
|
||||||
|
detector->stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void on_process(void* userdata) {
|
||||||
|
auto* detector = static_cast<EnhancedBeatDetector*>(userdata);
|
||||||
|
detector->process_audio();
|
||||||
|
}
|
||||||
|
|
||||||
|
void process_audio() {
|
||||||
|
if (should_quit_) return;
|
||||||
|
|
||||||
|
auto process_start = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
|
pw_buffer* buffer = pw_stream_dequeue_buffer(stream_);
|
||||||
|
if (!buffer) return;
|
||||||
|
|
||||||
|
spa_buffer* spa_buf = buffer->buffer;
|
||||||
|
if (!spa_buf->datas[0].data) {
|
||||||
|
pw_stream_queue_buffer(stream_, buffer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const float* audio_data = static_cast<const float*>(spa_buf->datas[0].data);
|
||||||
|
const uint32_t n_samples = spa_buf->datas[0].chunk->size / sizeof(float);
|
||||||
|
|
||||||
|
// Process in chunks
|
||||||
|
for (uint32_t offset = 0; offset + buf_size_ <= n_samples; offset += buf_size_) {
|
||||||
|
std::memcpy(input_buffer_->data, audio_data + offset, buf_size_ * sizeof(float));
|
||||||
|
|
||||||
|
// Beat detection
|
||||||
|
aubio_tempo_do(tempo_.get(), input_buffer_.get(), output_buffer_.get());
|
||||||
|
bool is_beat = output_buffer_->data[0] != 0.0f;
|
||||||
|
|
||||||
|
// Onset detection
|
||||||
|
aubio_onset_do(onset_.get(), input_buffer_.get(), output_buffer_.get());
|
||||||
|
bool is_onset = output_buffer_->data[0] != 0.0f;
|
||||||
|
|
||||||
|
float pitch_hz = 0.0f;
|
||||||
|
if (enable_pitch_detection_) {
|
||||||
|
aubio_pitch_do(pitch_.get(), input_buffer_.get(), pitch_buffer_.get());
|
||||||
|
pitch_hz = pitch_buffer_->data[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_beat) {
|
||||||
|
total_beats_++;
|
||||||
|
last_bpm_ = aubio_tempo_get_bpm(tempo_.get());
|
||||||
|
last_beat_time_ = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
|
// Update BPM history
|
||||||
|
recent_bpms_.push_back(last_bpm_);
|
||||||
|
if (recent_bpms_.size() > BPM_HISTORY_SIZE) {
|
||||||
|
recent_bpms_.erase(recent_bpms_.begin());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Visual feedback
|
||||||
|
if (enable_visual_feedback_) {
|
||||||
|
std::cout << generate_beat_visual(last_bpm_, true) << std::flush;
|
||||||
|
} else {
|
||||||
|
std::cout << " BPM: " << std::fixed << std::setprecision(1) << last_bpm_ << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_onset) {
|
||||||
|
total_onsets_++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Logging
|
||||||
|
if (enable_logging_ && log_file_.is_open() && (is_beat || is_onset)) {
|
||||||
|
auto now = std::chrono::system_clock::now();
|
||||||
|
auto time_t = std::chrono::system_clock::to_time_t(now);
|
||||||
|
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
|
now.time_since_epoch()) % 1000;
|
||||||
|
|
||||||
|
log_file_ << std::put_time(std::localtime(&time_t), "%H:%M:%S")
|
||||||
|
<< "." << std::setfill('0') << std::setw(3) << ms.count() << ","
|
||||||
|
<< (is_beat ? last_bpm_ : 0) << ","
|
||||||
|
<< (is_onset ? 1 : 0) << ","
|
||||||
|
<< pitch_hz << ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pw_stream_queue_buffer(stream_, buffer);
|
||||||
|
|
||||||
|
// Performance tracking
|
||||||
|
if (enable_performance_stats_) {
|
||||||
|
auto process_end = std::chrono::high_resolution_clock::now();
|
||||||
|
auto process_time = std::chrono::duration<double, std::milli>(process_end - process_start).count();
|
||||||
|
|
||||||
|
if (log_file_.is_open() && (total_beats_ > 0 || total_onsets_ > 0)) {
|
||||||
|
log_file_ << std::fixed << std::setprecision(3) << process_time << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process_times_.size() < 1000) {
|
||||||
|
process_times_.push_back(process_time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cleanup() {
|
||||||
|
if (log_file_.is_open()) {
|
||||||
|
log_file_.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stream_) {
|
||||||
|
pw_stream_destroy(stream_);
|
||||||
|
stream_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (core_) {
|
||||||
|
pw_core_disconnect(core_);
|
||||||
|
core_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context_) {
|
||||||
|
pw_context_destroy(context_);
|
||||||
|
context_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (main_loop_) {
|
||||||
|
pw_main_loop_destroy(main_loop_);
|
||||||
|
main_loop_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
tempo_.reset();
|
||||||
|
input_buffer_.reset();
|
||||||
|
output_buffer_.reset();
|
||||||
|
onset_.reset();
|
||||||
|
pitch_.reset();
|
||||||
|
pitch_buffer_.reset();
|
||||||
|
|
||||||
|
pw_deinit();
|
||||||
|
|
||||||
|
std::cout << "\n Cleanup complete - All resources freed!" << std::endl;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Static member definitions
|
||||||
|
std::atomic<bool> EnhancedBeatDetector::should_quit_{false};
|
||||||
|
EnhancedBeatDetector* EnhancedBeatDetector::instance_{nullptr};
|
||||||
|
|
||||||
|
void print_usage() {
|
||||||
|
std::cout << " Beat Detector Usage:" << std::endl;
|
||||||
|
std::cout << " ./beat_detector [buffer_size] [options]" << std::endl;
|
||||||
|
std::cout << "\nOptions:" << std::endl;
|
||||||
|
std::cout << " --no-log Disable logging to file" << std::endl;
|
||||||
|
std::cout << " --no-stats Disable performance statistics" << std::endl;
|
||||||
|
std::cout << " --pitch Enable pitch detection" << std::endl;
|
||||||
|
std::cout << " --no-visual Disable visual feedback" << std::endl;
|
||||||
|
std::cout << " --help Show this help" << std::endl;
|
||||||
|
std::cout << "\nExamples:" << std::endl;
|
||||||
|
std::cout << " ./beat_detector # Default settings" << std::endl;
|
||||||
|
std::cout << " ./beat_detector 256 --pitch # Smaller buffer with pitch detection" << std::endl;
|
||||||
|
std::cout << " ./beat_detector 1024 --no-visual # Larger buffer, no visual feedback" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
// Parse command line arguments
|
||||||
|
uint32_t buffer_size = 512;
|
||||||
|
bool enable_logging = true;
|
||||||
|
bool enable_performance_stats = true;
|
||||||
|
bool enable_pitch_detection = false;
|
||||||
|
bool enable_visual_feedback = true;
|
||||||
|
|
||||||
|
for (int i = 1; i < argc; ++i) {
|
||||||
|
std::string arg = argv[i];
|
||||||
|
|
||||||
|
if (arg == "--help" || arg == "-h") {
|
||||||
|
print_usage();
|
||||||
|
return 0;
|
||||||
|
} else if (arg == "--no-log") {
|
||||||
|
enable_logging = false;
|
||||||
|
} else if (arg == "--no-stats") {
|
||||||
|
enable_performance_stats = false;
|
||||||
|
} else if (arg == "--pitch") {
|
||||||
|
enable_pitch_detection = true;
|
||||||
|
} else if (arg == "--no-visual") {
|
||||||
|
enable_visual_feedback = false;
|
||||||
|
} else if (arg[0] != '-') {
|
||||||
|
// Assume it's a buffer size
|
||||||
|
try {
|
||||||
|
buffer_size = std::stoul(arg);
|
||||||
|
if (buffer_size < 64 || buffer_size > 8192) {
|
||||||
|
std::cerr << " Buffer size must be between 64 and 8192" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
std::cerr << " Invalid buffer size: " << arg << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
std::cerr << " Unknown option: " << arg << std::endl;
|
||||||
|
print_usage();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up signal handling
|
||||||
|
std::signal(SIGINT, EnhancedBeatDetector::signal_handler);
|
||||||
|
std::signal(SIGTERM, EnhancedBeatDetector::signal_handler);
|
||||||
|
|
||||||
|
try {
|
||||||
|
EnhancedBeatDetector detector(buffer_size, enable_logging, enable_performance_stats,
|
||||||
|
enable_pitch_detection, enable_visual_feedback);
|
||||||
|
detector.run();
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
std::cerr << " Error: " << e.what() << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compilation command:
|
||||||
|
* g++ -std=c++17 -O3 -Wall -Wextra -I/usr/include/pipewire-0.3 -I/usr/include/spa-0.2 -I/usr/include/aubio \
|
||||||
|
* -o beat_detector beat_detector.cpp -lpipewire-0.3 -laubio -pthread
|
||||||
|
*/
|
||||||
BIN
dots/quickshell/assets/bongocat.gif
Normal file
BIN
dots/quickshell/assets/bongocat.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
BIN
dots/quickshell/assets/kurukuru.gif
Normal file
BIN
dots/quickshell/assets/kurukuru.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 97 KiB |
84
dots/quickshell/config/Appearance.qml
Normal file
84
dots/quickshell/config/Appearance.qml
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
readonly property Rounding rounding: Rounding {}
|
||||||
|
readonly property Spacing spacing: Spacing {}
|
||||||
|
readonly property Padding padding: Padding {}
|
||||||
|
readonly property Font font: Font {}
|
||||||
|
readonly property Anim anim: Anim {}
|
||||||
|
|
||||||
|
component Rounding: QtObject {
|
||||||
|
readonly property int small: 12
|
||||||
|
readonly property int normal: 17
|
||||||
|
readonly property int large: 25
|
||||||
|
readonly property int full: 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
component Spacing: QtObject {
|
||||||
|
readonly property int small: 7
|
||||||
|
readonly property int smaller: 10
|
||||||
|
readonly property int normal: 12
|
||||||
|
readonly property int larger: 15
|
||||||
|
readonly property int large: 20
|
||||||
|
}
|
||||||
|
|
||||||
|
component Padding: QtObject {
|
||||||
|
readonly property int small: 5
|
||||||
|
readonly property int smaller: 7
|
||||||
|
readonly property int normal: 10
|
||||||
|
readonly property int larger: 12
|
||||||
|
readonly property int large: 15
|
||||||
|
}
|
||||||
|
|
||||||
|
component FontFamily: QtObject {
|
||||||
|
readonly property string sans: "IBM Plex Sans"
|
||||||
|
readonly property string mono: "JetBrains Mono NF"
|
||||||
|
readonly property string material: "Material Symbols Rounded"
|
||||||
|
}
|
||||||
|
|
||||||
|
component FontSize: QtObject {
|
||||||
|
readonly property int small: 11
|
||||||
|
readonly property int smaller: 12
|
||||||
|
readonly property int normal: 13
|
||||||
|
readonly property int larger: 15
|
||||||
|
readonly property int large: 18
|
||||||
|
readonly property int extraLarge: 28
|
||||||
|
}
|
||||||
|
|
||||||
|
component Font: QtObject {
|
||||||
|
readonly property FontFamily family: FontFamily {}
|
||||||
|
readonly property FontSize size: FontSize {}
|
||||||
|
}
|
||||||
|
|
||||||
|
component AnimCurves: 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]
|
||||||
|
}
|
||||||
|
|
||||||
|
component AnimDurations: 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
|
||||||
|
}
|
||||||
|
|
||||||
|
component Anim: QtObject {
|
||||||
|
readonly property AnimCurves curves: AnimCurves {}
|
||||||
|
readonly property AnimDurations durations: AnimDurations {}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
dots/quickshell/config/BarConfig.qml
Normal file
22
dots/quickshell/config/BarConfig.qml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
JsonObject {
|
||||||
|
property JsonObject sizes: JsonObject {
|
||||||
|
property int innerHeight: 30
|
||||||
|
property int windowPreviewSize: 400
|
||||||
|
property int trayMenuWidth: 300
|
||||||
|
property int batteryWidth: 250
|
||||||
|
}
|
||||||
|
|
||||||
|
property JsonObject workspaces: JsonObject {
|
||||||
|
property int shown: 5
|
||||||
|
property bool rounded: true
|
||||||
|
property bool activeIndicator: true
|
||||||
|
property bool occupiedBg: false
|
||||||
|
property bool showWindows: true
|
||||||
|
property bool activeTrail: false
|
||||||
|
property string label: " "
|
||||||
|
property string occupiedLabel: " "
|
||||||
|
property string activeLabel: " "
|
||||||
|
}
|
||||||
|
}
|
||||||
9
dots/quickshell/config/BorderConfig.qml
Normal file
9
dots/quickshell/config/BorderConfig.qml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import "root:/services"
|
||||||
|
import Quickshell.Io
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
JsonObject {
|
||||||
|
property color colour: Colours.palette.m3surface
|
||||||
|
property int thickness: Appearance.padding.normal
|
||||||
|
property int rounding: Appearance.rounding.large
|
||||||
|
}
|
||||||
36
dots/quickshell/config/Config.qml
Normal file
36
dots/quickshell/config/Config.qml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import "root:/utils"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property alias bar: adapter.bar
|
||||||
|
property alias border: adapter.border
|
||||||
|
property alias dashboard: adapter.dashboard
|
||||||
|
property alias launcher: adapter.launcher
|
||||||
|
property alias notifs: adapter.notifs
|
||||||
|
property alias osd: adapter.osd
|
||||||
|
property alias session: adapter.session
|
||||||
|
|
||||||
|
FileView {
|
||||||
|
path: `${Paths.config}/shell.json`
|
||||||
|
watchChanges: true
|
||||||
|
onFileChanged: reload()
|
||||||
|
onAdapterUpdated: writeAdapter()
|
||||||
|
|
||||||
|
JsonAdapter {
|
||||||
|
id: adapter
|
||||||
|
|
||||||
|
property JsonObject bar: BarConfig {}
|
||||||
|
property JsonObject border: BorderConfig {}
|
||||||
|
property JsonObject dashboard: DashboardConfig {}
|
||||||
|
property JsonObject launcher: LauncherConfig {}
|
||||||
|
property JsonObject notifs: NotifsConfig {}
|
||||||
|
property JsonObject osd: OsdConfig {}
|
||||||
|
property JsonObject session: SessionConfig {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
23
dots/quickshell/config/DashboardConfig.qml
Normal file
23
dots/quickshell/config/DashboardConfig.qml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
JsonObject {
|
||||||
|
property int mediaUpdateInterval: 500
|
||||||
|
property int visualiserBars: 45
|
||||||
|
property string weatherLocation: "" // A lat,long pair, e.g. "37.8267,-122.4233"
|
||||||
|
|
||||||
|
property JsonObject sizes: JsonObject {
|
||||||
|
readonly property int tabIndicatorHeight: 3
|
||||||
|
readonly property int tabIndicatorSpacing: 5
|
||||||
|
readonly property int infoWidth: 200
|
||||||
|
readonly property int infoIconSize: 25
|
||||||
|
readonly property int dateTimeWidth: 110
|
||||||
|
readonly property int mediaWidth: 200
|
||||||
|
readonly property int mediaProgressSweep: 180
|
||||||
|
readonly property int mediaProgressThickness: 8
|
||||||
|
readonly property int resourceProgessThickness: 10
|
||||||
|
readonly property int weatherWidth: 250
|
||||||
|
readonly property int mediaCoverArtSize: 150
|
||||||
|
readonly property int mediaVisualiserSize: 80
|
||||||
|
readonly property int resourceSize: 200
|
||||||
|
}
|
||||||
|
}
|
||||||
15
dots/quickshell/config/LauncherConfig.qml
Normal file
15
dots/quickshell/config/LauncherConfig.qml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
JsonObject {
|
||||||
|
property int maxShown: 8
|
||||||
|
property int maxWallpapers: 9 // Warning: even numbers look bad
|
||||||
|
property string actionPrefix: ">"
|
||||||
|
property bool enableDangerousActions: false // Allow actions that can cause losing data, like shutdown, reboot and logout
|
||||||
|
|
||||||
|
property JsonObject sizes: JsonObject {
|
||||||
|
property int itemWidth: 600
|
||||||
|
property int itemHeight: 57
|
||||||
|
property int wallpaperWidth: 280
|
||||||
|
property int wallpaperHeight: 200
|
||||||
|
}
|
||||||
|
}
|
||||||
15
dots/quickshell/config/NotifsConfig.qml
Normal file
15
dots/quickshell/config/NotifsConfig.qml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
JsonObject {
|
||||||
|
property bool expire: true
|
||||||
|
property int defaultExpireTimeout: 3000
|
||||||
|
property real clearThreshold: 0.3
|
||||||
|
property int expandThreshold: 20
|
||||||
|
property bool actionOnClick: false
|
||||||
|
|
||||||
|
property JsonObject sizes: JsonObject {
|
||||||
|
property int width: 400
|
||||||
|
property int image: 41
|
||||||
|
property int badge: 20
|
||||||
|
}
|
||||||
|
}
|
||||||
10
dots/quickshell/config/OsdConfig.qml
Normal file
10
dots/quickshell/config/OsdConfig.qml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
JsonObject {
|
||||||
|
property int hideDelay: 2000
|
||||||
|
|
||||||
|
property JsonObject sizes: JsonObject {
|
||||||
|
property int sliderWidth: 30
|
||||||
|
property int sliderHeight: 150
|
||||||
|
}
|
||||||
|
}
|
||||||
9
dots/quickshell/config/SessionConfig.qml
Normal file
9
dots/quickshell/config/SessionConfig.qml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
JsonObject {
|
||||||
|
property int dragThreshold: 30
|
||||||
|
|
||||||
|
property JsonObject sizes: JsonObject {
|
||||||
|
property int button: 80
|
||||||
|
}
|
||||||
|
}
|
||||||
65
dots/quickshell/modules/Shortcuts.qml
Normal file
65
dots/quickshell/modules/Shortcuts.qml
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
Scope {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property bool launcherInterrupted
|
||||||
|
|
||||||
|
CustomShortcut {
|
||||||
|
name: "showall"
|
||||||
|
description: "Toggle launcher, dashboard and osd"
|
||||||
|
onPressed: {
|
||||||
|
const v = Visibilities.getForActive();
|
||||||
|
v.launcher = v.dashboard = v.osd = !(v.launcher || v.dashboard || v.osd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomShortcut {
|
||||||
|
name: "session"
|
||||||
|
description: "Toggle session menu"
|
||||||
|
onPressed: {
|
||||||
|
const visibilities = Visibilities.getForActive();
|
||||||
|
visibilities.session = !visibilities.session;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomShortcut {
|
||||||
|
name: "launcher"
|
||||||
|
description: "Toggle launcher"
|
||||||
|
onPressed: root.launcherInterrupted = false
|
||||||
|
onReleased: {
|
||||||
|
if (!root.launcherInterrupted) {
|
||||||
|
const visibilities = Visibilities.getForActive();
|
||||||
|
visibilities.launcher = !visibilities.launcher;
|
||||||
|
}
|
||||||
|
root.launcherInterrupted = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomShortcut {
|
||||||
|
name: "launcherInterrupt"
|
||||||
|
description: "Interrupt launcher keybind"
|
||||||
|
onPressed: root.launcherInterrupted = true
|
||||||
|
}
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
target: "drawers"
|
||||||
|
|
||||||
|
function toggle(drawer: string): void {
|
||||||
|
if (list().split("\n").includes(drawer)) {
|
||||||
|
const visibilities = Visibilities.getForActive();
|
||||||
|
visibilities[drawer] = !visibilities[drawer];
|
||||||
|
} else {
|
||||||
|
console.warn(`[IPC] Drawer "${drawer}" does not exist`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function list(): string {
|
||||||
|
const visibilities = Visibilities.getForActive();
|
||||||
|
return Object.keys(visibilities).filter(k => typeof visibilities[k] === "boolean").join("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
dots/quickshell/modules/background/Background.qml
Normal file
26
dots/quickshell/modules/background/Background.qml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
|
|
||||||
|
Variants {
|
||||||
|
model: Quickshell.screens
|
||||||
|
|
||||||
|
StyledWindow {
|
||||||
|
id: win
|
||||||
|
|
||||||
|
required property ShellScreen modelData
|
||||||
|
|
||||||
|
screen: modelData
|
||||||
|
name: "background"
|
||||||
|
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||||
|
WlrLayershell.layer: WlrLayer.Background
|
||||||
|
color: "black"
|
||||||
|
|
||||||
|
anchors.top: true
|
||||||
|
anchors.bottom: true
|
||||||
|
anchors.left: true
|
||||||
|
anchors.right: true
|
||||||
|
|
||||||
|
Wallpaper {}
|
||||||
|
}
|
||||||
|
}
|
||||||
71
dots/quickshell/modules/background/Wallpaper.qml
Normal file
71
dots/quickshell/modules/background/Wallpaper.qml
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property string source: Wallpapers.current
|
||||||
|
property Image current: one
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
onSourceChanged: {
|
||||||
|
if (current === one)
|
||||||
|
two.update();
|
||||||
|
else
|
||||||
|
one.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
Img {
|
||||||
|
id: one
|
||||||
|
}
|
||||||
|
|
||||||
|
Img {
|
||||||
|
id: two
|
||||||
|
}
|
||||||
|
|
||||||
|
component Img: CachingImage {
|
||||||
|
id: img
|
||||||
|
|
||||||
|
function update(): void {
|
||||||
|
if (path === root.source)
|
||||||
|
root.current = this;
|
||||||
|
else
|
||||||
|
path = root.source;
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
opacity: 0
|
||||||
|
scale: Wallpapers.showPreview ? 1 : 0.8
|
||||||
|
|
||||||
|
onStatusChanged: {
|
||||||
|
if (status === Image.Ready)
|
||||||
|
root.current = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
states: State {
|
||||||
|
name: "visible"
|
||||||
|
when: root.current === img
|
||||||
|
|
||||||
|
PropertyChanges {
|
||||||
|
img.opacity: 1
|
||||||
|
img.scale: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transitions: Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
target: img
|
||||||
|
properties: "opacity,scale"
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
174
dots/quickshell/modules/bar/Bar.qml
Normal file
174
dots/quickshell/modules/bar/Bar.qml
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import "root:/modules/bar/popouts" as BarPopouts
|
||||||
|
import "components"
|
||||||
|
import "components/workspaces"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property ShellScreen screen
|
||||||
|
required property BarPopouts.Wrapper popouts
|
||||||
|
|
||||||
|
function checkPopout(y: real): void {
|
||||||
|
const spacing = Appearance.spacing.small;
|
||||||
|
const aw = activeWindow.child;
|
||||||
|
const awy = activeWindow.y + aw.y;
|
||||||
|
|
||||||
|
const ty = tray.y;
|
||||||
|
const th = tray.implicitHeight;
|
||||||
|
const trayItems = tray.items;
|
||||||
|
|
||||||
|
const n = statusIconsInner.network;
|
||||||
|
const ny = statusIcons.y + statusIconsInner.y + n.y - spacing / 2;
|
||||||
|
|
||||||
|
const bls = statusIcons.y + statusIconsInner.y + statusIconsInner.bs - spacing / 2;
|
||||||
|
const ble = statusIcons.y + statusIconsInner.y + statusIconsInner.be + spacing / 2;
|
||||||
|
|
||||||
|
const b = statusIconsInner.battery;
|
||||||
|
const by = statusIcons.y + statusIconsInner.y + b.y - spacing / 2;
|
||||||
|
|
||||||
|
if (y >= awy && y <= awy + aw.implicitHeight) {
|
||||||
|
popouts.currentName = "activewindow";
|
||||||
|
popouts.currentCenter = Qt.binding(() => activeWindow.y + aw.y + aw.implicitHeight / 2);
|
||||||
|
popouts.hasCurrent = true;
|
||||||
|
} else if (y > ty && y < ty + th) {
|
||||||
|
const index = Math.floor(((y - ty) / th) * trayItems.count);
|
||||||
|
const item = trayItems.itemAt(index);
|
||||||
|
|
||||||
|
popouts.currentName = `traymenu${index}`;
|
||||||
|
popouts.currentCenter = Qt.binding(() => tray.y + item.y + item.implicitHeight / 2);
|
||||||
|
popouts.hasCurrent = true;
|
||||||
|
} else if (y >= ny && y <= ny + n.implicitHeight + spacing) {
|
||||||
|
popouts.currentName = "network";
|
||||||
|
popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + n.y + n.implicitHeight / 2);
|
||||||
|
popouts.hasCurrent = true;
|
||||||
|
} else if (y >= bls && y <= ble) {
|
||||||
|
popouts.currentName = "bluetooth";
|
||||||
|
popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + statusIconsInner.bs + (statusIconsInner.be - statusIconsInner.bs) / 2);
|
||||||
|
popouts.hasCurrent = true;
|
||||||
|
} else if (y >= by && y <= by + b.implicitHeight + spacing) {
|
||||||
|
popouts.currentName = "battery";
|
||||||
|
popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + b.y + b.implicitHeight / 2);
|
||||||
|
popouts.hasCurrent = true;
|
||||||
|
} else {
|
||||||
|
popouts.hasCurrent = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
|
||||||
|
implicitWidth: child.implicitWidth + Config.border.thickness * 2
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: child
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
implicitWidth: Math.max(osIcon.implicitWidth, workspaces.implicitWidth, activeWindow.implicitWidth, tray.implicitWidth, clock.implicitWidth, statusIcons.implicitWidth, power.implicitWidth)
|
||||||
|
|
||||||
|
OsIcon {
|
||||||
|
id: osIcon
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: Appearance.padding.large
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: workspaces
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.top: osIcon.bottom
|
||||||
|
anchors.topMargin: Appearance.spacing.normal
|
||||||
|
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
color: Colours.palette.m3surfaceContainer
|
||||||
|
|
||||||
|
implicitWidth: workspacesInner.implicitWidth + Appearance.padding.small * 2
|
||||||
|
implicitHeight: workspacesInner.implicitHeight + Appearance.padding.small * 2
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.leftMargin: -Config.border.thickness
|
||||||
|
anchors.rightMargin: -Config.border.thickness
|
||||||
|
|
||||||
|
onWheel: event => {
|
||||||
|
const activeWs = Hyprland.activeClient?.workspace?.name;
|
||||||
|
if (activeWs?.startsWith("special:"))
|
||||||
|
Hyprland.dispatch(`togglespecialworkspace ${activeWs.slice(8)}`);
|
||||||
|
else if (event.angleDelta.y < 0 || Hyprland.activeWsId > 1)
|
||||||
|
Hyprland.dispatch(`workspace r${event.angleDelta.y > 0 ? "-" : "+"}1`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Workspaces {
|
||||||
|
id: workspacesInner
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ActiveWindow {
|
||||||
|
id: activeWindow
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.top: workspaces.bottom
|
||||||
|
anchors.bottom: tray.top
|
||||||
|
anchors.margins: Appearance.spacing.large
|
||||||
|
|
||||||
|
monitor: Brightness.getMonitorForScreen(root.screen)
|
||||||
|
}
|
||||||
|
|
||||||
|
Tray {
|
||||||
|
id: tray
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.bottom: clock.top
|
||||||
|
anchors.bottomMargin: Appearance.spacing.larger
|
||||||
|
}
|
||||||
|
|
||||||
|
Clock {
|
||||||
|
id: clock
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.bottom: statusIcons.top
|
||||||
|
anchors.bottomMargin: Appearance.spacing.normal
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: statusIcons
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: power.top
|
||||||
|
anchors.bottomMargin: Appearance.spacing.normal
|
||||||
|
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
color: Colours.palette.m3surfaceContainer
|
||||||
|
|
||||||
|
implicitHeight: statusIconsInner.implicitHeight + Appearance.padding.normal * 2
|
||||||
|
|
||||||
|
StatusIcons {
|
||||||
|
id: statusIconsInner
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Power {
|
||||||
|
id: power
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.bottomMargin: Appearance.padding.large
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
140
dots/quickshell/modules/bar/components/ActiveWindow.qml
Normal file
140
dots/quickshell/modules/bar/components/ActiveWindow.qml
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/utils"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Brightness.Monitor monitor
|
||||||
|
property color colour: Colours.palette.m3primary
|
||||||
|
readonly property Item child: child
|
||||||
|
|
||||||
|
implicitWidth: child.implicitWidth
|
||||||
|
implicitHeight: child.implicitHeight
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: child.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
onWheel: event => {
|
||||||
|
if (event.angleDelta.y > 0)
|
||||||
|
Audio.setVolume(Audio.volume + 0.1);
|
||||||
|
else if (event.angleDelta.y < 0)
|
||||||
|
Audio.setVolume(Audio.volume - 0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.top: child.bottom
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
onWheel: event => {
|
||||||
|
const monitor = root.monitor;
|
||||||
|
if (event.angleDelta.y > 0)
|
||||||
|
monitor.setBrightness(monitor.brightness + 0.1);
|
||||||
|
else if (event.angleDelta.y < 0)
|
||||||
|
monitor.setBrightness(monitor.brightness - 0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: child
|
||||||
|
|
||||||
|
property Item current: text1
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
implicitWidth: Math.max(icon.implicitWidth, current.implicitHeight)
|
||||||
|
implicitHeight: icon.implicitHeight + current.implicitWidth + current.anchors.topMargin
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
text: Icons.getAppCategoryIcon(Hyprland.activeClient?.wmClass, "desktop_windows")
|
||||||
|
color: root.colour
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Title {
|
||||||
|
id: text1
|
||||||
|
}
|
||||||
|
|
||||||
|
Title {
|
||||||
|
id: text2
|
||||||
|
}
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: metrics
|
||||||
|
|
||||||
|
text: Hyprland.activeClient?.title ?? qsTr("Desktop")
|
||||||
|
font.pointSize: Appearance.font.size.smaller
|
||||||
|
font.family: Appearance.font.family.mono
|
||||||
|
elide: Qt.ElideRight
|
||||||
|
elideWidth: root.height - icon.height
|
||||||
|
|
||||||
|
onTextChanged: {
|
||||||
|
const next = child.current === text1 ? text2 : text1;
|
||||||
|
next.text = elidedText;
|
||||||
|
child.current = next;
|
||||||
|
}
|
||||||
|
onElideWidthChanged: child.current.text = elidedText
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitWidth {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Title: StyledText {
|
||||||
|
id: text
|
||||||
|
|
||||||
|
anchors.horizontalCenter: icon.horizontalCenter
|
||||||
|
anchors.top: icon.bottom
|
||||||
|
anchors.topMargin: Appearance.spacing.small
|
||||||
|
|
||||||
|
font.pointSize: metrics.font.pointSize
|
||||||
|
font.family: metrics.font.family
|
||||||
|
color: root.colour
|
||||||
|
opacity: child.current === this ? 1 : 0
|
||||||
|
|
||||||
|
transform: Rotation {
|
||||||
|
angle: 90
|
||||||
|
origin.x: text.implicitHeight / 2
|
||||||
|
origin.y: text.implicitHeight / 2
|
||||||
|
}
|
||||||
|
|
||||||
|
width: implicitHeight
|
||||||
|
height: implicitWidth
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
33
dots/quickshell/modules/bar/components/Clock.qml
Normal file
33
dots/quickshell/modules/bar/components/Clock.qml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property color colour: Colours.palette.m3tertiary
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
text: "calendar_month"
|
||||||
|
color: root.colour
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: text
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
horizontalAlignment: StyledText.AlignHCenter
|
||||||
|
text: Time.format("hh\nmm")
|
||||||
|
font.pointSize: Appearance.font.size.smaller
|
||||||
|
font.family: Appearance.font.family.mono
|
||||||
|
color: root.colour
|
||||||
|
}
|
||||||
|
}
|
||||||
11
dots/quickshell/modules/bar/components/OsIcon.qml
Normal file
11
dots/quickshell/modules/bar/components/OsIcon.qml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/utils"
|
||||||
|
import "root:/config"
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: Icons.osIcon
|
||||||
|
font.pointSize: Appearance.font.size.smaller
|
||||||
|
font.family: Appearance.font.family.mono
|
||||||
|
color: Colours.palette.m3tertiary
|
||||||
|
}
|
||||||
27
dots/quickshell/modules/bar/components/Power.qml
Normal file
27
dots/quickshell/modules/bar/components/Power.qml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
text: "power_settings_new"
|
||||||
|
color: Colours.palette.m3error
|
||||||
|
font.bold: true
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
anchors.fill: undefined
|
||||||
|
anchors.centerIn: parent
|
||||||
|
anchors.horizontalCenterOffset: 1
|
||||||
|
|
||||||
|
implicitWidth: parent.implicitHeight + Appearance.padding.small * 2
|
||||||
|
implicitHeight: implicitWidth
|
||||||
|
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
const v = Visibilities.screens[QsWindow.window.screen];
|
||||||
|
v.session = !v.session;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
114
dots/quickshell/modules/bar/components/StatusIcons.qml
Normal file
114
dots/quickshell/modules/bar/components/StatusIcons.qml
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/utils"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Services.UPower
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property color colour: Colours.palette.m3secondary
|
||||||
|
|
||||||
|
readonly property Item network: network
|
||||||
|
readonly property real bs: bluetooth.y
|
||||||
|
readonly property real be: repeater.count > 0 ? devices.y + devices.implicitHeight : bluetooth.y + bluetooth.implicitHeight
|
||||||
|
readonly property Item battery: battery
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
implicitWidth: Math.max(network.implicitWidth, bluetooth.implicitWidth, devices.implicitWidth, battery.implicitWidth)
|
||||||
|
implicitHeight: network.implicitHeight + bluetooth.implicitHeight + bluetooth.anchors.topMargin + (repeater.count > 0 ? devices.implicitHeight + devices.anchors.topMargin : 0) + battery.implicitHeight + battery.anchors.topMargin
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: network
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
text: Network.active ? Icons.getNetworkIcon(Network.active.strength ?? 0) : "wifi_off"
|
||||||
|
color: root.colour
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: bluetooth
|
||||||
|
|
||||||
|
anchors.horizontalCenter: network.horizontalCenter
|
||||||
|
anchors.top: network.bottom
|
||||||
|
anchors.topMargin: Appearance.spacing.small
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
text: Bluetooth.powered ? "bluetooth" : "bluetooth_disabled"
|
||||||
|
color: root.colour
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: devices
|
||||||
|
|
||||||
|
anchors.horizontalCenter: bluetooth.horizontalCenter
|
||||||
|
anchors.top: bluetooth.bottom
|
||||||
|
anchors.topMargin: Appearance.spacing.small
|
||||||
|
|
||||||
|
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)
|
||||||
|
color: root.colour
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: battery
|
||||||
|
|
||||||
|
anchors.horizontalCenter: devices.horizontalCenter
|
||||||
|
anchors.top: repeater.count > 0 ? devices.bottom : bluetooth.bottom
|
||||||
|
anchors.topMargin: Appearance.spacing.small
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
text: {
|
||||||
|
if (!UPower.displayDevice.isLaptopBattery) {
|
||||||
|
if (PowerProfiles.profile === PowerProfile.PowerSaver)
|
||||||
|
return "energy_savings_leaf";
|
||||||
|
if (PowerProfiles.profile === PowerProfile.Performance)
|
||||||
|
return "rocket_launch";
|
||||||
|
return "balance";
|
||||||
|
}
|
||||||
|
|
||||||
|
const perc = UPower.displayDevice.percentage;
|
||||||
|
const charging = !UPower.onBattery;
|
||||||
|
if (perc === 1)
|
||||||
|
return charging ? "battery_charging_full" : "battery_full";
|
||||||
|
let level = Math.floor(perc * 7);
|
||||||
|
if (charging && (level === 4 || level === 1))
|
||||||
|
level--;
|
||||||
|
return charging ? `battery_charging_${(level + 3) * 10}` : `battery_${level}_bar`;
|
||||||
|
}
|
||||||
|
color: !UPower.onBattery || UPower.displayDevice.percentage > 0.2 ? root.colour : Colours.palette.m3error
|
||||||
|
fill: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitWidth {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
56
dots/quickshell/modules/bar/components/Tray.qml
Normal file
56
dots/quickshell/modules/bar/components/Tray.qml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
import "root:/config"
|
||||||
|
import Quickshell.Services.SystemTray
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
readonly property Repeater items: items
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
visible: width > 0 && height > 0 // To avoid warnings about being visible with no size
|
||||||
|
|
||||||
|
implicitWidth: layout.implicitWidth
|
||||||
|
implicitHeight: layout.implicitHeight
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: layout
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
add: Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "scale"
|
||||||
|
from: 0
|
||||||
|
to: 1
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standardDecel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
id: items
|
||||||
|
|
||||||
|
model: SystemTray.items
|
||||||
|
|
||||||
|
TrayItem {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitWidth {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
48
dots/quickshell/modules/bar/components/TrayItem.qml
Normal file
48
dots/quickshell/modules/bar/components/TrayItem.qml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import Quickshell.Services.SystemTray
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property SystemTrayItem modelData
|
||||||
|
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
|
implicitWidth: Appearance.font.size.small * 2
|
||||||
|
implicitHeight: Appearance.font.size.small * 2
|
||||||
|
|
||||||
|
onClicked: event => {
|
||||||
|
if (event.button === Qt.LeftButton)
|
||||||
|
modelData.activate();
|
||||||
|
else if (modelData.hasMenu)
|
||||||
|
menu.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO custom menu
|
||||||
|
QsMenuAnchor {
|
||||||
|
id: menu
|
||||||
|
|
||||||
|
menu: root.modelData.menu
|
||||||
|
anchor.window: this.QsWindow.window
|
||||||
|
}
|
||||||
|
|
||||||
|
IconImage {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
source: {
|
||||||
|
let icon = root.modelData.icon;
|
||||||
|
if (icon.includes("?path=")) {
|
||||||
|
const [name, path] = icon.split("?path=");
|
||||||
|
icon = `file://${path}/${name.slice(name.lastIndexOf("/") + 1)}`;
|
||||||
|
}
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
asynchronous: true
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Effects
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property list<Workspace> workspaces
|
||||||
|
required property Item mask
|
||||||
|
required property real maskWidth
|
||||||
|
required property real maskHeight
|
||||||
|
required property int groupOffset
|
||||||
|
|
||||||
|
readonly property int currentWsIdx: Hyprland.activeWsId - 1 - groupOffset
|
||||||
|
property real leading: getWsY(currentWsIdx)
|
||||||
|
property real trailing: getWsY(currentWsIdx)
|
||||||
|
property real currentSize: workspaces[currentWsIdx]?.size ?? 0
|
||||||
|
property real offset: Math.min(leading, trailing)
|
||||||
|
property real size: {
|
||||||
|
const s = Math.abs(leading - trailing) + currentSize;
|
||||||
|
if (Config.bar.workspaces.activeTrail && lastWs > currentWsIdx)
|
||||||
|
return Math.min(getWsY(lastWs) + (workspaces[lastWs]?.size ?? 0) - offset, s);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
property int cWs
|
||||||
|
property int lastWs
|
||||||
|
|
||||||
|
function getWsY(idx: int): real {
|
||||||
|
let y = 0;
|
||||||
|
for (let i = 0; i < idx; i++)
|
||||||
|
y += workspaces[i]?.size ?? 0;
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
onCurrentWsIdxChanged: {
|
||||||
|
lastWs = cWs;
|
||||||
|
cWs = currentWsIdx;
|
||||||
|
}
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
x: 1
|
||||||
|
y: offset + 1
|
||||||
|
implicitWidth: Config.bar.sizes.innerHeight - 2
|
||||||
|
implicitHeight: size - 2
|
||||||
|
radius: Config.bar.workspaces.rounded ? Appearance.rounding.full : 0
|
||||||
|
color: Colours.palette.m3primary
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: base
|
||||||
|
|
||||||
|
visible: false
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Colours.palette.m3onPrimary
|
||||||
|
}
|
||||||
|
|
||||||
|
MultiEffect {
|
||||||
|
source: base
|
||||||
|
maskSource: root.mask
|
||||||
|
maskEnabled: true
|
||||||
|
maskSpreadAtMin: 1
|
||||||
|
maskThresholdMin: 0.5
|
||||||
|
|
||||||
|
x: 0
|
||||||
|
y: -parent.offset
|
||||||
|
implicitWidth: root.maskWidth
|
||||||
|
implicitHeight: root.maskHeight
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on leading {
|
||||||
|
enabled: Config.bar.workspaces.activeTrail
|
||||||
|
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on trailing {
|
||||||
|
enabled: Config.bar.workspaces.activeTrail
|
||||||
|
|
||||||
|
Anim {
|
||||||
|
duration: Appearance.anim.durations.normal * 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on currentSize {
|
||||||
|
enabled: Config.bar.workspaces.activeTrail
|
||||||
|
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on offset {
|
||||||
|
enabled: !Config.bar.workspaces.activeTrail
|
||||||
|
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on size {
|
||||||
|
enabled: !Config.bar.workspaces.activeTrail
|
||||||
|
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Anim: NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property list<Workspace> workspaces
|
||||||
|
required property var occupied
|
||||||
|
required property int groupOffset
|
||||||
|
|
||||||
|
property list<var> pills: []
|
||||||
|
|
||||||
|
onOccupiedChanged: {
|
||||||
|
let count = 0;
|
||||||
|
const start = groupOffset;
|
||||||
|
const end = start + Config.bar.workspaces.shown;
|
||||||
|
for (const [ws, occ] of Object.entries(occupied)) {
|
||||||
|
if (ws > start && ws <= end && occ) {
|
||||||
|
if (!occupied[ws - 1]) {
|
||||||
|
if (pills[count])
|
||||||
|
pills[count].start = ws;
|
||||||
|
else
|
||||||
|
pills.push(pillComp.createObject(root, {
|
||||||
|
start: ws
|
||||||
|
}));
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if (!occupied[ws + 1])
|
||||||
|
pills[count - 1].end = ws;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pills.length > count)
|
||||||
|
pills.splice(count, pills.length - count).forEach(p => p.destroy());
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: ScriptModel {
|
||||||
|
values: root.pills.filter(p => p)
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: rect
|
||||||
|
|
||||||
|
required property var modelData
|
||||||
|
|
||||||
|
readonly property Workspace start: root.workspaces[modelData.start - 1 - root.groupOffset] ?? null
|
||||||
|
readonly property Workspace end: root.workspaces[modelData.end - 1 - root.groupOffset] ?? null
|
||||||
|
|
||||||
|
color: Colours.alpha(Colours.palette.m3surfaceContainerHigh, true)
|
||||||
|
radius: Config.bar.workspaces.rounded ? Appearance.rounding.full : 0
|
||||||
|
|
||||||
|
x: start?.x ?? 0
|
||||||
|
y: start?.y ?? 0
|
||||||
|
implicitWidth: Config.bar.sizes.innerHeight
|
||||||
|
implicitHeight: end?.y + end?.height - start?.y
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
scale: 0
|
||||||
|
Component.onCompleted: scale = 1
|
||||||
|
|
||||||
|
Behavior on scale {
|
||||||
|
Anim {
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standardDecel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on x {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on y {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Anim: NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
|
||||||
|
component Pill: QtObject {
|
||||||
|
property int start
|
||||||
|
property int end
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: pillComp
|
||||||
|
|
||||||
|
Pill {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/utils"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property int index
|
||||||
|
required property var occupied
|
||||||
|
required property int groupOffset
|
||||||
|
|
||||||
|
readonly property bool isWorkspace: true // Flag for finding workspace children
|
||||||
|
// Unanimated prop for others to use as reference
|
||||||
|
readonly property real size: childrenRect.height + (hasWindows ? Appearance.padding.normal : 0)
|
||||||
|
|
||||||
|
readonly property int ws: groupOffset + index + 1
|
||||||
|
readonly property bool isOccupied: occupied[ws] ?? false
|
||||||
|
readonly property bool hasWindows: isOccupied && Config.bar.workspaces.showWindows
|
||||||
|
|
||||||
|
Layout.preferredWidth: childrenRect.width
|
||||||
|
Layout.preferredHeight: size
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: indicator
|
||||||
|
|
||||||
|
readonly property string label: Config.bar.workspaces.label || root.ws
|
||||||
|
readonly property string occupiedLabel: Config.bar.workspaces.occupiedLabel || label
|
||||||
|
readonly property string activeLabel: Config.bar.workspaces.activeLabel || (root.isOccupied ? occupiedLabel : label)
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
text: Hyprland.activeWsId === root.ws ? activeLabel : root.isOccupied ? occupiedLabel : label
|
||||||
|
color: Config.bar.workspaces.occupiedBg || root.isOccupied || Hyprland.activeWsId === root.ws ? Colours.palette.m3onSurface : Colours.palette.m3outlineVariant
|
||||||
|
horizontalAlignment: StyledText.AlignHCenter
|
||||||
|
verticalAlignment: StyledText.AlignVCenter
|
||||||
|
|
||||||
|
width: Config.bar.sizes.innerHeight
|
||||||
|
height: Config.bar.sizes.innerHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: windows
|
||||||
|
|
||||||
|
active: Config.bar.workspaces.showWindows
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
|
anchors.horizontalCenter: indicator.horizontalCenter
|
||||||
|
anchors.top: indicator.bottom
|
||||||
|
|
||||||
|
sourceComponent: Column {
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
add: Transition {
|
||||||
|
Anim {
|
||||||
|
properties: "scale"
|
||||||
|
from: 0
|
||||||
|
to: 1
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standardDecel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: ScriptModel {
|
||||||
|
values: Hyprland.clients.filter(c => c.workspace?.id === root.ws)
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
required property Hyprland.Client modelData
|
||||||
|
|
||||||
|
text: Icons.getAppCategoryIcon(modelData.wmClass, "terminal")
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on Layout.preferredWidth {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on Layout.preferredHeight {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Anim: NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
readonly property list<Workspace> workspaces: layout.children.filter(c => c.isWorkspace).sort((w1, w2) => w1.ws - w2.ws)
|
||||||
|
readonly property var occupied: Hyprland.workspaces.values.reduce((acc, curr) => {
|
||||||
|
acc[curr.id] = curr.lastIpcObject.windows > 0;
|
||||||
|
return acc;
|
||||||
|
}, {})
|
||||||
|
readonly property int groupOffset: Math.floor((Hyprland.activeWsId - 1) / Config.bar.workspaces.shown) * Config.bar.workspaces.shown
|
||||||
|
|
||||||
|
implicitWidth: layout.implicitWidth
|
||||||
|
implicitHeight: layout.implicitHeight
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: layout
|
||||||
|
|
||||||
|
spacing: 0
|
||||||
|
layer.enabled: true
|
||||||
|
layer.smooth: true
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: Config.bar.workspaces.shown
|
||||||
|
|
||||||
|
Workspace {
|
||||||
|
occupied: root.occupied
|
||||||
|
groupOffset: root.groupOffset
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
active: Config.bar.workspaces.occupiedBg
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
|
z: -1
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
sourceComponent: OccupiedBg {
|
||||||
|
workspaces: root.workspaces
|
||||||
|
occupied: root.occupied
|
||||||
|
groupOffset: root.groupOffset
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
active: Config.bar.workspaces.activeIndicator
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
|
sourceComponent: ActiveIndicator {
|
||||||
|
workspaces: root.workspaces
|
||||||
|
mask: layout
|
||||||
|
maskWidth: root.width
|
||||||
|
maskHeight: root.height
|
||||||
|
groupOffset: root.groupOffset
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
onPressed: event => {
|
||||||
|
const ws = layout.childAt(event.x, event.y).index + root.groupOffset + 1;
|
||||||
|
if (Hyprland.activeWsId !== ws)
|
||||||
|
Hyprland.dispatch(`workspace ${ws}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
75
dots/quickshell/modules/bar/popouts/ActiveWindow.qml
Normal file
75
dots/quickshell/modules/bar/popouts/ActiveWindow.qml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/utils"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
implicitWidth: Hyprland.activeClient ? child.implicitWidth : -Appearance.padding.large * 2
|
||||||
|
implicitHeight: child.implicitHeight
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: child
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: detailsRow
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
IconImage {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
implicitSize: details.implicitHeight
|
||||||
|
source: Icons.getAppIcon(Hyprland.activeClient?.wmClass ?? "", "image-missing")
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: details
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: Hyprland.activeClient?.title ?? ""
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
|
||||||
|
elide: Text.ElideRight
|
||||||
|
width: preview.implicitWidth - icon.implicitWidth - detailsRow.spacing
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: Hyprland.activeClient?.wmClass ?? ""
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
|
||||||
|
elide: Text.ElideRight
|
||||||
|
width: preview.implicitWidth - icon.implicitWidth - detailsRow.spacing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ClippingWrapperRectangle {
|
||||||
|
color: "transparent"
|
||||||
|
radius: Appearance.rounding.small
|
||||||
|
|
||||||
|
ScreencopyView {
|
||||||
|
id: preview
|
||||||
|
|
||||||
|
captureSource: Hyprland.activeClient ? ToplevelManager.activeToplevel : null
|
||||||
|
live: visible
|
||||||
|
|
||||||
|
constraintSize.width: Config.bar.sizes.windowPreviewSize
|
||||||
|
constraintSize.height: Config.bar.sizes.windowPreviewSize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Anim: NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
74
dots/quickshell/modules/bar/popouts/Background.qml
Normal file
74
dots/quickshell/modules/bar/popouts/Background.qml
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Shapes
|
||||||
|
|
||||||
|
ShapePath {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Wrapper wrapper
|
||||||
|
required property bool invertBottomRounding
|
||||||
|
readonly property real rounding: Config.border.rounding
|
||||||
|
readonly property bool flatten: wrapper.width < rounding * 2
|
||||||
|
readonly property real roundingX: flatten ? wrapper.width / 2 : rounding
|
||||||
|
property real ibr: invertBottomRounding ? -1 : 1
|
||||||
|
|
||||||
|
strokeWidth: -1
|
||||||
|
fillColor: Config.border.colour
|
||||||
|
|
||||||
|
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 * root.ibr
|
||||||
|
relativeY: root.rounding
|
||||||
|
radiusX: Math.min(root.rounding, root.wrapper.width)
|
||||||
|
radiusY: root.rounding
|
||||||
|
direction: root.ibr < 0 ? PathArc.Counterclockwise : PathArc.Clockwise
|
||||||
|
}
|
||||||
|
PathLine {
|
||||||
|
relativeX: -(root.wrapper.width - root.roundingX - root.roundingX * root.ibr)
|
||||||
|
relativeY: 0
|
||||||
|
}
|
||||||
|
PathArc {
|
||||||
|
relativeX: -root.roundingX
|
||||||
|
relativeY: root.rounding
|
||||||
|
radiusX: Math.min(root.rounding, root.wrapper.width)
|
||||||
|
radiusY: root.rounding
|
||||||
|
direction: PathArc.Counterclockwise
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on fillColor {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on ibr {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
235
dots/quickshell/modules/bar/popouts/Battery.qml
Normal file
235
dots/quickshell/modules/bar/popouts/Battery.qml
Normal file
@@ -0,0 +1,235 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell.Services.UPower
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
width: Config.bar.sizes.batteryWidth
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: UPower.displayDevice.isLaptopBattery ? qsTr("Remaining: %1%").arg(Math.round(UPower.displayDevice.percentage * 100)) : qsTr("No battery detected")
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
function formatSeconds(s: int, fallback: string): string {
|
||||||
|
const day = Math.floor(s / 86400);
|
||||||
|
const hr = Math.floor(s / 3600) % 60;
|
||||||
|
const min = Math.floor(s / 60) % 60;
|
||||||
|
|
||||||
|
let comps = [];
|
||||||
|
if (day > 0)
|
||||||
|
comps.push(`${day} days`);
|
||||||
|
if (hr > 0)
|
||||||
|
comps.push(`${hr} hours`);
|
||||||
|
if (min > 0)
|
||||||
|
comps.push(`${min} mins`);
|
||||||
|
|
||||||
|
return comps.join(", ") || fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
text: UPower.displayDevice.isLaptopBattery ? qsTr("Time %1: %2").arg(UPower.onBattery ? "remaining" : "until charged").arg(UPower.onBattery ? formatSeconds(UPower.displayDevice.timeToEmpty, "Calculating...") : formatSeconds(UPower.displayDevice.timeToFull, "Fully charged!")) : qsTr("Power profile: %1").arg(PowerProfile.toString(PowerProfiles.profile))
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
active: PowerProfiles.degradationReason !== PerformanceDegradationReason.None
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
|
height: active ? (item?.implicitHeight ?? 0) : 0
|
||||||
|
|
||||||
|
sourceComponent: StyledRect {
|
||||||
|
implicitWidth: child.implicitWidth + Appearance.padding.normal * 2
|
||||||
|
implicitHeight: child.implicitHeight + Appearance.padding.smaller * 2
|
||||||
|
|
||||||
|
color: Colours.palette.m3error
|
||||||
|
radius: Appearance.rounding.normal
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: child
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: -font.pointSize / 10
|
||||||
|
|
||||||
|
text: "warning"
|
||||||
|
color: Colours.palette.m3onError
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: qsTr("Performance Degraded")
|
||||||
|
color: Colours.palette.m3onError
|
||||||
|
font.family: Appearance.font.family.mono
|
||||||
|
font.weight: 500
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: -font.pointSize / 10
|
||||||
|
|
||||||
|
text: "warning"
|
||||||
|
color: Colours.palette.m3onError
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
text: qsTr("Reason: %1").arg(PerformanceDegradationReason.toString(PowerProfiles.degradationReason))
|
||||||
|
color: Colours.palette.m3onError
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: profiles
|
||||||
|
|
||||||
|
property string current: {
|
||||||
|
const p = PowerProfiles.profile;
|
||||||
|
if (p === PowerProfile.PowerSaver)
|
||||||
|
return saver.icon;
|
||||||
|
if (p === PowerProfile.Performance)
|
||||||
|
return perf.icon;
|
||||||
|
return balance.icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
implicitWidth: saver.implicitHeight + balance.implicitHeight + perf.implicitHeight + Appearance.padding.normal * 2 + Appearance.spacing.large * 2
|
||||||
|
implicitHeight: Math.max(saver.implicitHeight, balance.implicitHeight, perf.implicitHeight) + Appearance.padding.small * 2
|
||||||
|
|
||||||
|
color: Colours.palette.m3surfaceContainer
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: indicator
|
||||||
|
|
||||||
|
color: Colours.palette.m3primary
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
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: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Profile {
|
||||||
|
id: saver
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Appearance.padding.small
|
||||||
|
|
||||||
|
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: Appearance.padding.small
|
||||||
|
|
||||||
|
profile: PowerProfile.Performance
|
||||||
|
icon: "rocket_launch"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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: Item {
|
||||||
|
required property string icon
|
||||||
|
required property int profile
|
||||||
|
|
||||||
|
implicitWidth: icon.implicitHeight + Appearance.padding.small * 2
|
||||||
|
implicitHeight: icon.implicitHeight + Appearance.padding.small * 2
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
color: profiles.current === parent.icon ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
PowerProfiles.profile = parent.profile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
text: parent.icon
|
||||||
|
font.pointSize: Appearance.font.size.large
|
||||||
|
color: profiles.current === text ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface
|
||||||
|
fill: profiles.current === text ? 1 : 0
|
||||||
|
|
||||||
|
Behavior on fill {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
18
dots/quickshell/modules/bar/popouts/Bluetooth.qml
Normal file
18
dots/quickshell/modules/bar/popouts/Bluetooth.qml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: qsTr("Bluetooth %1").arg(Bluetooth.powered ? "enabled" : "disabled")
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: Bluetooth.devices.some(d => d.connected) ? qsTr("Connected to: %1").arg(Bluetooth.devices.filter(d => d.connected).map(d => d.alias).join(", ")) : qsTr("No devices connected")
|
||||||
|
}
|
||||||
|
}
|
||||||
175
dots/quickshell/modules/bar/popouts/Content.qml
Normal file
175
dots/quickshell/modules/bar/popouts/Content.qml
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Services.SystemTray
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property ShellScreen screen
|
||||||
|
|
||||||
|
property string currentName
|
||||||
|
property real currentCenter
|
||||||
|
property bool hasCurrent
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
implicitWidth: hasCurrent ? (content.children.find(c => c.shouldBeActive)?.implicitWidth ?? 0) + Appearance.padding.large * 2 : 0
|
||||||
|
implicitHeight: (content.children.find(c => c.shouldBeActive)?.implicitHeight ?? 0) + Appearance.padding.large * 2
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: content
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Appearance.padding.large
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
Popout {
|
||||||
|
name: "activewindow"
|
||||||
|
source: "ActiveWindow.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
Popout {
|
||||||
|
name: "network"
|
||||||
|
source: "Network.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
Popout {
|
||||||
|
name: "bluetooth"
|
||||||
|
source: "Bluetooth.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
Popout {
|
||||||
|
name: "battery"
|
||||||
|
source: "Battery.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: ScriptModel {
|
||||||
|
values: [...SystemTray.items.values]
|
||||||
|
}
|
||||||
|
|
||||||
|
Popout {
|
||||||
|
id: trayMenu
|
||||||
|
|
||||||
|
required property SystemTrayItem modelData
|
||||||
|
required property int index
|
||||||
|
|
||||||
|
name: `traymenu${index}`
|
||||||
|
sourceComponent: trayMenuComp
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: root
|
||||||
|
|
||||||
|
function onHasCurrentChanged(): void {
|
||||||
|
if (root.hasCurrent && trayMenu.shouldBeActive) {
|
||||||
|
trayMenu.sourceComponent = null;
|
||||||
|
trayMenu.sourceComponent = trayMenuComp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: trayMenuComp
|
||||||
|
|
||||||
|
TrayMenu {
|
||||||
|
popouts: root
|
||||||
|
trayItem: trayMenu.modelData.menu
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitWidth {
|
||||||
|
Anim {
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
enabled: root.implicitWidth > 0
|
||||||
|
|
||||||
|
Anim {
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on currentCenter {
|
||||||
|
enabled: root.implicitWidth > 0
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Popout: Loader {
|
||||||
|
id: popout
|
||||||
|
|
||||||
|
required property string name
|
||||||
|
property bool shouldBeActive: root.currentName === name
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
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: "active"
|
||||||
|
to: ""
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
Anim {
|
||||||
|
properties: "opacity,scale"
|
||||||
|
duration: Appearance.anim.durations.small
|
||||||
|
}
|
||||||
|
PropertyAction {
|
||||||
|
target: popout
|
||||||
|
property: "active"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition {
|
||||||
|
from: ""
|
||||||
|
to: "active"
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
PropertyAction {
|
||||||
|
target: popout
|
||||||
|
property: "active"
|
||||||
|
}
|
||||||
|
Anim {
|
||||||
|
properties: "opacity,scale"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
component Anim: NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
22
dots/quickshell/modules/bar/popouts/Network.qml
Normal file
22
dots/quickshell/modules/bar/popouts/Network.qml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: qsTr("Connected to: %1").arg(Network.active?.ssid ?? "None")
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: qsTr("Strength: %1/100").arg(Network.active?.strength ?? 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: qsTr("Frequency: %1 MHz").arg(Network.active?.frequency ?? 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
237
dots/quickshell/modules/bar/popouts/TrayMenu.qml
Normal file
237
dots/quickshell/modules/bar/popouts/TrayMenu.qml
Normal file
@@ -0,0 +1,237 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Widgets
|
||||||
|
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: Anim {}
|
||||||
|
pushExit: Anim {}
|
||||||
|
popEnter: Anim {}
|
||||||
|
popExit: Anim {}
|
||||||
|
|
||||||
|
component Anim: Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component SubMenu: Column {
|
||||||
|
id: menu
|
||||||
|
|
||||||
|
required property QsMenuHandle handle
|
||||||
|
property bool isSubMenu
|
||||||
|
property bool shown
|
||||||
|
|
||||||
|
padding: Appearance.padding.smaller
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
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 {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on scale {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QsMenuOpener {
|
||||||
|
id: menuOpener
|
||||||
|
|
||||||
|
menu: menu.handle
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: menuOpener.children
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: item
|
||||||
|
|
||||||
|
required property QsMenuEntry modelData
|
||||||
|
|
||||||
|
implicitWidth: Config.bar.sizes.trayMenuWidth
|
||||||
|
implicitHeight: modelData.isSeparator ? 1 : children.implicitHeight
|
||||||
|
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
color: modelData.isSeparator ? Colours.palette.m3outlineVariant : "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.margins: -Appearance.padding.small / 2
|
||||||
|
anchors.leftMargin: -Appearance.padding.smaller
|
||||||
|
anchors.rightMargin: -Appearance.padding.smaller
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: label
|
||||||
|
|
||||||
|
anchors.left: icon.right
|
||||||
|
anchors.leftMargin: icon.active ? Appearance.spacing.smaller : 0
|
||||||
|
|
||||||
|
text: labelMetrics.elidedText
|
||||||
|
color: item.modelData.enabled ? Colours.palette.m3onSurface : Colours.palette.m3outline
|
||||||
|
}
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: labelMetrics
|
||||||
|
|
||||||
|
text: item.modelData.text
|
||||||
|
font.pointSize: label.font.pointSize
|
||||||
|
font.family: label.font.family
|
||||||
|
|
||||||
|
elide: Text.ElideRight
|
||||||
|
elideWidth: Config.bar.sizes.trayMenuWidth - (icon.active ? icon.implicitWidth + label.anchors.leftMargin : 0) - (expand.active ? expand.implicitWidth + Appearance.spacing.normal : 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 ? Colours.palette.m3onSurface : Colours.palette.m3outline
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -Appearance.padding.small / 2
|
||||||
|
anchors.leftMargin: -Appearance.padding.smaller
|
||||||
|
anchors.rightMargin: -Appearance.padding.smaller * 2
|
||||||
|
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
color: Colours.palette.m3secondaryContainer
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
radius: parent.radius
|
||||||
|
color: Colours.palette.m3onSecondaryContainer
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
root.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: back
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: "chevron_left"
|
||||||
|
color: Colours.palette.m3onSecondaryContainer
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: qsTr("Back")
|
||||||
|
color: Colours.palette.m3onSecondaryContainer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: subMenuComp
|
||||||
|
|
||||||
|
SubMenu {}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
dots/quickshell/modules/bar/popouts/Wrapper.qml
Normal file
25
dots/quickshell/modules/bar/popouts/Wrapper.qml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property ShellScreen screen
|
||||||
|
|
||||||
|
property alias currentName: content.currentName
|
||||||
|
property alias currentCenter: content.currentCenter
|
||||||
|
property alias hasCurrent: content.hasCurrent
|
||||||
|
|
||||||
|
visible: width > 0 && height > 0
|
||||||
|
|
||||||
|
implicitWidth: content.implicitWidth
|
||||||
|
implicitHeight: content.implicitHeight
|
||||||
|
|
||||||
|
Content {
|
||||||
|
id: content
|
||||||
|
|
||||||
|
screen: root.screen
|
||||||
|
}
|
||||||
|
}
|
||||||
69
dots/quickshell/modules/dashboard/Background.qml
Normal file
69
dots/quickshell/modules/dashboard/Background.qml
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Shapes
|
||||||
|
import "root:/config"
|
||||||
|
import "root:/services"
|
||||||
|
|
||||||
|
ShapePath {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Wrapper 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
|
||||||
|
|
||||||
|
strokeWidth: -1
|
||||||
|
fillColor: Config.border.colour
|
||||||
|
|
||||||
|
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.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)
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on fillColor {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
123
dots/quickshell/modules/dashboard/Content.qml
Normal file
123
dots/quickshell/modules/dashboard/Content.qml
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
readonly property real nonAnimWidth: view.implicitWidth + viewWrapper.anchors.margins * 2
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
implicitWidth: nonAnimWidth
|
||||||
|
implicitHeight: tabs.implicitHeight + tabs.anchors.topMargin + view.implicitHeight + viewWrapper.anchors.margins * 2
|
||||||
|
|
||||||
|
Tabs {
|
||||||
|
id: tabs
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.topMargin: Appearance.padding.normal
|
||||||
|
anchors.margins: Appearance.padding.large
|
||||||
|
|
||||||
|
nonAnimWidth: root.nonAnimWidth
|
||||||
|
currentIndex: view.currentIndex
|
||||||
|
}
|
||||||
|
|
||||||
|
ClippingRectangle {
|
||||||
|
id: viewWrapper
|
||||||
|
|
||||||
|
anchors.top: tabs.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.margins: Appearance.padding.large
|
||||||
|
|
||||||
|
radius: Appearance.rounding.normal
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
Flickable {
|
||||||
|
id: view
|
||||||
|
|
||||||
|
readonly property int currentIndex: tabs.currentIndex
|
||||||
|
readonly property Item currentItem: row.children[currentIndex]
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
flickableDirection: Flickable.HorizontalFlick
|
||||||
|
|
||||||
|
implicitWidth: currentItem.implicitWidth
|
||||||
|
implicitHeight: currentItem.implicitHeight
|
||||||
|
|
||||||
|
contentX: currentItem.x
|
||||||
|
contentWidth: row.implicitWidth
|
||||||
|
contentHeight: row.implicitHeight
|
||||||
|
|
||||||
|
onContentXChanged: {
|
||||||
|
if (!moving)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const x = contentX - currentItem.x;
|
||||||
|
if (x > currentItem.implicitWidth / 2)
|
||||||
|
tabs.bar.incrementCurrentIndex();
|
||||||
|
else if (x < -currentItem.implicitWidth / 2)
|
||||||
|
tabs.bar.decrementCurrentIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
onDragEnded: {
|
||||||
|
const x = contentX - currentItem.x;
|
||||||
|
if (x > currentItem.implicitWidth / 10)
|
||||||
|
tabs.bar.incrementCurrentIndex();
|
||||||
|
else if (x < -currentItem.implicitWidth / 10)
|
||||||
|
tabs.bar.decrementCurrentIndex();
|
||||||
|
else
|
||||||
|
contentX = Qt.binding(() => currentItem.x);
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: row
|
||||||
|
|
||||||
|
Dash {
|
||||||
|
shouldUpdate: visible && this === view.currentItem
|
||||||
|
}
|
||||||
|
|
||||||
|
Media {
|
||||||
|
shouldUpdate: visible && this === view.currentItem
|
||||||
|
visibilities: root.visibilities
|
||||||
|
}
|
||||||
|
|
||||||
|
Performance {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on contentX {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitWidth {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.large
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.large
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
86
dots/quickshell/modules/dashboard/Dash.qml
Normal file
86
dots/quickshell/modules/dashboard/Dash.qml
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import "dash"
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
GridLayout {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property bool shouldUpdate
|
||||||
|
|
||||||
|
rowSpacing: Appearance.spacing.normal
|
||||||
|
columnSpacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
Rect {
|
||||||
|
Layout.column: 2
|
||||||
|
Layout.columnSpan: 3
|
||||||
|
Layout.preferredWidth: user.implicitWidth
|
||||||
|
Layout.preferredHeight: user.implicitHeight
|
||||||
|
|
||||||
|
User {
|
||||||
|
id: user
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect {
|
||||||
|
Layout.row: 0
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
Layout.preferredWidth: Config.dashboard.sizes.weatherWidth
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
Weather {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect {
|
||||||
|
Layout.row: 1
|
||||||
|
Layout.preferredWidth: dateTime.implicitWidth
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
DateTime {
|
||||||
|
id: dateTime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect {
|
||||||
|
Layout.row: 1
|
||||||
|
Layout.column: 1
|
||||||
|
Layout.columnSpan: 3
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: calendar.implicitHeight
|
||||||
|
|
||||||
|
Calendar {
|
||||||
|
id: calendar
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect {
|
||||||
|
Layout.row: 1
|
||||||
|
Layout.column: 4
|
||||||
|
Layout.preferredWidth: resources.implicitWidth
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
Resources {
|
||||||
|
id: resources
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect {
|
||||||
|
Layout.row: 0
|
||||||
|
Layout.column: 5
|
||||||
|
Layout.rowSpan: 2
|
||||||
|
Layout.preferredWidth: media.implicitWidth
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
Media {
|
||||||
|
id: media
|
||||||
|
|
||||||
|
shouldUpdate: root.shouldUpdate
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Rect: StyledRect {
|
||||||
|
radius: Appearance.rounding.small
|
||||||
|
color: Colours.palette.m3surfaceContainer
|
||||||
|
}
|
||||||
|
}
|
||||||
594
dots/quickshell/modules/dashboard/Media.qml
Normal file
594
dots/quickshell/modules/dashboard/Media.qml
Normal file
@@ -0,0 +1,594 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/utils"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import Quickshell.Services.Mpris
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Effects
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property bool shouldUpdate
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
|
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";
|
||||||
|
return `${Math.floor(length / 60)}:${Math.floor(length % 60).toString().padStart(2, "0")}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitWidth: cover.implicitWidth + Config.dashboard.sizes.mediaVisualiserSize * 2 + details.implicitWidth + details.anchors.leftMargin + bongocat.implicitWidth + bongocat.anchors.leftMargin * 2 + Appearance.padding.large * 2
|
||||||
|
implicitHeight: Math.max(cover.implicitHeight + Config.dashboard.sizes.mediaVisualiserSize * 2, details.implicitHeight, bongocat.implicitHeight) + Appearance.padding.large * 2
|
||||||
|
|
||||||
|
Behavior on playerProgress {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.large
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
running: root.shouldUpdate && (Players.active?.isPlaying ?? false)
|
||||||
|
interval: Config.dashboard.mediaUpdateInterval
|
||||||
|
triggeredOnStart: true
|
||||||
|
repeat: true
|
||||||
|
onTriggered: Players.active?.positionChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: Cava
|
||||||
|
|
||||||
|
function onValuesChanged(): void {
|
||||||
|
if (root.shouldUpdate)
|
||||||
|
visualiser.requestPaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Canvas {
|
||||||
|
id: visualiser
|
||||||
|
|
||||||
|
readonly property real centerX: width / 2
|
||||||
|
readonly property real centerY: height / 2
|
||||||
|
readonly property real innerX: cover.implicitWidth / 2 + Appearance.spacing.small
|
||||||
|
readonly property real innerY: cover.implicitHeight / 2 + Appearance.spacing.small
|
||||||
|
property color colour: Colours.palette.m3primary
|
||||||
|
|
||||||
|
anchors.fill: cover
|
||||||
|
anchors.margins: -Config.dashboard.sizes.mediaVisualiserSize
|
||||||
|
|
||||||
|
onColourChanged: requestPaint()
|
||||||
|
|
||||||
|
onPaint: {
|
||||||
|
const ctx = getContext("2d");
|
||||||
|
ctx.reset();
|
||||||
|
|
||||||
|
const values = Cava.values;
|
||||||
|
const len = values.length;
|
||||||
|
|
||||||
|
ctx.strokeStyle = colour;
|
||||||
|
ctx.lineWidth = 360 / len - Appearance.spacing.small / 4;
|
||||||
|
ctx.lineCap = "round";
|
||||||
|
|
||||||
|
const size = Config.dashboard.sizes.mediaVisualiserSize;
|
||||||
|
const cx = centerX;
|
||||||
|
const cy = centerY;
|
||||||
|
const rx = innerX + ctx.lineWidth / 2;
|
||||||
|
const ry = innerY + ctx.lineWidth / 2;
|
||||||
|
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
const v = Math.max(1, Math.min(100, values[i]));
|
||||||
|
|
||||||
|
const angle = i * 2 * Math.PI / len;
|
||||||
|
const magnitude = v / 100 * size;
|
||||||
|
const cos = Math.cos(angle);
|
||||||
|
const sin = Math.sin(angle);
|
||||||
|
|
||||||
|
ctx.moveTo(cx + rx * cos, cy + ry * sin);
|
||||||
|
ctx.lineTo(cx + (rx + magnitude) * cos, cy + (ry + magnitude) * sin);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.stroke();
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on colour {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledClippingRect {
|
||||||
|
id: cover
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Appearance.padding.large + Config.dashboard.sizes.mediaVisualiserSize
|
||||||
|
|
||||||
|
implicitWidth: Config.dashboard.sizes.mediaCoverArtSize
|
||||||
|
implicitHeight: Config.dashboard.sizes.mediaCoverArtSize
|
||||||
|
|
||||||
|
color: Colours.palette.m3surfaceContainerHigh
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
text: "art_track"
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: details
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: visualiser.right
|
||||||
|
anchors.leftMargin: Appearance.spacing.normal
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: title
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: (Players.active?.trackTitle ?? qsTr("No media")) || qsTr("Unknown title")
|
||||||
|
color: Colours.palette.m3primary
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
|
||||||
|
width: parent.implicitWidth
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: album
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: (Players.active?.trackAlbum ?? qsTr("No media")) || qsTr("Unknown album")
|
||||||
|
color: Colours.palette.m3outline
|
||||||
|
font.pointSize: Appearance.font.size.small
|
||||||
|
|
||||||
|
width: parent.implicitWidth
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: artist
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: (Players.active?.trackArtist ?? qsTr("No media")) || qsTr("Unknown artist")
|
||||||
|
color: Colours.palette.m3secondary
|
||||||
|
|
||||||
|
width: parent.implicitWidth
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: controls
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
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
|
||||||
|
primary: true
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
Players.active?.togglePlaying();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Control {
|
||||||
|
icon: "skip_next"
|
||||||
|
canUse: Players.active?.canGoNext ?? false
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
Players.active?.next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Slider {
|
||||||
|
id: slider
|
||||||
|
|
||||||
|
implicitWidth: controls.implicitWidth * 1.5
|
||||||
|
implicitHeight: Appearance.padding.normal * 3
|
||||||
|
|
||||||
|
value: root.playerProgress
|
||||||
|
onMoved: {
|
||||||
|
const active = Players.active;
|
||||||
|
if (active?.canSeek && active?.positionSupported)
|
||||||
|
active.position = value * active.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
background: Item {
|
||||||
|
StyledRect {
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.topMargin: slider.implicitHeight / 3
|
||||||
|
anchors.bottomMargin: slider.implicitHeight / 3
|
||||||
|
|
||||||
|
implicitWidth: slider.handle.x - slider.implicitHeight / 6
|
||||||
|
|
||||||
|
color: Colours.palette.m3primary
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
topRightRadius: slider.implicitHeight / 15
|
||||||
|
bottomRightRadius: slider.implicitHeight / 15
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.topMargin: slider.implicitHeight / 3
|
||||||
|
anchors.bottomMargin: slider.implicitHeight / 3
|
||||||
|
|
||||||
|
implicitWidth: parent.width - slider.handle.x - slider.handle.implicitWidth - slider.implicitHeight / 6
|
||||||
|
|
||||||
|
color: Colours.palette.m3surfaceContainer
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
topLeftRadius: slider.implicitHeight / 15
|
||||||
|
bottomLeftRadius: slider.implicitHeight / 15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handle: StyledRect {
|
||||||
|
id: rect
|
||||||
|
|
||||||
|
x: slider.visualPosition * slider.availableWidth
|
||||||
|
|
||||||
|
implicitWidth: slider.implicitHeight / 4.5
|
||||||
|
implicitHeight: slider.implicitHeight
|
||||||
|
|
||||||
|
color: Colours.palette.m3primary
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onPressed: event => event.accepted = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
implicitHeight: Math.max(position.implicitHeight, length.implicitHeight)
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: position
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
|
||||||
|
text: root.lengthStr(Players.active?.position ?? -1)
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font.pointSize: Appearance.font.size.small
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: length
|
||||||
|
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
text: root.lengthStr(Players.active?.length ?? -1)
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font.pointSize: Appearance.font.size.small
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
Control {
|
||||||
|
icon: "flip_to_front"
|
||||||
|
canUse: Players.active?.canRaise ?? false
|
||||||
|
fontSize: Appearance.font.size.larger
|
||||||
|
padding: Appearance.padding.small
|
||||||
|
fill: false
|
||||||
|
color: Colours.palette.m3surfaceContainer
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
Players.active?.raise();
|
||||||
|
root.visibilities.dashboard = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: playerSelector
|
||||||
|
|
||||||
|
property bool expanded
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
implicitWidth: slider.implicitWidth / 2
|
||||||
|
implicitHeight: currentPlayer.implicitHeight + Appearance.padding.small * 2
|
||||||
|
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: expanded = !expanded
|
||||||
|
|
||||||
|
RectangularShadow {
|
||||||
|
anchors.fill: playerSelectorBg
|
||||||
|
|
||||||
|
opacity: playerSelector.expanded ? 1 : 0
|
||||||
|
radius: playerSelectorBg.radius
|
||||||
|
color: Colours.palette.m3shadow
|
||||||
|
blur: 5
|
||||||
|
spread: 0
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: playerSelectorBg
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
implicitHeight: playersWrapper.implicitHeight + Appearance.padding.small * 2
|
||||||
|
|
||||||
|
color: Colours.palette.m3secondaryContainer
|
||||||
|
radius: Appearance.rounding.normal
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: playersWrapper
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.margins: Appearance.padding.small
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
implicitHeight: playerSelector.expanded && Players.list.length > 1 ? players.implicitHeight : currentPlayer.implicitHeight
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: players
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: Players.list.filter(p => p !== Players.active)
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: player
|
||||||
|
|
||||||
|
required property MprisPlayer modelData
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
IconImage {
|
||||||
|
id: playerIcon
|
||||||
|
|
||||||
|
source: Icons.getAppIcon(player.modelData.identity, "image-missing")
|
||||||
|
implicitSize: Math.round(identity.implicitHeight * 0.9)
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: identity
|
||||||
|
|
||||||
|
text: identityMetrics.elidedText
|
||||||
|
color: Colours.palette.m3onSecondaryContainer
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: identityMetrics
|
||||||
|
|
||||||
|
text: player.modelData.identity
|
||||||
|
font.family: identity.font.family
|
||||||
|
font.pointSize: identity.font.pointSize
|
||||||
|
elide: Text.ElideRight
|
||||||
|
elideWidth: playerSelector.implicitWidth - playerIcon.implicitWidth - player.spacing - Appearance.padding.smaller * 2
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
Players.manualActive = player.modelData;
|
||||||
|
playerSelector.expanded = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
implicitHeight: 1
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.margins: -Appearance.padding.normal
|
||||||
|
color: Colours.palette.m3secondary
|
||||||
|
implicitHeight: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: currentPlayer
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
IconImage {
|
||||||
|
id: currentIcon
|
||||||
|
|
||||||
|
source: Icons.getAppIcon(Players.active?.identity ?? "", "multimedia-player")
|
||||||
|
implicitSize: Math.round(currentIdentity.implicitHeight * 0.9)
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: currentIdentity
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
text: currentIdentityMetrics.elidedText
|
||||||
|
color: Colours.palette.m3onSecondaryContainer
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: currentIdentityMetrics
|
||||||
|
|
||||||
|
text: Players.active?.identity ?? "No players"
|
||||||
|
font.family: currentIdentity.font.family
|
||||||
|
font.pointSize: currentIdentity.font.pointSize
|
||||||
|
elide: Text.ElideRight
|
||||||
|
elideWidth: playerSelector.implicitWidth - currentIcon.implicitWidth - currentPlayer.spacing - Appearance.padding.smaller * 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Control {
|
||||||
|
icon: "delete"
|
||||||
|
canUse: Players.active?.canQuit ?? false
|
||||||
|
fontSize: Appearance.font.size.larger
|
||||||
|
padding: Appearance.padding.small
|
||||||
|
fill: false
|
||||||
|
color: Colours.palette.m3surfaceContainer
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
Players.active?.quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: bongocat
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: details.right
|
||||||
|
anchors.leftMargin: Appearance.spacing.normal
|
||||||
|
|
||||||
|
implicitWidth: visualiser.width
|
||||||
|
implicitHeight: visualiser.height
|
||||||
|
|
||||||
|
AnimatedImage {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
width: visualiser.width * 0.75
|
||||||
|
height: visualiser.height * 0.75
|
||||||
|
|
||||||
|
playing: root.shouldUpdate && (Players.active?.isPlaying ?? false)
|
||||||
|
speed: BeatDetector.bpm / 300
|
||||||
|
source: "root:/assets/bongocat.gif"
|
||||||
|
asynchronous: true
|
||||||
|
fillMode: AnimatedImage.PreserveAspectFit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
component Control: StyledRect {
|
||||||
|
id: control
|
||||||
|
|
||||||
|
required property string icon
|
||||||
|
required property bool canUse
|
||||||
|
property int fontSize: Appearance.font.size.extraLarge
|
||||||
|
property int padding
|
||||||
|
property bool fill: true
|
||||||
|
property bool primary
|
||||||
|
function onClicked(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitWidth: Math.max(icon.implicitWidth, icon.implicitHeight) + padding * 2
|
||||||
|
implicitHeight: implicitWidth
|
||||||
|
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
color: primary && canUse ? Colours.palette.m3primary : "transparent"
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
disabled: !control.canUse
|
||||||
|
radius: parent.radius
|
||||||
|
color: control.primary ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
control.onClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
anchors.verticalCenterOffset: font.pointSize * 0.05
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
fill: control.fill ? 1 : 0
|
||||||
|
text: control.icon
|
||||||
|
color: control.canUse ? control.primary ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface : Colours.palette.m3outline
|
||||||
|
font.pointSize: control.fontSize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
230
dots/quickshell/modules/dashboard/Performance.qml
Normal file
230
dots/quickshell/modules/dashboard/Performance.qml
Normal file
@@ -0,0 +1,230 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.large * 3
|
||||||
|
padding: Appearance.padding.large
|
||||||
|
leftPadding: padding * 2
|
||||||
|
rightPadding: padding * 3
|
||||||
|
|
||||||
|
Resource {
|
||||||
|
value1: Math.min(1, SystemUsage.gpuTemp / 90)
|
||||||
|
value2: SystemUsage.gpuPerc
|
||||||
|
|
||||||
|
label1: `${Math.ceil(SystemUsage.gpuTemp)}°C`
|
||||||
|
label2: `${Math.round(SystemUsage.gpuPerc * 100)}%`
|
||||||
|
|
||||||
|
sublabel1: qsTr("GPU temp")
|
||||||
|
sublabel2: qsTr("Usage")
|
||||||
|
}
|
||||||
|
|
||||||
|
Resource {
|
||||||
|
primary: true
|
||||||
|
|
||||||
|
value1: Math.min(1, SystemUsage.cpuTemp / 90)
|
||||||
|
value2: SystemUsage.cpuPerc
|
||||||
|
|
||||||
|
label1: `${Math.ceil(SystemUsage.cpuTemp)}°C`
|
||||||
|
label2: `${Math.round(SystemUsage.cpuPerc * 100)}%`
|
||||||
|
|
||||||
|
sublabel1: qsTr("CPU temp")
|
||||||
|
sublabel2: qsTr("Usage")
|
||||||
|
}
|
||||||
|
|
||||||
|
Resource {
|
||||||
|
value1: SystemUsage.memPerc
|
||||||
|
value2: SystemUsage.storagePerc
|
||||||
|
|
||||||
|
label1: {
|
||||||
|
const fmt = SystemUsage.formatKib(SystemUsage.memUsed);
|
||||||
|
return `${+fmt.value.toFixed(1)}${fmt.unit}`;
|
||||||
|
}
|
||||||
|
label2: {
|
||||||
|
const fmt = SystemUsage.formatKib(SystemUsage.storageUsed);
|
||||||
|
return `${Math.floor(fmt.value)}${fmt.unit}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
sublabel1: qsTr("Memory")
|
||||||
|
sublabel2: qsTr("Storage")
|
||||||
|
}
|
||||||
|
|
||||||
|
component Resource: Item {
|
||||||
|
id: res
|
||||||
|
|
||||||
|
required property real value1
|
||||||
|
required property real value2
|
||||||
|
required property string sublabel1
|
||||||
|
required property string sublabel2
|
||||||
|
required property string label1
|
||||||
|
required property string label2
|
||||||
|
|
||||||
|
property bool primary
|
||||||
|
readonly property real primaryMult: primary ? 1.2 : 1
|
||||||
|
|
||||||
|
readonly property real thickness: Config.dashboard.sizes.resourceProgessThickness * primaryMult
|
||||||
|
|
||||||
|
property color fg1: Colours.palette.m3primary
|
||||||
|
property color fg2: Colours.palette.m3secondary
|
||||||
|
property color bg1: Colours.palette.m3primaryContainer
|
||||||
|
property color bg2: Colours.palette.m3secondaryContainer
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
implicitWidth: Config.dashboard.sizes.resourceSize * primaryMult
|
||||||
|
implicitHeight: Config.dashboard.sizes.resourceSize * primaryMult
|
||||||
|
|
||||||
|
onValue1Changed: canvas.requestPaint()
|
||||||
|
onValue2Changed: canvas.requestPaint()
|
||||||
|
onFg1Changed: canvas.requestPaint()
|
||||||
|
onFg2Changed: canvas.requestPaint()
|
||||||
|
onBg1Changed: canvas.requestPaint()
|
||||||
|
onBg2Changed: canvas.requestPaint()
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
text: res.label1
|
||||||
|
font.pointSize: Appearance.font.size.extraLarge * res.primaryMult
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
text: res.sublabel1
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font.pointSize: Appearance.font.size.smaller * res.primaryMult
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.horizontalCenter: parent.right
|
||||||
|
anchors.top: parent.verticalCenter
|
||||||
|
anchors.horizontalCenterOffset: -res.thickness / 2
|
||||||
|
anchors.topMargin: res.thickness / 2 + Appearance.spacing.small
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
text: res.label2
|
||||||
|
font.pointSize: Appearance.font.size.smaller * res.primaryMult
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
text: res.sublabel2
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font.pointSize: Appearance.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(220)
|
||||||
|
readonly property real arc2Start: degToRad(230)
|
||||||
|
readonly property real arc2End: degToRad(360)
|
||||||
|
|
||||||
|
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, false);
|
||||||
|
ctx.strokeStyle = res.bg2;
|
||||||
|
ctx.stroke();
|
||||||
|
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.arc(cx, cy, radius, a2s, (a2e - a2s) * res.value2 + a2s, false);
|
||||||
|
ctx.strokeStyle = res.fg2;
|
||||||
|
ctx.stroke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on value1 {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on value2 {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on fg1 {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on fg2 {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on bg1 {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on bg2 {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
250
dots/quickshell/modules/dashboard/Tabs.qml
Normal file
250
dots/quickshell/modules/dashboard/Tabs.qml
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property real nonAnimWidth
|
||||||
|
property alias currentIndex: bar.currentIndex
|
||||||
|
readonly property TabBar bar: bar
|
||||||
|
|
||||||
|
implicitHeight: bar.implicitHeight + indicator.implicitHeight + indicator.anchors.topMargin + separator.implicitHeight
|
||||||
|
|
||||||
|
TabBar {
|
||||||
|
id: bar
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
|
||||||
|
background: null
|
||||||
|
|
||||||
|
Tab {
|
||||||
|
iconName: "dashboard"
|
||||||
|
text: qsTr("Dashboard")
|
||||||
|
}
|
||||||
|
|
||||||
|
Tab {
|
||||||
|
iconName: "queue_music"
|
||||||
|
text: qsTr("Media")
|
||||||
|
}
|
||||||
|
|
||||||
|
Tab {
|
||||||
|
iconName: "speed"
|
||||||
|
text: qsTr("Performance")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tab {
|
||||||
|
// iconName: "workspaces"
|
||||||
|
// text: qsTr("Workspaces")
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: indicator
|
||||||
|
|
||||||
|
anchors.top: bar.bottom
|
||||||
|
anchors.topMargin: Config.dashboard.sizes.tabIndicatorSpacing
|
||||||
|
|
||||||
|
implicitWidth: bar.currentItem.implicitWidth
|
||||||
|
implicitHeight: Config.dashboard.sizes.tabIndicatorHeight
|
||||||
|
|
||||||
|
x: {
|
||||||
|
const tab = bar.currentItem;
|
||||||
|
const width = (root.nonAnimWidth - Config.dashboard.sizes.tabIndicatorSpacing * (bar.count - 1) * 2) / bar.count;
|
||||||
|
return width * tab.TabBar.index + (width - tab.implicitWidth) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
implicitHeight: parent.implicitHeight * 2
|
||||||
|
|
||||||
|
color: Colours.palette.m3primary
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on x {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitWidth {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: separator
|
||||||
|
|
||||||
|
anchors.top: indicator.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
implicitHeight: 1
|
||||||
|
color: Colours.palette.m3outlineVariant
|
||||||
|
}
|
||||||
|
|
||||||
|
component Tab: TabButton {
|
||||||
|
id: tab
|
||||||
|
|
||||||
|
required property string iconName
|
||||||
|
readonly property bool current: TabBar.tabBar.currentItem === this
|
||||||
|
|
||||||
|
background: null
|
||||||
|
|
||||||
|
contentItem: MouseArea {
|
||||||
|
id: mouse
|
||||||
|
|
||||||
|
implicitWidth: Math.max(icon.width, label.width)
|
||||||
|
implicitHeight: icon.height + label.height
|
||||||
|
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
|
onPressed: ({
|
||||||
|
x,
|
||||||
|
y
|
||||||
|
}) => {
|
||||||
|
tab.TabBar.tabBar.setCurrentIndex(tab.TabBar.index);
|
||||||
|
|
||||||
|
const stateY = stateWrapper.y;
|
||||||
|
rippleAnim.x = x;
|
||||||
|
rippleAnim.y = y - stateY;
|
||||||
|
|
||||||
|
const dist = (ox, oy) => ox * ox + oy * oy;
|
||||||
|
const stateEndY = stateY + stateWrapper.height;
|
||||||
|
rippleAnim.radius = Math.sqrt(Math.max(dist(0, stateY), dist(0, stateEndY), dist(width, stateY), dist(width, stateEndY)));
|
||||||
|
|
||||||
|
rippleAnim.restart();
|
||||||
|
}
|
||||||
|
onWheel: event => {
|
||||||
|
if (event.angleDelta.y < 0)
|
||||||
|
tab.TabBar.tabBar.incrementCurrentIndex();
|
||||||
|
else if (event.angleDelta.y > 0)
|
||||||
|
tab.TabBar.tabBar.decrementCurrentIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
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: Appearance.anim.durations.large
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standardDecel
|
||||||
|
}
|
||||||
|
Anim {
|
||||||
|
target: ripple
|
||||||
|
property: "opacity"
|
||||||
|
to: 0
|
||||||
|
duration: Appearance.anim.durations.large
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standardDecel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ClippingRectangle {
|
||||||
|
id: stateWrapper
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
implicitHeight: parent.height + Config.dashboard.sizes.tabIndicatorSpacing * 2
|
||||||
|
|
||||||
|
color: "transparent"
|
||||||
|
radius: Appearance.rounding.small
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: stateLayer
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
color: tab.current ? Colours.palette.m3primary : Colours.palette.m3onSurface
|
||||||
|
opacity: mouse.pressed ? 0.1 : tab.hovered ? 0.08 : 0
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: ripple
|
||||||
|
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
color: tab.current ? Colours.palette.m3primary : Colours.palette.m3onSurface
|
||||||
|
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.current ? Colours.palette.m3primary : Colours.palette.m3onSurfaceVariant
|
||||||
|
fill: tab.current ? 1 : 0
|
||||||
|
font.pointSize: Appearance.font.size.large
|
||||||
|
|
||||||
|
Behavior on fill {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: label
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
text: tab.text
|
||||||
|
color: tab.current ? Colours.palette.m3primary : Colours.palette.m3onSurfaceVariant
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Anim: NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
55
dots/quickshell/modules/dashboard/Wrapper.qml
Normal file
55
dots/quickshell/modules/dashboard/Wrapper.qml
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import "root:/config"
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
|
visible: height > 0
|
||||||
|
implicitHeight: 0
|
||||||
|
implicitWidth: content.implicitWidth
|
||||||
|
|
||||||
|
states: State {
|
||||||
|
name: "visible"
|
||||||
|
when: root.visibilities.dashboard
|
||||||
|
|
||||||
|
PropertyChanges {
|
||||||
|
root.implicitHeight: content.implicitHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
from: ""
|
||||||
|
to: "visible"
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
property: "implicitHeight"
|
||||||
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition {
|
||||||
|
from: "visible"
|
||||||
|
to: ""
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
property: "implicitHeight"
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
Content {
|
||||||
|
id: content
|
||||||
|
|
||||||
|
visibilities: root.visibilities
|
||||||
|
}
|
||||||
|
}
|
||||||
72
dots/quickshell/modules/dashboard/dash/Calendar.qml
Normal file
72
dots/quickshell/modules/dashboard/dash/Calendar.qml
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
padding: Appearance.padding.large
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
DayOfWeekRow {
|
||||||
|
id: days
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.margins: parent.padding
|
||||||
|
|
||||||
|
delegate: StyledText {
|
||||||
|
required property var model
|
||||||
|
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: model.shortName
|
||||||
|
font.family: Appearance.font.family.sans
|
||||||
|
font.weight: 500
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MonthGrid {
|
||||||
|
id: grid
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.margins: parent.padding
|
||||||
|
|
||||||
|
spacing: 3
|
||||||
|
|
||||||
|
delegate: Item {
|
||||||
|
id: day
|
||||||
|
|
||||||
|
required property var model
|
||||||
|
|
||||||
|
implicitWidth: implicitHeight
|
||||||
|
implicitHeight: text.implicitHeight + Appearance.padding.small * 2
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
implicitWidth: parent.implicitHeight
|
||||||
|
implicitHeight: parent.implicitHeight
|
||||||
|
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
color: model.today ? Colours.palette.m3primary : "transparent"
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: text
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: grid.locale.toString(day.model.date, "d")
|
||||||
|
color: day.model.today ? Colours.palette.m3onPrimary : day.model.month === grid.month ? Colours.palette.m3onSurfaceVariant : Colours.palette.m3outline
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
71
dots/quickshell/modules/dashboard/dash/DateTime.qml
Normal file
71
dots/quickshell/modules/dashboard/dash/DateTime.qml
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
implicitWidth: Config.dashboard.sizes.dateTimeWidth
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: hours
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: (root.height - (hours.implicitHeight + sep.implicitHeight + sep.anchors.topMargin + mins.implicitHeight + mins.anchors.topMargin + date.implicitHeight + date.anchors.topMargin)) / 2
|
||||||
|
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: Time.format("HH")
|
||||||
|
color: Colours.palette.m3secondary
|
||||||
|
font.pointSize: Appearance.font.size.extraLarge
|
||||||
|
font.weight: 500
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: sep
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: hours.bottom
|
||||||
|
anchors.topMargin: -font.pointSize * 0.5
|
||||||
|
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: "•••"
|
||||||
|
color: Colours.palette.m3primary
|
||||||
|
font.pointSize: Appearance.font.size.extraLarge * 0.9
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: mins
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: sep.bottom
|
||||||
|
anchors.topMargin: -sep.font.pointSize * 0.45
|
||||||
|
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: Time.format("mm")
|
||||||
|
color: Colours.palette.m3secondary
|
||||||
|
font.pointSize: Appearance.font.size.extraLarge
|
||||||
|
font.weight: 500
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: date
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: mins.bottom
|
||||||
|
anchors.topMargin: Appearance.spacing.normal
|
||||||
|
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: Time.format("ddd, d")
|
||||||
|
color: Colours.palette.m3tertiary
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
font.weight: 500
|
||||||
|
}
|
||||||
|
}
|
||||||
262
dots/quickshell/modules/dashboard/dash/Media.qml
Normal file
262
dots/quickshell/modules/dashboard/dash/Media.qml
Normal file
@@ -0,0 +1,262 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Shapes
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property bool shouldUpdate
|
||||||
|
|
||||||
|
property real playerProgress: {
|
||||||
|
const active = Players.active;
|
||||||
|
return active?.length ? active.position / active.length : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
implicitWidth: Config.dashboard.sizes.mediaWidth
|
||||||
|
|
||||||
|
Behavior on playerProgress {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.large
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
running: root.shouldUpdate && (Players.active?.isPlaying ?? false)
|
||||||
|
interval: Config.dashboard.mediaUpdateInterval
|
||||||
|
triggeredOnStart: true
|
||||||
|
repeat: true
|
||||||
|
onTriggered: Players.active?.positionChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
Shape {
|
||||||
|
preferredRendererType: Shape.CurveRenderer
|
||||||
|
|
||||||
|
ShapePath {
|
||||||
|
fillColor: "transparent"
|
||||||
|
strokeColor: Colours.palette.m3surfaceContainerHigh
|
||||||
|
strokeWidth: Config.dashboard.sizes.mediaProgressThickness
|
||||||
|
capStyle: ShapePath.RoundCap
|
||||||
|
|
||||||
|
PathAngleArc {
|
||||||
|
centerX: cover.x + cover.width / 2
|
||||||
|
centerY: cover.y + cover.height / 2
|
||||||
|
radiusX: (cover.width + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
|
||||||
|
radiusY: (cover.height + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
|
||||||
|
startAngle: -90 - Config.dashboard.sizes.mediaProgressSweep / 2
|
||||||
|
sweepAngle: Config.dashboard.sizes.mediaProgressSweep
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on strokeColor {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ShapePath {
|
||||||
|
fillColor: "transparent"
|
||||||
|
strokeColor: Colours.palette.m3primary
|
||||||
|
strokeWidth: Config.dashboard.sizes.mediaProgressThickness
|
||||||
|
capStyle: ShapePath.RoundCap
|
||||||
|
|
||||||
|
PathAngleArc {
|
||||||
|
centerX: cover.x + cover.width / 2
|
||||||
|
centerY: cover.y + cover.height / 2
|
||||||
|
radiusX: (cover.width + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
|
||||||
|
radiusY: (cover.height + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
|
||||||
|
startAngle: -90 - Config.dashboard.sizes.mediaProgressSweep / 2
|
||||||
|
sweepAngle: Config.dashboard.sizes.mediaProgressSweep * root.playerProgress
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on strokeColor {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledClippingRect {
|
||||||
|
id: cover
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.margins: Appearance.padding.large + Config.dashboard.sizes.mediaProgressThickness + Appearance.spacing.small
|
||||||
|
|
||||||
|
implicitHeight: width
|
||||||
|
color: Colours.palette.m3surfaceContainerHigh
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
text: "art_track"
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: title
|
||||||
|
|
||||||
|
anchors.top: cover.bottom
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.topMargin: Appearance.spacing.normal
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: (Players.active?.trackTitle ?? qsTr("No media")) || qsTr("Unknown title")
|
||||||
|
color: Colours.palette.m3primary
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
|
||||||
|
width: parent.implicitWidth - Appearance.padding.large * 2
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: album
|
||||||
|
|
||||||
|
anchors.top: title.bottom
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.topMargin: Appearance.spacing.small
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: (Players.active?.trackAlbum ?? qsTr("No media")) || qsTr("Unknown album")
|
||||||
|
color: Colours.palette.m3outline
|
||||||
|
font.pointSize: Appearance.font.size.small
|
||||||
|
|
||||||
|
width: parent.implicitWidth - Appearance.padding.large * 2
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: artist
|
||||||
|
|
||||||
|
anchors.top: album.bottom
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.topMargin: Appearance.spacing.small
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: (Players.active?.trackArtist ?? qsTr("No media")) || qsTr("Unknown artist")
|
||||||
|
color: Colours.palette.m3secondary
|
||||||
|
|
||||||
|
width: parent.implicitWidth - Appearance.padding.large * 2
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: controls
|
||||||
|
|
||||||
|
anchors.top: artist.bottom
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.topMargin: Appearance.spacing.smaller
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimatedImage {
|
||||||
|
id: bongocat
|
||||||
|
|
||||||
|
anchors.top: controls.bottom
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.topMargin: Appearance.spacing.small
|
||||||
|
anchors.bottomMargin: Appearance.padding.large
|
||||||
|
anchors.margins: Appearance.padding.large * 2
|
||||||
|
|
||||||
|
playing: root.shouldUpdate && (Players.active?.isPlaying ?? false)
|
||||||
|
speed: BeatDetector.bpm / 300
|
||||||
|
source: "root:/assets/bongocat.gif"
|
||||||
|
asynchronous: true
|
||||||
|
fillMode: AnimatedImage.PreserveAspectFit
|
||||||
|
}
|
||||||
|
|
||||||
|
component Control: StyledRect {
|
||||||
|
id: control
|
||||||
|
|
||||||
|
required property string icon
|
||||||
|
required property bool canUse
|
||||||
|
function onClicked(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitWidth: Math.max(icon.implicitHeight, icon.implicitHeight) + Appearance.padding.small
|
||||||
|
implicitHeight: implicitWidth
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
disabled: !control.canUse
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
|
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 ? Colours.palette.m3onSurface : Colours.palette.m3outline
|
||||||
|
font.pointSize: Appearance.font.size.large
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
85
dots/quickshell/modules/dashboard/dash/Resources.qml
Normal file
85
dots/quickshell/modules/dashboard/dash/Resources.qml
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
padding: Appearance.padding.large
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
Resource {
|
||||||
|
icon: "memory"
|
||||||
|
value: SystemUsage.cpuPerc
|
||||||
|
colour: Colours.palette.m3primary
|
||||||
|
}
|
||||||
|
|
||||||
|
Resource {
|
||||||
|
icon: "memory_alt"
|
||||||
|
value: SystemUsage.memPerc
|
||||||
|
colour: Colours.palette.m3secondary
|
||||||
|
}
|
||||||
|
|
||||||
|
Resource {
|
||||||
|
icon: "hard_disk"
|
||||||
|
value: SystemUsage.storagePerc
|
||||||
|
colour: Colours.palette.m3tertiary
|
||||||
|
}
|
||||||
|
|
||||||
|
component Resource: Item {
|
||||||
|
id: res
|
||||||
|
|
||||||
|
required property string icon
|
||||||
|
required property real value
|
||||||
|
required property color colour
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.margins: Appearance.padding.large
|
||||||
|
implicitWidth: icon.implicitWidth
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: icon.top
|
||||||
|
anchors.bottomMargin: Appearance.spacing.small
|
||||||
|
|
||||||
|
implicitWidth: Config.dashboard.sizes.resourceProgessThickness
|
||||||
|
|
||||||
|
color: Colours.palette.m3surfaceContainerHigh
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
implicitHeight: res.value * parent.height
|
||||||
|
|
||||||
|
color: res.colour
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
text: res.icon
|
||||||
|
color: res.colour
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on value {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.large
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
117
dots/quickshell/modules/dashboard/dash/User.qml
Normal file
117
dots/quickshell/modules/dashboard/dash/User.qml
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import "root:/utils"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
padding: Appearance.padding.large
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
StyledClippingRect {
|
||||||
|
implicitWidth: info.implicitHeight
|
||||||
|
implicitHeight: info.implicitHeight
|
||||||
|
|
||||||
|
radius: Appearance.rounding.large
|
||||||
|
color: Colours.palette.m3surfaceContainerHigh
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
text: "person"
|
||||||
|
fill: 1
|
||||||
|
font.pointSize: (info.implicitHeight / 2) || 1
|
||||||
|
}
|
||||||
|
|
||||||
|
CachingImage {
|
||||||
|
anchors.fill: parent
|
||||||
|
path: `${Paths.home}/.face`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: info
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
InfoLine {
|
||||||
|
icon: Icons.osIcon
|
||||||
|
text: Icons.osName
|
||||||
|
colour: Colours.palette.m3primary
|
||||||
|
}
|
||||||
|
|
||||||
|
InfoLine {
|
||||||
|
icon: "select_window_2"
|
||||||
|
text: Quickshell.env("XDG_CURRENT_DESKTOP") || Quickshell.env("XDG_SESSION_DESKTOP")
|
||||||
|
colour: Colours.palette.m3secondary
|
||||||
|
}
|
||||||
|
|
||||||
|
InfoLine {
|
||||||
|
icon: "timer"
|
||||||
|
text: uptimeProc.uptime
|
||||||
|
colour: Colours.palette.m3tertiary
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
interval: 15000
|
||||||
|
onTriggered: uptimeProc.running = true
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: uptimeProc
|
||||||
|
|
||||||
|
property string uptime
|
||||||
|
|
||||||
|
running: true
|
||||||
|
command: ["uptime", "-p"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: uptimeProc.uptime = text.trim()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component InfoLine: Item {
|
||||||
|
id: line
|
||||||
|
|
||||||
|
required property string icon
|
||||||
|
required property string text
|
||||||
|
required property color colour
|
||||||
|
|
||||||
|
implicitWidth: icon.implicitWidth + text.width + text.anchors.leftMargin
|
||||||
|
implicitHeight: Math.max(icon.implicitHeight, text.implicitHeight)
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: (Config.dashboard.sizes.infoIconSize - implicitWidth) / 2
|
||||||
|
|
||||||
|
text: line.icon
|
||||||
|
color: line.colour
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
font.variableAxes: ({
|
||||||
|
FILL: 1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: text
|
||||||
|
|
||||||
|
anchors.verticalCenter: icon.verticalCenter
|
||||||
|
anchors.left: icon.right
|
||||||
|
anchors.leftMargin: icon.anchors.leftMargin
|
||||||
|
text: `: ${line.text}`
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
|
||||||
|
width: Config.dashboard.sizes.infoWidth
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
63
dots/quickshell/modules/dashboard/dash/Weather.qml
Normal file
63
dots/quickshell/modules/dashboard/dash/Weather.qml
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import "root:/utils"
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
implicitWidth: icon.implicitWidth + info.implicitWidth + info.anchors.leftMargin
|
||||||
|
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (visible)
|
||||||
|
Weather.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: parent.left
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
text: Weather.icon || "cloud_alert"
|
||||||
|
color: Colours.palette.m3secondary
|
||||||
|
font.pointSize: Appearance.font.size.extraLarge * 2
|
||||||
|
font.variableAxes: ({
|
||||||
|
opsz: Appearance.font.size.extraLarge * 1.2
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: info
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: icon.right
|
||||||
|
anchors.leftMargin: Appearance.spacing.large
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
text: `${Weather.temperature}°C`
|
||||||
|
color: Colours.palette.m3primary
|
||||||
|
font.pointSize: Appearance.font.size.extraLarge
|
||||||
|
font.weight: 500
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
text: Weather.description || qsTr("No weather")
|
||||||
|
|
||||||
|
elide: Text.ElideRight
|
||||||
|
width: Math.min(implicitWidth, root.parent.width - icon.implicitWidth - info.anchors.leftMargin - Appearance.padding.large * 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
66
dots/quickshell/modules/drawers/Backgrounds.qml
Normal file
66
dots/quickshell/modules/drawers/Backgrounds.qml
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import "root:/modules/osd" as Osd
|
||||||
|
import "root:/modules/notifications" as Notifications
|
||||||
|
import "root:/modules/session" as Session
|
||||||
|
import "root:/modules/launcher" as Launcher
|
||||||
|
import "root:/modules/dashboard" as Dashboard
|
||||||
|
import "root:/modules/bar/popouts" as BarPopouts
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Shapes
|
||||||
|
|
||||||
|
Shape {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Panels panels
|
||||||
|
required property Item bar
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Config.border.thickness
|
||||||
|
anchors.leftMargin: bar.implicitWidth
|
||||||
|
preferredRendererType: Shape.CurveRenderer
|
||||||
|
opacity: Colours.transparency.enabled ? Colours.transparency.base : 1
|
||||||
|
|
||||||
|
Osd.Background {
|
||||||
|
wrapper: panels.osd
|
||||||
|
|
||||||
|
startX: root.width - panels.session.width
|
||||||
|
startY: (root.height - wrapper.height) / 2 - rounding
|
||||||
|
}
|
||||||
|
|
||||||
|
Notifications.Background {
|
||||||
|
wrapper: panels.notifications
|
||||||
|
|
||||||
|
startX: root.width
|
||||||
|
startY: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Session.Background {
|
||||||
|
wrapper: panels.session
|
||||||
|
|
||||||
|
startX: root.width
|
||||||
|
startY: (root.height - wrapper.height) / 2 - rounding
|
||||||
|
}
|
||||||
|
|
||||||
|
Launcher.Background {
|
||||||
|
wrapper: panels.launcher
|
||||||
|
|
||||||
|
startX: (root.width - wrapper.width) / 2 - rounding
|
||||||
|
startY: root.height
|
||||||
|
}
|
||||||
|
|
||||||
|
Dashboard.Background {
|
||||||
|
wrapper: panels.dashboard
|
||||||
|
|
||||||
|
startX: (root.width - wrapper.width) / 2 - rounding
|
||||||
|
startY: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
BarPopouts.Background {
|
||||||
|
wrapper: panels.popouts
|
||||||
|
invertBottomRounding: wrapper.y + wrapper.height + 1 >= root.height
|
||||||
|
|
||||||
|
startX: 0
|
||||||
|
startY: wrapper.y - rounding
|
||||||
|
}
|
||||||
|
}
|
||||||
47
dots/quickshell/modules/drawers/Border.qml
Normal file
47
dots/quickshell/modules/drawers/Border.qml
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Effects
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Item bar
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: rect
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Colours.alpha(Config.border.colour, false)
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: mask
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
layer.enabled: true
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Config.border.thickness
|
||||||
|
anchors.leftMargin: root.bar.implicitWidth
|
||||||
|
radius: Config.border.rounding
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MultiEffect {
|
||||||
|
anchors.fill: parent
|
||||||
|
maskEnabled: true
|
||||||
|
maskInverted: true
|
||||||
|
maskSource: mask
|
||||||
|
source: rect
|
||||||
|
maskThresholdMin: 0.5
|
||||||
|
maskSpreadAtMin: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
147
dots/quickshell/modules/drawers/Drawers.qml
Normal file
147
dots/quickshell/modules/drawers/Drawers.qml
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import "root:/modules/bar"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Effects
|
||||||
|
|
||||||
|
Variants {
|
||||||
|
model: Quickshell.screens
|
||||||
|
|
||||||
|
Scope {
|
||||||
|
id: scope
|
||||||
|
|
||||||
|
required property ShellScreen modelData
|
||||||
|
|
||||||
|
Exclusions {
|
||||||
|
screen: scope.modelData
|
||||||
|
bar: bar
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledWindow {
|
||||||
|
id: win
|
||||||
|
|
||||||
|
screen: scope.modelData
|
||||||
|
name: "drawers"
|
||||||
|
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||||
|
WlrLayershell.keyboardFocus: visibilities.launcher || visibilities.session ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||||
|
|
||||||
|
mask: Region {
|
||||||
|
x: bar.implicitWidth
|
||||||
|
y: Config.border.thickness
|
||||||
|
width: win.width - bar.implicitWidth - Config.border.thickness
|
||||||
|
height: win.height - Config.border.thickness * 2
|
||||||
|
intersection: Intersection.Xor
|
||||||
|
|
||||||
|
regions: regions.instances
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors.top: true
|
||||||
|
anchors.bottom: true
|
||||||
|
anchors.left: true
|
||||||
|
anchors.right: true
|
||||||
|
|
||||||
|
Variants {
|
||||||
|
id: regions
|
||||||
|
|
||||||
|
model: panels.children
|
||||||
|
|
||||||
|
Region {
|
||||||
|
required property Item modelData
|
||||||
|
|
||||||
|
x: modelData.x + bar.implicitWidth
|
||||||
|
y: modelData.y + Config.border.thickness
|
||||||
|
width: modelData.width
|
||||||
|
height: modelData.height
|
||||||
|
intersection: Intersection.Subtract
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HyprlandFocusGrab {
|
||||||
|
active: visibilities.launcher || visibilities.session
|
||||||
|
windows: [win]
|
||||||
|
onCleared: {
|
||||||
|
visibilities.launcher = false;
|
||||||
|
visibilities.session = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: visibilities.session ? 0.5 : 0
|
||||||
|
color: Colours.palette.m3scrim
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: background
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
Border {
|
||||||
|
bar: bar
|
||||||
|
}
|
||||||
|
|
||||||
|
Backgrounds {
|
||||||
|
panels: panels
|
||||||
|
bar: bar
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MultiEffect {
|
||||||
|
anchors.fill: source
|
||||||
|
source: background
|
||||||
|
shadowEnabled: true
|
||||||
|
blurMax: 15
|
||||||
|
shadowColor: Qt.alpha(Colours.palette.m3shadow, 0.7)
|
||||||
|
}
|
||||||
|
|
||||||
|
PersistentProperties {
|
||||||
|
id: visibilities
|
||||||
|
|
||||||
|
property bool osd
|
||||||
|
property bool session
|
||||||
|
property bool launcher
|
||||||
|
property bool dashboard
|
||||||
|
|
||||||
|
Component.onCompleted: Visibilities.screens[scope.modelData] = this
|
||||||
|
}
|
||||||
|
|
||||||
|
Interactions {
|
||||||
|
screen: scope.modelData
|
||||||
|
popouts: panels.popouts
|
||||||
|
visibilities: visibilities
|
||||||
|
panels: panels
|
||||||
|
bar: bar
|
||||||
|
|
||||||
|
Panels {
|
||||||
|
id: panels
|
||||||
|
|
||||||
|
screen: scope.modelData
|
||||||
|
visibilities: visibilities
|
||||||
|
bar: bar
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Bar {
|
||||||
|
id: bar
|
||||||
|
|
||||||
|
screen: scope.modelData
|
||||||
|
popouts: panels.popouts
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
37
dots/quickshell/modules/drawers/Exclusions.qml
Normal file
37
dots/quickshell/modules/drawers/Exclusions.qml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Scope {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property ShellScreen screen
|
||||||
|
required property Item bar
|
||||||
|
|
||||||
|
ExclusionZone {
|
||||||
|
anchors.left: true
|
||||||
|
exclusiveZone: root.bar.implicitWidth
|
||||||
|
}
|
||||||
|
|
||||||
|
ExclusionZone {
|
||||||
|
anchors.top: true
|
||||||
|
}
|
||||||
|
|
||||||
|
ExclusionZone {
|
||||||
|
anchors.right: true
|
||||||
|
}
|
||||||
|
|
||||||
|
ExclusionZone {
|
||||||
|
anchors.bottom: true
|
||||||
|
}
|
||||||
|
|
||||||
|
component ExclusionZone: StyledWindow {
|
||||||
|
screen: root.screen
|
||||||
|
name: "border-exclusion"
|
||||||
|
exclusiveZone: Config.border.thickness
|
||||||
|
mask: Region {}
|
||||||
|
}
|
||||||
|
}
|
||||||
160
dots/quickshell/modules/drawers/Interactions.qml
Normal file
160
dots/quickshell/modules/drawers/Interactions.qml
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import "root:/modules/bar/popouts" as BarPopouts
|
||||||
|
import "root:/modules/osd" as Osd
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property ShellScreen screen
|
||||||
|
required property BarPopouts.Wrapper popouts
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
required property Panels panels
|
||||||
|
required property Item bar
|
||||||
|
|
||||||
|
property bool osdHovered
|
||||||
|
property point dragStart
|
||||||
|
property bool dashboardShortcutActive
|
||||||
|
property bool osdShortcutActive
|
||||||
|
|
||||||
|
function withinPanelHeight(panel: Item, x: real, y: real): bool {
|
||||||
|
const panelY = Config.border.thickness + panel.y;
|
||||||
|
return y >= panelY - Config.border.rounding && y <= panelY + panel.height + Config.border.rounding;
|
||||||
|
}
|
||||||
|
|
||||||
|
function inRightPanel(panel: Item, x: real, y: real): bool {
|
||||||
|
return x > bar.implicitWidth + panel.x && withinPanelHeight(panel, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
function inTopPanel(panel: Item, x: real, y: real): bool {
|
||||||
|
const panelX = bar.implicitWidth + panel.x;
|
||||||
|
return y < Config.border.thickness + panel.y + panel.height && x >= panelX - Config.border.rounding && x <= panelX + panel.width + Config.border.rounding;
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
|
||||||
|
onPressed: event => dragStart = Qt.point(event.x, event.y)
|
||||||
|
onContainsMouseChanged: {
|
||||||
|
if (!containsMouse) {
|
||||||
|
// Only hide if not activated by shortcut
|
||||||
|
if (!osdShortcutActive) {
|
||||||
|
visibilities.osd = false;
|
||||||
|
osdHovered = false;
|
||||||
|
}
|
||||||
|
if (!dashboardShortcutActive) {
|
||||||
|
visibilities.dashboard = false;
|
||||||
|
}
|
||||||
|
popouts.hasCurrent = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onPositionChanged: ({
|
||||||
|
x,
|
||||||
|
y
|
||||||
|
}) => {
|
||||||
|
// Show osd on hover
|
||||||
|
const showOsd = inRightPanel(panels.osd, x, y);
|
||||||
|
|
||||||
|
// Always update visibility based on hover if not in shortcut mode
|
||||||
|
if (!osdShortcutActive) {
|
||||||
|
visibilities.osd = showOsd;
|
||||||
|
osdHovered = showOsd;
|
||||||
|
} else if (showOsd) {
|
||||||
|
// If hovering over OSD area while in shortcut mode, transition to hover control
|
||||||
|
osdShortcutActive = false;
|
||||||
|
osdHovered = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show/hide session on drag
|
||||||
|
if (pressed && withinPanelHeight(panels.session, x, y)) {
|
||||||
|
const dragX = x - dragStart.x;
|
||||||
|
if (dragX < -Config.session.dragThreshold)
|
||||||
|
visibilities.session = true;
|
||||||
|
else if (dragX > Config.session.dragThreshold)
|
||||||
|
visibilities.session = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show dashboard on hover
|
||||||
|
const showDashboard = inTopPanel(panels.dashboard, x, y);
|
||||||
|
|
||||||
|
// Always update visibility based on hover if not in shortcut mode
|
||||||
|
if (!dashboardShortcutActive) {
|
||||||
|
visibilities.dashboard = showDashboard;
|
||||||
|
} else if (showDashboard) {
|
||||||
|
// If hovering over dashboard area while in shortcut mode, transition to hover control
|
||||||
|
dashboardShortcutActive = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show popouts on hover
|
||||||
|
const popout = panels.popouts;
|
||||||
|
if (x < bar.implicitWidth + popout.width) {
|
||||||
|
if (x < bar.implicitWidth)
|
||||||
|
// Handle like part of bar
|
||||||
|
bar.checkPopout(y);
|
||||||
|
else
|
||||||
|
// Keep on hover
|
||||||
|
popouts.hasCurrent = withinPanelHeight(popout, x, y);
|
||||||
|
} else
|
||||||
|
popouts.hasCurrent = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Monitor individual visibility changes
|
||||||
|
Connections {
|
||||||
|
target: root.visibilities
|
||||||
|
|
||||||
|
function onLauncherChanged() {
|
||||||
|
// If launcher is hidden, clear shortcut flags for dashboard and OSD
|
||||||
|
if (!root.visibilities.launcher) {
|
||||||
|
root.dashboardShortcutActive = false;
|
||||||
|
root.osdShortcutActive = false;
|
||||||
|
|
||||||
|
// Also hide dashboard and OSD if they're not being hovered
|
||||||
|
const inDashboardArea = root.inTopPanel(root.panels.dashboard, root.mouseX, root.mouseY);
|
||||||
|
const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY);
|
||||||
|
|
||||||
|
if (!inDashboardArea) {
|
||||||
|
root.visibilities.dashboard = false;
|
||||||
|
}
|
||||||
|
if (!inOsdArea) {
|
||||||
|
root.visibilities.osd = false;
|
||||||
|
root.osdHovered = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onDashboardChanged() {
|
||||||
|
if (root.visibilities.dashboard) {
|
||||||
|
// Dashboard became visible, immediately check if this should be shortcut mode
|
||||||
|
const inDashboardArea = root.inTopPanel(root.panels.dashboard, root.mouseX, root.mouseY);
|
||||||
|
if (!inDashboardArea) {
|
||||||
|
root.dashboardShortcutActive = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Dashboard hidden, clear shortcut flag
|
||||||
|
root.dashboardShortcutActive = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onOsdChanged() {
|
||||||
|
if (root.visibilities.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 {
|
||||||
|
screen: root.screen
|
||||||
|
visibilities: root.visibilities
|
||||||
|
hovered: root.osdHovered
|
||||||
|
}
|
||||||
|
}
|
||||||
93
dots/quickshell/modules/drawers/Panels.qml
Normal file
93
dots/quickshell/modules/drawers/Panels.qml
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import "root:/modules/osd" as Osd
|
||||||
|
import "root:/modules/notifications" as Notifications
|
||||||
|
import "root:/modules/session" as Session
|
||||||
|
import "root:/modules/launcher" as Launcher
|
||||||
|
import "root:/modules/dashboard" as Dashboard
|
||||||
|
import "root:/modules/bar/popouts" as BarPopouts
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property ShellScreen screen
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
required property Item bar
|
||||||
|
|
||||||
|
readonly property Osd.Wrapper osd: osd
|
||||||
|
readonly property Notifications.Wrapper notifications: notifications
|
||||||
|
readonly property Session.Wrapper session: session
|
||||||
|
readonly property Launcher.Wrapper launcher: launcher
|
||||||
|
readonly property Dashboard.Wrapper dashboard: dashboard
|
||||||
|
readonly property BarPopouts.Wrapper popouts: popouts
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Config.border.thickness
|
||||||
|
anchors.leftMargin: bar.implicitWidth
|
||||||
|
|
||||||
|
Component.onCompleted: Visibilities.panels[screen] = this
|
||||||
|
|
||||||
|
Osd.Wrapper {
|
||||||
|
id: osd
|
||||||
|
|
||||||
|
clip: root.visibilities.session
|
||||||
|
screen: root.screen
|
||||||
|
visibility: root.visibilities.osd
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: session.width
|
||||||
|
}
|
||||||
|
|
||||||
|
Notifications.Wrapper {
|
||||||
|
id: notifications
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
}
|
||||||
|
|
||||||
|
Session.Wrapper {
|
||||||
|
id: session
|
||||||
|
|
||||||
|
visibilities: root.visibilities
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.right: parent.right
|
||||||
|
}
|
||||||
|
|
||||||
|
Launcher.Wrapper {
|
||||||
|
id: launcher
|
||||||
|
|
||||||
|
visibilities: root.visibilities
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
}
|
||||||
|
|
||||||
|
Dashboard.Wrapper {
|
||||||
|
id: dashboard
|
||||||
|
|
||||||
|
visibilities: root.visibilities
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.top: parent.top
|
||||||
|
}
|
||||||
|
|
||||||
|
BarPopouts.Wrapper {
|
||||||
|
id: popouts
|
||||||
|
|
||||||
|
screen: root.screen
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.verticalCenter: parent.top
|
||||||
|
anchors.verticalCenterOffset: {
|
||||||
|
const off = root.popouts.currentCenter - Config.border.thickness;
|
||||||
|
const diff = root.height - Math.floor(off + implicitHeight / 2);
|
||||||
|
if (diff < 0)
|
||||||
|
return off + diff;
|
||||||
|
return off;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
69
dots/quickshell/modules/launcher/ActionItem.qml
Normal file
69
dots/quickshell/modules/launcher/ActionItem.qml
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Actions.Action modelData
|
||||||
|
required property var list
|
||||||
|
|
||||||
|
implicitHeight: Config.launcher.sizes.itemHeight
|
||||||
|
|
||||||
|
anchors.left: parent?.left
|
||||||
|
anchors.right: parent?.right
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
root.modelData?.onClicked(root.list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.leftMargin: Appearance.padding.larger
|
||||||
|
anchors.rightMargin: Appearance.padding.larger
|
||||||
|
anchors.margins: Appearance.padding.smaller
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
text: root.modelData?.icon ?? ""
|
||||||
|
font.pointSize: Appearance.font.size.extraLarge
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.left: icon.right
|
||||||
|
anchors.leftMargin: Appearance.spacing.larger
|
||||||
|
anchors.verticalCenter: icon.verticalCenter
|
||||||
|
|
||||||
|
implicitWidth: parent.width - icon.width
|
||||||
|
implicitHeight: name.implicitHeight + desc.implicitHeight
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: name
|
||||||
|
|
||||||
|
text: root.modelData?.name ?? ""
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: desc
|
||||||
|
|
||||||
|
text: root.modelData?.desc ?? ""
|
||||||
|
font.pointSize: Appearance.font.size.small
|
||||||
|
color: Colours.alpha(Colours.palette.m3outline, true)
|
||||||
|
|
||||||
|
elide: Text.ElideRight
|
||||||
|
width: root.width - icon.width - Appearance.rounding.normal * 2
|
||||||
|
|
||||||
|
anchors.top: name.bottom
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
152
dots/quickshell/modules/launcher/Actions.qml
Normal file
152
dots/quickshell/modules/launcher/Actions.qml
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import "root:/utils/scripts/fuzzysort.js" as Fuzzy
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
readonly property list<Action> list: [
|
||||||
|
Action {
|
||||||
|
name: qsTr("Scheme")
|
||||||
|
desc: qsTr("Change the current colour scheme")
|
||||||
|
icon: "palette"
|
||||||
|
|
||||||
|
function onClicked(list: AppList): void {
|
||||||
|
root.autocomplete(list, "scheme");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Action {
|
||||||
|
name: qsTr("Wallpaper")
|
||||||
|
desc: qsTr("Change the current wallpaper")
|
||||||
|
icon: "image"
|
||||||
|
|
||||||
|
function onClicked(list: AppList): void {
|
||||||
|
root.autocomplete(list, "wallpaper");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Action {
|
||||||
|
name: qsTr("Variant")
|
||||||
|
desc: qsTr("Change the current scheme variant")
|
||||||
|
icon: "colors"
|
||||||
|
|
||||||
|
function onClicked(list: AppList): void {
|
||||||
|
root.autocomplete(list, "variant");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Action {
|
||||||
|
name: qsTr("Transparency")
|
||||||
|
desc: qsTr("Change shell transparency")
|
||||||
|
icon: "opacity"
|
||||||
|
|
||||||
|
function onClicked(list: AppList): void {
|
||||||
|
root.autocomplete(list, "transparency");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Action {
|
||||||
|
name: qsTr("Light")
|
||||||
|
desc: qsTr("Change the scheme to light mode")
|
||||||
|
icon: "light_mode"
|
||||||
|
|
||||||
|
function onClicked(list: AppList): void {
|
||||||
|
list.visibilities.launcher = false;
|
||||||
|
Colours.setMode("light");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Action {
|
||||||
|
name: qsTr("Dark")
|
||||||
|
desc: qsTr("Change the scheme to dark mode")
|
||||||
|
icon: "dark_mode"
|
||||||
|
|
||||||
|
function onClicked(list: AppList): void {
|
||||||
|
list.visibilities.launcher = false;
|
||||||
|
Colours.setMode("dark");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Action {
|
||||||
|
name: qsTr("Shutdown")
|
||||||
|
desc: qsTr("Shutdown the system")
|
||||||
|
icon: "power_settings_new"
|
||||||
|
disabled: !Config.launcher.enableDangerousActions
|
||||||
|
|
||||||
|
function onClicked(list: AppList): void {
|
||||||
|
list.visibilities.launcher = false;
|
||||||
|
Quickshell.execDetached(["systemctl", "poweroff"]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Action {
|
||||||
|
name: qsTr("Reboot")
|
||||||
|
desc: qsTr("Reboot the system")
|
||||||
|
icon: "cached"
|
||||||
|
disabled: !Config.launcher.enableDangerousActions
|
||||||
|
|
||||||
|
function onClicked(list: AppList): void {
|
||||||
|
list.visibilities.launcher = false;
|
||||||
|
Quickshell.execDetached(["systemctl", "reboot"]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Action {
|
||||||
|
name: qsTr("Logout")
|
||||||
|
desc: qsTr("Log out of the current session")
|
||||||
|
icon: "exit_to_app"
|
||||||
|
disabled: !Config.launcher.enableDangerousActions
|
||||||
|
|
||||||
|
function onClicked(list: AppList): void {
|
||||||
|
list.visibilities.launcher = false;
|
||||||
|
Quickshell.execDetached(["sh", "-c", "(uwsm stop | grep -q 'Compositor is not running' && loginctl terminate-user $USER) || uwsm stop"]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Action {
|
||||||
|
name: qsTr("Lock")
|
||||||
|
desc: qsTr("Lock the current session")
|
||||||
|
icon: "lock"
|
||||||
|
|
||||||
|
function onClicked(list: AppList): void {
|
||||||
|
list.visibilities.launcher = false;
|
||||||
|
Quickshell.execDetached(["loginctl", "lock-session"]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Action {
|
||||||
|
name: qsTr("Sleep")
|
||||||
|
desc: qsTr("Suspend then hibernate")
|
||||||
|
icon: "bedtime"
|
||||||
|
|
||||||
|
function onClicked(list: AppList): void {
|
||||||
|
list.visibilities.launcher = false;
|
||||||
|
Quickshell.execDetached(["systemctl", "suspend-then-hibernate"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
readonly property list<var> preppedActions: list.filter(a => !a.disabled).map(a => ({
|
||||||
|
name: Fuzzy.prepare(a.name),
|
||||||
|
desc: Fuzzy.prepare(a.desc),
|
||||||
|
action: a
|
||||||
|
}))
|
||||||
|
|
||||||
|
function fuzzyQuery(search: string): var {
|
||||||
|
return Fuzzy.go(search.slice(Config.launcher.actionPrefix.length), preppedActions, {
|
||||||
|
all: true,
|
||||||
|
keys: ["name", "desc"],
|
||||||
|
scoreFn: r => r[0].score > 0 ? r[0].score * 0.9 + r[1].score * 0.1 : 0
|
||||||
|
}).map(r => r.obj.action);
|
||||||
|
}
|
||||||
|
|
||||||
|
function autocomplete(list: AppList, text: string): void {
|
||||||
|
list.search.text = `${Config.launcher.actionPrefix}${text} `;
|
||||||
|
}
|
||||||
|
|
||||||
|
component Action: QtObject {
|
||||||
|
required property string name
|
||||||
|
required property string desc
|
||||||
|
required property string icon
|
||||||
|
property bool disabled
|
||||||
|
|
||||||
|
function onClicked(list: AppList): void {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
72
dots/quickshell/modules/launcher/AppItem.qml
Normal file
72
dots/quickshell/modules/launcher/AppItem.qml
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property DesktopEntry modelData
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
|
implicitHeight: Config.launcher.sizes.itemHeight
|
||||||
|
|
||||||
|
anchors.left: parent?.left
|
||||||
|
anchors.right: parent?.right
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
Apps.launch(root.modelData);
|
||||||
|
root.visibilities.launcher = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.leftMargin: Appearance.padding.larger
|
||||||
|
anchors.rightMargin: Appearance.padding.larger
|
||||||
|
anchors.margins: Appearance.padding.smaller
|
||||||
|
|
||||||
|
IconImage {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
source: Quickshell.iconPath(root.modelData?.icon, "image-missing")
|
||||||
|
implicitSize: parent.height * 0.8
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.left: icon.right
|
||||||
|
anchors.leftMargin: Appearance.spacing.normal
|
||||||
|
anchors.verticalCenter: icon.verticalCenter
|
||||||
|
|
||||||
|
implicitWidth: parent.width - icon.width
|
||||||
|
implicitHeight: name.implicitHeight + comment.implicitHeight
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: name
|
||||||
|
|
||||||
|
text: root.modelData?.name ?? ""
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: comment
|
||||||
|
|
||||||
|
text: (root.modelData?.comment || root.modelData?.genericName || root.modelData?.name) ?? ""
|
||||||
|
font.pointSize: Appearance.font.size.small
|
||||||
|
color: Colours.alpha(Colours.palette.m3outline, true)
|
||||||
|
|
||||||
|
elide: Text.ElideRight
|
||||||
|
width: root.width - icon.width - Appearance.rounding.normal * 2
|
||||||
|
|
||||||
|
anchors.top: name.bottom
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
199
dots/quickshell/modules/launcher/AppList.qml
Normal file
199
dots/quickshell/modules/launcher/AppList.qml
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property TextField search
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
|
property bool isAction: search.text.startsWith(Config.launcher.actionPrefix)
|
||||||
|
property bool isScheme: search.text.startsWith(`${Config.launcher.actionPrefix}scheme `)
|
||||||
|
property bool isVariant: search.text.startsWith(`${Config.launcher.actionPrefix}variant `)
|
||||||
|
|
||||||
|
function getModelValues() {
|
||||||
|
let text = search.text;
|
||||||
|
if (isScheme)
|
||||||
|
return Schemes.fuzzyQuery(text);
|
||||||
|
if (isVariant)
|
||||||
|
return M3Variants.fuzzyQuery(text);
|
||||||
|
if (isAction)
|
||||||
|
return Actions.fuzzyQuery(text);
|
||||||
|
if (text.startsWith(Config.launcher.actionPrefix))
|
||||||
|
text = search.text.slice(Config.launcher.actionPrefix.length);
|
||||||
|
return Apps.fuzzyQuery(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
model: ScriptModel {
|
||||||
|
values: root.getModelValues()
|
||||||
|
onValuesChanged: root.currentIndex = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
orientation: Qt.Vertical
|
||||||
|
implicitHeight: (Config.launcher.sizes.itemHeight + spacing) * Math.min(Config.launcher.maxShown, count) - spacing
|
||||||
|
|
||||||
|
highlightMoveDuration: Appearance.anim.durations.normal
|
||||||
|
highlightResizeDuration: 0
|
||||||
|
|
||||||
|
highlight: StyledRect {
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
color: Colours.palette.m3onSurface
|
||||||
|
opacity: 0.08
|
||||||
|
}
|
||||||
|
|
||||||
|
delegate: {
|
||||||
|
if (isScheme)
|
||||||
|
return schemeItem;
|
||||||
|
if (isVariant)
|
||||||
|
return variantItem;
|
||||||
|
if (isAction)
|
||||||
|
return actionItem;
|
||||||
|
return appItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
ScrollBar.vertical: StyledScrollBar {}
|
||||||
|
|
||||||
|
add: Transition {
|
||||||
|
Anim {
|
||||||
|
properties: "opacity,scale"
|
||||||
|
from: 0
|
||||||
|
to: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
remove: Transition {
|
||||||
|
Anim {
|
||||||
|
properties: "opacity,scale"
|
||||||
|
from: 1
|
||||||
|
to: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
move: Transition {
|
||||||
|
Anim {
|
||||||
|
property: "y"
|
||||||
|
}
|
||||||
|
Anim {
|
||||||
|
properties: "opacity,scale"
|
||||||
|
to: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addDisplaced: Transition {
|
||||||
|
Anim {
|
||||||
|
property: "y"
|
||||||
|
duration: Appearance.anim.durations.small
|
||||||
|
}
|
||||||
|
Anim {
|
||||||
|
properties: "opacity,scale"
|
||||||
|
to: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
displaced: Transition {
|
||||||
|
Anim {
|
||||||
|
property: "y"
|
||||||
|
}
|
||||||
|
Anim {
|
||||||
|
properties: "opacity,scale"
|
||||||
|
to: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: appItem
|
||||||
|
|
||||||
|
AppItem {
|
||||||
|
visibilities: root.visibilities
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: actionItem
|
||||||
|
|
||||||
|
ActionItem {
|
||||||
|
list: root
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: schemeItem
|
||||||
|
|
||||||
|
SchemeItem {
|
||||||
|
list: root
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: variantItem
|
||||||
|
|
||||||
|
VariantItem {
|
||||||
|
list: root
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on isAction {
|
||||||
|
ChangeAnim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on isScheme {
|
||||||
|
ChangeAnim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on isVariant {
|
||||||
|
ChangeAnim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
component ChangeAnim: SequentialAnimation {
|
||||||
|
ParallelAnimation {
|
||||||
|
Anim {
|
||||||
|
target: root
|
||||||
|
property: "opacity"
|
||||||
|
from: 1
|
||||||
|
to: 0
|
||||||
|
duration: Appearance.anim.durations.small
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standardAccel
|
||||||
|
}
|
||||||
|
Anim {
|
||||||
|
target: root
|
||||||
|
property: "scale"
|
||||||
|
from: 1
|
||||||
|
to: 0.9
|
||||||
|
duration: Appearance.anim.durations.small
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standardAccel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PropertyAction {}
|
||||||
|
ParallelAnimation {
|
||||||
|
Anim {
|
||||||
|
target: root
|
||||||
|
property: "opacity"
|
||||||
|
from: 0
|
||||||
|
to: 1
|
||||||
|
duration: Appearance.anim.durations.small
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standardDecel
|
||||||
|
}
|
||||||
|
Anim {
|
||||||
|
target: root
|
||||||
|
property: "scale"
|
||||||
|
from: 0.9
|
||||||
|
to: 1
|
||||||
|
duration: Appearance.anim.durations.small
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standardDecel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Anim: NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
63
dots/quickshell/modules/launcher/Background.qml
Normal file
63
dots/quickshell/modules/launcher/Background.qml
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Shapes
|
||||||
|
|
||||||
|
ShapePath {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Wrapper 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
|
||||||
|
|
||||||
|
strokeWidth: -1
|
||||||
|
fillColor: Config.border.colour
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on fillColor {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
168
dots/quickshell/modules/launcher/Content.qml
Normal file
168
dots/quickshell/modules/launcher/Content.qml
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
readonly property int padding: Appearance.padding.large
|
||||||
|
readonly property int rounding: Appearance.rounding.large
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
visibilities: root.visibilities
|
||||||
|
search: search
|
||||||
|
padding: root.padding
|
||||||
|
rounding: root.rounding
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: searchWrapper
|
||||||
|
|
||||||
|
color: Colours.alpha(Colours.palette.m3surfaceContainer, true)
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
|
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: Colours.palette.m3onSurfaceVariant
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledTextField {
|
||||||
|
id: search
|
||||||
|
|
||||||
|
anchors.left: searchIcon.right
|
||||||
|
anchors.right: clearIcon.left
|
||||||
|
anchors.leftMargin: Appearance.spacing.small
|
||||||
|
anchors.rightMargin: Appearance.spacing.small
|
||||||
|
|
||||||
|
topPadding: Appearance.padding.larger
|
||||||
|
bottomPadding: Appearance.padding.larger
|
||||||
|
|
||||||
|
placeholderText: qsTr("Type \"%1\" for commands").arg(Config.launcher.actionPrefix)
|
||||||
|
background: null
|
||||||
|
|
||||||
|
onAccepted: {
|
||||||
|
const currentItem = list.currentList?.currentItem;
|
||||||
|
if (currentItem) {
|
||||||
|
if (list.showWallpapers) {
|
||||||
|
Wallpapers.setWallpaper(currentItem.modelData.path);
|
||||||
|
root.visibilities.launcher = false;
|
||||||
|
} else if (text.startsWith(Config.launcher.actionPrefix)) {
|
||||||
|
currentItem.modelData.onClicked(list.currentList);
|
||||||
|
} else {
|
||||||
|
Apps.launch(currentItem.modelData);
|
||||||
|
root.visibilities.launcher = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Keys.onUpPressed: list.currentList?.decrementCurrentIndex()
|
||||||
|
Keys.onDownPressed: list.currentList?.incrementCurrentIndex()
|
||||||
|
|
||||||
|
Keys.onEscapePressed: root.visibilities.launcher = false
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: root.visibilities
|
||||||
|
|
||||||
|
function onLauncherChanged(): void {
|
||||||
|
if (root.visibilities.launcher)
|
||||||
|
search.forceActiveFocus();
|
||||||
|
else {
|
||||||
|
search.text = "";
|
||||||
|
const current = list.currentList;
|
||||||
|
if (current)
|
||||||
|
current.currentIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: clearIcon
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: root.padding
|
||||||
|
|
||||||
|
width: search.text ? implicitWidth : implicitWidth / 2
|
||||||
|
opacity: {
|
||||||
|
if (!search.text)
|
||||||
|
return 0;
|
||||||
|
if (mouse.pressed)
|
||||||
|
return 0.7;
|
||||||
|
if (mouse.hovered)
|
||||||
|
return 0.8;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
text: "close"
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: mouse
|
||||||
|
|
||||||
|
property bool hovered
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: search.text ? Qt.PointingHandCursor : undefined
|
||||||
|
|
||||||
|
onEntered: hovered = true
|
||||||
|
onExited: hovered = false
|
||||||
|
onClicked: search.text = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on width {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.small
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.small
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
189
dots/quickshell/modules/launcher/ContentList.qml
Normal file
189
dots/quickshell/modules/launcher/ContentList.qml
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
required property TextField search
|
||||||
|
required property int padding
|
||||||
|
required property int rounding
|
||||||
|
|
||||||
|
readonly property bool showWallpapers: search.text.startsWith(`${Config.launcher.actionPrefix}wallpaper `)
|
||||||
|
property var currentList
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
state: showWallpapers ? "wallpapers" : "apps"
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "apps"
|
||||||
|
|
||||||
|
PropertyChanges {
|
||||||
|
root.currentList: appList.item
|
||||||
|
root.implicitWidth: Config.launcher.sizes.itemWidth
|
||||||
|
root.implicitHeight: Math.max(empty.implicitHeight, appList.implicitHeight)
|
||||||
|
appList.active: true
|
||||||
|
}
|
||||||
|
|
||||||
|
AnchorChanges {
|
||||||
|
anchors.left: root.parent.left
|
||||||
|
anchors.right: root.parent.right
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "wallpapers"
|
||||||
|
|
||||||
|
PropertyChanges {
|
||||||
|
root.currentList: wallpaperList.item
|
||||||
|
root.implicitWidth: Math.max(Config.launcher.sizes.itemWidth, wallpaperList.implicitWidth)
|
||||||
|
root.implicitHeight: Config.launcher.sizes.wallpaperHeight
|
||||||
|
wallpaperList.active: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
transitions: Transition {
|
||||||
|
SequentialAnimation {
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
property: "opacity"
|
||||||
|
from: 1
|
||||||
|
to: 0
|
||||||
|
duration: Appearance.anim.durations.small
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
PropertyAction {
|
||||||
|
targets: [appList, wallpaperList]
|
||||||
|
properties: "active"
|
||||||
|
}
|
||||||
|
ParallelAnimation {
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
properties: "implicitWidth,implicitHeight"
|
||||||
|
duration: Appearance.anim.durations.large
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
property: "opacity"
|
||||||
|
from: 0
|
||||||
|
to: 1
|
||||||
|
duration: Appearance.anim.durations.large
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: appList
|
||||||
|
|
||||||
|
active: false
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
sourceComponent: AppList {
|
||||||
|
search: root.search
|
||||||
|
visibilities: root.visibilities
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: wallpaperList
|
||||||
|
|
||||||
|
active: false
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
sourceComponent: WallpaperList {
|
||||||
|
search: root.search
|
||||||
|
visibilities: root.visibilities
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: empty
|
||||||
|
|
||||||
|
opacity: root.currentList?.count === 0 ? 1 : 0
|
||||||
|
scale: root.currentList?.count === 0 ? 1 : 0.5
|
||||||
|
|
||||||
|
implicitWidth: icon.width + text.width + Appearance.spacing.small
|
||||||
|
implicitHeight: icon.height
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
text: "manage_search"
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font.pointSize: Appearance.font.size.extraLarge
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: text
|
||||||
|
|
||||||
|
anchors.left: icon.right
|
||||||
|
anchors.leftMargin: Appearance.spacing.small
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
text: qsTr("No results")
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font.pointSize: Appearance.font.size.larger
|
||||||
|
font.weight: 500
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on scale {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitWidth {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.large
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.large
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
91
dots/quickshell/modules/launcher/M3Variants.qml
Normal file
91
dots/quickshell/modules/launcher/M3Variants.qml
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import "root:/utils/scripts/fuzzysort.js" as Fuzzy
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
readonly property list<Variant> list: [
|
||||||
|
Variant {
|
||||||
|
variant: "vibrant"
|
||||||
|
icon: "sentiment_very_dissatisfied"
|
||||||
|
name: "Vibrant"
|
||||||
|
description: "A high chroma palette. The primary palette's chroma is at maximum."
|
||||||
|
},
|
||||||
|
Variant {
|
||||||
|
variant: "tonalspot"
|
||||||
|
icon: "android"
|
||||||
|
name: "Tonal Spot"
|
||||||
|
description: "Default for Material theme colours. A pastel palette with a low chroma."
|
||||||
|
},
|
||||||
|
Variant {
|
||||||
|
variant: "expressive"
|
||||||
|
icon: "compare_arrows"
|
||||||
|
name: "Expressive"
|
||||||
|
description: "A medium chroma palette. The primary palette's hue is different from the seed colour, for variety."
|
||||||
|
},
|
||||||
|
Variant {
|
||||||
|
variant: "fidelity"
|
||||||
|
icon: "compare"
|
||||||
|
name: "Fidelity"
|
||||||
|
description: "Matches the seed colour, even if the seed colour is very bright (high chroma)."
|
||||||
|
},
|
||||||
|
Variant {
|
||||||
|
variant: "content"
|
||||||
|
icon: "sentiment_calm"
|
||||||
|
name: "Content"
|
||||||
|
description: "Almost identical to fidelity."
|
||||||
|
},
|
||||||
|
Variant {
|
||||||
|
variant: "fruitsalad"
|
||||||
|
icon: "nutrition"
|
||||||
|
name: "Fruit Salad"
|
||||||
|
description: "A playful theme - the seed colour's hue does not appear in the theme."
|
||||||
|
},
|
||||||
|
Variant {
|
||||||
|
variant: "rainbow"
|
||||||
|
icon: "looks"
|
||||||
|
name: "Rainbow"
|
||||||
|
description: "A playful theme - the seed colour's hue does not appear in the theme."
|
||||||
|
},
|
||||||
|
Variant {
|
||||||
|
variant: "neutral"
|
||||||
|
icon: "contrast"
|
||||||
|
name: "Neutral"
|
||||||
|
description: "Close to grayscale, a hint of chroma."
|
||||||
|
},
|
||||||
|
Variant {
|
||||||
|
variant: "monochrome"
|
||||||
|
icon: "filter_b_and_w"
|
||||||
|
name: "Monochrome"
|
||||||
|
description: "All colours are grayscale, no chroma."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
readonly property list<var> preppedVariants: list.map(v => ({
|
||||||
|
name: Fuzzy.prepare(v.variant),
|
||||||
|
variant: v
|
||||||
|
}))
|
||||||
|
|
||||||
|
function fuzzyQuery(search: string): var {
|
||||||
|
return Fuzzy.go(search.slice(`${Config.launcher.actionPrefix}variant `.length), preppedVariants, {
|
||||||
|
all: true,
|
||||||
|
key: "name"
|
||||||
|
}).map(r => r.obj.variant);
|
||||||
|
}
|
||||||
|
|
||||||
|
component Variant: QtObject {
|
||||||
|
required property string variant
|
||||||
|
required property string icon
|
||||||
|
required property string name
|
||||||
|
required property string description
|
||||||
|
|
||||||
|
function onClicked(list: AppList): void {
|
||||||
|
list.visibilities.launcher = false;
|
||||||
|
Quickshell.execDetached(["caelestia", "scheme", "set", "-v", variant]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
93
dots/quickshell/modules/launcher/SchemeItem.qml
Normal file
93
dots/quickshell/modules/launcher/SchemeItem.qml
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Schemes.Scheme modelData
|
||||||
|
required property var list
|
||||||
|
|
||||||
|
implicitHeight: Config.launcher.sizes.itemHeight
|
||||||
|
|
||||||
|
anchors.left: parent?.left
|
||||||
|
anchors.right: parent?.right
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
root.modelData?.onClicked(root.list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.leftMargin: Appearance.padding.larger
|
||||||
|
anchors.rightMargin: Appearance.padding.larger
|
||||||
|
anchors.margins: Appearance.padding.smaller
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: preview
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
border.width: 1
|
||||||
|
border.color: Qt.alpha(`#${root.modelData?.colours?.outline}`, 0.5)
|
||||||
|
|
||||||
|
color: `#${root.modelData?.colours?.surface}`
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
implicitWidth: parent.height * 0.8
|
||||||
|
implicitHeight: parent.height * 0.8
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
implicitWidth: parent.implicitWidth / 2
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
implicitWidth: preview.implicitWidth
|
||||||
|
color: `#${root.modelData?.colours?.primary}`
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.left: preview.right
|
||||||
|
anchors.leftMargin: Appearance.spacing.normal
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
width: parent.width - preview.width
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: name
|
||||||
|
|
||||||
|
text: root.modelData?.name ?? ""
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: comment
|
||||||
|
|
||||||
|
text: root.modelData?.flavour ?? ""
|
||||||
|
font.pointSize: Appearance.font.size.small
|
||||||
|
color: Colours.palette.m3outline
|
||||||
|
|
||||||
|
elide: Text.ElideRight
|
||||||
|
width: parent.width - Appearance.rounding.normal * 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
67
dots/quickshell/modules/launcher/Schemes.qml
Normal file
67
dots/quickshell/modules/launcher/Schemes.qml
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import "root:/utils/scripts/fuzzysort.js" as Fuzzy
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
readonly property list<var> preppedSchemes: schemes.instances.map(s => ({
|
||||||
|
name: Fuzzy.prepare(s.name),
|
||||||
|
flavour: Fuzzy.prepare(s.flavour),
|
||||||
|
scheme: s
|
||||||
|
}))
|
||||||
|
|
||||||
|
function fuzzyQuery(search: string): var {
|
||||||
|
return Fuzzy.go(search.slice(`${Config.launcher.actionPrefix}scheme `.length), preppedSchemes, {
|
||||||
|
all: true,
|
||||||
|
keys: ["name", "flavour"],
|
||||||
|
scoreFn: r => r[0].score > 0 ? r[0].score * 0.9 + r[1].score * 0.1 : 0
|
||||||
|
}).map(r => r.obj.scheme);
|
||||||
|
}
|
||||||
|
|
||||||
|
Variants {
|
||||||
|
id: schemes
|
||||||
|
|
||||||
|
Scheme {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: getSchemes
|
||||||
|
|
||||||
|
running: true
|
||||||
|
command: ["caelestia", "scheme", "list"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
const schemeData = JSON.parse(text);
|
||||||
|
const list = Object.entries(schemeData).map(([name, f]) => Object.entries(f).map(([flavour, colours]) => ({
|
||||||
|
name,
|
||||||
|
flavour,
|
||||||
|
colours
|
||||||
|
})));
|
||||||
|
|
||||||
|
const flat = [];
|
||||||
|
for (const s of list)
|
||||||
|
for (const f of s)
|
||||||
|
flat.push(f);
|
||||||
|
|
||||||
|
schemes.model = flat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Scheme: QtObject {
|
||||||
|
required property var modelData
|
||||||
|
readonly property string name: modelData.name
|
||||||
|
readonly property string flavour: modelData.flavour
|
||||||
|
readonly property var colours: modelData.colours
|
||||||
|
|
||||||
|
function onClicked(list: AppList): void {
|
||||||
|
list.visibilities.launcher = false;
|
||||||
|
Quickshell.execDetached(["caelestia", "scheme", "set", "-n", name, "-f", flavour]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
69
dots/quickshell/modules/launcher/VariantItem.qml
Normal file
69
dots/quickshell/modules/launcher/VariantItem.qml
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property M3Variants.Variant modelData
|
||||||
|
required property var list
|
||||||
|
|
||||||
|
implicitHeight: Config.launcher.sizes.itemHeight
|
||||||
|
|
||||||
|
anchors.left: parent?.left
|
||||||
|
anchors.right: parent?.right
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
root.modelData?.onClicked(root.list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.leftMargin: Appearance.padding.larger
|
||||||
|
anchors.rightMargin: Appearance.padding.larger
|
||||||
|
anchors.margins: Appearance.padding.smaller
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
text: root.modelData?.icon ?? ""
|
||||||
|
font.pointSize: Appearance.font.size.extraLarge
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.left: icon.right
|
||||||
|
anchors.leftMargin: Appearance.spacing.larger
|
||||||
|
anchors.verticalCenter: icon.verticalCenter
|
||||||
|
|
||||||
|
implicitWidth: parent.width - icon.width
|
||||||
|
implicitHeight: name.implicitHeight + desc.implicitHeight
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: name
|
||||||
|
|
||||||
|
text: root.modelData?.name ?? ""
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: desc
|
||||||
|
|
||||||
|
text: root.modelData?.description ?? ""
|
||||||
|
font.pointSize: Appearance.font.size.small
|
||||||
|
color: Colours.alpha(Colours.palette.m3outline, true)
|
||||||
|
|
||||||
|
elide: Text.ElideRight
|
||||||
|
width: root.width - icon.width - Appearance.rounding.normal * 2
|
||||||
|
|
||||||
|
anchors.top: name.bottom
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
109
dots/quickshell/modules/launcher/WallpaperItem.qml
Normal file
109
dots/quickshell/modules/launcher/WallpaperItem.qml
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Effects
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Wallpapers.Wallpaper modelData
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
|
scale: 0.5
|
||||||
|
opacity: 0
|
||||||
|
z: PathView.z ?? 0
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
scale = Qt.binding(() => PathView.isCurrentItem ? 1 : PathView.onPath ? 0.8 : 0);
|
||||||
|
opacity = Qt.binding(() => PathView.onPath ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitWidth: image.width + Appearance.padding.larger * 2
|
||||||
|
implicitHeight: image.height + label.height + Appearance.spacing.small / 2 + Appearance.padding.large + Appearance.padding.normal
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
radius: Appearance.rounding.normal
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
Wallpapers.setWallpaper(root.modelData.path);
|
||||||
|
root.visibilities.launcher = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CachingImage {
|
||||||
|
id: image
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
y: Appearance.padding.large
|
||||||
|
|
||||||
|
visible: false
|
||||||
|
path: root.modelData.path
|
||||||
|
smooth: !root.PathView.view.moving
|
||||||
|
|
||||||
|
width: Config.launcher.sizes.wallpaperWidth
|
||||||
|
height: width / 16 * 9
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: mask
|
||||||
|
|
||||||
|
layer.enabled: true
|
||||||
|
layer.smooth: true
|
||||||
|
visible: false
|
||||||
|
anchors.fill: image
|
||||||
|
radius: Appearance.rounding.normal
|
||||||
|
}
|
||||||
|
|
||||||
|
RectangularShadow {
|
||||||
|
opacity: root.PathView.isCurrentItem ? 0.7 : 0
|
||||||
|
anchors.fill: mask
|
||||||
|
radius: mask.radius
|
||||||
|
color: Colours.palette.m3shadow
|
||||||
|
blur: 10
|
||||||
|
spread: 3
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MultiEffect {
|
||||||
|
anchors.fill: image
|
||||||
|
source: image
|
||||||
|
maskEnabled: true
|
||||||
|
maskSource: mask
|
||||||
|
maskSpreadAtMin: 1
|
||||||
|
maskThresholdMin: 0.5
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: label
|
||||||
|
|
||||||
|
anchors.top: image.bottom
|
||||||
|
anchors.topMargin: Appearance.spacing.small / 2
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
width: image.width - Appearance.padding.normal * 2
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
elide: Text.ElideRight
|
||||||
|
renderType: Text.QtRendering
|
||||||
|
text: root.modelData.name
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on scale {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Anim: NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
79
dots/quickshell/modules/launcher/WallpaperList.qml
Normal file
79
dots/quickshell/modules/launcher/WallpaperList.qml
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
|
||||||
|
PathView {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property TextField search
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
readonly property int numItems: {
|
||||||
|
const screenWidth = QsWindow.window?.screen.width * 0.8;
|
||||||
|
if (!screenWidth)
|
||||||
|
return 0;
|
||||||
|
const itemWidth = Config.launcher.sizes.wallpaperWidth * 0.8;
|
||||||
|
const max = Config.launcher.maxWallpapers;
|
||||||
|
if (max * itemWidth > screenWidth) {
|
||||||
|
const items = Math.floor(screenWidth / itemWidth);
|
||||||
|
return items > 1 && items % 2 === 0 ? items - 1 : items;
|
||||||
|
}
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
|
model: ScriptModel {
|
||||||
|
readonly property string search: root.search.text.split(" ").slice(1).join(" ")
|
||||||
|
|
||||||
|
values: {
|
||||||
|
const list = Wallpapers.fuzzyQuery(search);
|
||||||
|
if (list.length > 1 && list.length % 2 === 0)
|
||||||
|
list.length -= 1; // Always show odd number
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
onValuesChanged: root.currentIndex = search ? 0 : values.findIndex(w => w.path === Wallpapers.actualCurrent)
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: currentIndex = Wallpapers.list.findIndex(w => w.path === Wallpapers.actualCurrent)
|
||||||
|
Component.onDestruction: Wallpapers.stopPreview()
|
||||||
|
|
||||||
|
onCurrentItemChanged: {
|
||||||
|
if (currentItem)
|
||||||
|
Wallpapers.preview(currentItem.modelData.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitWidth: Math.min(numItems, count) * (Config.launcher.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2)
|
||||||
|
pathItemCount: numItems
|
||||||
|
cacheItemCount: 4
|
||||||
|
|
||||||
|
snapMode: PathView.SnapToItem
|
||||||
|
preferredHighlightBegin: 0.5
|
||||||
|
preferredHighlightEnd: 0.5
|
||||||
|
highlightRangeMode: PathView.StrictlyEnforceRange
|
||||||
|
|
||||||
|
delegate: WallpaperItem {
|
||||||
|
visibilities: root.visibilities
|
||||||
|
}
|
||||||
|
|
||||||
|
path: Path {
|
||||||
|
startY: root.height / 2
|
||||||
|
|
||||||
|
PathAttribute {
|
||||||
|
name: "z"
|
||||||
|
value: 0
|
||||||
|
}
|
||||||
|
PathLine {
|
||||||
|
x: root.width / 2
|
||||||
|
relativeY: 0
|
||||||
|
}
|
||||||
|
PathAttribute {
|
||||||
|
name: "z"
|
||||||
|
value: 1
|
||||||
|
}
|
||||||
|
PathLine {
|
||||||
|
x: root.width
|
||||||
|
relativeY: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
55
dots/quickshell/modules/launcher/Wrapper.qml
Normal file
55
dots/quickshell/modules/launcher/Wrapper.qml
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
|
visible: height > 0
|
||||||
|
implicitHeight: 0
|
||||||
|
implicitWidth: content.implicitWidth
|
||||||
|
|
||||||
|
states: State {
|
||||||
|
name: "visible"
|
||||||
|
when: root.visibilities.launcher
|
||||||
|
|
||||||
|
PropertyChanges {
|
||||||
|
root.implicitHeight: content.implicitHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
from: ""
|
||||||
|
to: "visible"
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
property: "implicitHeight"
|
||||||
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition {
|
||||||
|
from: "visible"
|
||||||
|
to: ""
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
property: "implicitHeight"
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
Content {
|
||||||
|
id: content
|
||||||
|
|
||||||
|
visibilities: root.visibilities
|
||||||
|
}
|
||||||
|
}
|
||||||
66
dots/quickshell/modules/notifications/Background.qml
Normal file
66
dots/quickshell/modules/notifications/Background.qml
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Shapes
|
||||||
|
|
||||||
|
ShapePath {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Wrapper 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
|
||||||
|
|
||||||
|
strokeWidth: -1
|
||||||
|
fillColor: Config.border.colour
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
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.Clockwise : PathArc.Counterclockwise
|
||||||
|
}
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on fillColor {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on fullHeightRounding {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
162
dots/quickshell/modules/notifications/Content.qml
Normal file
162
dots/quickshell/modules/notifications/Content.qml
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
readonly property int padding: Appearance.padding.large
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
implicitWidth: Config.notifs.sizes.width + padding * 2
|
||||||
|
implicitHeight: {
|
||||||
|
const count = list.count;
|
||||||
|
if (count === 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
let height = (count - 1) * Appearance.spacing.smaller;
|
||||||
|
for (let i = 0; i < count; i++)
|
||||||
|
height += list.itemAtIndex(i)?.nonAnimHeight ?? 0;
|
||||||
|
|
||||||
|
const screen = QsWindow.window?.screen;
|
||||||
|
const visibilities = Visibilities.screens[screen];
|
||||||
|
const panel = Visibilities.panels[screen];
|
||||||
|
if (visibilities && panel) {
|
||||||
|
if (visibilities.osd) {
|
||||||
|
const h = panel.osd.y - Config.border.rounding * 2;
|
||||||
|
if (height > h)
|
||||||
|
height = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (visibilities.session) {
|
||||||
|
const h = panel.session.y - Config.border.rounding * 2;
|
||||||
|
if (height > h)
|
||||||
|
height = h;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.min((screen?.height ?? 0) - Config.border.thickness * 2, height + padding * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
ClippingWrapperRectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: root.padding
|
||||||
|
|
||||||
|
color: "transparent"
|
||||||
|
radius: Appearance.rounding.normal
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: list
|
||||||
|
|
||||||
|
model: ScriptModel {
|
||||||
|
values: [...Notifs.popups].reverse()
|
||||||
|
}
|
||||||
|
|
||||||
|
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 : Appearance.spacing.smaller)
|
||||||
|
|
||||||
|
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.sizes.width : -Config.notifs.sizes.width) * 2
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
PropertyAction {
|
||||||
|
target: wrapper
|
||||||
|
property: "ListView.delayRemove"
|
||||||
|
value: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ClippingRectangle {
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: wrapper.idx === 0 ? 0 : Appearance.spacing.smaller
|
||||||
|
|
||||||
|
color: "transparent"
|
||||||
|
radius: notif.radius
|
||||||
|
implicitWidth: notif.implicitWidth
|
||||||
|
implicitHeight: notif.implicitHeight
|
||||||
|
|
||||||
|
Notification {
|
||||||
|
id: notif
|
||||||
|
|
||||||
|
modelData: wrapper.modelData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
move: Transition {
|
||||||
|
Anim {
|
||||||
|
property: "y"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
displaced: Transition {
|
||||||
|
Anim {
|
||||||
|
property: "y"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Anim: NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||||
|
}
|
||||||
|
}
|
||||||
494
dots/quickshell/modules/notifications/Notification.qml
Normal file
494
dots/quickshell/modules/notifications/Notification.qml
Normal file
@@ -0,0 +1,494 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import Quickshell.Services.Notifications
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Notifs.Notif modelData
|
||||||
|
readonly property bool hasImage: modelData.image.length > 0
|
||||||
|
readonly property bool hasAppIcon: modelData.appIcon.length > 0
|
||||||
|
readonly property int nonAnimHeight: summary.implicitHeight + (root.expanded ? appName.height + body.height + actions.height + actions.anchors.topMargin : bodyPreview.height) + inner.anchors.margins * 2
|
||||||
|
property bool expanded
|
||||||
|
|
||||||
|
color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3secondaryContainer : Colours.palette.m3surfaceContainer
|
||||||
|
radius: Appearance.rounding.normal
|
||||||
|
implicitWidth: Config.notifs.sizes.width
|
||||||
|
implicitHeight: inner.implicitHeight
|
||||||
|
|
||||||
|
x: Config.notifs.sizes.width
|
||||||
|
Component.onCompleted: x = 0
|
||||||
|
|
||||||
|
RetainableLock {
|
||||||
|
object: root.modelData.notification
|
||||||
|
locked: true
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
property int startY
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: pressed ? Qt.ClosedHandCursor : undefined
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.MiddleButton
|
||||||
|
preventStealing: true
|
||||||
|
|
||||||
|
onEntered: root.modelData.timer.stop()
|
||||||
|
onExited: root.modelData.timer.start()
|
||||||
|
|
||||||
|
drag.target: parent
|
||||||
|
drag.axis: Drag.XAxis
|
||||||
|
|
||||||
|
onPressed: event => {
|
||||||
|
startY = event.y;
|
||||||
|
if (event.button === Qt.MiddleButton)
|
||||||
|
root.modelData.notification.dismiss();
|
||||||
|
}
|
||||||
|
onReleased: event => {
|
||||||
|
if (Math.abs(root.x) < Config.notifs.sizes.width * Config.notifs.clearThreshold)
|
||||||
|
root.x = 0;
|
||||||
|
else
|
||||||
|
root.modelData.popup = false;
|
||||||
|
}
|
||||||
|
onPositionChanged: event => {
|
||||||
|
if (pressed) {
|
||||||
|
const diffY = event.y - startY;
|
||||||
|
if (Math.abs(diffY) > Config.notifs.expandThreshold)
|
||||||
|
root.expanded = diffY > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onClicked: event => {
|
||||||
|
if (!Config.notifs.actionOnClick || event.button !== Qt.LeftButton)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const actions = root.modelData.actions;
|
||||||
|
if (actions?.length === 1)
|
||||||
|
actions[0].invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on x {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: inner
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.margins: Appearance.padding.normal
|
||||||
|
|
||||||
|
implicitHeight: root.nonAnimHeight
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
Anim {
|
||||||
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: image
|
||||||
|
|
||||||
|
active: root.hasImage
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
width: Config.notifs.sizes.image
|
||||||
|
height: Config.notifs.sizes.image
|
||||||
|
visible: root.hasImage || root.hasAppIcon
|
||||||
|
|
||||||
|
sourceComponent: ClippingRectangle {
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
implicitWidth: Config.notifs.sizes.image
|
||||||
|
implicitHeight: Config.notifs.sizes.image
|
||||||
|
|
||||||
|
Image {
|
||||||
|
anchors.fill: parent
|
||||||
|
source: Qt.resolvedUrl(root.modelData.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: StyledRect {
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3error : root.modelData.urgency === NotificationUrgency.Low ? Colours.palette.m3surfaceContainerHighest : Colours.palette.m3tertiaryContainer
|
||||||
|
implicitWidth: root.hasImage ? Config.notifs.sizes.badge : Config.notifs.sizes.image
|
||||||
|
implicitHeight: root.hasImage ? Config.notifs.sizes.badge : Config.notifs.sizes.image
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
active: root.hasAppIcon
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
visible: !root.modelData.appIcon.endsWith("symbolic")
|
||||||
|
|
||||||
|
width: Math.round(parent.width * 0.6)
|
||||||
|
height: Math.round(parent.width * 0.6)
|
||||||
|
|
||||||
|
sourceComponent: IconImage {
|
||||||
|
implicitSize: Math.round(parent.width * 0.6)
|
||||||
|
source: Quickshell.iconPath(root.modelData.appIcon)
|
||||||
|
asynchronous: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
active: root.modelData.appIcon.endsWith("symbolic")
|
||||||
|
asynchronous: true
|
||||||
|
anchors.fill: icon
|
||||||
|
|
||||||
|
sourceComponent: Colouriser {
|
||||||
|
source: icon
|
||||||
|
colorizationColor: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3onError : root.modelData.urgency === NotificationUrgency.Low ? Colours.palette.m3onSurface : Colours.palette.m3onTertiaryContainer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
active: !root.hasAppIcon
|
||||||
|
asynchronous: true
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
sourceComponent: MaterialIcon {
|
||||||
|
text: {
|
||||||
|
const summary = root.modelData.summary.toLowerCase();
|
||||||
|
if (summary.includes("reboot"))
|
||||||
|
return "restart_alt";
|
||||||
|
if (summary.includes("recording"))
|
||||||
|
return "screen_record";
|
||||||
|
if (summary.includes("battery"))
|
||||||
|
return "power";
|
||||||
|
if (summary.includes("screenshot"))
|
||||||
|
return "screenshot_monitor";
|
||||||
|
if (summary.includes("welcome"))
|
||||||
|
return "waving_hand";
|
||||||
|
if (summary.includes("time") || summary.includes("a break"))
|
||||||
|
return "schedule";
|
||||||
|
if (summary.includes("installed"))
|
||||||
|
return "download";
|
||||||
|
if (summary.includes("update"))
|
||||||
|
return "update";
|
||||||
|
if (summary.startsWith("file"))
|
||||||
|
return "folder_copy";
|
||||||
|
if (summary.startsWith("unable to"))
|
||||||
|
return "deployed_code_alert";
|
||||||
|
if (root.modelData.urgency === NotificationUrgency.Critical)
|
||||||
|
return "release_alert";
|
||||||
|
return "chat";
|
||||||
|
}
|
||||||
|
|
||||||
|
color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3onError : root.modelData.urgency === NotificationUrgency.Low ? Colours.palette.m3onSurface : Colours.palette.m3onTertiaryContainer
|
||||||
|
font.pointSize: Appearance.font.size.large
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: appName
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: image.right
|
||||||
|
anchors.leftMargin: Appearance.spacing.smaller
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
text: appNameMetrics.elidedText
|
||||||
|
maximumLineCount: 1
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font.pointSize: Appearance.font.size.small
|
||||||
|
|
||||||
|
opacity: root.expanded ? 1 : 0
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: appNameMetrics
|
||||||
|
|
||||||
|
text: root.modelData.appName
|
||||||
|
font.family: appName.font.family
|
||||||
|
font.pointSize: appName.font.pointSize
|
||||||
|
elide: Text.ElideRight
|
||||||
|
elideWidth: expandBtn.x - time.width - timeSep.width - summary.x - Appearance.spacing.small * 3
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: summary
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: image.right
|
||||||
|
anchors.leftMargin: Appearance.spacing.smaller
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
text: summaryMetrics.elidedText
|
||||||
|
maximumLineCount: 1
|
||||||
|
height: implicitHeight
|
||||||
|
|
||||||
|
states: State {
|
||||||
|
name: "expanded"
|
||||||
|
when: root.expanded
|
||||||
|
|
||||||
|
PropertyChanges {
|
||||||
|
summary.maximumLineCount: undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
AnchorChanges {
|
||||||
|
target: summary
|
||||||
|
anchors.top: appName.bottom
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transitions: Transition {
|
||||||
|
PropertyAction {
|
||||||
|
target: summary
|
||||||
|
property: "maximumLineCount"
|
||||||
|
}
|
||||||
|
AnchorAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on height {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: summaryMetrics
|
||||||
|
|
||||||
|
text: root.modelData.summary
|
||||||
|
font.family: summary.font.family
|
||||||
|
font.pointSize: summary.font.pointSize
|
||||||
|
elide: Text.ElideRight
|
||||||
|
elideWidth: expandBtn.x - time.width - timeSep.width - summary.x - Appearance.spacing.small * 3
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: timeSep
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: summary.right
|
||||||
|
anchors.leftMargin: Appearance.spacing.small
|
||||||
|
|
||||||
|
text: "•"
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font.pointSize: Appearance.font.size.small
|
||||||
|
|
||||||
|
states: State {
|
||||||
|
name: "expanded"
|
||||||
|
when: root.expanded
|
||||||
|
|
||||||
|
AnchorChanges {
|
||||||
|
target: timeSep
|
||||||
|
anchors.left: appName.right
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transitions: Transition {
|
||||||
|
AnchorAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: time
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: timeSep.right
|
||||||
|
anchors.leftMargin: Appearance.spacing.small
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
text: root.modelData.timeStr
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font.pointSize: Appearance.font.size.small
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: expandBtn
|
||||||
|
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
|
||||||
|
implicitWidth: expandIcon.height
|
||||||
|
implicitHeight: expandIcon.height
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
|
function onClicked() {
|
||||||
|
root.expanded = !root.expanded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: expandIcon
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
text: root.expanded ? "expand_less" : "expand_more"
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: bodyPreview
|
||||||
|
|
||||||
|
anchors.left: summary.left
|
||||||
|
anchors.right: expandBtn.left
|
||||||
|
anchors.top: summary.bottom
|
||||||
|
anchors.rightMargin: Appearance.spacing.small
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
textFormat: Text.MarkdownText
|
||||||
|
text: bodyPreviewMetrics.elidedText
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font.pointSize: Appearance.font.size.small
|
||||||
|
|
||||||
|
opacity: root.expanded ? 0 : 1
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: bodyPreviewMetrics
|
||||||
|
|
||||||
|
text: root.modelData.body
|
||||||
|
font.family: bodyPreview.font.family
|
||||||
|
font.pointSize: bodyPreview.font.pointSize
|
||||||
|
elide: Text.ElideRight
|
||||||
|
elideWidth: bodyPreview.width
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: body
|
||||||
|
|
||||||
|
anchors.left: summary.left
|
||||||
|
anchors.right: expandBtn.left
|
||||||
|
anchors.top: summary.bottom
|
||||||
|
anchors.rightMargin: Appearance.spacing.small
|
||||||
|
|
||||||
|
animate: true
|
||||||
|
textFormat: Text.MarkdownText
|
||||||
|
text: root.modelData.body
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font.pointSize: Appearance.font.size.small
|
||||||
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
|
|
||||||
|
opacity: root.expanded ? 1 : 0
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: actions
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.top: body.bottom
|
||||||
|
anchors.topMargin: Appearance.spacing.small
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.smaller
|
||||||
|
|
||||||
|
opacity: root.expanded ? 1 : 0
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: root.modelData.actions
|
||||||
|
|
||||||
|
delegate: StyledRect {
|
||||||
|
id: action
|
||||||
|
|
||||||
|
required property NotificationAction modelData
|
||||||
|
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
color: Colours.palette.m3surfaceContainerHigh
|
||||||
|
|
||||||
|
Layout.preferredWidth: actionText.width + Appearance.padding.normal * 2
|
||||||
|
Layout.preferredHeight: actionText.height + Appearance.padding.small * 2
|
||||||
|
implicitWidth: actionText.width + Appearance.padding.normal * 2
|
||||||
|
implicitHeight: actionText.height + Appearance.padding.small * 2
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
action.modelData.invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: actionText
|
||||||
|
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: actionTextMetrics.elidedText
|
||||||
|
color: Colours.palette.m3onSurfaceVariant
|
||||||
|
font.pointSize: Appearance.font.size.small
|
||||||
|
}
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: actionTextMetrics
|
||||||
|
|
||||||
|
text: modelData.text
|
||||||
|
font.family: actionText.font.family
|
||||||
|
font.pointSize: actionText.font.pointSize
|
||||||
|
elide: Text.ElideRight
|
||||||
|
elideWidth: {
|
||||||
|
const numActions = root.modelData.actions.length;
|
||||||
|
return (inner.width - actions.spacing * (numActions - 1)) / numActions - Appearance.padding.normal * 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Anim: NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
14
dots/quickshell/modules/notifications/Wrapper.qml
Normal file
14
dots/quickshell/modules/notifications/Wrapper.qml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
visible: height > 0
|
||||||
|
implicitHeight: content.implicitHeight
|
||||||
|
implicitWidth: content.implicitWidth
|
||||||
|
|
||||||
|
Content {
|
||||||
|
id: content
|
||||||
|
}
|
||||||
|
}
|
||||||
63
dots/quickshell/modules/osd/Background.qml
Normal file
63
dots/quickshell/modules/osd/Background.qml
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Shapes
|
||||||
|
|
||||||
|
ShapePath {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Wrapper 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
|
||||||
|
|
||||||
|
strokeWidth: -1
|
||||||
|
fillColor: Config.border.colour
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on fillColor {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
43
dots/quickshell/modules/osd/Content.qml
Normal file
43
dots/quickshell/modules/osd/Content.qml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Brightness.Monitor monitor
|
||||||
|
|
||||||
|
padding: Appearance.padding.large
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: parent.left
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
VerticalSlider {
|
||||||
|
icon: {
|
||||||
|
if (Audio.muted)
|
||||||
|
return "no_sound";
|
||||||
|
if (value >= 0.5)
|
||||||
|
return "volume_up";
|
||||||
|
if (value > 0)
|
||||||
|
return "volume_down";
|
||||||
|
return "volume_mute";
|
||||||
|
}
|
||||||
|
value: Audio.volume
|
||||||
|
onMoved: Audio.setVolume(value)
|
||||||
|
|
||||||
|
implicitWidth: Config.osd.sizes.sliderWidth
|
||||||
|
implicitHeight: Config.osd.sizes.sliderHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
VerticalSlider {
|
||||||
|
icon: `brightness_${(Math.round(value * 6) + 1)}`
|
||||||
|
value: root.monitor?.brightness ?? 0
|
||||||
|
onMoved: root.monitor?.setBrightness(value)
|
||||||
|
|
||||||
|
implicitWidth: Config.osd.sizes.sliderWidth
|
||||||
|
implicitHeight: Config.osd.sizes.sliderHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
48
dots/quickshell/modules/osd/Interactions.qml
Normal file
48
dots/quickshell/modules/osd/Interactions.qml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Scope {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property ShellScreen screen
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
required property bool hovered
|
||||||
|
readonly property Brightness.Monitor monitor: Brightness.getMonitorForScreen(screen)
|
||||||
|
|
||||||
|
function show(): void {
|
||||||
|
root.visibilities.osd = true;
|
||||||
|
timer.restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: Audio
|
||||||
|
|
||||||
|
function onMutedChanged(): void {
|
||||||
|
root.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function onVolumeChanged(): void {
|
||||||
|
root.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: root.monitor
|
||||||
|
|
||||||
|
function onBrightnessChanged(): void {
|
||||||
|
root.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: timer
|
||||||
|
|
||||||
|
interval: Config.osd.hideDelay
|
||||||
|
onTriggered: {
|
||||||
|
if (!root.hovered)
|
||||||
|
root.visibilities.osd = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
57
dots/quickshell/modules/osd/Wrapper.qml
Normal file
57
dots/quickshell/modules/osd/Wrapper.qml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property ShellScreen screen
|
||||||
|
required property bool visibility
|
||||||
|
|
||||||
|
visible: width > 0
|
||||||
|
implicitWidth: 0
|
||||||
|
implicitHeight: content.implicitHeight
|
||||||
|
|
||||||
|
states: State {
|
||||||
|
name: "visible"
|
||||||
|
when: root.visibility
|
||||||
|
|
||||||
|
PropertyChanges {
|
||||||
|
root.implicitWidth: content.implicitWidth
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
from: ""
|
||||||
|
to: "visible"
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
property: "implicitWidth"
|
||||||
|
duration: Appearance.anim.durations.expressiveFastSpatial
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition {
|
||||||
|
from: "visible"
|
||||||
|
to: ""
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
property: "implicitWidth"
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
Content {
|
||||||
|
id: content
|
||||||
|
|
||||||
|
monitor: Brightness.getMonitorForScreen(root.screen)
|
||||||
|
}
|
||||||
|
}
|
||||||
63
dots/quickshell/modules/session/Background.qml
Normal file
63
dots/quickshell/modules/session/Background.qml
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Shapes
|
||||||
|
|
||||||
|
ShapePath {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Wrapper 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
|
||||||
|
|
||||||
|
strokeWidth: -1
|
||||||
|
fillColor: Config.border.colour
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on fillColor {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
119
dots/quickshell/modules/session/Content.qml
Normal file
119
dots/quickshell/modules/session/Content.qml
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
|
padding: Appearance.padding.large
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: parent.left
|
||||||
|
|
||||||
|
spacing: Appearance.spacing.large
|
||||||
|
|
||||||
|
SessionButton {
|
||||||
|
id: logout
|
||||||
|
|
||||||
|
icon: "logout"
|
||||||
|
command: ["sh", "-c", "(uwsm stop | grep -q 'Compositor is not running' && loginctl terminate-user $USER) || uwsm stop"]
|
||||||
|
|
||||||
|
KeyNavigation.down: shutdown
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: root.visibilities
|
||||||
|
|
||||||
|
function onSessionChanged(): void {
|
||||||
|
if (root.visibilities.session)
|
||||||
|
logout.focus = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SessionButton {
|
||||||
|
id: shutdown
|
||||||
|
|
||||||
|
icon: "power_settings_new"
|
||||||
|
command: ["systemctl", "poweroff"]
|
||||||
|
|
||||||
|
KeyNavigation.up: logout
|
||||||
|
KeyNavigation.down: hibernate
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimatedImage {
|
||||||
|
width: Config.session.sizes.button
|
||||||
|
height: Config.session.sizes.button
|
||||||
|
sourceSize.width: width
|
||||||
|
sourceSize.height: height
|
||||||
|
|
||||||
|
playing: visible
|
||||||
|
asynchronous: true
|
||||||
|
speed: 0.7
|
||||||
|
source: "root:/assets/kurukuru.gif"
|
||||||
|
}
|
||||||
|
|
||||||
|
SessionButton {
|
||||||
|
id: hibernate
|
||||||
|
|
||||||
|
icon: "downloading"
|
||||||
|
command: ["systemctl", "hibernate"]
|
||||||
|
|
||||||
|
KeyNavigation.up: shutdown
|
||||||
|
KeyNavigation.down: reboot
|
||||||
|
}
|
||||||
|
|
||||||
|
SessionButton {
|
||||||
|
id: reboot
|
||||||
|
|
||||||
|
icon: "cached"
|
||||||
|
command: ["systemctl", "reboot"]
|
||||||
|
|
||||||
|
KeyNavigation.up: hibernate
|
||||||
|
}
|
||||||
|
|
||||||
|
component SessionButton: StyledRect {
|
||||||
|
id: button
|
||||||
|
|
||||||
|
required property string icon
|
||||||
|
required property list<string> command
|
||||||
|
|
||||||
|
implicitWidth: Config.session.sizes.button
|
||||||
|
implicitHeight: Config.session.sizes.button
|
||||||
|
|
||||||
|
radius: Appearance.rounding.large
|
||||||
|
color: button.activeFocus ? Colours.palette.m3secondaryContainer : Colours.palette.m3surfaceContainer
|
||||||
|
|
||||||
|
Keys.onEnterPressed: proc.startDetached()
|
||||||
|
Keys.onReturnPressed: proc.startDetached()
|
||||||
|
Keys.onEscapePressed: root.visibilities.session = false
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: proc
|
||||||
|
|
||||||
|
command: button.command
|
||||||
|
}
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
radius: parent.radius
|
||||||
|
|
||||||
|
function onClicked(): void {
|
||||||
|
proc.startDetached();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
text: button.icon
|
||||||
|
color: button.activeFocus ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface
|
||||||
|
font.pointSize: Appearance.font.size.extraLarge
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
56
dots/quickshell/modules/session/Wrapper.qml
Normal file
56
dots/quickshell/modules/session/Wrapper.qml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
|
visible: width > 0
|
||||||
|
implicitWidth: 0
|
||||||
|
implicitHeight: content.implicitHeight
|
||||||
|
|
||||||
|
states: State {
|
||||||
|
name: "visible"
|
||||||
|
when: root.visibilities.session
|
||||||
|
|
||||||
|
PropertyChanges {
|
||||||
|
root.implicitWidth: content.implicitWidth
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
from: ""
|
||||||
|
to: "visible"
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
property: "implicitWidth"
|
||||||
|
duration: Appearance.anim.durations.expressiveFastSpatial
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition {
|
||||||
|
from: "visible"
|
||||||
|
to: ""
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
property: "implicitWidth"
|
||||||
|
duration: root.visibilities.osd ? Appearance.anim.durations.expressiveFastSpatial : Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: root.visibilities.osd ? Appearance.anim.curves.expressiveFastSpatial : Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
Content {
|
||||||
|
id: content
|
||||||
|
|
||||||
|
visibilities: root.visibilities
|
||||||
|
}
|
||||||
|
}
|
||||||
9
dots/quickshell/run.fish
Executable file
9
dots/quickshell/run.fish
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
|
set -l dbus 'quickshell.dbus.properties.warning = false;quickshell.dbus.dbusmenu.warning = false' # System tray dbus property errors
|
||||||
|
set -l notifs 'quickshell.service.notifications.warning = false' # Notification server warnings on reload
|
||||||
|
set -l sni 'quickshell.service.sni.host.warning = false' # StatusNotifierItem warnings on reload
|
||||||
|
set -l process 'QProcess: Destroyed while process' # Long running processes on reload
|
||||||
|
set -l cache "Cannot open: file://$XDG_CACHE_HOME/caelestia/imagecache/"
|
||||||
|
|
||||||
|
qs -p (dirname (status filename)) --log-rules "$dbus;$notifs;$sni" | grep -vF -e $process -e $cache
|
||||||
37
dots/quickshell/services/Apps.qml
Normal file
37
dots/quickshell/services/Apps.qml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import "root:/utils/scripts/fuzzysort.js" as Fuzzy
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
readonly property list<DesktopEntry> list: DesktopEntries.applications.values.filter(a => !a.noDisplay).sort((a, b) => a.name.localeCompare(b.name))
|
||||||
|
readonly property list<var> preppedApps: list.map(a => ({
|
||||||
|
name: Fuzzy.prepare(a.name),
|
||||||
|
comment: Fuzzy.prepare(a.comment),
|
||||||
|
entry: a
|
||||||
|
}))
|
||||||
|
|
||||||
|
function fuzzyQuery(search: string): var { // Idk why list<DesktopEntry> doesn't work
|
||||||
|
return Fuzzy.go(search, preppedApps, {
|
||||||
|
all: true,
|
||||||
|
keys: ["name", "comment"],
|
||||||
|
scoreFn: r => r[0].score > 0 ? r[0].score * 0.9 + r[1].score * 0.1 : 0
|
||||||
|
}).map(r => r.obj.entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
function launch(entry: DesktopEntry): void {
|
||||||
|
launchProc.entry = entry;
|
||||||
|
launchProc.startDetached();
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: launchProc
|
||||||
|
|
||||||
|
property DesktopEntry entry
|
||||||
|
|
||||||
|
command: ["app2unit", "--", `${entry?.id}.desktop`]
|
||||||
|
}
|
||||||
|
}
|
||||||
25
dots/quickshell/services/Audio.qml
Normal file
25
dots/quickshell/services/Audio.qml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Services.Pipewire
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
readonly property PwNode sink: Pipewire.defaultAudioSink
|
||||||
|
readonly property PwNode source: Pipewire.defaultAudioSource
|
||||||
|
|
||||||
|
readonly property bool muted: sink?.audio?.muted ?? false
|
||||||
|
readonly property real volume: sink?.audio?.volume ?? 0
|
||||||
|
|
||||||
|
function setVolume(volume: real): void {
|
||||||
|
if (sink?.ready && sink?.audio) {
|
||||||
|
sink.audio.muted = false;
|
||||||
|
sink.audio.volume = volume;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PwObjectTracker {
|
||||||
|
objects: [Pipewire.defaultAudioSink, Pipewire.defaultAudioSource]
|
||||||
|
}
|
||||||
|
}
|
||||||
22
dots/quickshell/services/BeatDetector.qml
Normal file
22
dots/quickshell/services/BeatDetector.qml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property real bpm
|
||||||
|
|
||||||
|
Process {
|
||||||
|
running: true
|
||||||
|
command: ["/usr/lib/caelestia/beat_detector", "--no-log", "--no-stats", "--no-visual"]
|
||||||
|
stdout: SplitParser {
|
||||||
|
onRead: data => {
|
||||||
|
const match = data.match(/BPM: ([0-9]+\.[0-9])/);
|
||||||
|
if (match)
|
||||||
|
root.bpm = parseFloat(match[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
96
dots/quickshell/services/Bluetooth.qml
Normal file
96
dots/quickshell/services/Bluetooth.qml
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
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"]
|
||||||
|
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`]
|
||||||
|
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 {}
|
||||||
|
}
|
||||||
|
}
|
||||||
111
dots/quickshell/services/Brightness.qml
Normal file
111
dots/quickshell/services/Brightness.qml
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property list<var> ddcMonitors: []
|
||||||
|
readonly property list<Monitor> monitors: variants.instances
|
||||||
|
|
||||||
|
function getMonitorForScreen(screen: ShellScreen): var {
|
||||||
|
return monitors.find(m => m.modelData === screen);
|
||||||
|
}
|
||||||
|
|
||||||
|
function increaseBrightness(): void {
|
||||||
|
const focusedName = Hyprland.focusedMonitor.name;
|
||||||
|
const monitor = monitors.find(m => focusedName === m.modelData.name);
|
||||||
|
if (monitor)
|
||||||
|
monitor.setBrightness(monitor.brightness + 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function decreaseBrightness(): void {
|
||||||
|
const focusedName = Hyprland.focusedMonitor.name;
|
||||||
|
const monitor = monitors.find(m => focusedName === m.modelData.name);
|
||||||
|
if (monitor)
|
||||||
|
monitor.setBrightness(monitor.brightness - 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
reloadableId: "brightness"
|
||||||
|
|
||||||
|
onMonitorsChanged: {
|
||||||
|
ddcMonitors = [];
|
||||||
|
ddcProc.running = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Variants {
|
||||||
|
id: variants
|
||||||
|
|
||||||
|
model: Quickshell.screens
|
||||||
|
|
||||||
|
Monitor {}
|
||||||
|
}
|
||||||
|
|
||||||
|
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]
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: setProc
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomShortcut {
|
||||||
|
name: "brightnessUp"
|
||||||
|
onPressed: root.increaseBrightness()
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomShortcut {
|
||||||
|
name: "brightnessDown"
|
||||||
|
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 ?? ""
|
||||||
|
property real brightness
|
||||||
|
|
||||||
|
readonly property Process initProc: Process {
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
const [, , , current, max] = text.split(" ");
|
||||||
|
monitor.brightness = parseInt(current) / parseInt(max);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
brightness = value;
|
||||||
|
setProc.command = isDdc ? ["ddcutil", "-b", busNum, "setvcp", "10", rounded] : ["brightnessctl", "s", `${rounded}%`];
|
||||||
|
setProc.startDetached();
|
||||||
|
}
|
||||||
|
|
||||||
|
onBusNumChanged: {
|
||||||
|
initProc.command = isDdc ? ["ddcutil", "-b", busNum, "getvcp", "10", "--brief"] : ["sh", "-c", `echo "a b c $(brightnessctl g) $(brightnessctl m)"`];
|
||||||
|
initProc.running = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
initProc.command = isDdc ? ["ddcutil", "-b", busNum, "getvcp", "10", "--brief"] : ["sh", "-c", `echo "a b c $(brightnessctl g) $(brightnessctl m)"`];
|
||||||
|
initProc.running = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
dots/quickshell/services/Cava.qml
Normal file
19
dots/quickshell/services/Cava.qml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property list<int> values
|
||||||
|
|
||||||
|
Process {
|
||||||
|
running: true
|
||||||
|
command: ["sh", "-c", `printf '[general]\nframerate=60\nbars=${Config.dashboard.visualiserBars}\n[output]\nchannels=mono\nmethod=raw\nraw_target=/dev/stdout\ndata_format=ascii\nascii_max_range=100' | cava -p /dev/stdin`]
|
||||||
|
stdout: SplitParser {
|
||||||
|
onRead: data => root.values = data.slice(0, -1).split(";").map(v => parseInt(v, 10))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
143
dots/quickshell/services/Colours.qml
Normal file
143
dots/quickshell/services/Colours.qml
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import "root:/config"
|
||||||
|
import "root:/utils"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
readonly property list<string> colourNames: ["rosewater", "flamingo", "pink", "mauve", "red", "maroon", "peach", "yellow", "green", "teal", "sky", "sapphire", "blue", "lavender"]
|
||||||
|
|
||||||
|
property bool showPreview
|
||||||
|
property bool endPreviewOnNextChange
|
||||||
|
property bool light
|
||||||
|
readonly property Colours palette: showPreview ? preview : current
|
||||||
|
readonly property Colours current: Colours {}
|
||||||
|
readonly property Colours preview: Colours {}
|
||||||
|
readonly property Transparency transparency: Transparency {}
|
||||||
|
|
||||||
|
function alpha(c: color, layer: bool): color {
|
||||||
|
if (!transparency.enabled)
|
||||||
|
return c;
|
||||||
|
c = Qt.rgba(c.r, c.g, c.b, layer ? transparency.layers : transparency.base);
|
||||||
|
if (layer)
|
||||||
|
c.hsvValue = Math.max(0, Math.min(1, c.hslLightness + (light ? -0.2 : 0.2))); // TODO: edit based on colours (hue or smth)
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
function on(c: color): color {
|
||||||
|
if (c.hslLightness < 0.5)
|
||||||
|
return Qt.hsla(c.hslHue, c.hslSaturation, 0.9, 1);
|
||||||
|
return Qt.hsla(c.hslHue, c.hslSaturation, 0.1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function load(data: string, isPreview: bool): void {
|
||||||
|
const colours = isPreview ? preview : current;
|
||||||
|
const scheme = JSON.parse(data);
|
||||||
|
|
||||||
|
light = scheme.mode === "light";
|
||||||
|
|
||||||
|
for (const [name, colour] of Object.entries(scheme.colours)) {
|
||||||
|
const propName = colourNames.includes(name) ? name : `m3${name}`;
|
||||||
|
if (colours.hasOwnProperty(propName))
|
||||||
|
colours[propName] = `#${colour}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isPreview || (isPreview && endPreviewOnNextChange)) {
|
||||||
|
showPreview = false;
|
||||||
|
endPreviewOnNextChange = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setMode(mode: string): void {
|
||||||
|
Quickshell.execDetached(["caelestia", "scheme", "set", "--notify", "-m", mode]);
|
||||||
|
}
|
||||||
|
|
||||||
|
FileView {
|
||||||
|
path: `${Paths.state}/scheme.json`
|
||||||
|
watchChanges: true
|
||||||
|
onFileChanged: reload()
|
||||||
|
onLoaded: root.load(text(), false)
|
||||||
|
}
|
||||||
|
|
||||||
|
component Transparency: QtObject {
|
||||||
|
readonly property bool enabled: false
|
||||||
|
readonly property real base: 0.78
|
||||||
|
readonly property real layers: 0.58
|
||||||
|
}
|
||||||
|
|
||||||
|
component Colours: QtObject {
|
||||||
|
property color m3primary_paletteKeyColor: "#7870AB"
|
||||||
|
property color m3secondary_paletteKeyColor: "#78748A"
|
||||||
|
property color m3tertiary_paletteKeyColor: "#976A7D"
|
||||||
|
property color m3neutral_paletteKeyColor: "#79767D"
|
||||||
|
property color m3neutral_variant_paletteKeyColor: "#797680"
|
||||||
|
property color m3background: "#141318"
|
||||||
|
property color m3onBackground: "#E5E1E9"
|
||||||
|
property color m3surface: "#141318"
|
||||||
|
property color m3surfaceDim: "#141318"
|
||||||
|
property color m3surfaceBright: "#3A383E"
|
||||||
|
property color m3surfaceContainerLowest: "#0E0D13"
|
||||||
|
property color m3surfaceContainerLow: "#1C1B20"
|
||||||
|
property color m3surfaceContainer: "#201F25"
|
||||||
|
property color m3surfaceContainerHigh: "#2B292F"
|
||||||
|
property color m3surfaceContainerHighest: "#35343A"
|
||||||
|
property color m3onSurface: "#E5E1E9"
|
||||||
|
property color m3surfaceVariant: "#48454E"
|
||||||
|
property color m3onSurfaceVariant: "#C9C5D0"
|
||||||
|
property color m3inverseSurface: "#E5E1E9"
|
||||||
|
property color m3inverseOnSurface: "#312F36"
|
||||||
|
property color m3outline: "#938F99"
|
||||||
|
property color m3outlineVariant: "#48454E"
|
||||||
|
property color m3shadow: "#000000"
|
||||||
|
property color m3scrim: "#000000"
|
||||||
|
property color m3surfaceTint: "#C8BFFF"
|
||||||
|
property color m3primary: "#C8BFFF"
|
||||||
|
property color m3onPrimary: "#30285F"
|
||||||
|
property color m3primaryContainer: "#473F77"
|
||||||
|
property color m3onPrimaryContainer: "#E5DEFF"
|
||||||
|
property color m3inversePrimary: "#5F5791"
|
||||||
|
property color m3secondary: "#C9C3DC"
|
||||||
|
property color m3onSecondary: "#312E41"
|
||||||
|
property color m3secondaryContainer: "#484459"
|
||||||
|
property color m3onSecondaryContainer: "#E5DFF9"
|
||||||
|
property color m3tertiary: "#ECB8CD"
|
||||||
|
property color m3onTertiary: "#482536"
|
||||||
|
property color m3tertiaryContainer: "#B38397"
|
||||||
|
property color m3onTertiaryContainer: "#000000"
|
||||||
|
property color m3error: "#EA8DC1"
|
||||||
|
property color m3onError: "#690005"
|
||||||
|
property color m3errorContainer: "#93000A"
|
||||||
|
property color m3onErrorContainer: "#FFDAD6"
|
||||||
|
property color m3primaryFixed: "#E5DEFF"
|
||||||
|
property color m3primaryFixedDim: "#C8BFFF"
|
||||||
|
property color m3onPrimaryFixed: "#1B1149"
|
||||||
|
property color m3onPrimaryFixedVariant: "#473F77"
|
||||||
|
property color m3secondaryFixed: "#E5DFF9"
|
||||||
|
property color m3secondaryFixedDim: "#C9C3DC"
|
||||||
|
property color m3onSecondaryFixed: "#1C192B"
|
||||||
|
property color m3onSecondaryFixedVariant: "#484459"
|
||||||
|
property color m3tertiaryFixed: "#FFD8E7"
|
||||||
|
property color m3tertiaryFixedDim: "#ECB8CD"
|
||||||
|
property color m3onTertiaryFixed: "#301121"
|
||||||
|
property color m3onTertiaryFixedVariant: "#613B4C"
|
||||||
|
|
||||||
|
property color rosewater: "#B8C4FF"
|
||||||
|
property color flamingo: "#DBB9F8"
|
||||||
|
property color pink: "#F3B3E3"
|
||||||
|
property color mauve: "#D0BDFE"
|
||||||
|
property color red: "#F8B3D1"
|
||||||
|
property color maroon: "#F6B2DA"
|
||||||
|
property color peach: "#E4B7F4"
|
||||||
|
property color yellow: "#C3C0FF"
|
||||||
|
property color green: "#ADC6FF"
|
||||||
|
property color teal: "#D4BBFC"
|
||||||
|
property color sky: "#CBBEFF"
|
||||||
|
property color sapphire: "#BDC2FF"
|
||||||
|
property color blue: "#C7BFFF"
|
||||||
|
property color lavender: "#EAB5ED"
|
||||||
|
}
|
||||||
|
}
|
||||||
113
dots/quickshell/services/Hyprland.qml
Normal file
113
dots/quickshell/services/Hyprland.qml
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
readonly property list<Client> clients: []
|
||||||
|
readonly property var workspaces: Hyprland.workspaces
|
||||||
|
readonly property var monitors: Hyprland.monitors
|
||||||
|
property Client activeClient: null
|
||||||
|
readonly property HyprlandWorkspace activeWorkspace: focusedMonitor?.activeWorkspace ?? null
|
||||||
|
readonly property HyprlandMonitor focusedMonitor: Hyprland.focusedMonitor
|
||||||
|
readonly property int activeWsId: activeWorkspace?.id ?? 1
|
||||||
|
property point cursorPos
|
||||||
|
|
||||||
|
function reload() {
|
||||||
|
Hyprland.refreshWorkspaces();
|
||||||
|
Hyprland.refreshMonitors();
|
||||||
|
getClients.running = true;
|
||||||
|
getActiveClient.running = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function dispatch(request: string): void {
|
||||||
|
Hyprland.dispatch(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: reload()
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: Hyprland
|
||||||
|
|
||||||
|
function onRawEvent(event: HyprlandEvent): void {
|
||||||
|
if (!event.name.endsWith("v2"))
|
||||||
|
root.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: getClients
|
||||||
|
command: ["hyprctl", "-j", "clients"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
const clients = JSON.parse(text);
|
||||||
|
const rClients = root.clients;
|
||||||
|
|
||||||
|
const destroyed = rClients.filter(rc => !clients.find(c => c.address === rc.address));
|
||||||
|
for (const client of destroyed)
|
||||||
|
rClients.splice(rClients.indexOf(client), 1).forEach(c => c.destroy());
|
||||||
|
|
||||||
|
for (const client of clients) {
|
||||||
|
const match = rClients.find(c => c.address === client.address);
|
||||||
|
if (match) {
|
||||||
|
match.lastIpcObject = client;
|
||||||
|
} else {
|
||||||
|
rClients.push(clientComp.createObject(root, {
|
||||||
|
lastIpcObject: client
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: getActiveClient
|
||||||
|
command: ["hyprctl", "-j", "activewindow"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
const client = JSON.parse(text);
|
||||||
|
const rClient = root.activeClient;
|
||||||
|
if (client.address) {
|
||||||
|
if (rClient)
|
||||||
|
rClient.lastIpcObject = client;
|
||||||
|
else
|
||||||
|
root.activeClient = clientComp.createObject(root, {
|
||||||
|
lastIpcObject: client
|
||||||
|
});
|
||||||
|
} else if (rClient) {
|
||||||
|
rClient.destroy();
|
||||||
|
root.activeClient = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Client: QtObject {
|
||||||
|
required property var lastIpcObject
|
||||||
|
readonly property string address: lastIpcObject.address
|
||||||
|
readonly property string wmClass: lastIpcObject.class
|
||||||
|
readonly property string title: lastIpcObject.title
|
||||||
|
readonly property string initialClass: lastIpcObject.initialClass
|
||||||
|
readonly property string initialTitle: lastIpcObject.initialTitle
|
||||||
|
readonly property int x: lastIpcObject.at[0]
|
||||||
|
readonly property int y: lastIpcObject.at[1]
|
||||||
|
readonly property int width: lastIpcObject.size[0]
|
||||||
|
readonly property int height: lastIpcObject.size[1]
|
||||||
|
readonly property HyprlandWorkspace workspace: Hyprland.workspaces.values.find(w => w.id === lastIpcObject.workspace.id) ?? null
|
||||||
|
readonly property bool floating: lastIpcObject.floating
|
||||||
|
readonly property bool fullscreen: lastIpcObject.fullscreen
|
||||||
|
readonly property int pid: lastIpcObject.pid
|
||||||
|
readonly property int focusHistoryId: lastIpcObject.focusHistoryID
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: clientComp
|
||||||
|
|
||||||
|
Client {}
|
||||||
|
}
|
||||||
|
}
|
||||||
77
dots/quickshell/services/Network.qml
Normal file
77
dots/quickshell/services/Network.qml
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
reloadableId: "network"
|
||||||
|
|
||||||
|
Process {
|
||||||
|
running: true
|
||||||
|
command: ["nmcli", "m"]
|
||||||
|
stdout: SplitParser {
|
||||||
|
onRead: getNetworks.running = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: getNetworks
|
||||||
|
running: true
|
||||||
|
command: ["nmcli", "-g", "ACTIVE,SIGNAL,FREQ,SSID,BSSID", "d", "w"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
const PLACEHOLDER = "STRINGWHICHHOPEFULLYWONTBEUSED";
|
||||||
|
const rep = new RegExp("\\\\:", "g");
|
||||||
|
const rep2 = new RegExp(PLACEHOLDER, "g");
|
||||||
|
|
||||||
|
const networks = 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, ":")
|
||||||
|
};
|
||||||
|
});
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: apComp
|
||||||
|
|
||||||
|
AccessPoint {}
|
||||||
|
}
|
||||||
|
}
|
||||||
108
dots/quickshell/services/Notifs.qml
Normal file
108
dots/quickshell/services/Notifs.qml
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import Quickshell.Services.Notifications
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
readonly property list<Notif> list: []
|
||||||
|
readonly property list<Notif> popups: list.filter(n => n.popup)
|
||||||
|
|
||||||
|
NotificationServer {
|
||||||
|
id: server
|
||||||
|
|
||||||
|
keepOnReload: false
|
||||||
|
actionsSupported: true
|
||||||
|
bodyHyperlinksSupported: true
|
||||||
|
bodyImagesSupported: true
|
||||||
|
bodyMarkupSupported: true
|
||||||
|
imageSupported: true
|
||||||
|
|
||||||
|
onNotification: notif => {
|
||||||
|
notif.tracked = true;
|
||||||
|
|
||||||
|
root.list.push(notifComp.createObject(root, {
|
||||||
|
popup: true,
|
||||||
|
notification: notif
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomShortcut {
|
||||||
|
name: "clearNotifs"
|
||||||
|
description: "Clear all notifications"
|
||||||
|
onPressed: {
|
||||||
|
for (const notif of root.list)
|
||||||
|
notif.popup = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
target: "notifs"
|
||||||
|
|
||||||
|
function clear(): void {
|
||||||
|
for (const notif of root.list)
|
||||||
|
notif.popup = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Notif: QtObject {
|
||||||
|
id: notif
|
||||||
|
|
||||||
|
property bool popup
|
||||||
|
readonly property date time: new Date()
|
||||||
|
readonly property string timeStr: {
|
||||||
|
const diff = Time.date.getTime() - time.getTime();
|
||||||
|
const m = Math.floor(diff / 60000);
|
||||||
|
const h = Math.floor(m / 60);
|
||||||
|
|
||||||
|
if (h < 1 && m < 1)
|
||||||
|
return "now";
|
||||||
|
if (h < 1)
|
||||||
|
return `${m}m`;
|
||||||
|
return `${h}h`;
|
||||||
|
}
|
||||||
|
|
||||||
|
required property Notification notification
|
||||||
|
readonly property string summary: notification.summary
|
||||||
|
readonly property string body: notification.body
|
||||||
|
readonly property string appIcon: notification.appIcon
|
||||||
|
readonly property string appName: notification.appName
|
||||||
|
readonly property string image: notification.image
|
||||||
|
readonly property var urgency: notification.urgency // Idk why NotificationUrgency doesn't work
|
||||||
|
readonly property list<NotificationAction> actions: notification.actions
|
||||||
|
|
||||||
|
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 = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {}
|
||||||
|
}
|
||||||
|
}
|
||||||
97
dots/quickshell/services/Players.qml
Normal file
97
dots/quickshell/services/Players.qml
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import "root:/widgets"
|
||||||
|
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 => p.identity === "Spotify") ?? list[0] ?? null
|
||||||
|
property MprisPlayer manualActive
|
||||||
|
|
||||||
|
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 => p.identity).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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
196
dots/quickshell/services/SystemUsage.qml
Normal file
196
dots/quickshell/services/SystemUsage.qml
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property real cpuPerc
|
||||||
|
property real cpuTemp
|
||||||
|
property real gpuPerc
|
||||||
|
property real gpuTemp
|
||||||
|
property int memUsed
|
||||||
|
property int memTotal
|
||||||
|
readonly property real memPerc: memTotal > 0 ? memUsed / memTotal : 0
|
||||||
|
property int storageUsed
|
||||||
|
property int storageTotal
|
||||||
|
property real storagePerc: storageTotal > 0 ? storageUsed / storageTotal : 0
|
||||||
|
|
||||||
|
property int lastCpuIdle
|
||||||
|
property int lastCpuTotal
|
||||||
|
|
||||||
|
function formatKib(kib: int): 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: true
|
||||||
|
interval: 3000
|
||||||
|
repeat: true
|
||||||
|
onTriggered: {
|
||||||
|
stat.reload();
|
||||||
|
meminfo.reload();
|
||||||
|
storage.running = true;
|
||||||
|
cpuTemp.running = true;
|
||||||
|
gpuUsage.running = true;
|
||||||
|
gpuTemp.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];
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
running: true
|
||||||
|
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: cpuTemp
|
||||||
|
|
||||||
|
running: true
|
||||||
|
command: ["sh", "-c", "cat /sys/class/thermal/thermal_zone*/temp"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
const temps = text.trim().split(" ");
|
||||||
|
const sum = temps.reduce((acc, d) => acc + parseInt(d, 10), 0);
|
||||||
|
root.cpuTemp = sum / temps.length / 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: gpuUsage
|
||||||
|
|
||||||
|
running: true
|
||||||
|
command: ["sh", "-c", "cat /sys/class/drm/card*/device/gpu_busy_percent"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
const percs = text.trim().split("\n");
|
||||||
|
const sum = percs.reduce((acc, d) => acc + parseInt(d, 10), 0);
|
||||||
|
root.gpuPerc = sum / percs.length / 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: gpuTemp
|
||||||
|
|
||||||
|
running: true
|
||||||
|
command: ["sensors"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
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) {
|
||||||
|
const match = line.match(/^(temp[0-9]+|GPU core|edge)+:\s+\+([0-9]+\.[0-9]+)°C/);
|
||||||
|
if (match) {
|
||||||
|
sum += parseFloat(match[2]);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
root.gpuTemp = count > 0 ? sum / count : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
20
dots/quickshell/services/Time.qml
Normal file
20
dots/quickshell/services/Time.qml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
function format(fmt: string): string {
|
||||||
|
return Qt.formatDateTime(clock.date, fmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemClock {
|
||||||
|
id: clock
|
||||||
|
precision: SystemClock.Seconds
|
||||||
|
}
|
||||||
|
}
|
||||||
12
dots/quickshell/services/Visibilities.qml
Normal file
12
dots/quickshell/services/Visibilities.qml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import Quickshell
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
property var screens: ({})
|
||||||
|
property var panels: ({})
|
||||||
|
|
||||||
|
function getForActive(): PersistentProperties {
|
||||||
|
return Object.entries(screens).find(s => s[0].slice(s[0].indexOf('"') + 1, s[0].lastIndexOf('"')) === Hyprland.focusedMonitor.name)[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
117
dots/quickshell/services/Wallpapers.qml
Normal file
117
dots/quickshell/services/Wallpapers.qml
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import "root:/utils/scripts/fuzzysort.js" as Fuzzy
|
||||||
|
import "root:/utils"
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
readonly property string currentNamePath: `${Paths.state}/wallpaper/path.txt`.slice(7)
|
||||||
|
readonly property string path: `${Paths.pictures}/Wallpapers`.slice(7)
|
||||||
|
readonly property list<string> extensions: ["jpg", "jpeg", "png", "webp", "tif", "tiff"]
|
||||||
|
|
||||||
|
readonly property list<Wallpaper> list: wallpapers.instances
|
||||||
|
property bool showPreview: false
|
||||||
|
readonly property string current: showPreview ? previewPath : actualCurrent
|
||||||
|
property string previewPath
|
||||||
|
property string actualCurrent
|
||||||
|
|
||||||
|
readonly property list<var> preppedWalls: list.map(w => ({
|
||||||
|
name: Fuzzy.prepare(w.name),
|
||||||
|
path: Fuzzy.prepare(w.path),
|
||||||
|
wall: w
|
||||||
|
}))
|
||||||
|
|
||||||
|
function fuzzyQuery(search: string): var {
|
||||||
|
return Fuzzy.go(search, preppedWalls, {
|
||||||
|
all: true,
|
||||||
|
keys: ["name", "path"],
|
||||||
|
scoreFn: r => r[0].score * 0.9 + r[1].score * 0.1
|
||||||
|
}).map(r => r.obj.wall);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setWallpaper(path: string): void {
|
||||||
|
actualCurrent = path;
|
||||||
|
setWall.path = path;
|
||||||
|
setWall.startDetached();
|
||||||
|
}
|
||||||
|
|
||||||
|
function preview(path: string): void {
|
||||||
|
previewPath = path;
|
||||||
|
showPreview = true;
|
||||||
|
getPreviewColoursProc.running = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopPreview(): void {
|
||||||
|
showPreview = false;
|
||||||
|
Colours.endPreviewOnNextChange = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
reloadableId: "wallpapers"
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
target: "wallpaper"
|
||||||
|
|
||||||
|
function get(): string {
|
||||||
|
return root.actualCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
function set(path: string): void {
|
||||||
|
root.setWallpaper(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
function list(): string {
|
||||||
|
return root.list.map(w => w.path).join("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FileView {
|
||||||
|
path: root.currentNamePath
|
||||||
|
watchChanges: true
|
||||||
|
onFileChanged: reload()
|
||||||
|
onLoaded: root.actualCurrent = text().trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: getPreviewColoursProc
|
||||||
|
|
||||||
|
command: ["caelestia", "wallpaper", "-p", root.previewPath]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
Colours.load(text, true);
|
||||||
|
Colours.showPreview = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: setWall
|
||||||
|
|
||||||
|
property string path
|
||||||
|
|
||||||
|
command: ["caelestia", "wallpaper", "-f", path]
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
running: true
|
||||||
|
command: ["find", root.path, "-type", "d", "-path", '*/.*', "-prune", "-o", "-not", "-name", '.*', "-type", "f", "-print"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: wallpapers.model = text.trim().split("\n").filter(w => root.extensions.includes(w.slice(w.lastIndexOf(".") + 1))).sort()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Variants {
|
||||||
|
id: wallpapers
|
||||||
|
|
||||||
|
Wallpaper {}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Wallpaper: QtObject {
|
||||||
|
required property string modelData
|
||||||
|
readonly property string path: modelData
|
||||||
|
readonly property string name: path.slice(path.lastIndexOf("/") + 1, path.lastIndexOf("."))
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user