Compare commits
243 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 33746fca04 | |||
| 853b683962 | |||
| b1bfcb3ed0 | |||
| 68662120ba | |||
| b8af60008d | |||
| b8524ff621 | |||
| ffde4063a0 | |||
| 96bf5f3365 | |||
| 053efb4aaf | |||
| c88aef2164 | |||
| 01b54ec5e1 | |||
| 7276ee28dc | |||
| a14ebe2016 | |||
| d3f6765819 | |||
| a3d0ee18cb | |||
| c9d6b95ca5 | |||
| 794a26a3fe | |||
| ca3a288eab | |||
| 902863e5ba | |||
| dd49198cf7 | |||
| ceca949535 | |||
| 24d5584b98 | |||
| 62ec1b9f33 | |||
| 9c6a1ce1a4 | |||
| b6ad180b6a | |||
| b20767c702 | |||
| 362b7bb8c2 | |||
| 405825518a | |||
| db7a822caf | |||
| 3bd9444e2f | |||
| d0e696c681 | |||
| 550630feaa | |||
| 8c22855dd8 | |||
| 015ee61885 | |||
| 8fba953f52 | |||
| 3d2fc0a3b1 | |||
| c060be79e8 | |||
| cb1df5078b | |||
| 5eb32fc30c | |||
| 0a84c822d5 | |||
| f89236f51e | |||
| 4b1316e887 | |||
| 63f4694322 | |||
| 51a8f1d5e1 | |||
| d57010a501 | |||
| d506d5ad27 | |||
| f6119072f7 | |||
| 00063309cd | |||
| c30891de83 | |||
| 55e9c0f267 | |||
| 3424df53e2 | |||
| 583c50f994 | |||
| ca53152630 | |||
| 0cd7df243b | |||
| 6a8ad4dbf2 | |||
| f57577fefd | |||
| 3a05cd339d | |||
| c67a498f8d | |||
| e7e772ebc6 | |||
| fb2c9c6a21 | |||
| 383671344f | |||
| beb1d96750 | |||
| 6f8af9028b | |||
| e874c19ee2 | |||
| af04e5d227 | |||
| 4ab19a8e37 | |||
| 783d05f815 | |||
| 17fb9c0fef | |||
| 39cbfa2c93 | |||
| 5c5018033d | |||
| d9afc6c7c7 | |||
| 17fef78672 | |||
| c120dcae41 | |||
| 64e65ca9df | |||
| 22a7993c07 | |||
| 24526ca2d1 | |||
| c5ee27bf62 | |||
| 7cec08d262 | |||
| 97b657ce9a | |||
| 33f6706658 | |||
| f6c4dc8ee1 | |||
| a53a4b32eb | |||
| e80ac202d0 | |||
| 6e6f6c28f6 | |||
| 26bfa952d7 | |||
| 611abdf028 | |||
| 37a112a04b | |||
| bfc09c71a8 | |||
| c7fabf9fc5 | |||
| 0bae21c891 | |||
| 53733c7fe0 | |||
| 836b92cc5f | |||
| bcc75abc54 | |||
| 11c185baa6 | |||
| 7cc056c327 | |||
| f657741551 | |||
| 073e1dd8b1 | |||
| 8fa447c63d | |||
| e4113994dc | |||
| 8a2eeb6c31 | |||
| 10340a83dd | |||
| c2bd45db4a | |||
| d5256a3952 | |||
| abd85388f6 | |||
| 2bad732592 | |||
| 47120db391 | |||
| d568cd34ab | |||
| a3a55ba8d1 | |||
| 8db28ec3a0 | |||
| 9688e99a8e | |||
| cbc81a1af8 | |||
| 14ec888269 | |||
| 2eb0529e98 | |||
| 7a2786af66 | |||
| 1eb2bbda00 | |||
| 6b8ae3f291 | |||
| 4a18eda37c | |||
| 85c126ad1e | |||
| 6316e788b9 | |||
| 3cf206ea43 | |||
| f870bbcc52 | |||
| 09d61dc70d | |||
| cd86fc53a3 | |||
| 47b964d9ce | |||
| 2b83c7784c | |||
| 26c2315b66 | |||
| 89ae3b6074 | |||
| 4cd687afc0 | |||
| 263ef66816 | |||
| bcb0da3ab9 | |||
| c3f877c19e | |||
| ac1d19acbb | |||
| 93d6bf536a | |||
| 95a6824598 | |||
| c1035e8a06 | |||
| 2fd01a7274 | |||
| 007cb32690 | |||
| be6c7d4c03 | |||
| 32c8b7311d | |||
| 666bfacfcc | |||
| 76ddb9bdfc | |||
| 6043cb12a1 | |||
| dbc5469855 | |||
| fb315b61fb | |||
| 8ed5c92e8f | |||
| 4949b98cb1 | |||
| 7f88cbaf38 | |||
| e45ecf864a | |||
| 630a20faa7 | |||
| a7457c57c0 | |||
| 9418a92e99 | |||
| f53efea589 | |||
| 2da0d2a903 | |||
| 3ebc2befcb | |||
| c1dbd387d8 | |||
| 47b8d68d4b | |||
| 6d78a01659 | |||
| 55b497f132 | |||
| 0df32b9e95 | |||
| 9a606f3e58 | |||
| 40b2e46b25 | |||
| 7ac158d9ea | |||
| f85bd82943 | |||
| ddcdb5d445 | |||
| 52302057ba | |||
| 3dbe83a0e1 | |||
| d05903d744 | |||
| cd39814b29 | |||
| d2ef6075a9 | |||
| 585128c447 | |||
| 487c56bc47 | |||
| 8bd8a7dad7 | |||
| 55dd900257 | |||
| f8c5f56ca7 | |||
| eceb453036 | |||
| 2ec8ef6299 | |||
| 32b77e0ced | |||
| 3d2c2db828 | |||
| 635e2c3964 | |||
| e5c03448c2 | |||
| 440d103b46 | |||
| 84e708aaad | |||
| 463e5b619a | |||
| 2e9792cdff | |||
| 41e88cff01 | |||
| b95f1cfd9d | |||
| 3f66efc0ac | |||
| ea7f477665 | |||
| e31a37ba5f | |||
| d77a77071e | |||
| 52c947f0ac | |||
| 6437ed4b40 | |||
| b655b51855 | |||
| c3dab78b04 | |||
| 61c3fe20d5 | |||
| 138d80ef00 | |||
| 22976a6681 | |||
| 56252365b3 | |||
| 54efaeb8b3 | |||
| 96b089f401 | |||
| 7aefe2052f | |||
| 883bac89cb | |||
| 35e6207ad2 | |||
| 6ee804e849 | |||
| 54eb48c0bf | |||
| d752d70526 | |||
| ad563d72f5 | |||
| e182b9e599 | |||
| 28303f9d07 | |||
| 6f28c40d68 | |||
| 408e535867 | |||
| e8bd010011 | |||
| 62f6442e6e | |||
| 21bedf189b | |||
| 3114ecb690 | |||
| 24a14b41d7 | |||
| be71172a37 | |||
| 0fcbc4b8b1 | |||
| 50d4582b49 | |||
| 31e2cfe850 | |||
| 2da1d2c8ab | |||
| f4d5f54f9a | |||
| a67e3383e8 | |||
| 361b4e7979 | |||
| 7129db4276 | |||
| c022933d16 | |||
| c266665cff | |||
| 262d6404a4 | |||
| c99d8abeac | |||
| 864604401b | |||
| 205a76b2f3 | |||
| 42ea3318c1 | |||
| 1eae2044c1 | |||
| f531d5cbbb | |||
| ec49904bac | |||
| 8cc2b14ad1 | |||
| d839f32196 | |||
| 3c46256a9f | |||
| 10b56e1e1b | |||
| 0644c5bf86 | |||
| c1efd7dacc | |||
| a982ca500b | |||
| 6b482979fe |
@@ -0,0 +1,42 @@
|
||||
name: Lint & Format (JS/TS)
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
lint-format:
|
||||
runs-on: alpine
|
||||
container: node:26-alpine
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
apk add --no-cache \
|
||||
git
|
||||
|
||||
- name: Prettier
|
||||
continue-on-error: true
|
||||
run: |
|
||||
if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then
|
||||
npx --yes prettier --check "**/*.{js,jsx,ts,tsx,mjs,cjs}" --ignore-path .prettierignore
|
||||
else
|
||||
echo "No JS/TS files found"
|
||||
fi
|
||||
|
||||
- name: ESLint
|
||||
run: |
|
||||
if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then
|
||||
if [ -f package.json ]; then
|
||||
npm install --no-audit --no-fund
|
||||
fi
|
||||
if [ -f eslint.config.js ] || [ -f eslint.config.mjs ] || [ -f eslint.config.cjs ] || [ -f .eslintrc ] || [ -f .eslintrc.js ] || [ -f .eslintrc.cjs ] || [ -f .eslintrc.json ] || [ -f .eslintrc.yaml ] || [ -f .eslintrc.yml ]; then
|
||||
npx --yes eslint . && echo "ESLint passed" || echo "ESLint failed"
|
||||
else
|
||||
echo "No eslint config found"
|
||||
fi
|
||||
else
|
||||
echo "No JS/TS files found"
|
||||
fi
|
||||
@@ -0,0 +1,34 @@
|
||||
name: Lint & Format (Python)
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
lint-format:
|
||||
runs-on: alpine
|
||||
container: node:26-alpine
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
apk add --no-cache \
|
||||
git \
|
||||
python3 \
|
||||
py3-pip
|
||||
python3 -m venv .venv
|
||||
. .venv/bin/activate
|
||||
pip install --no-cache-dir ruff
|
||||
|
||||
- name: Format check
|
||||
continue-on-error: true
|
||||
run: |
|
||||
. .venv/bin/activate
|
||||
ruff format --check .
|
||||
|
||||
- name: Lint
|
||||
run: |
|
||||
. .venv/bin/activate
|
||||
ruff check .
|
||||
@@ -0,0 +1,72 @@
|
||||
name: Lint & Format (Rust)
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
lint-format:
|
||||
runs-on: alpine
|
||||
container: node:26-alpine
|
||||
env:
|
||||
CARGO_HOME: ${{ github.workspace }}/.cargo
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cache cargo packages
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
cache-name: cache-cargo-packages
|
||||
with:
|
||||
path: |
|
||||
.cargo/registry
|
||||
.cargo/git
|
||||
target
|
||||
key: rust-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
rust-${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
rust-${{ runner.os }}-build-
|
||||
rust-
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
apk add --no-cache \
|
||||
git \
|
||||
cargo \
|
||||
rust \
|
||||
rustfmt \
|
||||
rust-clippy
|
||||
|
||||
- name: Format check
|
||||
continue-on-error: true
|
||||
run: |
|
||||
if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then
|
||||
for manifest in $(find . -name "Cargo.toml"); do
|
||||
cargo fmt --manifest-path "$manifest" --check && \
|
||||
echo "$manifest: formatting OK" || \
|
||||
echo "$manifest: needs formatting"
|
||||
done
|
||||
elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then
|
||||
echo "Rust files found but no Cargo.toml"
|
||||
exit 1
|
||||
else
|
||||
echo "No Rust project found"
|
||||
fi
|
||||
|
||||
- name: Clippy
|
||||
run: |
|
||||
if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then
|
||||
status=0
|
||||
for manifest in $(find . -name "Cargo.toml"); do
|
||||
cargo clippy --manifest-path "$manifest" --all-targets --all-features -- -D warnings && \
|
||||
echo "$manifest: Clippy passed" || \
|
||||
{ echo "$manifest: Clippy failed"; status=1; }
|
||||
done
|
||||
exit $status
|
||||
elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then
|
||||
echo "Rust files found but no Cargo.toml"
|
||||
exit 1
|
||||
else
|
||||
echo "No Rust project found"
|
||||
fi
|
||||
@@ -1,3 +1,4 @@
|
||||
**/__pycache__/
|
||||
./result/
|
||||
.pyre/
|
||||
.cache/
|
||||
@@ -11,3 +12,4 @@ pkg/
|
||||
uv.lock
|
||||
.qtcreator/
|
||||
dist/
|
||||
**/target/
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
.venv/
|
||||
scripts/fzf.js
|
||||
scripts/fuzzysort.js
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"semi": true,
|
||||
"singleQuote": false,
|
||||
"jsxSingleQuote": false,
|
||||
"tabWidth": 4,
|
||||
"printWidth": 80,
|
||||
"trailingComma": "es5",
|
||||
"bracketSpacing": true,
|
||||
"bracketSameLine": false,
|
||||
"arrowParens": "always",
|
||||
"endOfLine": "lf",
|
||||
"proseWrap": "preserve"
|
||||
}
|
||||
@@ -12,6 +12,7 @@ set(ENABLE_MODULES "plugin;shell" CACHE STRING "Modules to build/install")
|
||||
set(INSTALL_LIBDIR "usr/lib/ZShell" CACHE STRING "Library install dir")
|
||||
set(INSTALL_QMLDIR "usr/lib/qt6/qml" CACHE STRING "QML install dir")
|
||||
set(INSTALL_QSCONFDIR "etc/xdg/quickshell/zshell" CACHE STRING "Quickshell config install dir")
|
||||
set(INSTALL_GREETERCONFDIR "etc/xdg/quickshell/zshell-greeter" CACHE STRING "Quickshell greeter install dir")
|
||||
|
||||
add_compile_options(
|
||||
-Wall -Wextra -Wpedantic -Wshadow -Wconversion
|
||||
@@ -31,4 +32,5 @@ if("shell" IN_LIST ENABLE_MODULES)
|
||||
install(DIRECTORY ${dir} DESTINATION "${INSTALL_QSCONFDIR}")
|
||||
endforeach()
|
||||
install(FILES shell.qml DESTINATION "${INSTALL_QSCONFDIR}")
|
||||
install(DIRECTORY Greeter/ DESTINATION "${INSTALL_GREETERCONFDIR}")
|
||||
endif()
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ import QtQuick
|
||||
import qs.Config
|
||||
|
||||
NumberAnimation {
|
||||
duration: MaterialEasing.standardTime
|
||||
easing.bezierCurve: MaterialEasing.standard
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.bezierCurve: Appearance.anim.curves.standard
|
||||
easing.type: Easing.BezierSpline
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ Slider {
|
||||
bottomRightRadius: root.implicitHeight / 15
|
||||
color: root.nonPeakColor
|
||||
implicitWidth: root.handle.x - root.implicitHeight
|
||||
radius: 1000
|
||||
radius: Appearance.rounding.full
|
||||
topRightRadius: root.implicitHeight / 15
|
||||
|
||||
CustomRect {
|
||||
@@ -29,7 +29,7 @@ Slider {
|
||||
bottomRightRadius: root.implicitHeight / 15
|
||||
color: root.peakColor
|
||||
implicitWidth: parent.width * root.peak
|
||||
radius: 1000
|
||||
radius: Appearance.rounding.full
|
||||
topRightRadius: root.implicitHeight / 15
|
||||
|
||||
Behavior on implicitWidth {
|
||||
@@ -49,7 +49,7 @@ Slider {
|
||||
bottomLeftRadius: root.implicitHeight / 15
|
||||
color: DynamicColors.tPalette.m3surfaceContainer
|
||||
implicitWidth: root.implicitWidth - root.handle.x - root.handle.implicitWidth - root.implicitHeight
|
||||
radius: 1000
|
||||
radius: Appearance.rounding.full
|
||||
topLeftRadius: root.implicitHeight / 15
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ Slider {
|
||||
color: DynamicColors.palette.m3primary
|
||||
implicitHeight: 15
|
||||
implicitWidth: 5
|
||||
radius: 1000
|
||||
radius: Appearance.rounding.full
|
||||
x: root.visualPosition * root.availableWidth - implicitWidth / 2
|
||||
|
||||
MouseArea {
|
||||
|
||||
@@ -6,7 +6,7 @@ Button {
|
||||
id: control
|
||||
|
||||
property color bgColor: DynamicColors.palette.m3primary
|
||||
property int radius: 4
|
||||
property int radius: Appearance.rounding.smallest / 2
|
||||
property color textColor: DynamicColors.palette.m3onPrimary
|
||||
|
||||
background: CustomRect {
|
||||
|
||||
@@ -22,7 +22,7 @@ CheckBox {
|
||||
color: DynamicColors.palette.m3surfaceVariant
|
||||
implicitHeight: control.checkHeight
|
||||
implicitWidth: control.checkWidth
|
||||
radius: 4
|
||||
radius: Appearance.rounding.smallest / 2
|
||||
|
||||
CustomRect {
|
||||
color: DynamicColors.palette.m3primary
|
||||
|
||||
@@ -25,7 +25,7 @@ RadioButton {
|
||||
color: "transparent"
|
||||
implicitHeight: 16
|
||||
implicitWidth: 16
|
||||
radius: 1000
|
||||
radius: Appearance.rounding.full
|
||||
|
||||
Behavior on border.color {
|
||||
CAnim {
|
||||
@@ -47,7 +47,7 @@ RadioButton {
|
||||
color: Qt.alpha(DynamicColors.palette.m3primary, root.checked ? 1 : 0)
|
||||
implicitHeight: 8
|
||||
implicitWidth: 8
|
||||
radius: 1000
|
||||
radius: Appearance.rounding.full
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ ScrollBar {
|
||||
return 0.6;
|
||||
return 0;
|
||||
}
|
||||
radius: 1000
|
||||
radius: Appearance.rounding.full
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
|
||||
@@ -5,15 +5,17 @@ import qs.Config
|
||||
Slider {
|
||||
id: root
|
||||
|
||||
property color color: DynamicColors.palette.m3primary
|
||||
|
||||
background: Item {
|
||||
CustomRect {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
bottomRightRadius: root.implicitHeight / 6
|
||||
color: DynamicColors.palette.m3primary
|
||||
color: root.color
|
||||
implicitWidth: root.handle.x - root.implicitHeight / 2
|
||||
radius: 1000
|
||||
radius: Appearance.rounding.full
|
||||
topRightRadius: root.implicitHeight / 6
|
||||
}
|
||||
|
||||
@@ -24,16 +26,16 @@ Slider {
|
||||
bottomLeftRadius: root.implicitHeight / 6
|
||||
color: DynamicColors.tPalette.m3surfaceContainer
|
||||
implicitWidth: parent.width - root.handle.x - root.handle.implicitWidth - root.implicitHeight / 2
|
||||
radius: 1000
|
||||
radius: Appearance.rounding.full
|
||||
topLeftRadius: root.implicitHeight / 6
|
||||
}
|
||||
}
|
||||
handle: CustomRect {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: DynamicColors.palette.m3primary
|
||||
color: root.color
|
||||
implicitHeight: 15
|
||||
implicitWidth: 5
|
||||
radius: 1000
|
||||
radius: Appearance.rounding.full
|
||||
x: root.visualPosition * root.availableWidth - implicitWidth / 2
|
||||
|
||||
MouseArea {
|
||||
|
||||
@@ -15,7 +15,7 @@ Switch {
|
||||
color: root.checked ? DynamicColors.palette.m3primary : DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, root.cLayer)
|
||||
implicitHeight: 13 + 7 * 2
|
||||
implicitWidth: implicitHeight * 1.7
|
||||
radius: 1000
|
||||
radius: Appearance.rounding.full
|
||||
|
||||
CustomRect {
|
||||
readonly property real nonAnimWidth: root.pressed ? implicitHeight * 1.3 : implicitHeight
|
||||
@@ -24,7 +24,7 @@ Switch {
|
||||
color: root.checked ? DynamicColors.palette.m3onPrimary : DynamicColors.layer(DynamicColors.palette.m3outline, root.cLayer + 1)
|
||||
implicitHeight: parent.implicitHeight - 10
|
||||
implicitWidth: nonAnimWidth
|
||||
radius: 1000
|
||||
radius: Appearance.rounding.full
|
||||
x: root.checked ? parent.implicitWidth - nonAnimWidth - 10 / 2 : 10 / 2
|
||||
|
||||
Behavior on implicitWidth {
|
||||
|
||||
@@ -22,7 +22,7 @@ Item {
|
||||
implicitHeight: shown ? (tooltipTextObject.implicitHeight + 2 * root.verticalPadding) : 0
|
||||
implicitWidth: shown ? (tooltipTextObject.implicitWidth + 2 * root.horizontalPadding) : 0
|
||||
opacity: shown ? 1 : 0
|
||||
radius: 8
|
||||
radius: Appearance.rounding.smallest
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Anim {
|
||||
|
||||
@@ -10,7 +10,7 @@ CustomRect {
|
||||
implicitHeight: count.implicitHeight + 4 * 2
|
||||
implicitWidth: count.implicitWidth + 8 * 2
|
||||
opacity: extra > 0 ? 1 : 0
|
||||
radius: 8
|
||||
radius: Appearance.rounding.smallest
|
||||
scale: extra > 0 ? 1 : 0.5
|
||||
|
||||
Behavior on opacity {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import qs.Config
|
||||
|
||||
IconButton {
|
||||
id: root
|
||||
|
||||
required property bool shouldBeVisible
|
||||
|
||||
opacity: 0
|
||||
scale: 0
|
||||
visible: root.scale > 0
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.small
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
onShouldBeVisibleChanged: {
|
||||
if (root.shouldBeVisible) {
|
||||
root.opacity = 1;
|
||||
root.scale = 1;
|
||||
} else {
|
||||
root.opacity = 0;
|
||||
root.scale = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,12 +41,11 @@ CustomRect {
|
||||
color: type === IconButton.Text ? "transparent" : disabled ? disabledColour : internalChecked ? activeColour : inactiveColour
|
||||
implicitHeight: label.implicitHeight + padding * 2
|
||||
implicitWidth: implicitHeight
|
||||
radius: internalChecked ? 6 : implicitHeight / 2 * Math.min(1, 1)
|
||||
radius: internalChecked ? 6 : (implicitHeight / 2 * Math.min(1, 1)) * Appearance.rounding.scale
|
||||
|
||||
Behavior on radius {
|
||||
Anim {
|
||||
id: radiusAnim
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ Item {
|
||||
animate: root.animate
|
||||
animateProp: "opacity"
|
||||
color: root.color
|
||||
font.pointSize: elideText.font.pointSize
|
||||
text: elideText.text
|
||||
}
|
||||
|
||||
@@ -111,6 +112,7 @@ Item {
|
||||
animate: root.animate
|
||||
animateProp: "opacity"
|
||||
color: root.color
|
||||
font.pointSize: elideText.font.pointSize
|
||||
text: t1.text
|
||||
x: t1.width + root.gap
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ Elevation {
|
||||
level: root.expanded ? 2 : 0
|
||||
radius: itemHeight / 2
|
||||
visible: implicitHeight > 0
|
||||
z: root.expanded ? 100 : 0
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Anim {
|
||||
@@ -68,6 +69,7 @@ Elevation {
|
||||
anchors.fill: parent
|
||||
color: DynamicColors.palette.m3surfaceContainer
|
||||
radius: parent.radius
|
||||
z: root.z
|
||||
|
||||
// Main visible spinner: normal/outside text color
|
||||
PathView {
|
||||
|
||||
@@ -85,7 +85,7 @@ MouseArea {
|
||||
border.pixelAligned: false
|
||||
color: root.color
|
||||
opacity: 0
|
||||
radius: 1000
|
||||
radius: Appearance.rounding.full
|
||||
|
||||
transform: Translate {
|
||||
x: -ripple.width / 2
|
||||
|
||||
@@ -4,6 +4,7 @@ import Quickshell
|
||||
|
||||
Singleton {
|
||||
readonly property AppearanceConf.Anim anim: Config.appearance.anim
|
||||
readonly property AppearanceConf.Deform deform: Config.appearance.deform
|
||||
readonly property AppearanceConf.FontStuff font: Config.appearance.font
|
||||
readonly property AppearanceConf.Padding padding: Config.appearance.padding
|
||||
// Literally just here to shorten accessing stuff :woe:
|
||||
|
||||
@@ -3,6 +3,8 @@ import Quickshell.Io
|
||||
JsonObject {
|
||||
property Anim anim: Anim {
|
||||
}
|
||||
property Deform deform: Deform {
|
||||
}
|
||||
property FontStuff font: FontStuff {
|
||||
}
|
||||
property Padding padding: Padding {
|
||||
@@ -43,6 +45,9 @@ JsonObject {
|
||||
property real scale: 1
|
||||
property int small: 200 * scale
|
||||
}
|
||||
component Deform: JsonObject {
|
||||
property real scale: 1
|
||||
}
|
||||
component FontFamily: JsonObject {
|
||||
property string clock: "Rubik"
|
||||
property string material: "Material Symbols Rounded"
|
||||
@@ -66,8 +71,8 @@ JsonObject {
|
||||
}
|
||||
component Padding: JsonObject {
|
||||
property int large: 15 * scale
|
||||
property int larger: 12 * scale
|
||||
property int normal: 10 * scale
|
||||
property int larger: 13 * scale
|
||||
property int normal: 9 * scale
|
||||
property real scale: 1
|
||||
property int small: 5 * scale
|
||||
property int smaller: 7 * scale
|
||||
@@ -75,18 +80,18 @@ JsonObject {
|
||||
}
|
||||
component Rounding: JsonObject {
|
||||
property int full: 1000 * scale
|
||||
property int large: 25 * scale
|
||||
property int normal: 17 * scale
|
||||
property int large: 24 * scale
|
||||
property int normal: 18 * scale
|
||||
property real scale: 1
|
||||
property int small: 12 * scale
|
||||
property int smallest: 8 * scale
|
||||
}
|
||||
component Spacing: JsonObject {
|
||||
property int large: 20 * scale
|
||||
property int larger: 15 * scale
|
||||
property int larger: 16 * scale
|
||||
property int normal: 12 * scale
|
||||
property real scale: 1
|
||||
property int small: 7 * scale
|
||||
property int small: 8 * scale
|
||||
property int smaller: 10 * scale
|
||||
}
|
||||
component Transparency: JsonObject {
|
||||
|
||||
@@ -4,4 +4,11 @@ import qs.Config
|
||||
JsonObject {
|
||||
property bool enabled: true
|
||||
property int wallFadeDuration: MaterialEasing.standardTime
|
||||
property real alignX: 0.5
|
||||
property real alignY: 0.5
|
||||
property real zoom: 1.0
|
||||
property real sourceClipX: 0
|
||||
property real sourceClipY: 0
|
||||
property real sourceClipW: 0
|
||||
property real sourceClipH: 0
|
||||
}
|
||||
|
||||
+5
-11
@@ -8,10 +8,6 @@ JsonObject {
|
||||
id: "workspaces",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "audio",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "media",
|
||||
enabled: true
|
||||
@@ -24,10 +20,6 @@ JsonObject {
|
||||
id: "updates",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "dash",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "spacer",
|
||||
enabled: true
|
||||
@@ -41,12 +33,12 @@ JsonObject {
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "tray",
|
||||
id: "hyprsunset",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "upower",
|
||||
enabled: false
|
||||
id: "tray",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "network",
|
||||
@@ -62,9 +54,11 @@ JsonObject {
|
||||
},
|
||||
]
|
||||
property int height: 34
|
||||
property bool hideWhenNotif: false
|
||||
property Popouts popouts: Popouts {
|
||||
}
|
||||
property int rounding: 8
|
||||
property int smoothing: 32
|
||||
|
||||
component Popouts: JsonObject {
|
||||
property bool activeWindow: true
|
||||
|
||||
+42
-4
@@ -23,6 +23,7 @@ Singleton {
|
||||
property alias osd: adapter.osd
|
||||
property alias overview: adapter.overview
|
||||
property bool recentlySaved: false
|
||||
property alias screenshot: adapter.screenshot
|
||||
property alias services: adapter.services
|
||||
property alias sidebar: adapter.sidebar
|
||||
property alias utilities: adapter.utilities
|
||||
@@ -48,6 +49,9 @@ Singleton {
|
||||
padding: {
|
||||
scale: appearance.padding.scale
|
||||
},
|
||||
deform: {
|
||||
scale: appearance.deform.scale
|
||||
},
|
||||
font: {
|
||||
family: {
|
||||
sans: appearance.font.family.sans,
|
||||
@@ -77,15 +81,24 @@ Singleton {
|
||||
function serializeBackground(): var {
|
||||
return {
|
||||
wallFadeDuration: background.wallFadeDuration,
|
||||
enabled: background.enabled
|
||||
enabled: background.enabled,
|
||||
alignX: background.alignX,
|
||||
sourceClipX: background.sourceClipX,
|
||||
sourceClipY: background.sourceClipY,
|
||||
sourceClipW: background.sourceClipW,
|
||||
sourceClipH: background.sourceClipH,
|
||||
alignY: background.alignY,
|
||||
zoom: background.zoom
|
||||
};
|
||||
}
|
||||
|
||||
function serializeBar(): var {
|
||||
return {
|
||||
autoHide: barConfig.autoHide,
|
||||
hideWhenNotif: barConfig.hideWhenNotif,
|
||||
rounding: barConfig.rounding,
|
||||
border: barConfig.border,
|
||||
smoothing: barConfig.smoothing,
|
||||
height: barConfig.height,
|
||||
popouts: {
|
||||
tray: barConfig.popouts.tray,
|
||||
@@ -121,7 +134,8 @@ Singleton {
|
||||
background: serializeBackground(),
|
||||
launcher: serializeLauncher(),
|
||||
colors: serializeColors(),
|
||||
dock: serializeDock()
|
||||
dock: serializeDock(),
|
||||
screenshot: serializeScreenshot()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -173,10 +187,15 @@ Singleton {
|
||||
logo: general.logo,
|
||||
wallpaperPath: general.wallpaperPath,
|
||||
desktopIcons: general.desktopIcons,
|
||||
dateFormat: general.dateFormat,
|
||||
color: {
|
||||
wallust: general.color.wallust,
|
||||
mode: general.color.mode,
|
||||
smart: general.color.smart,
|
||||
scheduleDark: general.color.scheduleDark,
|
||||
scheduleHyprsunset: general.color.scheduleHyprsunset,
|
||||
scheduleHyprsunsetStart: general.color.scheduleHyprsunsetStart,
|
||||
hyprsunsetTemp: general.color.hyprsunsetTemp,
|
||||
scheduleHyprsunsetEnd: general.color.scheduleHyprsunsetEnd,
|
||||
schemeGeneration: general.color.schemeGeneration,
|
||||
scheduleDarkStart: general.color.scheduleDarkStart,
|
||||
scheduleDarkEnd: general.color.scheduleDarkEnd,
|
||||
@@ -198,6 +217,7 @@ Singleton {
|
||||
return {
|
||||
maxAppsShown: launcher.maxAppsShown,
|
||||
maxWallpapers: launcher.maxWallpapers,
|
||||
uwsm: launcher.uwsm,
|
||||
actionPrefix: launcher.actionPrefix,
|
||||
specialPrefix: launcher.specialPrefix,
|
||||
useFuzzy: {
|
||||
@@ -221,6 +241,7 @@ Singleton {
|
||||
return {
|
||||
recolorLogo: lock.recolorLogo,
|
||||
enableFprint: lock.enableFprint,
|
||||
showNotifContent: lock.showNotifContent,
|
||||
maxFprintTries: lock.maxFprintTries,
|
||||
blurAmount: lock.blurAmount,
|
||||
sizes: {
|
||||
@@ -262,9 +283,24 @@ Singleton {
|
||||
};
|
||||
}
|
||||
|
||||
function serializeScreenshot(): var {
|
||||
return {
|
||||
enable_pp: screenshot.enable_pp,
|
||||
mode: screenshot.mode,
|
||||
corner_radius: screenshot.corner_radius,
|
||||
drop_shadow: screenshot.drop_shadow,
|
||||
rounded_corners: screenshot.rounded_corners,
|
||||
shadow_blur_radius: screenshot.shadow_blur_radius,
|
||||
shadow_color: screenshot.shadow_color,
|
||||
shadow_offset_x: screenshot.shadow_offset_x,
|
||||
shadow_offset_y: screenshot.shadow_offset_y
|
||||
};
|
||||
}
|
||||
|
||||
function serializeServices(): var {
|
||||
return {
|
||||
weatherLocation: services.weatherLocation,
|
||||
updates: services.updates,
|
||||
useFahrenheit: services.useFahrenheit,
|
||||
ddcutilService: services.ddcutilService,
|
||||
useTwelveHourClock: services.useTwelveHourClock,
|
||||
@@ -317,7 +353,6 @@ Singleton {
|
||||
|
||||
ElapsedTimer {
|
||||
id: timer
|
||||
|
||||
}
|
||||
|
||||
Timer {
|
||||
@@ -374,6 +409,7 @@ Singleton {
|
||||
}
|
||||
onLoaded: {
|
||||
ModeScheduler.checkStartup();
|
||||
Hyprsunset.checkStartup();
|
||||
try {
|
||||
JSON.parse(text());
|
||||
const elapsed = timer.elapsedMs();
|
||||
@@ -416,6 +452,8 @@ Singleton {
|
||||
}
|
||||
property Overview overview: Overview {
|
||||
}
|
||||
property Screenshot screenshot: Screenshot {
|
||||
}
|
||||
property Services services: Services {
|
||||
}
|
||||
property SidebarConfig sidebar: SidebarConfig {
|
||||
|
||||
+60
-61
@@ -3,6 +3,7 @@ pragma ComponentBehavior: Bound
|
||||
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Hyprland
|
||||
import QtQuick
|
||||
import ZShell
|
||||
import qs.Helpers
|
||||
@@ -78,12 +79,59 @@ Singleton {
|
||||
return Qt.hsla(c.hslHue, c.hslSaturation, 0.1, 1);
|
||||
}
|
||||
|
||||
function reloadHyprRules(): void {
|
||||
const blur = transparency.enabled ? 1 : 0;
|
||||
const alpha = transparency.base - 0.03;
|
||||
|
||||
const rules = `
|
||||
hl.layer_rule({
|
||||
match = { namespace = "ZShell-Bar" },
|
||||
blur = ${blur}
|
||||
})
|
||||
|
||||
hl.layer_rule({
|
||||
match = { namespace = "ZShell-Bar" },
|
||||
ignore_alpha = ${alpha}
|
||||
})
|
||||
|
||||
hl.layer_rule({
|
||||
match = { namespace = "ZShell-Auth" },
|
||||
blur = ${blur}
|
||||
})
|
||||
|
||||
hl.layer_rule({
|
||||
match = { namespace = "ZShell-Auth" },
|
||||
ignore_alpha = ${alpha}
|
||||
})
|
||||
`;
|
||||
|
||||
Hypr.extras.message(`eval ${rules}`);
|
||||
}
|
||||
|
||||
function setMode(mode: string): void {
|
||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--mode", mode]);
|
||||
Config.general.color.mode = mode;
|
||||
Config.save();
|
||||
}
|
||||
|
||||
Component.onCompleted: debounceTimer.triggered()
|
||||
|
||||
Connections {
|
||||
function onUsingLuaChanged(): void {
|
||||
root.reloadHyprRules();
|
||||
}
|
||||
|
||||
target: Hyprland
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onConfigReloaded(): void {
|
||||
root.reloadHyprRules();
|
||||
}
|
||||
|
||||
target: Hypr
|
||||
}
|
||||
|
||||
FileView {
|
||||
path: `${Paths.state}/scheme.json`
|
||||
watchChanges: true
|
||||
@@ -92,72 +140,20 @@ Singleton {
|
||||
onLoaded: root.load(text(), false)
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: debounceTimer
|
||||
|
||||
interval: 300
|
||||
|
||||
onTriggered: root.reloadHyprRules()
|
||||
}
|
||||
|
||||
ImageAnalyser {
|
||||
id: analyser
|
||||
|
||||
source: WallpaperPath.currentWallpaperPath
|
||||
}
|
||||
|
||||
component M3MaccchiatoPalette: QtObject {
|
||||
property color m3background: "#131317"
|
||||
property color m3error: "#ffb4ab"
|
||||
property color m3errorContainer: "#93000a"
|
||||
property color m3inverseOnSurface: "#303034"
|
||||
property color m3inversePrimary: "#525b92"
|
||||
property color m3inverseSurface: "#e4e1e7"
|
||||
property color m3neutral_paletteKeyColor: "#77767b"
|
||||
property color m3neutral_variant_paletteKeyColor: "#767680"
|
||||
property color m3onBackground: "#e4e1e7"
|
||||
property color m3onError: "#690005"
|
||||
property color m3onErrorContainer: "#ffdad6"
|
||||
property color m3onPrimary: "#232c60"
|
||||
property color m3onPrimaryContainer: "#ffffff"
|
||||
property color m3onPrimaryFixed: "#0b154b"
|
||||
property color m3onPrimaryFixedVariant: "#3a4378"
|
||||
property color m3onSecondary: "#2c2f44"
|
||||
property color m3onSecondaryContainer: "#b1b3ce"
|
||||
property color m3onSecondaryFixed: "#171a2e"
|
||||
property color m3onSecondaryFixedVariant: "#42455c"
|
||||
property color m3onSuccess: "#213528"
|
||||
property color m3onSuccessContainer: "#D1E9D6"
|
||||
property color m3onSurface: "#e4e1e7"
|
||||
property color m3onSurfaceVariant: "#c6c5d1"
|
||||
property color m3onTertiary: "#4c1f48"
|
||||
property color m3onTertiaryContainer: "#000000"
|
||||
property color m3onTertiaryFixed: "#340831"
|
||||
property color m3onTertiaryFixedVariant: "#66365f"
|
||||
property color m3outline: "#90909a"
|
||||
property color m3outlineVariant: "#46464f"
|
||||
property color m3primary: "#bac3ff"
|
||||
property color m3primaryContainer: "#6a73ac"
|
||||
property color m3primaryFixed: "#dee0ff"
|
||||
property color m3primaryFixedDim: "#bac3ff"
|
||||
property color m3primary_paletteKeyColor: "#6a73ac"
|
||||
property color m3scrim: "#000000"
|
||||
property color m3secondary: "#c3c5e0"
|
||||
property color m3secondaryContainer: "#42455c"
|
||||
property color m3secondaryFixed: "#dfe1fd"
|
||||
property color m3secondaryFixedDim: "#c3c5e0"
|
||||
property color m3secondary_paletteKeyColor: "#72758e"
|
||||
property color m3shadow: "#000000"
|
||||
property color m3success: "#B5CCBA"
|
||||
property color m3successContainer: "#374B3E"
|
||||
property color m3surface: "#131317"
|
||||
property color m3surfaceBright: "#39393d"
|
||||
property color m3surfaceContainer: "#1f1f23"
|
||||
property color m3surfaceContainerHigh: "#2a2a2e"
|
||||
property color m3surfaceContainerHighest: "#353438"
|
||||
property color m3surfaceContainerLow: "#1b1b1f"
|
||||
property color m3surfaceContainerLowest: "#0e0e12"
|
||||
property color m3surfaceDim: "#131317"
|
||||
property color m3surfaceTint: "#bac3ff"
|
||||
property color m3surfaceVariant: "#46464f"
|
||||
property color m3tertiary: "#f1b3e5"
|
||||
property color m3tertiaryContainer: "#b77ead"
|
||||
property color m3tertiaryFixed: "#ffd7f4"
|
||||
property color m3tertiaryFixedDim: "#f1b3e5"
|
||||
property color m3tertiary_paletteKeyColor: "#9b6592"
|
||||
}
|
||||
component M3Palette: QtObject {
|
||||
property color m3background: "#191114"
|
||||
property color m3error: "#ffb4ab"
|
||||
@@ -279,8 +275,11 @@ Singleton {
|
||||
readonly property color m3tertiary_paletteKeyColor: root.layer(root.palette.m3tertiary_paletteKeyColor)
|
||||
}
|
||||
component Transparency: QtObject {
|
||||
readonly property real base: Appearance.transparency.base - (root.light ? 0.1 : 0)
|
||||
readonly property real base: Math.max(0, Math.min(1, Appearance.transparency.base - (root.light ? 0.1 : 0)))
|
||||
readonly property bool enabled: Appearance.transparency.enabled
|
||||
readonly property real layers: Appearance.transparency.layers
|
||||
|
||||
onBaseChanged: debounceTimer.restart()
|
||||
onEnabledChanged: debounceTimer.restart()
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -6,6 +6,7 @@ JsonObject {
|
||||
}
|
||||
property Color color: Color {
|
||||
}
|
||||
property string dateFormat: "ddd d MMM - hh:mm:ss"
|
||||
property bool desktopIcons: false
|
||||
property Idle idle: Idle {
|
||||
}
|
||||
@@ -19,13 +20,17 @@ JsonObject {
|
||||
property list<string> terminal: ["kitty"]
|
||||
}
|
||||
component Color: JsonObject {
|
||||
property int hyprsunsetTemp: 5000
|
||||
property string mode: "dark"
|
||||
property bool neovimColors: false
|
||||
property bool scheduleDark: false
|
||||
property int scheduleDarkEnd: 0
|
||||
property int scheduleDarkStart: 0
|
||||
property bool scheduleHyprsunset: false
|
||||
property int scheduleHyprsunsetEnd: 0
|
||||
property int scheduleHyprsunsetStart: 0
|
||||
property bool schemeGeneration: true
|
||||
property bool smart: false
|
||||
property bool wallust: false
|
||||
}
|
||||
component Idle: JsonObject {
|
||||
property list<var> timeouts: [
|
||||
|
||||
@@ -91,6 +91,7 @@ JsonObject {
|
||||
property string specialPrefix: "@"
|
||||
property UseFuzzy useFuzzy: UseFuzzy {
|
||||
}
|
||||
property bool uwsm: true
|
||||
|
||||
component Sizes: JsonObject {
|
||||
property int itemHeight: 50
|
||||
|
||||
@@ -5,6 +5,7 @@ JsonObject {
|
||||
property bool enableFprint: true
|
||||
property int maxFprintTries: 3
|
||||
property bool recolorLogo: false
|
||||
property bool showNotifContent: false
|
||||
property Sizes sizes: Sizes {
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import Quickshell.Io
|
||||
|
||||
JsonObject {
|
||||
property real corner_radius: 12.0
|
||||
property bool drop_shadow: true
|
||||
property bool enable_pp: true
|
||||
property string mode: "manual"
|
||||
property bool rounded_corners: false
|
||||
property real shadow_blur_radius: 22.0
|
||||
property list<int> shadow_color: [0, 0, 0, 160]
|
||||
property real shadow_offset_x: 5.0
|
||||
property real shadow_offset_y: 5.0
|
||||
}
|
||||
@@ -14,6 +14,7 @@ JsonObject {
|
||||
"to": "YT Music"
|
||||
}
|
||||
]
|
||||
property bool updates: true
|
||||
property bool useFahrenheit: false
|
||||
property bool useTwelveHourClock: Qt.locale().timeFormat(Locale.ShortFormat).toLowerCase().includes("a")
|
||||
property int visualizerBars: 30
|
||||
|
||||
@@ -113,11 +113,12 @@ Singleton {
|
||||
id: storage
|
||||
|
||||
path: `${Paths.state}/notifs.json`
|
||||
printErrors: false
|
||||
|
||||
onLoadFailed: err => {
|
||||
if (err === FileViewError.FileNotFound) {
|
||||
root.loaded = true;
|
||||
setText("[]");
|
||||
Qt.callLater(() => setText("[]"));
|
||||
}
|
||||
}
|
||||
onLoaded: {
|
||||
|
||||
@@ -48,7 +48,7 @@ Shape {
|
||||
|
||||
Modules.Background {
|
||||
invertBottomRounding: wrapper.x <= 0
|
||||
rounding: root.panels.popouts.currentName.startsWith("updates") ? Appearance.rounding.normal : Appearance.rounding.smallest
|
||||
rounding: root.panels.popouts.currentName.startsWith("updates") || root.panels.popouts.currentName.startsWith("audio") ? Appearance.rounding.normal : Appearance.rounding.smallest
|
||||
startX: wrapper.x - rounding
|
||||
startY: wrapper.y
|
||||
wrapper: root.panels.popouts
|
||||
|
||||
+23
-174
@@ -3,184 +3,33 @@ import QtQuick
|
||||
Canvas {
|
||||
id: root
|
||||
|
||||
property rect dirtyRect: Qt.rect(0, 0, 0, 0)
|
||||
property bool frameQueued: false
|
||||
property bool fullRepaintPending: true
|
||||
property point lastPoint: Qt.point(0, 0)
|
||||
property real minPointDistance: 2.0
|
||||
property color penColor: "white"
|
||||
property real penWidth: 4
|
||||
property var pendingSegments: []
|
||||
property bool strokeActive: false
|
||||
property var strokes: []
|
||||
property var points: []
|
||||
|
||||
function appendPoint(x, y) {
|
||||
if (!strokeActive || strokes.length === 0)
|
||||
function clear(): void {
|
||||
var ctx = getContext('2d');
|
||||
root.points = [];
|
||||
ctx.reset();
|
||||
root.requestPaint();
|
||||
}
|
||||
|
||||
renderStrategy: Canvas.Cooperative
|
||||
|
||||
onPaint: {
|
||||
if (points.length < 2)
|
||||
return;
|
||||
const dx = x - lastPoint.x;
|
||||
const dy = y - lastPoint.y;
|
||||
|
||||
if ((dx * dx + dy * dy) < (minPointDistance * minPointDistance))
|
||||
return;
|
||||
const x1 = lastPoint.x;
|
||||
const y1 = lastPoint.y;
|
||||
const x2 = x;
|
||||
const y2 = y;
|
||||
|
||||
strokes[strokes.length - 1].push(Qt.point(x2, y2));
|
||||
|
||||
pendingSegments.push({
|
||||
dot: false,
|
||||
x1: x1,
|
||||
y1: y1,
|
||||
x2: x2,
|
||||
y2: y2
|
||||
});
|
||||
|
||||
lastPoint = Qt.point(x2, y2);
|
||||
queueDirty(segmentDirtyRect(x1, y1, x2, y2));
|
||||
}
|
||||
|
||||
function beginStroke(x, y) {
|
||||
const p = Qt.point(x, y);
|
||||
strokes.push([p]);
|
||||
lastPoint = p;
|
||||
strokeActive = true;
|
||||
|
||||
pendingSegments.push({
|
||||
dot: true,
|
||||
x: x,
|
||||
y: y
|
||||
});
|
||||
|
||||
queueDirty(pointDirtyRect(x, y));
|
||||
}
|
||||
|
||||
function clear() {
|
||||
strokes = [];
|
||||
pendingSegments = [];
|
||||
dirtyRect = Qt.rect(0, 0, 0, 0);
|
||||
fullRepaintPending = true;
|
||||
markDirty(Qt.rect(0, 0, width, height));
|
||||
}
|
||||
|
||||
function drawDot(ctx, x, y) {
|
||||
ctx.beginPath();
|
||||
ctx.arc(x, y, penWidth / 2, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
function drawSegment(ctx, x1, y1, x2, y2) {
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x1, y1);
|
||||
ctx.lineTo(x2, y2);
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
function endStroke() {
|
||||
strokeActive = false;
|
||||
}
|
||||
|
||||
function pointDirtyRect(x, y) {
|
||||
const pad = penWidth + 2;
|
||||
return Qt.rect(x - pad, y - pad, pad * 2, pad * 2);
|
||||
}
|
||||
|
||||
function queueDirty(r) {
|
||||
dirtyRect = unionRects(dirtyRect, r);
|
||||
|
||||
if (frameQueued)
|
||||
return;
|
||||
frameQueued = true;
|
||||
|
||||
requestAnimationFrame(function () {
|
||||
frameQueued = false;
|
||||
|
||||
if (dirtyRect.width > 0 && dirtyRect.height > 0) {
|
||||
markDirty(dirtyRect);
|
||||
dirtyRect = Qt.rect(0, 0, 0, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function replayAll(ctx) {
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
|
||||
for (const stroke of strokes) {
|
||||
if (!stroke || stroke.length === 0)
|
||||
continue;
|
||||
if (stroke.length === 1) {
|
||||
const p = stroke[0];
|
||||
drawDot(ctx, p.x, p.y);
|
||||
continue;
|
||||
}
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(stroke[0].x, stroke[0].y);
|
||||
for (let i = 1; i < stroke.length; ++i)
|
||||
ctx.lineTo(stroke[i].x, stroke[i].y);
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
function requestFullRepaint() {
|
||||
fullRepaintPending = true;
|
||||
markDirty(Qt.rect(0, 0, width, height));
|
||||
}
|
||||
|
||||
function segmentDirtyRect(x1, y1, x2, y2) {
|
||||
const pad = penWidth + 2;
|
||||
const left = Math.min(x1, x2) - pad;
|
||||
const top = Math.min(y1, y2) - pad;
|
||||
const right = Math.max(x1, x2) + pad;
|
||||
const bottom = Math.max(y1, y2) + pad;
|
||||
return Qt.rect(left, top, right - left, bottom - top);
|
||||
}
|
||||
|
||||
function unionRects(a, b) {
|
||||
if (a.width <= 0 || a.height <= 0)
|
||||
return b;
|
||||
if (b.width <= 0 || b.height <= 0)
|
||||
return a;
|
||||
|
||||
const left = Math.min(a.x, b.x);
|
||||
const top = Math.min(a.y, b.y);
|
||||
const right = Math.max(a.x + a.width, b.x + b.width);
|
||||
const bottom = Math.max(a.y + a.height, b.y + b.height);
|
||||
|
||||
return Qt.rect(left, top, right - left, bottom - top);
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
contextType: "2d"
|
||||
renderStrategy: Canvas.Threaded
|
||||
renderTarget: Canvas.Image
|
||||
|
||||
onHeightChanged: requestFullRepaint()
|
||||
onPaint: region => {
|
||||
const ctx = getContext("2d");
|
||||
|
||||
var ctx = root.getContext('2d');
|
||||
ctx.save();
|
||||
ctx.lineWidth = root.penWidth;
|
||||
ctx.strokeStyle = root.penColor;
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
ctx.lineWidth = penWidth;
|
||||
ctx.strokeStyle = penColor;
|
||||
ctx.fillStyle = penColor;
|
||||
|
||||
if (fullRepaintPending) {
|
||||
fullRepaintPending = false;
|
||||
replayAll(ctx);
|
||||
pendingSegments = [];
|
||||
return;
|
||||
}
|
||||
|
||||
for (const seg of pendingSegments) {
|
||||
if (seg.dot)
|
||||
drawDot(ctx, seg.x, seg.y);
|
||||
else
|
||||
drawSegment(ctx, seg.x1, seg.y1, seg.x2, seg.y2);
|
||||
}
|
||||
|
||||
pendingSegments = [];
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(points[0].x, points[0].y);
|
||||
for (var i = 1; i < points.length; i++)
|
||||
ctx.lineTo(points[i].x, points[i].y);
|
||||
ctx.stroke();
|
||||
points = points.slice(points.length - 2);
|
||||
ctx.restore();
|
||||
}
|
||||
onWidthChanged: requestFullRepaint()
|
||||
}
|
||||
|
||||
@@ -30,8 +30,10 @@ CustomMouseArea {
|
||||
const x = event.x;
|
||||
const y = event.y;
|
||||
|
||||
if (event.buttons & Qt.LeftButton)
|
||||
root.drawing.appendPoint(x, y);
|
||||
if (root.visibilities.isDrawing && (event.buttons & Qt.LeftButton)) {
|
||||
root.drawing.points.push(Qt.point(x, y));
|
||||
root.drawing.requestPaint();
|
||||
}
|
||||
|
||||
if (root.inLeftPanel(root.popout, x, y)) {
|
||||
root.z = -2;
|
||||
@@ -44,7 +46,8 @@ CustomMouseArea {
|
||||
|
||||
if (root.visibilities.isDrawing && (event.buttons & Qt.LeftButton)) {
|
||||
root.panels.drawing.expanded = false;
|
||||
root.drawing.beginStroke(x, y);
|
||||
root.drawing.points.push(Qt.point(x, y));
|
||||
root.drawing.requestPaint();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -52,7 +55,6 @@ CustomMouseArea {
|
||||
root.drawing.clear();
|
||||
}
|
||||
onReleased: {
|
||||
if (root.visibilities.isDrawing)
|
||||
root.drawing.endStroke();
|
||||
root.drawing.points = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,22 +12,37 @@ Scope {
|
||||
required property ShellScreen screen
|
||||
|
||||
ExclusionZone {
|
||||
id: top
|
||||
|
||||
anchors.top: true
|
||||
exclusiveZone: root.bar.exclusiveZone
|
||||
}
|
||||
|
||||
ExclusionZone {
|
||||
id: left
|
||||
|
||||
anchors.left: true
|
||||
}
|
||||
|
||||
ExclusionZone {
|
||||
id: right
|
||||
|
||||
anchors.right: true
|
||||
}
|
||||
|
||||
ExclusionZone {
|
||||
id: bottom
|
||||
|
||||
anchors.bottom: true
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 5000
|
||||
running: true
|
||||
|
||||
onTriggered: console.log("top height:", top.exclusiveZone, "left width:", left.exclusiveZone, "right width:", right.exclusiveZone, "bottom height:", bottom.exclusiveZone)
|
||||
}
|
||||
|
||||
component ExclusionZone: CustomWindow {
|
||||
exclusiveZone: Config.barConfig.border
|
||||
implicitHeight: 1
|
||||
|
||||
@@ -52,8 +52,9 @@ CustomMouseArea {
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
cursorShape: (pressed && dragStart.y < bar.implicitHeight) ? Qt.ClosedHandCursor : undefined
|
||||
hoverEnabled: true
|
||||
propagateComposedEvents: true
|
||||
propagateComposedEvents: false
|
||||
|
||||
onContainsMouseChanged: {
|
||||
if (!containsMouse) {
|
||||
@@ -71,24 +72,32 @@ CustomMouseArea {
|
||||
}
|
||||
}
|
||||
onPositionChanged: event => {
|
||||
if (popouts.isDetached)
|
||||
return;
|
||||
|
||||
const x = event.x;
|
||||
const y = event.y;
|
||||
const dragX = x - dragStart.x;
|
||||
const dragY = y - dragStart.y;
|
||||
|
||||
if (root.visibilities.isDrawing && !root.inLeftPanel(root.panels.drawing, x, y)) {
|
||||
root.input.z = 2;
|
||||
// root.input.z = 2;
|
||||
root.panels.drawing.expanded = false;
|
||||
}
|
||||
|
||||
if (!visibilities.bar && Config.barConfig.autoHide && y < bar.implicitHeight)
|
||||
bar.isHovered = true;
|
||||
|
||||
if (pressed && dragStart.y < bar.implicitHeight) {
|
||||
if (dragY > 20)
|
||||
visibilities.settings = true;
|
||||
else if (dragY < -20)
|
||||
visibilities.settings = false;
|
||||
}
|
||||
|
||||
if (Config.dock.hoverToReveal && pressed && dragStart.y > root.screen.height - root.bar.implicitHeight)
|
||||
if (dragY < -10)
|
||||
visibilities.dock = true;
|
||||
|
||||
if (panels.sidebar.width === 0) {
|
||||
const showOsd = inRightPanel(panels.osd, x, y);
|
||||
const showOsd = inRightPanel(panels.osdWrapper, x, y);
|
||||
|
||||
if (showOsd) {
|
||||
osdShortcutActive = false;
|
||||
@@ -96,7 +105,7 @@ CustomMouseArea {
|
||||
}
|
||||
} else {
|
||||
const outOfSidebar = x < width - panels.sidebar.width;
|
||||
const showOsd = outOfSidebar && inRightPanel(panels.osd, x, y);
|
||||
const showOsd = outOfSidebar && inRightPanel(panels.osdWrapper, x, y);
|
||||
|
||||
if (!osdShortcutActive) {
|
||||
visibilities.osd = showOsd;
|
||||
@@ -107,13 +116,14 @@ CustomMouseArea {
|
||||
}
|
||||
}
|
||||
|
||||
if (!visibilities.dock && !visibilities.launcher && inBottomPanel(panels.dock, x, y))
|
||||
if (Config.dock.enable && !Config.dock.hoverToReveal && !visibilities.dock && !visibilities.launcher && inBottomPanel(panels.dock, x, y))
|
||||
visibilities.dock = true;
|
||||
|
||||
if (y < root.bar.implicitHeight) {
|
||||
root.bar.checkPopout(x);
|
||||
}
|
||||
}
|
||||
onPressed: event => dragStart = Qt.point(event.x, event.y)
|
||||
|
||||
Connections {
|
||||
function onDashboardChanged() {
|
||||
@@ -168,7 +178,7 @@ CustomMouseArea {
|
||||
}
|
||||
|
||||
function onResourcesChanged() {
|
||||
if (root.visibilities.resources && root.popouts.currentName.startsWith("audio")) {
|
||||
if (root.visibilities.resources && (root.popouts.currentName.startsWith("audio") || root.popouts.currentName.startsWith("updates"))) {
|
||||
root.popouts.hasCurrent = false;
|
||||
}
|
||||
|
||||
@@ -180,6 +190,7 @@ CustomMouseArea {
|
||||
if (root.visibilities.settings) {
|
||||
root.visibilities.resources = false;
|
||||
root.visibilities.dashboard = false;
|
||||
root.visibilities.sidebar = false;
|
||||
root.panels.popouts.hasCurrent = false;
|
||||
root.visibilities.launcher = false;
|
||||
}
|
||||
@@ -188,6 +199,7 @@ CustomMouseArea {
|
||||
function onSidebarChanged() {
|
||||
if (root.visibilities.sidebar) {
|
||||
root.visibilities.dashboard = false;
|
||||
root.visibilities.settings = false;
|
||||
root.popouts.hasCurrent = false;
|
||||
}
|
||||
}
|
||||
|
||||
+154
-28
@@ -13,6 +13,7 @@ import qs.Modules.Resources as Resources
|
||||
import qs.Modules.Settings as Settings
|
||||
import qs.Modules.Drawing as Drawing
|
||||
import qs.Modules.Dock as Dock
|
||||
import qs.Modules.SysTray.Popouts as SysPopouts
|
||||
import qs.Config
|
||||
|
||||
Item {
|
||||
@@ -20,18 +21,24 @@ Item {
|
||||
|
||||
required property Item bar
|
||||
readonly property alias dashboard: dashboard
|
||||
readonly property alias dashboardWrapper: dashboardWrapper
|
||||
readonly property alias dock: dock
|
||||
readonly property alias drawing: drawing
|
||||
required property Canvas drawingItem
|
||||
readonly property alias launcher: launcher
|
||||
readonly property alias notifications: notifications
|
||||
readonly property alias osd: osd
|
||||
readonly property alias popouts: popouts
|
||||
readonly property alias osdWrapper: osdWrapper
|
||||
readonly property alias popouts: popouts.content
|
||||
readonly property alias popoutsWrapper: popouts
|
||||
readonly property alias resources: resources
|
||||
readonly property alias resourcesWrapper: resourcesWrapper
|
||||
required property ShellScreen screen
|
||||
readonly property alias settings: settings
|
||||
readonly property alias settingsWrapper: settingsWrapper
|
||||
readonly property alias sidebar: sidebar
|
||||
readonly property alias toasts: toasts
|
||||
readonly property alias traySubmenus: traySubmenus
|
||||
readonly property alias utilities: utilities
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
@@ -39,12 +46,43 @@ Item {
|
||||
anchors.margins: Config.barConfig.border
|
||||
anchors.topMargin: bar.implicitHeight
|
||||
|
||||
Resources.Wrapper {
|
||||
id: resources
|
||||
Item {
|
||||
id: resourcesWrapper
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
visibilities: root.visibilities
|
||||
clip: true
|
||||
implicitHeight: resources.implicitHeight * (1 - resources.offsetScale)
|
||||
implicitWidth: resources.implicitWidth
|
||||
|
||||
Resources.Wrapper {
|
||||
id: resources
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: osdWrapper
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: sidebar.width * (1 - sidebar.offsetScale)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
clip: sidebar.visible
|
||||
implicitHeight: osd.implicitHeight
|
||||
implicitWidth: osd.implicitWidth * (1 - osd.offsetScale)
|
||||
|
||||
Osd.Wrapper {
|
||||
id: osd
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
screen: root.screen
|
||||
sidebarOrSessionVisible: sidebar.visible
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
||||
|
||||
Drawing.Wrapper {
|
||||
@@ -57,29 +95,84 @@ Item {
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
|
||||
Osd.Wrapper {
|
||||
id: osd
|
||||
Item {
|
||||
id: traySubmenus
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: sidebar.width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
clip: sidebar.width > 0
|
||||
screen: root.screen
|
||||
visibilities: root.visibilities
|
||||
Repeater {
|
||||
model: popouts.content.state.submenus
|
||||
|
||||
CustomClippingRect {
|
||||
id: subMenuWrapper
|
||||
|
||||
required property int index
|
||||
required property var modelData
|
||||
property real targetX: 0
|
||||
property real targetY: 0
|
||||
|
||||
function updatePosition() {
|
||||
let sourceItem = modelData.sourceItem;
|
||||
if (!sourceItem || !sourceItem.parent)
|
||||
return;
|
||||
|
||||
let mapped = sourceItem.mapToItem(root, 0, -Appearance.padding.small);
|
||||
|
||||
let rightX = mapped.x + modelData.sourceWidth + Config.barConfig.border;
|
||||
let leftX = mapped.x - implicitWidth - Config.barConfig.border;
|
||||
|
||||
if (rightX + implicitWidth > root.width) {
|
||||
targetX = leftX;
|
||||
} else {
|
||||
targetX = rightX;
|
||||
}
|
||||
|
||||
targetY = mapped.y;
|
||||
|
||||
if (targetY + implicitHeight > root.height) {
|
||||
targetY = root.height - implicitHeight;
|
||||
}
|
||||
if (targetY < 0)
|
||||
targetY = 0;
|
||||
}
|
||||
|
||||
implicitHeight: subMenuContent.implicitHeight + Appearance.padding.small * 2
|
||||
implicitWidth: subMenuContent.implicitWidth + Appearance.padding.small * 2
|
||||
radius: Appearance.rounding.normal
|
||||
x: targetX
|
||||
y: targetY
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on implicitWidth {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
updatePosition();
|
||||
}
|
||||
onImplicitHeightChanged: updatePosition()
|
||||
onImplicitWidthChanged: updatePosition()
|
||||
|
||||
SysPopouts.SubMenu {
|
||||
id: subMenuContent
|
||||
|
||||
anchors.centerIn: parent
|
||||
handle: subMenuWrapper.modelData.handle
|
||||
level: subMenuWrapper.index + 1
|
||||
popouts: root.popouts.state
|
||||
screen: root.screen
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Modules.Wrapper {
|
||||
Modules.ClipWrapper {
|
||||
id: popouts
|
||||
|
||||
anchors.top: parent.top
|
||||
screen: root.screen
|
||||
x: {
|
||||
const off = currentCenter - nonAnimWidth / 2;
|
||||
const diff = root.width - Math.floor(off + nonAnimWidth);
|
||||
if (diff < 0)
|
||||
return off + diff;
|
||||
return Math.floor(Math.max(off, 0));
|
||||
}
|
||||
}
|
||||
|
||||
Toasts.Toasts {
|
||||
@@ -96,6 +189,7 @@ Item {
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
panels: root
|
||||
sidebarPanel: sidebar
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
|
||||
@@ -119,12 +213,33 @@ Item {
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
|
||||
Dashboard.Wrapper {
|
||||
id: dashboard
|
||||
Item {
|
||||
id: dashboardWrapper
|
||||
|
||||
property real offsetScale: dashboard.shouldBeActive ? 0 : 1
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
visibilities: root.visibilities
|
||||
clip: true
|
||||
implicitHeight: dashboard.implicitHeight * (1 - offsetScale)
|
||||
implicitWidth: dashboard.implicitWidth
|
||||
|
||||
Behavior on offsetScale {
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||
}
|
||||
}
|
||||
|
||||
Dashboard.Wrapper {
|
||||
id: dashboard
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: (-implicitHeight - 5) * offsetScale
|
||||
offsetScale: dashboardWrapper.offsetScale
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
||||
|
||||
Sidebar.Wrapper {
|
||||
@@ -137,14 +252,25 @@ Item {
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
|
||||
Settings.Wrapper {
|
||||
id: settings
|
||||
Item {
|
||||
id: settingsWrapper
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
panels: root
|
||||
screen: root.screen
|
||||
visibilities: root.visibilities
|
||||
clip: true
|
||||
implicitHeight: settings.implicitHeight * (1 - settings.offsetScale)
|
||||
implicitWidth: settings.implicitWidth
|
||||
|
||||
Settings.Wrapper {
|
||||
id: settings
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
// anchors.centerIn: parent
|
||||
panels: root
|
||||
screen: root.screen
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
||||
|
||||
Dock.Wrapper {
|
||||
|
||||
+230
-10
@@ -3,8 +3,10 @@ pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Hyprland
|
||||
import ZShell.Blobs
|
||||
import qs.Daemons
|
||||
import qs.Components
|
||||
import qs.Modules
|
||||
@@ -62,7 +64,7 @@ Variants {
|
||||
|
||||
height: win.height - bar.implicitHeight - Config.barConfig.border
|
||||
intersection: Intersection.Xor
|
||||
regions: popoutRegions.instances
|
||||
regions: [...popoutRegions.instances, ...subMenuRegions.instances]
|
||||
width: win.width - Config.barConfig.border * 2
|
||||
x: Config.barConfig.border
|
||||
y: bar.implicitHeight
|
||||
@@ -91,6 +93,22 @@ Variants {
|
||||
}
|
||||
}
|
||||
|
||||
Variants {
|
||||
id: subMenuRegions
|
||||
|
||||
model: panels.traySubmenus.children
|
||||
|
||||
Region {
|
||||
required property Item modelData
|
||||
|
||||
height: modelData.height
|
||||
intersection: Intersection.Subtract
|
||||
width: modelData.width
|
||||
x: modelData.x + panels.traySubmenus.x + Config.barConfig.border
|
||||
y: modelData.y + panels.traySubmenus.y + bar.implicitHeight
|
||||
}
|
||||
}
|
||||
|
||||
HyprlandFocusGrab {
|
||||
id: focusGrab
|
||||
|
||||
@@ -126,10 +144,18 @@ Variants {
|
||||
Component.onCompleted: Visibilities.load(scope.modelData, this)
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function toggleLauncher(fix: string): void {
|
||||
visibilities.launcher = !visibilities.launcher;
|
||||
}
|
||||
|
||||
target: "visibilities"
|
||||
}
|
||||
|
||||
Binding {
|
||||
property: "bar"
|
||||
target: visibilities
|
||||
value: visibilities.sidebar || visibilities.dashboard || visibilities.osd || visibilities.notif || visibilities.resources || visibilities.settings || bar.isHovered
|
||||
value: visibilities.sidebar || visibilities.dashboard || visibilities.osd || (!Config.barConfig.hideWhenNotif && visibilities.notif) || visibilities.resources || visibilities.settings || bar.isHovered
|
||||
when: Config.barConfig.autoHide
|
||||
}
|
||||
|
||||
@@ -144,16 +170,165 @@ Variants {
|
||||
shadowEnabled: true
|
||||
}
|
||||
|
||||
Border {
|
||||
bar: bar
|
||||
visibilities: visibilities
|
||||
BlobGroup {
|
||||
id: blobGroup
|
||||
|
||||
color: DynamicColors.palette.m3surface
|
||||
smoothing: Config.barConfig.smoothing
|
||||
|
||||
Behavior on color {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Backgrounds {
|
||||
bar: bar
|
||||
panels: panels
|
||||
visibilities: visibilities
|
||||
z: 1
|
||||
BlobInvertedRect {
|
||||
anchors.fill: parent
|
||||
anchors.margins: -50
|
||||
borderBottom: Config.barConfig.border - anchors.margins
|
||||
borderLeft: Config.barConfig.border - anchors.margins
|
||||
borderRight: Config.barConfig.border - anchors.margins
|
||||
borderTop: bar.implicitHeight - anchors.margins
|
||||
group: blobGroup
|
||||
radius: Config.barConfig.rounding
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: dashBg
|
||||
|
||||
property real extraHeight: 0.2
|
||||
|
||||
deformAmount: 0.06
|
||||
implicitHeight: panels.dashboard.height * (1 + extraHeight)
|
||||
implicitWidth: panels.dashboard.width
|
||||
panel: panels.dashboardWrapper
|
||||
radius: Appearance.rounding.normal
|
||||
x: panels.dashboardWrapper.x + panels.dashboard.x + Config.barConfig.border
|
||||
y: panels.dashboardWrapper.y + panels.dashboard.y + bar.implicitHeight - panels.dashboard.height * extraHeight
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: launcherBg
|
||||
|
||||
property real extraHeight: 0.2
|
||||
|
||||
deformAmount: 0.06
|
||||
implicitHeight: panels.launcher.height * (1 + extraHeight)
|
||||
panel: panels.launcher
|
||||
radius: Appearance.rounding.smallest + 5
|
||||
y: panels.launcher.y + bar.implicitHeight
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: sidebarBg
|
||||
|
||||
bottomLeftRadius: 0
|
||||
deformAmount: 0.04
|
||||
exclude: panels.sidebar.offsetScale > 0.08 ? [] : [utilsBg]
|
||||
implicitHeight: panel.height * (1 / rawDeformMatrix.m22) + 2
|
||||
panel: panels.sidebar
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: osdBg
|
||||
|
||||
deformAmount: 0.1
|
||||
implicitHeight: panels.osd.height
|
||||
implicitWidth: panels.osd.width
|
||||
panel: panels.osdWrapper
|
||||
radius: 20
|
||||
x: panels.osdWrapper.x + panels.osd.x + Config.barConfig.border
|
||||
y: panels.osdWrapper.y + panels.osd.y + bar.implicitHeight
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: notifsBg
|
||||
|
||||
panel: panels.notifications
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: utilsBg
|
||||
|
||||
deformAmount: panels.sidebar.visible ? (0.1) : (0.1)
|
||||
exclude: panels.sidebar.offsetScale > 0.08 ? [] : [sidebarBg]
|
||||
panel: panels.utilities
|
||||
topLeftRadius: 0
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: popoutBg
|
||||
|
||||
property real extraHeight: panels.popouts.isDetached ? 0 : 0.2
|
||||
|
||||
deformAmount: panels.popouts.isDetached ? 0.05 : panels.popouts.hasCurrent ? 0.15 : 0.1
|
||||
implicitHeight: panels.popouts.height * (1 + extraHeight)
|
||||
implicitWidth: panels.popouts.width
|
||||
panel: panels.popoutsWrapper
|
||||
radius: (panels.popouts.currentName.startsWith("audio") || panels.popouts.currentName.startsWith("updates")) ? Appearance.rounding.normal : 20 * Appearance.rounding.scale
|
||||
x: panels.popoutsWrapper.x + panels.popouts.x + Config.barConfig.border
|
||||
y: panels.popoutsWrapper.y + panels.popouts.y + bar.implicitHeight - panels.popouts.height * extraHeight
|
||||
|
||||
Behavior on extraHeight {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: resourcesBg
|
||||
|
||||
deformAmount: 0.05
|
||||
implicitHeight: panels.resources.height
|
||||
implicitWidth: panels.resources.width
|
||||
panel: panels.resourcesWrapper
|
||||
radius: Appearance.rounding.normal
|
||||
x: panels.resourcesWrapper.x + panels.resources.x + Config.barConfig.border
|
||||
y: panels.resourcesWrapper.y + panels.resources.y + bar.implicitHeight
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: settingsBg
|
||||
|
||||
property real extraHeight: 0.2
|
||||
|
||||
deformAmount: 0.03
|
||||
implicitHeight: panels.settings.height * (1 + extraHeight)
|
||||
implicitWidth: panels.settings.width
|
||||
panel: panels.settings
|
||||
radius: Appearance.rounding.large
|
||||
topLeftRadius: Appearance.rounding.large + Appearance.padding.smaller
|
||||
topRightRadius: Appearance.rounding.large + Appearance.padding.smaller
|
||||
x: panels.settingsWrapper.x + panels.settings.x + Config.barConfig.border
|
||||
y: panels.settingsWrapper.y + panels.settings.y + bar.implicitHeight - panels.settings.height * extraHeight
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: dockBg
|
||||
|
||||
deformAmount: 0.08
|
||||
panel: panels.dock
|
||||
radius: Appearance.rounding.normal
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: drawingBg
|
||||
|
||||
deformAmount: 0.08
|
||||
panel: panels.drawing
|
||||
radius: Appearance.rounding.normal
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: panels.traySubmenus.children
|
||||
|
||||
PanelBg {
|
||||
required property Item modelData
|
||||
|
||||
deformAmount: 0.1
|
||||
panel: modelData
|
||||
radius: 20 * Appearance.rounding.scale
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,6 +370,37 @@ Variants {
|
||||
drawingItem: drawing
|
||||
screen: scope.modelData
|
||||
visibilities: visibilities
|
||||
|
||||
dashboard.transform: Matrix4x4 {
|
||||
matrix: dashBg.deformMatrix
|
||||
}
|
||||
dock.transform: Matrix4x4 {
|
||||
matrix: dockBg.deformMatrix
|
||||
}
|
||||
launcher.transform: Matrix4x4 {
|
||||
matrix: launcherBg.deformMatrix
|
||||
}
|
||||
notifications.transform: Matrix4x4 {
|
||||
matrix: notifsBg.deformMatrix
|
||||
}
|
||||
osd.transform: Matrix4x4 {
|
||||
matrix: osdBg.deformMatrix
|
||||
}
|
||||
popouts.transform: Matrix4x4 {
|
||||
matrix: popoutBg.deformMatrix
|
||||
}
|
||||
resources.transform: Matrix4x4 {
|
||||
matrix: resourcesBg.deformMatrix
|
||||
}
|
||||
settings.transform: Matrix4x4 {
|
||||
matrix: settingsBg.deformMatrix
|
||||
}
|
||||
sidebar.transform: Matrix4x4 {
|
||||
matrix: sidebarBg.deformMatrix
|
||||
}
|
||||
utilities.transform: Matrix4x4 {
|
||||
matrix: utilsBg.deformMatrix
|
||||
}
|
||||
}
|
||||
|
||||
BarLoader {
|
||||
@@ -203,10 +409,24 @@ Variants {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
popouts: panels.popouts
|
||||
popoutsWrapper: panels.popoutsWrapper
|
||||
screen: scope.modelData
|
||||
visibilities: visibilities
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component PanelBg: BlobRect {
|
||||
property real deformAmount: 0.15
|
||||
required property Item panel
|
||||
|
||||
deformScale: (deformAmount * Config.appearance.deform.scale) / 10000
|
||||
group: blobGroup
|
||||
implicitHeight: panel.height
|
||||
implicitWidth: panel.width
|
||||
radius: Appearance.rounding.smallest
|
||||
x: panel.x + Config.barConfig.border
|
||||
y: panel.y + bar.implicitHeight
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,388 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Paths
|
||||
import qs.Components
|
||||
import qs.Helpers
|
||||
import qs.Config
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
|
||||
readonly property real centerScale: Math.min(1, screenHeight / 1440)
|
||||
readonly property int centerWidth: Config.lock.sizes.centerWidth * centerScale
|
||||
required property var greeter
|
||||
required property real screenHeight
|
||||
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: false
|
||||
Layout.preferredWidth: centerWidth
|
||||
spacing: Appearance.spacing.large * 2
|
||||
|
||||
RowLayout {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
spacing: Appearance.spacing.small
|
||||
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
color: DynamicColors.palette.m3secondary
|
||||
font.bold: true
|
||||
font.family: Appearance.font.family.clock
|
||||
font.pointSize: Math.floor(Appearance.font.size.extraLarge * 3 * root.centerScale)
|
||||
text: Time.hourStr
|
||||
}
|
||||
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
color: DynamicColors.palette.m3primary
|
||||
font.bold: true
|
||||
font.family: Appearance.font.family.clock
|
||||
font.pointSize: Math.floor(Appearance.font.size.extraLarge * 3 * root.centerScale)
|
||||
text: ":"
|
||||
}
|
||||
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
color: DynamicColors.palette.m3secondary
|
||||
font.bold: true
|
||||
font.family: Appearance.font.family.clock
|
||||
font.pointSize: Math.floor(Appearance.font.size.extraLarge * 3 * root.centerScale)
|
||||
text: Time.minuteStr
|
||||
}
|
||||
}
|
||||
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.topMargin: -Appearance.padding.large * 2
|
||||
color: DynamicColors.palette.m3tertiary
|
||||
font.bold: true
|
||||
font.family: Appearance.font.family.mono
|
||||
font.pointSize: Math.floor(Appearance.font.size.extraLarge * root.centerScale)
|
||||
text: Time.format("dddd, d MMMM yyyy")
|
||||
}
|
||||
|
||||
CustomClippingRect {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.topMargin: Appearance.spacing.large * 2
|
||||
color: DynamicColors.tPalette.m3surfaceContainer
|
||||
implicitHeight: root.centerWidth / 2
|
||||
implicitWidth: root.centerWidth / 2
|
||||
radius: Appearance.rounding.full
|
||||
|
||||
MaterialIcon {
|
||||
anchors.centerIn: parent
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
font.pointSize: Math.floor(root.centerWidth / 4)
|
||||
text: "person"
|
||||
}
|
||||
|
||||
CachingImage {
|
||||
id: pfp
|
||||
|
||||
anchors.fill: parent
|
||||
path: root.greeter.userFace
|
||||
}
|
||||
}
|
||||
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
font.family: Appearance.font.family.mono
|
||||
font.pointSize: Appearance.font.size.normal
|
||||
font.weight: 600
|
||||
text: root.greeter.username
|
||||
visible: text.length > 0
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: DynamicColors.tPalette.m3surfaceContainer
|
||||
focus: true
|
||||
implicitHeight: input.implicitHeight + Appearance.padding.small * 2
|
||||
implicitWidth: root.centerWidth * 0.8
|
||||
radius: Appearance.rounding.full
|
||||
|
||||
Keys.onPressed: event => {
|
||||
if (root.greeter.launching)
|
||||
return;
|
||||
|
||||
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return)
|
||||
inputField.placeholder.animate = false;
|
||||
|
||||
root.greeter.handleKey(event);
|
||||
}
|
||||
onActiveFocusChanged: {
|
||||
if (!activeFocus)
|
||||
forceActiveFocus();
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
function onClicked(): void {
|
||||
parent.forceActiveFocus();
|
||||
}
|
||||
|
||||
cursorShape: Qt.IBeamCursor
|
||||
hoverEnabled: false
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: input
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: Appearance.padding.small
|
||||
spacing: Appearance.spacing.normal
|
||||
|
||||
Item {
|
||||
implicitHeight: statusIcon.implicitHeight + Appearance.padding.small * 2
|
||||
implicitWidth: implicitHeight
|
||||
|
||||
MaterialIcon {
|
||||
id: statusIcon
|
||||
|
||||
anchors.centerIn: parent
|
||||
animate: true
|
||||
color: root.greeter.errorMessage ? DynamicColors.palette.m3error : DynamicColors.palette.m3onSurface
|
||||
opacity: root.greeter.launching ? 0 : 1
|
||||
text: {
|
||||
if (root.greeter.errorMessage)
|
||||
return "error";
|
||||
if (root.greeter.awaitingResponse)
|
||||
return root.greeter.echoResponse ? "person" : "lock";
|
||||
if (root.greeter.buffer.length > 0)
|
||||
return "password";
|
||||
return "login";
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CircularIndicator {
|
||||
anchors.fill: parent
|
||||
running: root.greeter.launching
|
||||
}
|
||||
}
|
||||
|
||||
InputField {
|
||||
id: inputField
|
||||
|
||||
greeter: root.greeter
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
color: root.greeter.buffer && !root.greeter.launching ? DynamicColors.palette.m3primary : DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHigh, 2)
|
||||
implicitHeight: enterIcon.implicitHeight + Appearance.padding.small * 2
|
||||
implicitWidth: implicitHeight
|
||||
radius: Appearance.rounding.full
|
||||
|
||||
StateLayer {
|
||||
function onClicked(): void {
|
||||
root.greeter.submit();
|
||||
}
|
||||
|
||||
color: root.greeter.buffer && !root.greeter.launching ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3onSurface
|
||||
}
|
||||
|
||||
MaterialIcon {
|
||||
id: enterIcon
|
||||
|
||||
anchors.centerIn: parent
|
||||
color: root.greeter.buffer && !root.greeter.launching ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3onSurface
|
||||
font.weight: 500
|
||||
text: root.greeter.launching ? "hourglass_top" : "arrow_forward"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -Appearance.spacing.large
|
||||
implicitHeight: Math.max(message.implicitHeight, stateMessage.implicitHeight)
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
CustomText {
|
||||
id: stateMessage
|
||||
|
||||
readonly property string msg: {
|
||||
if (Hypr.kbLayout !== Hypr.defaultKbLayout) {
|
||||
if (Hypr.capsLock && Hypr.numLock)
|
||||
return qsTr("Caps lock and Num lock are ON.\nKeyboard layout: %1").arg(Hypr.kbLayoutFull);
|
||||
if (Hypr.capsLock)
|
||||
return qsTr("Caps lock is ON. Kb layout: %1").arg(Hypr.kbLayoutFull);
|
||||
if (Hypr.numLock)
|
||||
return qsTr("Num lock is ON. Kb layout: %1").arg(Hypr.kbLayoutFull);
|
||||
return qsTr("Keyboard layout: %1").arg(Hypr.kbLayoutFull);
|
||||
}
|
||||
|
||||
if (Hypr.capsLock && Hypr.numLock)
|
||||
return qsTr("Caps lock and Num lock are ON.");
|
||||
if (Hypr.capsLock)
|
||||
return qsTr("Caps lock is ON.");
|
||||
if (Hypr.numLock)
|
||||
return qsTr("Num lock is ON.");
|
||||
|
||||
return "";
|
||||
}
|
||||
property bool shouldBeVisible
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
animateProp: "opacity"
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
font.family: Appearance.font.family.mono
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
lineHeight: 1.2
|
||||
opacity: shouldBeVisible && !message.msg ? 1 : 0
|
||||
scale: shouldBeVisible && !message.msg ? 1 : 0.7
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
onMsgChanged: {
|
||||
if (msg) {
|
||||
if (opacity > 0) {
|
||||
animate = true;
|
||||
text = msg;
|
||||
animate = false;
|
||||
} else {
|
||||
text = msg;
|
||||
}
|
||||
shouldBeVisible = true;
|
||||
} else {
|
||||
shouldBeVisible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CustomText {
|
||||
id: message
|
||||
|
||||
readonly property bool isError: !!root.greeter.errorMessage
|
||||
readonly property string msg: {
|
||||
if (root.greeter.errorMessage)
|
||||
return root.greeter.errorMessage;
|
||||
|
||||
if (root.greeter.launching) {
|
||||
if (root.greeter.selectedSession && root.greeter.selectedSession.name)
|
||||
return qsTr("Starting %1...").arg(root.greeter.selectedSession.name);
|
||||
return qsTr("Starting session...");
|
||||
}
|
||||
|
||||
if (root.greeter.awaitingResponse && root.greeter.promptMessage)
|
||||
return root.greeter.promptMessage;
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
color: isError ? DynamicColors.palette.m3error : DynamicColors.palette.m3primary
|
||||
font.family: Appearance.font.family.mono
|
||||
font.pointSize: Appearance.font.size.small
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
opacity: 0
|
||||
scale: 0.7
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
|
||||
onMsgChanged: {
|
||||
if (msg) {
|
||||
if (opacity > 0) {
|
||||
animate = true;
|
||||
text = msg;
|
||||
animate = false;
|
||||
|
||||
exitAnim.stop();
|
||||
if (scale < 1)
|
||||
appearAnim.restart();
|
||||
else
|
||||
flashAnim.restart();
|
||||
} else {
|
||||
text = msg;
|
||||
exitAnim.stop();
|
||||
appearAnim.restart();
|
||||
}
|
||||
} else {
|
||||
appearAnim.stop();
|
||||
flashAnim.stop();
|
||||
exitAnim.start();
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onFlashMsg(): void {
|
||||
exitAnim.stop();
|
||||
if (message.scale < 1)
|
||||
appearAnim.restart();
|
||||
else
|
||||
flashAnim.restart();
|
||||
}
|
||||
|
||||
target: root.greeter
|
||||
}
|
||||
|
||||
Anim {
|
||||
id: appearAnim
|
||||
|
||||
properties: "scale,opacity"
|
||||
target: message
|
||||
to: 1
|
||||
|
||||
onFinished: flashAnim.restart()
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
id: flashAnim
|
||||
|
||||
loops: 2
|
||||
|
||||
FlashAnim {
|
||||
to: 0.3
|
||||
}
|
||||
|
||||
FlashAnim {
|
||||
to: 1
|
||||
}
|
||||
}
|
||||
|
||||
ParallelAnimation {
|
||||
id: exitAnim
|
||||
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.large
|
||||
property: "scale"
|
||||
target: message
|
||||
to: 0.7
|
||||
}
|
||||
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.large
|
||||
property: "opacity"
|
||||
target: message
|
||||
to: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component FlashAnim: NumberAnimation {
|
||||
duration: Appearance.anim.durations.small
|
||||
easing.type: Easing.Linear
|
||||
property: "opacity"
|
||||
target: message
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import QtQuick
|
||||
import qs.Config
|
||||
|
||||
NumberAnimation {
|
||||
duration: MaterialEasing.standardTime
|
||||
easing.bezierCurve: MaterialEasing.standard
|
||||
easing.type: Easing.BezierSpline
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
property real idx1: index
|
||||
property int idx1Duration: 100
|
||||
property real idx2: index
|
||||
property int idx2Duration: 300
|
||||
required property int index
|
||||
|
||||
Behavior on idx1 {
|
||||
NumberAnimation {
|
||||
duration: root.idx1Duration
|
||||
easing.type: Easing.OutSine
|
||||
}
|
||||
}
|
||||
Behavior on idx2 {
|
||||
NumberAnimation {
|
||||
duration: root.idx2Duration
|
||||
easing.type: Easing.OutSine
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
import QtQuick
|
||||
import QtQuick.Templates
|
||||
import qs.Config
|
||||
|
||||
Slider {
|
||||
id: root
|
||||
|
||||
property color color: DynamicColors.palette.m3secondary
|
||||
required property string icon
|
||||
property bool initialized: false
|
||||
readonly property bool isHorizontal: orientation === Qt.Horizontal
|
||||
readonly property bool isVertical: orientation === Qt.Vertical
|
||||
property real multiplier: 100
|
||||
property real oldValue
|
||||
|
||||
// Wrapper components can inject their own track visuals here.
|
||||
property Component trackContent
|
||||
|
||||
// Keep current behavior for existing usages.
|
||||
orientation: Qt.Vertical
|
||||
|
||||
background: CustomRect {
|
||||
id: groove
|
||||
|
||||
color: DynamicColors.layer(DynamicColors.palette.m3surfaceContainer, 2)
|
||||
height: root.availableHeight
|
||||
radius: Appearance.rounding.full
|
||||
width: root.availableWidth
|
||||
x: root.leftPadding
|
||||
y: root.topPadding
|
||||
|
||||
Loader {
|
||||
id: trackLoader
|
||||
|
||||
anchors.fill: parent
|
||||
sourceComponent: root.trackContent
|
||||
|
||||
onLoaded: {
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
item.rootSlider = root;
|
||||
item.groove = groove;
|
||||
item.handleItem = handle;
|
||||
}
|
||||
}
|
||||
}
|
||||
handle: Item {
|
||||
id: handle
|
||||
|
||||
property alias moving: icon.moving
|
||||
|
||||
implicitHeight: Math.min(root.width, root.height)
|
||||
implicitWidth: Math.min(root.width, root.height)
|
||||
x: root.isHorizontal ? root.leftPadding + root.visualPosition * (root.availableWidth - width) : root.leftPadding + (root.availableWidth - width) / 2
|
||||
y: root.isVertical ? root.topPadding + root.visualPosition * (root.availableHeight - height) : root.topPadding + (root.availableHeight - height) / 2
|
||||
|
||||
Elevation {
|
||||
anchors.fill: parent
|
||||
level: handleInteraction.containsMouse ? 2 : 1
|
||||
radius: rect.radius
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
id: rect
|
||||
|
||||
anchors.fill: parent
|
||||
color: DynamicColors.palette.m3inverseSurface
|
||||
radius: Appearance.rounding.full
|
||||
|
||||
MouseArea {
|
||||
id: handleInteraction
|
||||
|
||||
acceptedButtons: Qt.NoButton
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
}
|
||||
|
||||
MaterialIcon {
|
||||
id: icon
|
||||
|
||||
property bool moving
|
||||
|
||||
function update(): void {
|
||||
animate = !moving;
|
||||
binding.when = moving;
|
||||
font.pointSize = moving ? Appearance.font.size.small : Appearance.font.size.larger;
|
||||
font.family = moving ? Appearance.font.family.sans : Appearance.font.family.material;
|
||||
}
|
||||
|
||||
anchors.centerIn: parent
|
||||
color: DynamicColors.palette.m3inverseOnSurface
|
||||
text: root.icon
|
||||
|
||||
onMovingChanged: anim.restart()
|
||||
|
||||
Binding {
|
||||
id: binding
|
||||
|
||||
property: "text"
|
||||
target: icon
|
||||
value: Math.round(root.value * root.multiplier)
|
||||
when: false
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
id: anim
|
||||
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.normal / 2
|
||||
easing.bezierCurve: Appearance.anim.curves.standardAccel
|
||||
property: "scale"
|
||||
target: icon
|
||||
to: 0
|
||||
}
|
||||
|
||||
ScriptAction {
|
||||
script: icon.update()
|
||||
}
|
||||
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.normal / 2
|
||||
easing.bezierCurve: Appearance.anim.curves.standardDecel
|
||||
property: "scale"
|
||||
target: icon
|
||||
to: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Behavior on value {
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.large
|
||||
}
|
||||
}
|
||||
|
||||
onPressedChanged: handle.moving = pressed
|
||||
onValueChanged: {
|
||||
if (!initialized) {
|
||||
initialized = true;
|
||||
oldValue = value;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Math.abs(value - oldValue) < 0.01)
|
||||
return;
|
||||
|
||||
oldValue = value;
|
||||
handle.moving = true;
|
||||
stateChangeDelay.restart();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: stateChangeDelay
|
||||
|
||||
interval: 500
|
||||
|
||||
onTriggered: {
|
||||
if (!root.pressed)
|
||||
handle.moving = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import QtQuick
|
||||
import qs.Config
|
||||
|
||||
ColorAnimation {
|
||||
duration: MaterialEasing.standardTime
|
||||
easing.bezierCurve: MaterialEasing.standard
|
||||
easing.type: Easing.BezierSpline
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
import qs.Config
|
||||
import ZShell.Internal
|
||||
import QtQuick
|
||||
import QtQuick.Templates
|
||||
|
||||
BusyIndicator {
|
||||
id: root
|
||||
|
||||
enum AnimState {
|
||||
Stopped,
|
||||
Running,
|
||||
Completing
|
||||
}
|
||||
enum AnimType {
|
||||
Advance = 0,
|
||||
Retreat
|
||||
}
|
||||
|
||||
property int animState
|
||||
property color bgColour: DynamicColors.palette.m3secondaryContainer
|
||||
property color fgColour: DynamicColors.palette.m3primary
|
||||
property real implicitSize: Appearance.font.size.normal * 3
|
||||
property real internalStrokeWidth: strokeWidth
|
||||
readonly property alias progress: manager.progress
|
||||
property real strokeWidth: Appearance.padding.small * 0.8
|
||||
property alias type: manager.indeterminateAnimationType
|
||||
|
||||
implicitHeight: implicitSize
|
||||
implicitWidth: implicitSize
|
||||
padding: 0
|
||||
|
||||
contentItem: CircularProgress {
|
||||
anchors.fill: parent
|
||||
bgColour: root.bgColour
|
||||
fgColour: root.fgColour
|
||||
padding: root.padding
|
||||
rotation: manager.rotation
|
||||
startAngle: manager.startFraction * 360
|
||||
strokeWidth: root.internalStrokeWidth
|
||||
value: manager.endFraction - manager.startFraction
|
||||
}
|
||||
states: State {
|
||||
name: "stopped"
|
||||
when: !root.running
|
||||
|
||||
PropertyChanges {
|
||||
root.internalStrokeWidth: root.strokeWidth / 3
|
||||
root.opacity: 0
|
||||
}
|
||||
}
|
||||
transitions: Transition {
|
||||
Anim {
|
||||
duration: manager.completeEndDuration * Appearance.anim.durations.scale
|
||||
properties: "opacity,internalStrokeWidth"
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (running) {
|
||||
running = false;
|
||||
running = true;
|
||||
}
|
||||
}
|
||||
onRunningChanged: {
|
||||
if (running) {
|
||||
manager.completeEndProgress = 0;
|
||||
animState = CircularIndicator.Running;
|
||||
} else {
|
||||
if (animState == CircularIndicator.Running)
|
||||
animState = CircularIndicator.Completing;
|
||||
}
|
||||
}
|
||||
|
||||
CircularIndicatorManager {
|
||||
id: manager
|
||||
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
duration: manager.duration * Appearance.anim.durations.scale
|
||||
from: 0
|
||||
loops: Animation.Infinite
|
||||
property: "progress"
|
||||
running: root.animState !== CircularIndicator.Stopped
|
||||
target: manager
|
||||
to: 1
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
duration: manager.completeEndDuration * Appearance.anim.durations.scale
|
||||
from: 0
|
||||
property: "completeEndProgress"
|
||||
running: root.animState === CircularIndicator.Completing
|
||||
target: manager
|
||||
to: 1
|
||||
|
||||
onFinished: {
|
||||
if (root.animState === CircularIndicator.Completing)
|
||||
root.animState = CircularIndicator.Stopped;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
import qs.Config
|
||||
|
||||
Shape {
|
||||
id: root
|
||||
|
||||
readonly property real arcRadius: (size - padding - strokeWidth) / 2
|
||||
property color bgColour: DynamicColors.palette.m3secondaryContainer
|
||||
property color fgColour: DynamicColors.palette.m3primary
|
||||
readonly property real gapAngle: ((spacing + strokeWidth) / (arcRadius || 1)) * (180 / Math.PI)
|
||||
property int padding: 0
|
||||
readonly property real size: Math.min(width, height)
|
||||
property int spacing: Appearance.spacing.small
|
||||
property int startAngle: -90
|
||||
property int strokeWidth: Appearance.padding.smaller
|
||||
readonly property real vValue: value || 1 / 360
|
||||
property real value
|
||||
|
||||
asynchronous: true
|
||||
preferredRendererType: Shape.CurveRenderer
|
||||
|
||||
ShapePath {
|
||||
capStyle: Appearance.rounding.scale === 0 ? ShapePath.SquareCap : ShapePath.RoundCap
|
||||
fillColor: "transparent"
|
||||
strokeColor: root.bgColour
|
||||
strokeWidth: root.strokeWidth
|
||||
|
||||
Behavior on strokeColor {
|
||||
CAnim {
|
||||
duration: Appearance.anim.durations.large
|
||||
}
|
||||
}
|
||||
|
||||
PathAngleArc {
|
||||
centerX: root.size / 2
|
||||
centerY: root.size / 2
|
||||
radiusX: root.arcRadius
|
||||
radiusY: root.arcRadius
|
||||
startAngle: root.startAngle + 360 * root.vValue + root.gapAngle
|
||||
sweepAngle: Math.max(-root.gapAngle, 360 * (1 - root.vValue) - root.gapAngle * 2)
|
||||
}
|
||||
}
|
||||
|
||||
ShapePath {
|
||||
capStyle: Appearance.rounding.scale === 0 ? ShapePath.SquareCap : ShapePath.RoundCap
|
||||
fillColor: "transparent"
|
||||
strokeColor: root.fgColour
|
||||
strokeWidth: root.strokeWidth
|
||||
|
||||
Behavior on strokeColor {
|
||||
CAnim {
|
||||
duration: Appearance.anim.durations.large
|
||||
}
|
||||
}
|
||||
|
||||
PathAngleArc {
|
||||
centerX: root.size / 2
|
||||
centerY: root.size / 2
|
||||
radiusX: root.arcRadius
|
||||
radiusY: root.arcRadius
|
||||
startAngle: root.startAngle
|
||||
sweepAngle: 360 * root.vValue
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Config
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
|
||||
default property alias content: contentColumn.data
|
||||
property string description: ""
|
||||
property bool expanded: false
|
||||
property bool nested: false
|
||||
property bool showBackground: false
|
||||
required property string title
|
||||
|
||||
signal toggleRequested
|
||||
|
||||
Layout.fillWidth: true
|
||||
spacing: Appearance.spacing.small
|
||||
|
||||
Item {
|
||||
id: sectionHeaderItem
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: Math.max(titleRow.implicitHeight + Appearance.padding.normal * 2, 48)
|
||||
|
||||
RowLayout {
|
||||
id: titleRow
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Appearance.padding.normal
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Appearance.padding.normal
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Appearance.spacing.normal
|
||||
|
||||
CustomText {
|
||||
font.pointSize: Appearance.font.size.larger
|
||||
font.weight: 500
|
||||
text: root.title
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
MaterialIcon {
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
font.pointSize: Appearance.font.size.normal
|
||||
rotation: root.expanded ? 180 : 0
|
||||
text: "expand_more"
|
||||
|
||||
Behavior on rotation {
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.small
|
||||
easing.bezierCurve: Appearance.anim.curves.standard
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
function onClicked(): void {
|
||||
root.toggleRequested();
|
||||
root.expanded = !root.expanded;
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
color: DynamicColors.palette.m3onSurface
|
||||
radius: Appearance.rounding.normal
|
||||
showHoverBackground: false
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: contentWrapper
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: root.expanded ? (contentColumn.implicitHeight + Appearance.spacing.small * 2) : 0
|
||||
clip: true
|
||||
|
||||
Behavior on Layout.preferredHeight {
|
||||
Anim {
|
||||
easing.bezierCurve: Appearance.anim.curves.standard
|
||||
}
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
id: backgroundRect
|
||||
|
||||
anchors.fill: parent
|
||||
color: DynamicColors.transparency.enabled ? DynamicColors.layer(DynamicColors.palette.m3surfaceContainer, root.nested ? 3 : 2) : (root.nested ? DynamicColors.palette.m3surfaceContainerHigh : DynamicColors.palette.m3surfaceContainer)
|
||||
opacity: root.showBackground && root.expanded ? 1.0 : 0.0
|
||||
radius: Appearance.rounding.normal
|
||||
visible: root.showBackground
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
easing.bezierCurve: Appearance.anim.curves.standard
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: contentColumn
|
||||
|
||||
anchors.bottomMargin: Appearance.spacing.small
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Appearance.padding.normal
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Appearance.padding.normal
|
||||
opacity: root.expanded ? 1.0 : 0.0
|
||||
spacing: Appearance.spacing.small
|
||||
y: Appearance.spacing.small
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
easing.bezierCurve: Appearance.anim.curves.standard
|
||||
}
|
||||
}
|
||||
|
||||
CustomText {
|
||||
id: descriptionText
|
||||
|
||||
Layout.bottomMargin: root.description !== "" ? Appearance.spacing.small : 0
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: root.description !== "" ? Appearance.spacing.smaller : 0
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
font.pointSize: Appearance.font.size.small
|
||||
text: root.description
|
||||
visible: root.description !== ""
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.Config
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
readonly property real arcStartAngle: 0.75 * Math.PI
|
||||
readonly property real arcSweep: 1.5 * Math.PI
|
||||
property real currentHue: 0
|
||||
property bool dragActive: false
|
||||
required property var drawing
|
||||
readonly property real handleAngle: hueToAngle(currentHue)
|
||||
readonly property real handleCenterX: width / 2 + radius * Math.cos(handleAngle)
|
||||
readonly property real handleCenterY: height / 2 + radius * Math.sin(handleAngle)
|
||||
property real handleSize: 32
|
||||
property real lastChromaticHue: 0
|
||||
readonly property real radius: (Math.min(width, height) - handleSize) / 2
|
||||
readonly property int segmentCount: 240
|
||||
readonly property color thumbColor: DynamicColors.palette.m3inverseSurface
|
||||
readonly property color thumbContentColor: DynamicColors.palette.m3inverseOnSurface
|
||||
readonly property color trackColor: DynamicColors.layer(DynamicColors.palette.m3surfaceContainer, 2)
|
||||
|
||||
function hueToAngle(hue) {
|
||||
return arcStartAngle + arcSweep * hue;
|
||||
}
|
||||
|
||||
function normalizeAngle(angle) {
|
||||
const tau = Math.PI * 2;
|
||||
let a = angle % tau;
|
||||
if (a < 0)
|
||||
a += tau;
|
||||
return a;
|
||||
}
|
||||
|
||||
function pointIsOnTrack(x, y) {
|
||||
const cx = width / 2;
|
||||
const cy = height / 2;
|
||||
const dx = x - cx;
|
||||
const dy = y - cy;
|
||||
const distance = Math.sqrt(dx * dx + dy * dy);
|
||||
|
||||
return distance >= radius - handleSize / 2 && distance <= radius + handleSize / 2;
|
||||
}
|
||||
|
||||
function syncFromPenColor() {
|
||||
if (!drawing)
|
||||
return;
|
||||
|
||||
const c = drawing.penColor;
|
||||
|
||||
if (c.hsvSaturation > 0) {
|
||||
currentHue = c.hsvHue;
|
||||
lastChromaticHue = c.hsvHue;
|
||||
} else {
|
||||
currentHue = lastChromaticHue;
|
||||
}
|
||||
|
||||
canvas.requestPaint();
|
||||
}
|
||||
|
||||
function updateHueFromPoint(x, y, force = false) {
|
||||
const cx = width / 2;
|
||||
const cy = height / 2;
|
||||
const dx = x - cx;
|
||||
const dy = y - cy;
|
||||
|
||||
const distance = Math.sqrt(dx * dx + dy * dy);
|
||||
|
||||
if (!force && (distance < radius - handleSize / 2 || distance > radius + handleSize / 2))
|
||||
return;
|
||||
|
||||
const angle = normalizeAngle(Math.atan2(dy, dx));
|
||||
const start = normalizeAngle(arcStartAngle);
|
||||
|
||||
let relative = angle - start;
|
||||
if (relative < 0)
|
||||
relative += Math.PI * 2;
|
||||
|
||||
if (relative > arcSweep) {
|
||||
const gap = Math.PI * 2 - arcSweep;
|
||||
relative = relative < arcSweep + gap / 2 ? arcSweep : 0;
|
||||
}
|
||||
|
||||
currentHue = relative / arcSweep;
|
||||
lastChromaticHue = currentHue;
|
||||
drawing.penColor = Qt.hsva(currentHue, drawing.penColor.hsvSaturation, drawing.penColor.hsvValue, drawing.penColor.a);
|
||||
}
|
||||
|
||||
implicitHeight: 180
|
||||
implicitWidth: 220
|
||||
|
||||
Component.onCompleted: syncFromPenColor()
|
||||
onCurrentHueChanged: canvas.requestPaint()
|
||||
onDrawingChanged: syncFromPenColor()
|
||||
onHandleSizeChanged: canvas.requestPaint()
|
||||
onHeightChanged: canvas.requestPaint()
|
||||
onWidthChanged: canvas.requestPaint()
|
||||
|
||||
Connections {
|
||||
function onPenColorChanged() {
|
||||
root.syncFromPenColor();
|
||||
}
|
||||
|
||||
target: root.drawing
|
||||
}
|
||||
|
||||
Canvas {
|
||||
id: canvas
|
||||
|
||||
anchors.fill: parent
|
||||
renderStrategy: Canvas.Threaded
|
||||
renderTarget: Canvas.Image
|
||||
|
||||
Component.onCompleted: requestPaint()
|
||||
onPaint: {
|
||||
const ctx = getContext("2d");
|
||||
ctx.reset();
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
|
||||
const cx = width / 2;
|
||||
const cy = height / 2;
|
||||
const radius = root.radius;
|
||||
const trackWidth = root.handleSize;
|
||||
|
||||
// Background track: always show the full hue spectrum
|
||||
for (let i = 0; i < root.segmentCount; ++i) {
|
||||
const t1 = i / root.segmentCount;
|
||||
const t2 = (i + 1) / root.segmentCount;
|
||||
const a1 = root.arcStartAngle + root.arcSweep * t1;
|
||||
const a2 = root.arcStartAngle + root.arcSweep * t2;
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.arc(cx, cy, radius, a1, a2);
|
||||
ctx.lineWidth = trackWidth;
|
||||
ctx.lineCap = "round";
|
||||
ctx.strokeStyle = Qt.hsla(t1, 1.0, 0.5, 1.0);
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: handle
|
||||
|
||||
height: root.handleSize
|
||||
width: root.handleSize
|
||||
x: root.handleCenterX - width / 2
|
||||
y: root.handleCenterY - height / 2
|
||||
z: 1
|
||||
|
||||
Elevation {
|
||||
anchors.fill: parent
|
||||
level: handleHover.containsMouse ? 2 : 1
|
||||
radius: rect.radius
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: rect
|
||||
|
||||
anchors.fill: parent
|
||||
color: root.thumbColor
|
||||
radius: width / 2
|
||||
|
||||
MouseArea {
|
||||
id: handleHover
|
||||
|
||||
acceptedButtons: Qt.NoButton
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
color: root.drawing ? root.drawing.penColor : Qt.hsla(root.currentHue, 1.0, 0.5, 1.0)
|
||||
height: width
|
||||
radius: width / 2
|
||||
width: parent.width - 12
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: dragArea
|
||||
|
||||
acceptedButtons: Qt.LeftButton
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
onCanceled: {
|
||||
root.dragActive = false;
|
||||
}
|
||||
onPositionChanged: mouse => {
|
||||
if ((mouse.buttons & Qt.LeftButton) && root.dragActive)
|
||||
root.updateHueFromPoint(mouse.x, mouse.y, true);
|
||||
}
|
||||
onPressed: mouse => {
|
||||
root.dragActive = root.pointIsOnTrack(mouse.x, mouse.y);
|
||||
if (root.dragActive)
|
||||
root.updateHueFromPoint(mouse.x, mouse.y);
|
||||
}
|
||||
onReleased: {
|
||||
root.dragActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import ZShell
|
||||
import Quickshell.Widgets
|
||||
import QtQuick
|
||||
|
||||
IconImage {
|
||||
id: root
|
||||
|
||||
required property color color
|
||||
|
||||
asynchronous: true
|
||||
layer.enabled: true
|
||||
|
||||
layer.effect: Coloriser {
|
||||
colorizationColor: root.color
|
||||
sourceColor: analyser.dominantColour
|
||||
}
|
||||
|
||||
layer.onEnabledChanged: {
|
||||
if (layer.enabled && status === Image.Ready)
|
||||
analyser.requestUpdate();
|
||||
}
|
||||
onStatusChanged: {
|
||||
if (layer.enabled && status === Image.Ready)
|
||||
analyser.requestUpdate();
|
||||
}
|
||||
|
||||
ImageAnalyser {
|
||||
id: analyser
|
||||
|
||||
sourceItem: root
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
|
||||
MultiEffect {
|
||||
property color sourceColor: "black"
|
||||
|
||||
brightness: 1 - sourceColor.hslLightness
|
||||
colorization: 1
|
||||
|
||||
Behavior on colorizationColor {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import QtQuick
|
||||
import QtQuick.Templates
|
||||
import qs.Config
|
||||
|
||||
Slider {
|
||||
id: root
|
||||
|
||||
property color nonPeakColor: DynamicColors.tPalette.m3primary
|
||||
required property real peak
|
||||
property color peakColor: DynamicColors.palette.m3primary
|
||||
|
||||
background: Item {
|
||||
CustomRect {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: root.implicitHeight / 3
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: root.implicitHeight / 3
|
||||
bottomRightRadius: root.implicitHeight / 15
|
||||
color: root.nonPeakColor
|
||||
implicitWidth: root.handle.x - root.implicitHeight
|
||||
radius: Appearance.rounding.full
|
||||
topRightRadius: root.implicitHeight / 15
|
||||
|
||||
CustomRect {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
bottomRightRadius: root.implicitHeight / 15
|
||||
color: root.peakColor
|
||||
implicitWidth: parent.width * root.peak
|
||||
radius: Appearance.rounding.full
|
||||
topRightRadius: root.implicitHeight / 15
|
||||
|
||||
Behavior on implicitWidth {
|
||||
Anim {
|
||||
duration: 50
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: root.implicitHeight / 3
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: root.implicitHeight / 3
|
||||
bottomLeftRadius: root.implicitHeight / 15
|
||||
color: DynamicColors.tPalette.m3surfaceContainer
|
||||
implicitWidth: root.implicitWidth - root.handle.x - root.handle.implicitWidth - root.implicitHeight
|
||||
radius: Appearance.rounding.full
|
||||
topLeftRadius: root.implicitHeight / 15
|
||||
}
|
||||
}
|
||||
handle: CustomRect {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: DynamicColors.palette.m3primary
|
||||
implicitHeight: 15
|
||||
implicitWidth: 5
|
||||
radius: Appearance.rounding.full
|
||||
x: root.visualPosition * root.availableWidth - implicitWidth / 2
|
||||
|
||||
MouseArea {
|
||||
acceptedButtons: Qt.NoButton
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls.Basic
|
||||
|
||||
BusyIndicator {
|
||||
id: control
|
||||
|
||||
property int busySize: 64
|
||||
property color color: delegate.color
|
||||
|
||||
contentItem: Item {
|
||||
implicitHeight: control.busySize
|
||||
implicitWidth: control.busySize
|
||||
|
||||
Item {
|
||||
id: item
|
||||
|
||||
height: control.busySize
|
||||
opacity: control.running ? 1 : 0
|
||||
width: control.busySize
|
||||
x: parent.width / 2 - (control.busySize / 2)
|
||||
y: parent.height / 2 - (control.busySize / 2)
|
||||
|
||||
Behavior on opacity {
|
||||
OpacityAnimator {
|
||||
duration: 250
|
||||
}
|
||||
}
|
||||
|
||||
RotationAnimator {
|
||||
duration: 1250
|
||||
from: 0
|
||||
loops: Animation.Infinite
|
||||
running: control.visible && control.running
|
||||
target: item
|
||||
to: 360
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
|
||||
model: 6
|
||||
|
||||
CustomRect {
|
||||
id: delegate
|
||||
|
||||
required property int index
|
||||
|
||||
color: control.color
|
||||
implicitHeight: 10
|
||||
implicitWidth: 10
|
||||
radius: 5
|
||||
x: item.width / 2 - width / 2
|
||||
y: item.height / 2 - height / 2
|
||||
|
||||
transform: [
|
||||
Translate {
|
||||
y: -Math.min(item.width, item.height) * 0.5 + 5
|
||||
},
|
||||
Rotation {
|
||||
angle: delegate.index / repeater.count * 360
|
||||
origin.x: 5
|
||||
origin.y: 5
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import qs.Config
|
||||
|
||||
Button {
|
||||
id: control
|
||||
|
||||
property color bgColor: DynamicColors.palette.m3primary
|
||||
property int radius: Appearance.rounding.smallest / 2
|
||||
property color textColor: DynamicColors.palette.m3onPrimary
|
||||
|
||||
background: CustomRect {
|
||||
color: control.bgColor
|
||||
opacity: control.enabled ? 1.0 : 0.5
|
||||
radius: control.radius
|
||||
}
|
||||
contentItem: CustomText {
|
||||
color: control.textColor
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
opacity: control.enabled ? 1.0 : 0.5
|
||||
text: control.text
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
function onClicked(): void {
|
||||
control.clicked();
|
||||
}
|
||||
|
||||
radius: control.radius
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import qs.Config
|
||||
|
||||
CheckBox {
|
||||
id: control
|
||||
|
||||
property int checkHeight: 20
|
||||
property int checkWidth: 20
|
||||
|
||||
contentItem: CustomText {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: control.checkWidth + control.leftPadding + 8
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font.pointSize: control.font.pointSize
|
||||
text: control.text
|
||||
}
|
||||
indicator: CustomRect {
|
||||
// x: control.leftPadding
|
||||
// y: parent.implicitHeight / 2 - implicitHeight / 2
|
||||
border.color: control.checked ? DynamicColors.palette.m3primary : "transparent"
|
||||
color: DynamicColors.palette.m3surfaceVariant
|
||||
implicitHeight: control.checkHeight
|
||||
implicitWidth: control.checkWidth
|
||||
radius: Appearance.rounding.smallest / 2
|
||||
|
||||
CustomRect {
|
||||
color: DynamicColors.palette.m3primary
|
||||
implicitHeight: control.checkHeight - (y * 2)
|
||||
implicitWidth: control.checkWidth - (x * 2)
|
||||
radius: 3
|
||||
visible: control.checked
|
||||
x: 4
|
||||
y: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import Quickshell.Widgets
|
||||
import QtQuick
|
||||
|
||||
ClippingRectangle {
|
||||
id: root
|
||||
|
||||
color: "transparent"
|
||||
|
||||
Behavior on color {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import qs.Config
|
||||
|
||||
ComboBox {
|
||||
id: root
|
||||
|
||||
property int cornerRadius: Appearance.rounding.normal
|
||||
property int fieldHeight: 42
|
||||
property bool filled: true
|
||||
property real focusRingOpacity: 0.70
|
||||
property int hPadding: 16
|
||||
property int menuCornerRadius: 16
|
||||
property int menuRowHeight: 46
|
||||
property int menuVisibleRows: 7
|
||||
property bool preferPopupWindow: false
|
||||
|
||||
hoverEnabled: true
|
||||
implicitHeight: fieldHeight
|
||||
implicitWidth: 240
|
||||
spacing: 8
|
||||
|
||||
// ---------- Field background (filled/outlined + state layers + focus ring) ----------
|
||||
background: Item {
|
||||
anchors.fill: parent
|
||||
|
||||
CustomRect {
|
||||
id: container
|
||||
|
||||
anchors.fill: parent
|
||||
color: DynamicColors.palette.m3surfaceVariant
|
||||
radius: root.cornerRadius
|
||||
|
||||
StateLayer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- Content ----------
|
||||
contentItem: RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: root.hPadding
|
||||
anchors.rightMargin: root.hPadding
|
||||
spacing: 12
|
||||
|
||||
// Display text
|
||||
CustomText {
|
||||
Layout.fillWidth: true
|
||||
color: root.enabled ? DynamicColors.palette.m3onSurface : DynamicColors.palette.m3onSurfaceVariant
|
||||
elide: Text.ElideRight
|
||||
font.pixelSize: 16
|
||||
font.weight: Font.Medium
|
||||
text: root.currentText
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
// Indicator chevron (simple, replace with your icon system)
|
||||
CustomText {
|
||||
color: root.enabled ? DynamicColors.palette.m3onSurfaceVariant : DynamicColors.palette.m3onSurfaceVariant
|
||||
rotation: root.popup.visible ? 180 : 0
|
||||
text: "▾"
|
||||
transformOrigin: Item.Center
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
Behavior on rotation {
|
||||
NumberAnimation {
|
||||
duration: 140
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
popup: Popup {
|
||||
id: p
|
||||
|
||||
implicitHeight: list.contentItem.height + Appearance.padding.small * 2
|
||||
implicitWidth: root.width
|
||||
modal: true
|
||||
popupType: root.preferPopupWindow ? Popup.Window : Popup.Item
|
||||
y: -list.currentIndex * (root.menuRowHeight + Appearance.spacing.small) - Appearance.padding.small
|
||||
|
||||
background: CustomRect {
|
||||
color: DynamicColors.palette.m3surface
|
||||
radius: root.menuCornerRadius
|
||||
}
|
||||
contentItem: ListView {
|
||||
id: list
|
||||
|
||||
anchors.bottomMargin: Appearance.padding.small
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: Appearance.padding.small
|
||||
clip: true
|
||||
currentIndex: root.currentIndex
|
||||
model: root.delegateModel
|
||||
spacing: Appearance.spacing.small
|
||||
|
||||
delegate: CustomRect {
|
||||
required property int index
|
||||
required property var modelData
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: (index === root.currentIndex) ? DynamicColors.palette.m3primary : "transparent"
|
||||
implicitHeight: root.menuRowHeight
|
||||
implicitWidth: p.implicitWidth - Appearance.padding.small * 2
|
||||
radius: Appearance.rounding.normal - Appearance.padding.small
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 10
|
||||
|
||||
CustomText {
|
||||
Layout.fillWidth: true
|
||||
color: DynamicColors.palette.m3onSurface
|
||||
elide: Text.ElideRight
|
||||
font.pixelSize: 15
|
||||
text: modelData
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
CustomText {
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
text: "✓"
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
visible: index === root.currentIndex
|
||||
}
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
onClicked: {
|
||||
root.currentIndex = index;
|
||||
p.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Expressive-ish open/close motion: subtle scale+fade (tune to taste). :contentReference[oaicite:5]{index=5}
|
||||
enter: Transition {
|
||||
Anim {
|
||||
from: 0
|
||||
property: "opacity"
|
||||
to: 1
|
||||
}
|
||||
|
||||
Anim {
|
||||
from: 0.98
|
||||
property: "scale"
|
||||
to: 1.0
|
||||
}
|
||||
}
|
||||
exit: Transition {
|
||||
Anim {
|
||||
from: 1
|
||||
property: "opacity"
|
||||
to: 0
|
||||
}
|
||||
}
|
||||
|
||||
Elevation {
|
||||
anchors.fill: parent
|
||||
level: 2
|
||||
radius: root.menuCornerRadius
|
||||
z: -1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import QtQuick
|
||||
|
||||
Flickable {
|
||||
id: root
|
||||
|
||||
maximumFlickVelocity: 3000
|
||||
|
||||
rebound: Transition {
|
||||
Anim {
|
||||
properties: "x,y"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import Quickshell.Widgets
|
||||
import QtQuick
|
||||
|
||||
IconImage {
|
||||
id: root
|
||||
|
||||
asynchronous: true
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import QtQuick
|
||||
|
||||
ListView {
|
||||
id: root
|
||||
|
||||
maximumFlickVelocity: 3000
|
||||
|
||||
rebound: Transition {
|
||||
Anim {
|
||||
properties: "x,y"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import QtQuick
|
||||
|
||||
MouseArea {
|
||||
property int scrollAccumulatedY: 0
|
||||
|
||||
function onWheel(event: WheelEvent): void {
|
||||
}
|
||||
|
||||
onWheel: event => {
|
||||
if (Math.sign(event.angleDelta.y) !== Math.sign(scrollAccumulatedY))
|
||||
scrollAccumulatedY = 0;
|
||||
scrollAccumulatedY += event.angleDelta.y;
|
||||
|
||||
if (Math.abs(scrollAccumulatedY) >= 120) {
|
||||
onWheel(event);
|
||||
scrollAccumulatedY = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import QtQuick
|
||||
import QtQuick.Templates
|
||||
import qs.Config
|
||||
|
||||
RadioButton {
|
||||
id: root
|
||||
|
||||
font.pointSize: Appearance.font.size.normal
|
||||
implicitHeight: Math.max(implicitIndicatorHeight, implicitContentHeight)
|
||||
implicitWidth: implicitIndicatorWidth + implicitContentWidth + contentItem.anchors.leftMargin
|
||||
|
||||
contentItem: CustomText {
|
||||
anchors.left: outerCircle.right
|
||||
anchors.leftMargin: 10
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font.pointSize: root.font.pointSize
|
||||
text: root.text
|
||||
}
|
||||
indicator: Rectangle {
|
||||
id: outerCircle
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
border.color: root.checked ? DynamicColors.palette.m3primary : DynamicColors.palette.m3onSurfaceVariant
|
||||
border.width: 2
|
||||
color: "transparent"
|
||||
implicitHeight: 16
|
||||
implicitWidth: 16
|
||||
radius: Appearance.rounding.full
|
||||
|
||||
Behavior on border.color {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
function onClicked(): void {
|
||||
root.click();
|
||||
}
|
||||
|
||||
anchors.margins: -7
|
||||
color: root.checked ? DynamicColors.palette.m3onSurface : DynamicColors.palette.m3primary
|
||||
z: -1
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
anchors.centerIn: parent
|
||||
color: Qt.alpha(DynamicColors.palette.m3primary, root.checked ? 1 : 0)
|
||||
implicitHeight: 8
|
||||
implicitWidth: 8
|
||||
radius: Appearance.rounding.full
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import QtQuick
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
color: "transparent"
|
||||
|
||||
Behavior on color {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
import qs.Config
|
||||
import QtQuick
|
||||
import QtQuick.Templates
|
||||
|
||||
ScrollBar {
|
||||
id: root
|
||||
|
||||
property bool _updatingFromFlickable: false
|
||||
property bool _updatingFromUser: false
|
||||
property bool animating
|
||||
required property Flickable flickable
|
||||
property real nonAnimPosition
|
||||
property bool shouldBeActive
|
||||
|
||||
implicitWidth: 8
|
||||
|
||||
contentItem: CustomRect {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
color: DynamicColors.palette.m3secondary
|
||||
opacity: {
|
||||
if (root.size === 1)
|
||||
return 0;
|
||||
if (fullMouse.pressed)
|
||||
return 1;
|
||||
if (mouse.containsMouse)
|
||||
return 0.8;
|
||||
if (root.policy === ScrollBar.AlwaysOn || root.shouldBeActive)
|
||||
return 0.6;
|
||||
return 0;
|
||||
}
|
||||
radius: Appearance.rounding.full
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouse
|
||||
|
||||
acceptedButtons: Qt.NoButton
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
}
|
||||
}
|
||||
Behavior on position {
|
||||
enabled: !fullMouse.pressed
|
||||
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (flickable) {
|
||||
const contentHeight = flickable.contentHeight;
|
||||
const height = flickable.height;
|
||||
if (contentHeight > height) {
|
||||
nonAnimPosition = Math.max(0, Math.min(1, flickable.contentY / (contentHeight - height)));
|
||||
}
|
||||
}
|
||||
}
|
||||
onHoveredChanged: {
|
||||
if (hovered)
|
||||
shouldBeActive = true;
|
||||
else
|
||||
shouldBeActive = flickable.moving;
|
||||
}
|
||||
|
||||
// Sync nonAnimPosition with Qt's automatic position binding
|
||||
onPositionChanged: {
|
||||
if (_updatingFromUser) {
|
||||
_updatingFromUser = false;
|
||||
return;
|
||||
}
|
||||
if (position === nonAnimPosition) {
|
||||
animating = false;
|
||||
return;
|
||||
}
|
||||
if (!animating && !_updatingFromFlickable && !fullMouse.pressed) {
|
||||
nonAnimPosition = position;
|
||||
}
|
||||
}
|
||||
|
||||
// Sync nonAnimPosition with flickable when not animating
|
||||
Connections {
|
||||
function onContentYChanged() {
|
||||
if (!animating && !fullMouse.pressed) {
|
||||
_updatingFromFlickable = true;
|
||||
const contentHeight = flickable.contentHeight;
|
||||
const height = flickable.height;
|
||||
if (contentHeight > height) {
|
||||
nonAnimPosition = Math.max(0, Math.min(1, flickable.contentY / (contentHeight - height)));
|
||||
} else {
|
||||
nonAnimPosition = 0;
|
||||
}
|
||||
_updatingFromFlickable = false;
|
||||
}
|
||||
}
|
||||
|
||||
target: flickable
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onMovingChanged(): void {
|
||||
if (root.flickable.moving)
|
||||
root.shouldBeActive = true;
|
||||
else
|
||||
hideDelay.restart();
|
||||
}
|
||||
|
||||
target: root.flickable
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hideDelay
|
||||
|
||||
interval: 600
|
||||
|
||||
onTriggered: root.shouldBeActive = root.flickable.moving || root.hovered
|
||||
}
|
||||
|
||||
CustomMouseArea {
|
||||
id: fullMouse
|
||||
|
||||
function onWheel(event: WheelEvent): void {
|
||||
root.animating = true;
|
||||
root._updatingFromUser = true;
|
||||
let newPos = root.nonAnimPosition;
|
||||
if (event.angleDelta.y > 0)
|
||||
newPos = Math.max(0, root.nonAnimPosition - 0.1);
|
||||
else if (event.angleDelta.y < 0)
|
||||
newPos = Math.min(1 - root.size, root.nonAnimPosition + 0.1);
|
||||
root.nonAnimPosition = newPos;
|
||||
// Update flickable position
|
||||
// Map scrollbar position [0, 1-size] to contentY [0, maxContentY]
|
||||
if (root.flickable) {
|
||||
const contentHeight = root.flickable.contentHeight;
|
||||
const height = root.flickable.height;
|
||||
if (contentHeight > height) {
|
||||
const maxContentY = contentHeight - height;
|
||||
const maxPos = 1 - root.size;
|
||||
const contentY = maxPos > 0 ? (newPos / maxPos) * maxContentY : 0;
|
||||
root.flickable.contentY = Math.max(0, Math.min(maxContentY, contentY));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
preventStealing: true
|
||||
|
||||
onPositionChanged: event => {
|
||||
root._updatingFromUser = true;
|
||||
const newPos = Math.max(0, Math.min(1 - root.size, event.y / root.height - root.size / 2));
|
||||
root.nonAnimPosition = newPos;
|
||||
// Update flickable position
|
||||
// Map scrollbar position [0, 1-size] to contentY [0, maxContentY]
|
||||
if (root.flickable) {
|
||||
const contentHeight = root.flickable.contentHeight;
|
||||
const height = root.flickable.height;
|
||||
if (contentHeight > height) {
|
||||
const maxContentY = contentHeight - height;
|
||||
const maxPos = 1 - root.size;
|
||||
const contentY = maxPos > 0 ? (newPos / maxPos) * maxContentY : 0;
|
||||
root.flickable.contentY = Math.max(0, Math.min(maxContentY, contentY));
|
||||
}
|
||||
}
|
||||
}
|
||||
onPressed: event => {
|
||||
root.animating = true;
|
||||
root._updatingFromUser = true;
|
||||
const newPos = Math.max(0, Math.min(1 - root.size, event.y / root.height - root.size / 2));
|
||||
root.nonAnimPosition = newPos;
|
||||
// Update flickable position
|
||||
// Map scrollbar position [0, 1-size] to contentY [0, maxContentY]
|
||||
if (root.flickable) {
|
||||
const contentHeight = root.flickable.contentHeight;
|
||||
const height = root.flickable.height;
|
||||
if (contentHeight > height) {
|
||||
const maxContentY = contentHeight - height;
|
||||
const maxPos = 1 - root.size;
|
||||
const contentY = maxPos > 0 ? (newPos / maxPos) * maxContentY : 0;
|
||||
root.flickable.contentY = Math.max(0, Math.min(maxContentY, contentY));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import Quickshell.Hyprland
|
||||
|
||||
GlobalShortcut {
|
||||
appid: "zshell"
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import QtQuick
|
||||
import QtQuick.Templates
|
||||
import qs.Config
|
||||
|
||||
Slider {
|
||||
id: root
|
||||
|
||||
background: Item {
|
||||
CustomRect {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
bottomRightRadius: root.implicitHeight / 6
|
||||
color: DynamicColors.palette.m3primary
|
||||
implicitWidth: root.handle.x - root.implicitHeight / 2
|
||||
radius: Appearance.rounding.full
|
||||
topRightRadius: root.implicitHeight / 6
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
bottomLeftRadius: root.implicitHeight / 6
|
||||
color: DynamicColors.tPalette.m3surfaceContainer
|
||||
implicitWidth: parent.width - root.handle.x - root.handle.implicitWidth - root.implicitHeight / 2
|
||||
radius: Appearance.rounding.full
|
||||
topLeftRadius: root.implicitHeight / 6
|
||||
}
|
||||
}
|
||||
handle: CustomRect {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: DynamicColors.palette.m3primary
|
||||
implicitHeight: 15
|
||||
implicitWidth: 5
|
||||
radius: Appearance.rounding.full
|
||||
x: root.visualPosition * root.availableWidth - implicitWidth / 2
|
||||
|
||||
MouseArea {
|
||||
acceptedButtons: Qt.NoButton
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Config
|
||||
|
||||
RowLayout {
|
||||
id: root
|
||||
|
||||
property string displayText: root.value.toString()
|
||||
property bool isEditing: false
|
||||
property real max: Infinity
|
||||
property real min: -Infinity
|
||||
property alias repeatRate: timer.interval
|
||||
property real step: 1
|
||||
property real value
|
||||
|
||||
signal valueModified(value: real)
|
||||
|
||||
spacing: Appearance.spacing.small
|
||||
|
||||
onValueChanged: {
|
||||
if (!root.isEditing) {
|
||||
root.displayText = root.value.toString();
|
||||
}
|
||||
}
|
||||
|
||||
CustomTextField {
|
||||
id: textField
|
||||
|
||||
implicitHeight: upButton.implicitHeight
|
||||
inputMethodHints: Qt.ImhFormattedNumbersOnly
|
||||
leftPadding: Appearance.padding.normal
|
||||
padding: Appearance.padding.small
|
||||
rightPadding: Appearance.padding.normal
|
||||
text: root.isEditing ? text : root.displayText
|
||||
|
||||
background: CustomRect {
|
||||
color: DynamicColors.tPalette.m3surfaceContainerHigh
|
||||
implicitWidth: 100
|
||||
radius: Appearance.rounding.full
|
||||
}
|
||||
validator: DoubleValidator {
|
||||
bottom: root.min
|
||||
decimals: root.step < 1 ? Math.max(1, Math.ceil(-Math.log10(root.step))) : 0
|
||||
top: root.max
|
||||
}
|
||||
|
||||
onAccepted: {
|
||||
const numValue = parseFloat(text);
|
||||
if (!isNaN(numValue)) {
|
||||
const clampedValue = Math.max(root.min, Math.min(root.max, numValue));
|
||||
root.value = clampedValue;
|
||||
root.displayText = clampedValue.toString();
|
||||
root.valueModified(clampedValue);
|
||||
} else {
|
||||
text = root.displayText;
|
||||
}
|
||||
root.isEditing = false;
|
||||
}
|
||||
onActiveFocusChanged: {
|
||||
if (activeFocus) {
|
||||
root.isEditing = true;
|
||||
} else {
|
||||
root.isEditing = false;
|
||||
root.displayText = root.value.toString();
|
||||
}
|
||||
}
|
||||
onEditingFinished: {
|
||||
if (text !== root.displayText) {
|
||||
const numValue = parseFloat(text);
|
||||
if (!isNaN(numValue)) {
|
||||
const clampedValue = Math.max(root.min, Math.min(root.max, numValue));
|
||||
root.value = clampedValue;
|
||||
root.displayText = clampedValue.toString();
|
||||
root.valueModified(clampedValue);
|
||||
} else {
|
||||
text = root.displayText;
|
||||
}
|
||||
}
|
||||
root.isEditing = false;
|
||||
}
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
id: upButton
|
||||
|
||||
color: DynamicColors.palette.m3primary
|
||||
implicitHeight: upIcon.implicitHeight + Appearance.padding.small * 2
|
||||
implicitWidth: implicitHeight
|
||||
radius: Appearance.rounding.full
|
||||
|
||||
StateLayer {
|
||||
id: upState
|
||||
|
||||
function onClicked(): void {
|
||||
let newValue = Math.min(root.max, root.value + root.step);
|
||||
// Round to avoid floating point precision errors
|
||||
const decimals = root.step < 1 ? Math.max(1, Math.ceil(-Math.log10(root.step))) : 0;
|
||||
newValue = Math.round(newValue * Math.pow(10, decimals)) / Math.pow(10, decimals);
|
||||
root.value = newValue;
|
||||
root.displayText = newValue.toString();
|
||||
root.valueModified(newValue);
|
||||
}
|
||||
|
||||
color: DynamicColors.palette.m3onPrimary
|
||||
|
||||
onPressAndHold: timer.start()
|
||||
onReleased: timer.stop()
|
||||
}
|
||||
|
||||
MaterialIcon {
|
||||
id: upIcon
|
||||
|
||||
anchors.centerIn: parent
|
||||
color: DynamicColors.palette.m3onPrimary
|
||||
text: "keyboard_arrow_up"
|
||||
}
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
color: DynamicColors.palette.m3primary
|
||||
implicitHeight: downIcon.implicitHeight + Appearance.padding.small * 2
|
||||
implicitWidth: implicitHeight
|
||||
radius: Appearance.rounding.full
|
||||
|
||||
StateLayer {
|
||||
id: downState
|
||||
|
||||
function onClicked(): void {
|
||||
let newValue = Math.max(root.min, root.value - root.step);
|
||||
// Round to avoid floating point precision errors
|
||||
const decimals = root.step < 1 ? Math.max(1, Math.ceil(-Math.log10(root.step))) : 0;
|
||||
newValue = Math.round(newValue * Math.pow(10, decimals)) / Math.pow(10, decimals);
|
||||
root.value = newValue;
|
||||
root.displayText = newValue.toString();
|
||||
root.valueModified(newValue);
|
||||
}
|
||||
|
||||
color: DynamicColors.palette.m3onPrimary
|
||||
|
||||
onPressAndHold: timer.start()
|
||||
onReleased: timer.stop()
|
||||
}
|
||||
|
||||
MaterialIcon {
|
||||
id: downIcon
|
||||
|
||||
anchors.centerIn: parent
|
||||
color: DynamicColors.palette.m3onPrimary
|
||||
text: "keyboard_arrow_down"
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: timer
|
||||
|
||||
interval: 100
|
||||
repeat: true
|
||||
triggeredOnStart: true
|
||||
|
||||
onTriggered: {
|
||||
if (upState.pressed)
|
||||
upState.onClicked();
|
||||
else if (downState.pressed)
|
||||
downState.onClicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Config
|
||||
import qs.Helpers
|
||||
|
||||
Row {
|
||||
id: root
|
||||
|
||||
enum Type {
|
||||
Filled,
|
||||
Tonal
|
||||
}
|
||||
|
||||
property alias active: menu.active
|
||||
property color color: type == CustomSplitButton.Filled ? DynamicColors.palette.m3primary : DynamicColors.palette.m3secondaryContainer
|
||||
property bool disabled
|
||||
property color disabledColor: Qt.alpha(DynamicColors.palette.m3onSurface, 0.1)
|
||||
property color disabledTextColor: Qt.alpha(DynamicColors.palette.m3onSurface, 0.38)
|
||||
property alias expanded: menu.expanded
|
||||
property string fallbackIcon
|
||||
property string fallbackText
|
||||
property real horizontalPadding: Appearance.padding.normal
|
||||
property alias iconLabel: iconLabel
|
||||
property alias label: label
|
||||
property alias menu: menu
|
||||
property alias menuItems: menu.items
|
||||
property bool menuOnTop
|
||||
property alias stateLayer: stateLayer
|
||||
property color textColor: type == CustomSplitButton.Filled ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3onSecondaryContainer
|
||||
property int type: CustomSplitButton.Filled
|
||||
property real verticalPadding: Appearance.padding.smaller
|
||||
|
||||
function closeDropdown(): void {
|
||||
SettingsDropdowns.close(menu);
|
||||
}
|
||||
|
||||
function openDropdown(): void {
|
||||
if (root.disabled)
|
||||
return;
|
||||
SettingsDropdowns.open(menu, root);
|
||||
}
|
||||
|
||||
function toggleDropdown(): void {
|
||||
if (root.disabled)
|
||||
return;
|
||||
SettingsDropdowns.toggle(menu, root);
|
||||
}
|
||||
|
||||
spacing: Math.floor(Appearance.spacing.small / 2)
|
||||
|
||||
onExpandedChanged: {
|
||||
if (!expanded)
|
||||
SettingsDropdowns.forget(menu);
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
bottomRightRadius: Appearance.rounding.small / 2
|
||||
color: root.disabled ? root.disabledColor : root.color
|
||||
implicitHeight: expandBtn.implicitHeight
|
||||
implicitWidth: textRow.implicitWidth + root.horizontalPadding * 2
|
||||
radius: implicitHeight / 2 * Math.min(1, Appearance.rounding.scale)
|
||||
topRightRadius: Appearance.rounding.small / 2
|
||||
|
||||
StateLayer {
|
||||
id: stateLayer
|
||||
|
||||
function onClicked(): void {
|
||||
root.active?.clicked();
|
||||
}
|
||||
|
||||
color: root.textColor
|
||||
disabled: root.disabled
|
||||
rect.bottomRightRadius: parent.bottomRightRadius
|
||||
rect.topRightRadius: parent.topRightRadius
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: textRow
|
||||
|
||||
anchors.centerIn: parent
|
||||
anchors.horizontalCenterOffset: Math.floor(root.verticalPadding / 4)
|
||||
spacing: Appearance.spacing.small
|
||||
|
||||
MaterialIcon {
|
||||
id: iconLabel
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
animate: true
|
||||
color: root.disabled ? root.disabledTextColor : root.textColor
|
||||
fill: 1
|
||||
text: root.active?.activeIcon ?? root.fallbackIcon
|
||||
}
|
||||
|
||||
CustomText {
|
||||
id: label
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.preferredWidth: implicitWidth
|
||||
animate: true
|
||||
clip: true
|
||||
color: root.disabled ? root.disabledTextColor : root.textColor
|
||||
text: root.active?.activeText ?? root.fallbackText
|
||||
|
||||
Behavior on Layout.preferredWidth {
|
||||
Anim {
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
id: expandBtn
|
||||
|
||||
property real rad: root.expanded ? implicitHeight / 2 * Math.min(1, Appearance.rounding.scale) : Appearance.rounding.small / 2
|
||||
|
||||
bottomLeftRadius: rad
|
||||
color: root.disabled ? root.disabledColor : root.color
|
||||
implicitHeight: expandIcon.implicitHeight + root.verticalPadding * 2
|
||||
implicitWidth: implicitHeight
|
||||
radius: implicitHeight / 2 * Math.min(1, Appearance.rounding.scale)
|
||||
topLeftRadius: rad
|
||||
|
||||
Behavior on rad {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
id: expandStateLayer
|
||||
|
||||
function onClicked(): void {
|
||||
root.toggleDropdown();
|
||||
}
|
||||
|
||||
color: root.textColor
|
||||
disabled: root.disabled
|
||||
rect.bottomLeftRadius: parent.bottomLeftRadius
|
||||
rect.topLeftRadius: parent.topLeftRadius
|
||||
}
|
||||
|
||||
MaterialIcon {
|
||||
id: expandIcon
|
||||
|
||||
anchors.centerIn: parent
|
||||
anchors.horizontalCenterOffset: root.expanded ? 0 : -Math.floor(root.verticalPadding / 4)
|
||||
color: root.disabled ? root.disabledTextColor : root.textColor
|
||||
rotation: root.expanded ? 180 : 0
|
||||
text: "expand_more"
|
||||
|
||||
Behavior on anchors.horizontalCenterOffset {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on rotation {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: menu
|
||||
|
||||
anchors.bottomMargin: Appearance.spacing.small
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.bottom
|
||||
anchors.topMargin: Appearance.spacing.small
|
||||
|
||||
states: State {
|
||||
when: root.menuOnTop
|
||||
|
||||
AnchorChanges {
|
||||
anchors.bottom: expandBtn.top
|
||||
anchors.top: undefined
|
||||
target: menu
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Config
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property alias active: splitButton.active
|
||||
property bool enabled: true
|
||||
property alias expanded: splitButton.expanded
|
||||
property int expandedZ: 100
|
||||
required property string label
|
||||
property alias menuItems: splitButton.menuItems
|
||||
property alias type: splitButton.type
|
||||
|
||||
signal selected(item: MenuItem)
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: row.implicitHeight + Appearance.padding.smaller * 2
|
||||
clip: false
|
||||
z: root.expanded ? expandedZ : -1
|
||||
|
||||
RowLayout {
|
||||
id: row
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.margins: Appearance.padding.small
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Appearance.spacing.normal
|
||||
|
||||
CustomText {
|
||||
Layout.fillWidth: true
|
||||
color: root.enabled ? DynamicColors.palette.m3onSurface : DynamicColors.palette.m3onSurfaceVariant
|
||||
font.pointSize: Appearance.font.size.larger
|
||||
text: root.label
|
||||
z: root.expanded ? root.expandedZ : -1
|
||||
}
|
||||
|
||||
CustomSplitButton {
|
||||
id: splitButton
|
||||
|
||||
enabled: root.enabled
|
||||
type: CustomSplitButton.Filled
|
||||
z: root.expanded ? root.expandedZ : -1
|
||||
|
||||
menu.onItemSelected: item => {
|
||||
root.selected(item);
|
||||
splitButton.closeDropdown();
|
||||
}
|
||||
stateLayer.onClicked: {
|
||||
splitButton.toggleDropdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
import QtQuick
|
||||
import QtQuick.Templates
|
||||
import QtQuick.Shapes
|
||||
import qs.Config
|
||||
|
||||
Switch {
|
||||
id: root
|
||||
|
||||
property int cLayer: 1
|
||||
|
||||
implicitHeight: implicitIndicatorHeight
|
||||
implicitWidth: implicitIndicatorWidth
|
||||
|
||||
indicator: CustomRect {
|
||||
color: root.checked ? DynamicColors.palette.m3primary : DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, root.cLayer)
|
||||
implicitHeight: 13 + 7 * 2
|
||||
implicitWidth: implicitHeight * 1.7
|
||||
radius: Appearance.rounding.full
|
||||
|
||||
CustomRect {
|
||||
readonly property real nonAnimWidth: root.pressed ? implicitHeight * 1.3 : implicitHeight
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: root.checked ? DynamicColors.palette.m3onPrimary : DynamicColors.layer(DynamicColors.palette.m3outline, root.cLayer + 1)
|
||||
implicitHeight: parent.implicitHeight - 10
|
||||
implicitWidth: nonAnimWidth
|
||||
radius: Appearance.rounding.full
|
||||
x: root.checked ? parent.implicitWidth - nonAnimWidth - 10 / 2 : 10 / 2
|
||||
|
||||
Behavior on implicitWidth {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on x {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
anchors.fill: parent
|
||||
color: root.checked ? DynamicColors.palette.m3primary : DynamicColors.palette.m3onSurface
|
||||
opacity: root.pressed ? 0.1 : root.hovered ? 0.08 : 0
|
||||
radius: parent.radius
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Shape {
|
||||
id: icon
|
||||
|
||||
property point end1: {
|
||||
if (root.pressed) {
|
||||
if (root.checked)
|
||||
return Qt.point(width * 0.4, height / 2);
|
||||
return Qt.point(width * 0.8, height / 2);
|
||||
}
|
||||
if (root.checked)
|
||||
return Qt.point(width * 0.4, height * 0.7);
|
||||
return Qt.point(width * 0.85, height * 0.85);
|
||||
}
|
||||
property point end2: {
|
||||
if (root.pressed)
|
||||
return Qt.point(width, height / 2);
|
||||
if (root.checked)
|
||||
return Qt.point(width * 0.85, height * 0.2);
|
||||
return Qt.point(width * 0.85, height * 0.15);
|
||||
}
|
||||
property point start1: {
|
||||
if (root.pressed)
|
||||
return Qt.point(width * 0.1, height / 2);
|
||||
if (root.checked)
|
||||
return Qt.point(width * 0.15, height / 2);
|
||||
return Qt.point(width * 0.15, height * 0.15);
|
||||
}
|
||||
property point start2: {
|
||||
if (root.pressed) {
|
||||
if (root.checked)
|
||||
return Qt.point(width * 0.4, height / 2);
|
||||
return Qt.point(width * 0.2, height / 2);
|
||||
}
|
||||
if (root.checked)
|
||||
return Qt.point(width * 0.4, height * 0.7);
|
||||
return Qt.point(width * 0.15, height * 0.85);
|
||||
}
|
||||
|
||||
anchors.centerIn: parent
|
||||
asynchronous: true
|
||||
height: parent.implicitHeight - Appearance.padding.small * 2
|
||||
preferredRendererType: Shape.CurveRenderer
|
||||
width: height
|
||||
|
||||
Behavior on end1 {
|
||||
PropAnim {
|
||||
}
|
||||
}
|
||||
Behavior on end2 {
|
||||
PropAnim {
|
||||
}
|
||||
}
|
||||
Behavior on start1 {
|
||||
PropAnim {
|
||||
}
|
||||
}
|
||||
Behavior on start2 {
|
||||
PropAnim {
|
||||
}
|
||||
}
|
||||
|
||||
ShapePath {
|
||||
capStyle: Appearance.rounding.scale === 0 ? ShapePath.SquareCap : ShapePath.RoundCap
|
||||
fillColor: "transparent"
|
||||
startX: icon.start1.x
|
||||
startY: icon.start1.y
|
||||
strokeColor: root.checked ? DynamicColors.palette.m3primary : DynamicColors.palette.m3surfaceContainerHighest
|
||||
strokeWidth: Appearance.font.size.larger * 0.15
|
||||
|
||||
Behavior on strokeColor {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: icon.end1.x
|
||||
y: icon.end1.y
|
||||
}
|
||||
|
||||
PathMove {
|
||||
x: icon.start2.x
|
||||
y: icon.start2.y
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: icon.end2.x
|
||||
y: icon.end2.y
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
enabled: false
|
||||
}
|
||||
|
||||
component PropAnim: PropertyAnimation {
|
||||
duration: MaterialEasing.expressiveEffectsTime
|
||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
||||
easing.type: Easing.BezierSpline
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.Config
|
||||
|
||||
Text {
|
||||
id: root
|
||||
|
||||
property bool animate: false
|
||||
property int animateDuration: 400
|
||||
property real animateFrom: 0
|
||||
property string animateProp: "scale"
|
||||
property real animateTo: 1
|
||||
|
||||
color: DynamicColors.palette.m3onSurface
|
||||
font.family: Appearance.font.family.sans
|
||||
font.pointSize: Appearance.font.size.normal
|
||||
renderType: Text.NativeRendering
|
||||
textFormat: Text.PlainText
|
||||
|
||||
Behavior on color {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
Behavior on text {
|
||||
enabled: root.animate
|
||||
|
||||
SequentialAnimation {
|
||||
Anim {
|
||||
easing.bezierCurve: MaterialEasing.standardAccel
|
||||
to: root.animateFrom
|
||||
}
|
||||
|
||||
PropertyAction {
|
||||
}
|
||||
|
||||
Anim {
|
||||
easing.bezierCurve: MaterialEasing.standardDecel
|
||||
to: root.animateTo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component Anim: NumberAnimation {
|
||||
duration: root.animateDuration / 2
|
||||
easing.type: Easing.BezierSpline
|
||||
properties: root.animateProp.split(",").length > 1 ? root.animateProp : ""
|
||||
property: root.animateProp.split(",").length === 1 ? root.animateProp : ""
|
||||
target: root
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import qs.Config
|
||||
|
||||
TextField {
|
||||
id: root
|
||||
|
||||
background: null
|
||||
color: DynamicColors.palette.m3onSurface
|
||||
cursorVisible: !readOnly
|
||||
font.family: Appearance.font.family.sans
|
||||
font.pointSize: Appearance.font.size.smaller
|
||||
placeholderTextColor: DynamicColors.palette.m3outline
|
||||
renderType: echoMode === TextField.Password ? TextField.QtRendering : TextField.NativeRendering
|
||||
|
||||
Behavior on color {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
cursorDelegate: CustomRect {
|
||||
id: cursor
|
||||
|
||||
property bool disableBlink
|
||||
|
||||
color: DynamicColors.palette.m3primary
|
||||
implicitWidth: 2
|
||||
radius: Appearance.rounding.normal
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.small
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onCursorPositionChanged(): void {
|
||||
if (root.activeFocus && root.cursorVisible) {
|
||||
cursor.opacity = 1;
|
||||
cursor.disableBlink = true;
|
||||
enableBlink.restart();
|
||||
}
|
||||
}
|
||||
|
||||
target: root
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: enableBlink
|
||||
|
||||
interval: 100
|
||||
|
||||
onTriggered: cursor.disableBlink = false
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 500
|
||||
repeat: true
|
||||
running: root.activeFocus && root.cursorVisible && !cursor.disableBlink
|
||||
triggeredOnStart: true
|
||||
|
||||
onTriggered: parent.opacity = parent.opacity === 1 ? 0 : 1
|
||||
}
|
||||
|
||||
Binding {
|
||||
cursor.opacity: 0
|
||||
when: !root.activeFocus || !root.cursorVisible
|
||||
}
|
||||
}
|
||||
Behavior on placeholderTextColor {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import qs.Config
|
||||
|
||||
TextInput {
|
||||
renderType: Text.NativeRendering
|
||||
selectedTextColor: DynamicColors.palette.m3onSecondaryContainer
|
||||
selectionColor: DynamicColors.tPalette.colSecondaryContainer
|
||||
|
||||
font {
|
||||
family: Appearance?.font.family.sans ?? "sans-serif"
|
||||
hintingPreference: Font.PreferFullHinting
|
||||
pixelSize: Appearance?.font.size.normal ?? 15
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import qs.Components
|
||||
|
||||
ToolTip {
|
||||
id: root
|
||||
|
||||
property bool alternativeVisibleCondition: false
|
||||
property bool extraVisibleCondition: true
|
||||
readonly property bool internalVisibleCondition: (extraVisibleCondition && (parent.hovered === undefined || parent?.hovered)) || alternativeVisibleCondition
|
||||
|
||||
background: null
|
||||
horizontalPadding: 10
|
||||
verticalPadding: 5
|
||||
visible: internalVisibleCondition
|
||||
|
||||
contentItem: CustomTooltipContent {
|
||||
id: contentItem
|
||||
|
||||
horizontalPadding: root.horizontalPadding
|
||||
shown: root.internalVisibleCondition
|
||||
text: root.text
|
||||
verticalPadding: root.verticalPadding
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import QtQuick
|
||||
import qs.Components
|
||||
import qs.Config
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property real horizontalPadding: 10
|
||||
property bool isVisible: backgroundRectangle.implicitHeight > 0
|
||||
property bool shown: false
|
||||
required property string text
|
||||
property real verticalPadding: 5
|
||||
|
||||
implicitHeight: tooltipTextObject.implicitHeight + 2 * root.verticalPadding
|
||||
implicitWidth: tooltipTextObject.implicitWidth + 2 * root.horizontalPadding
|
||||
|
||||
Rectangle {
|
||||
id: backgroundRectangle
|
||||
|
||||
clip: true
|
||||
color: DynamicColors.tPalette.m3inverseSurface ?? "#3C4043"
|
||||
implicitHeight: shown ? (tooltipTextObject.implicitHeight + 2 * root.verticalPadding) : 0
|
||||
implicitWidth: shown ? (tooltipTextObject.implicitWidth + 2 * root.horizontalPadding) : 0
|
||||
opacity: shown ? 1 : 0
|
||||
radius: Appearance.rounding.smallest
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on implicitWidth {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
anchors {
|
||||
bottom: root.bottom
|
||||
horizontalCenter: root.horizontalCenter
|
||||
}
|
||||
|
||||
CustomText {
|
||||
id: tooltipTextObject
|
||||
|
||||
anchors.centerIn: parent
|
||||
color: DynamicColors.palette.m3inverseOnSurface ?? "#FFFFFF"
|
||||
text: root.text
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
|
||||
PanelWindow {
|
||||
required property string name
|
||||
|
||||
WlrLayershell.namespace: `ZShell-${name}`
|
||||
color: "transparent"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import qs.Config
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
|
||||
RectangularShadow {
|
||||
property real dp: [0, 1, 3, 6, 8, 12][level]
|
||||
property int level
|
||||
|
||||
blur: (dp * 5) ** 0.7
|
||||
color: Qt.alpha(DynamicColors.palette.m3shadow, 0.7)
|
||||
offset.y: dp / 2
|
||||
spread: -dp * 0.3 + (dp * 0.1) ** 2
|
||||
|
||||
Behavior on dp {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import qs.Config
|
||||
import QtQuick
|
||||
|
||||
CustomRect {
|
||||
required property int extra
|
||||
|
||||
anchors.margins: 8
|
||||
anchors.right: parent.right
|
||||
color: DynamicColors.palette.m3tertiary
|
||||
implicitHeight: count.implicitHeight + 4 * 2
|
||||
implicitWidth: count.implicitWidth + 8 * 2
|
||||
opacity: extra > 0 ? 1 : 0
|
||||
radius: Appearance.rounding.smallest
|
||||
scale: extra > 0 ? 1 : 0.5
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
duration: MaterialEasing.expressiveEffectsTime
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
Anim {
|
||||
duration: MaterialEasing.expressiveEffectsTime
|
||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
||||
}
|
||||
}
|
||||
|
||||
Elevation {
|
||||
anchors.fill: parent
|
||||
level: 2
|
||||
opacity: parent.opacity
|
||||
radius: parent.radius
|
||||
z: -1
|
||||
}
|
||||
|
||||
CustomText {
|
||||
id: count
|
||||
|
||||
anchors.centerIn: parent
|
||||
animate: parent.opacity > 0
|
||||
color: DynamicColors.palette.m3onTertiary
|
||||
text: qsTr("+%1").arg(parent.extra)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import QtQuick
|
||||
import qs.Config
|
||||
|
||||
BaseStyledSlider {
|
||||
id: root
|
||||
|
||||
trackContent: Component {
|
||||
Item {
|
||||
property var groove
|
||||
readonly property real handleHeight: handleItem ? handleItem.height : 0
|
||||
property var handleItem
|
||||
readonly property real handleWidth: handleItem ? handleItem.width : 0
|
||||
|
||||
// Set by BaseStyledSlider's Loader
|
||||
property var rootSlider
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
CustomRect {
|
||||
color: rootSlider?.color
|
||||
height: rootSlider?.isVertical ? handleHeight + (1 - rootSlider?.visualPosition) * (groove?.height - handleHeight) : groove?.height
|
||||
radius: groove?.radius
|
||||
width: rootSlider?.isHorizontal ? handleWidth + rootSlider?.visualPosition * (groove?.width - handleWidth) : groove?.width
|
||||
x: rootSlider?.isHorizontal ? (rootSlider?.mirrored ? groove?.width - width : 0) : 0
|
||||
y: rootSlider?.isVertical ? groove?.height - height : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import QtQuick
|
||||
import qs.Config
|
||||
|
||||
BaseStyledSlider {
|
||||
id: root
|
||||
|
||||
property real alpha: 1.0
|
||||
property real brightness: 1.0
|
||||
property string channel: "saturation"
|
||||
readonly property color currentColor: Qt.hsva(hue, channel === "saturation" ? value : saturation, channel === "brightness" ? value : brightness, alpha)
|
||||
property real hue: 0.0
|
||||
property real saturation: 1.0
|
||||
|
||||
from: 0
|
||||
to: 1
|
||||
|
||||
trackContent: Component {
|
||||
Item {
|
||||
property var groove
|
||||
property var handleItem
|
||||
property var rootSlider
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
antialiasing: true
|
||||
color: "transparent"
|
||||
radius: groove?.radius ?? 0
|
||||
|
||||
gradient: Gradient {
|
||||
orientation: rootSlider?.isHorizontal ? Gradient.Horizontal : Gradient.Vertical
|
||||
|
||||
GradientStop {
|
||||
color: root.channel === "saturation" ? Qt.hsva(root.hue, 0.0, root.brightness, root.alpha) : Qt.hsva(root.hue, root.saturation, 0.0, root.alpha)
|
||||
position: 0.0
|
||||
}
|
||||
|
||||
GradientStop {
|
||||
color: root.channel === "saturation" ? Qt.hsva(root.hue, 1.0, root.brightness, root.alpha) : Qt.hsva(root.hue, root.saturation, 1.0, root.alpha)
|
||||
position: 1.0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
import qs.Config
|
||||
import QtQuick
|
||||
|
||||
CustomRect {
|
||||
id: root
|
||||
|
||||
enum Type {
|
||||
Filled,
|
||||
Tonal,
|
||||
Text
|
||||
}
|
||||
|
||||
property color activeColour: type === IconButton.Filled ? DynamicColors.palette.m3primary : DynamicColors.palette.m3secondary
|
||||
property color activeOnColour: type === IconButton.Filled ? DynamicColors.palette.m3onPrimary : type === IconButton.Tonal ? DynamicColors.palette.m3onSecondary : DynamicColors.palette.m3primary
|
||||
property bool checked
|
||||
property bool disabled
|
||||
property color disabledColour: Qt.alpha(DynamicColors.palette.m3onSurface, 0.1)
|
||||
property color disabledOnColour: Qt.alpha(DynamicColors.palette.m3onSurface, 0.38)
|
||||
property alias font: label.font
|
||||
property alias icon: label.text
|
||||
property color inactiveColour: {
|
||||
if (!toggle && type === IconButton.Filled)
|
||||
return DynamicColors.palette.m3primary;
|
||||
return type === IconButton.Filled ? DynamicColors.tPalette.m3surfaceContainer : DynamicColors.palette.m3secondaryContainer;
|
||||
}
|
||||
property color inactiveOnColour: {
|
||||
if (!toggle && type === IconButton.Filled)
|
||||
return DynamicColors.palette.m3onPrimary;
|
||||
return type === IconButton.Tonal ? DynamicColors.palette.m3onSecondaryContainer : DynamicColors.palette.m3onSurfaceVariant;
|
||||
}
|
||||
property bool internalChecked
|
||||
property alias label: label
|
||||
property real padding: type === IconButton.Text ? 10 / 2 : 7
|
||||
property alias radiusAnim: radiusAnim
|
||||
property alias stateLayer: stateLayer
|
||||
property bool toggle
|
||||
property int type: IconButton.Filled
|
||||
|
||||
signal clicked
|
||||
|
||||
color: type === IconButton.Text ? "transparent" : disabled ? disabledColour : internalChecked ? activeColour : inactiveColour
|
||||
implicitHeight: label.implicitHeight + padding * 2
|
||||
implicitWidth: implicitHeight
|
||||
radius: internalChecked ? 6 : implicitHeight / 2 * Math.min(1, 1)
|
||||
|
||||
Behavior on radius {
|
||||
Anim {
|
||||
id: radiusAnim
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
onCheckedChanged: internalChecked = checked
|
||||
|
||||
StateLayer {
|
||||
id: stateLayer
|
||||
|
||||
function onClicked(): void {
|
||||
if (root.toggle)
|
||||
root.internalChecked = !root.internalChecked;
|
||||
root.clicked();
|
||||
}
|
||||
|
||||
color: root.internalChecked ? root.activeOnColour : root.inactiveOnColour
|
||||
disabled: root.disabled
|
||||
}
|
||||
|
||||
MaterialIcon {
|
||||
id: label
|
||||
|
||||
anchors.centerIn: parent
|
||||
color: root.disabled ? root.disabledOnColour : root.internalChecked ? root.activeOnColour : root.inactiveOnColour
|
||||
fill: !root.toggle || root.internalChecked ? 1 : 0
|
||||
|
||||
Behavior on fill {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
import QtQuick
|
||||
import qs.Config
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property alias anim: marqueeAnim
|
||||
property bool animate: false
|
||||
property color color: DynamicColors.palette.m3onSurface
|
||||
property int fadeStrengthAnimMs: 180
|
||||
property real fadeStrengthIdle: 0.0
|
||||
property real fadeStrengthMoving: 1.0
|
||||
property alias font: elideText.font
|
||||
property int gap: 40
|
||||
property alias horizontalAlignment: elideText.horizontalAlignment
|
||||
property bool leftFadeEnabled: false
|
||||
property real leftFadeStrength: overflowing && leftFadeEnabled ? fadeStrengthMoving : fadeStrengthIdle
|
||||
property int leftFadeWidth: 28
|
||||
property bool marqueeEnabled: true
|
||||
readonly property bool overflowing: metrics.width > root.width
|
||||
property int pauseMs: 1200
|
||||
property real pixelsPerSecond: 40
|
||||
property real rightFadeStrength: overflowing ? fadeStrengthMoving : fadeStrengthIdle
|
||||
property int rightFadeWidth: 28
|
||||
property bool sliding: false
|
||||
property alias text: elideText.text
|
||||
|
||||
function durationForDistance(px): int {
|
||||
return Math.max(1, Math.round(Math.abs(px) / root.pixelsPerSecond * 1000));
|
||||
}
|
||||
|
||||
function resetMarquee() {
|
||||
marqueeAnim.stop();
|
||||
strip.x = 0;
|
||||
root.sliding = false;
|
||||
root.leftFadeEnabled = false;
|
||||
|
||||
if (root.marqueeEnabled && root.overflowing && root.visible) {
|
||||
marqueeAnim.restart();
|
||||
}
|
||||
}
|
||||
|
||||
clip: true
|
||||
implicitHeight: elideText.implicitHeight
|
||||
|
||||
Behavior on leftFadeStrength {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on rightFadeStrength {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
onTextChanged: resetMarquee()
|
||||
onVisibleChanged: if (!visible)
|
||||
resetMarquee()
|
||||
onWidthChanged: resetMarquee()
|
||||
|
||||
TextMetrics {
|
||||
id: metrics
|
||||
|
||||
font: elideText.font
|
||||
text: elideText.text
|
||||
}
|
||||
|
||||
CustomText {
|
||||
id: elideText
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
animate: root.animate
|
||||
animateProp: "scale,opacity"
|
||||
color: root.color
|
||||
elide: Text.ElideNone
|
||||
visible: !root.overflowing
|
||||
width: root.width
|
||||
}
|
||||
|
||||
Item {
|
||||
id: marqueeViewport
|
||||
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
layer.enabled: true
|
||||
visible: root.overflowing
|
||||
|
||||
layer.effect: OpacityMask {
|
||||
maskSource: rightFadeMask
|
||||
}
|
||||
|
||||
Item {
|
||||
id: strip
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
height: t1.implicitHeight
|
||||
width: t1.width + root.gap + t2.width
|
||||
x: 0
|
||||
|
||||
CustomText {
|
||||
id: t1
|
||||
|
||||
animate: root.animate
|
||||
animateProp: "opacity"
|
||||
color: root.color
|
||||
text: elideText.text
|
||||
}
|
||||
|
||||
CustomText {
|
||||
id: t2
|
||||
|
||||
animate: root.animate
|
||||
animateProp: "opacity"
|
||||
color: root.color
|
||||
text: t1.text
|
||||
x: t1.width + root.gap
|
||||
}
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
id: marqueeAnim
|
||||
|
||||
running: false
|
||||
|
||||
onFinished: pauseTimer.restart()
|
||||
|
||||
ScriptAction {
|
||||
script: {
|
||||
root.sliding = true;
|
||||
root.leftFadeEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
Anim {
|
||||
duration: root.durationForDistance(t1.width)
|
||||
easing.bezierCurve: Easing.Linear
|
||||
easing.type: Easing.Linear
|
||||
from: 0
|
||||
property: "x"
|
||||
target: strip
|
||||
to: -t1.width
|
||||
}
|
||||
|
||||
ScriptAction {
|
||||
script: {
|
||||
root.leftFadeEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
Anim {
|
||||
duration: root.durationForDistance(root.gap)
|
||||
easing.bezierCurve: Easing.Linear
|
||||
easing.type: Easing.Linear
|
||||
from: -t1.width
|
||||
property: "x"
|
||||
target: strip
|
||||
to: -(t1.width + root.gap)
|
||||
}
|
||||
|
||||
ScriptAction {
|
||||
script: {
|
||||
root.sliding = false;
|
||||
strip.x = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: pauseTimer
|
||||
|
||||
interval: root.pauseMs
|
||||
repeat: false
|
||||
running: true
|
||||
|
||||
onTriggered: {
|
||||
if (root.marqueeEnabled)
|
||||
marqueeAnim.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: rightFadeMask
|
||||
|
||||
readonly property real fadeStartPos: {
|
||||
const w = Math.max(1, width);
|
||||
return Math.max(0, Math.min(1, (w - root.rightFadeWidth) / w));
|
||||
}
|
||||
readonly property real leftFadeEndPos: {
|
||||
const w = Math.max(1, width);
|
||||
return Math.max(0, Math.min(1, root.leftFadeWidth / w));
|
||||
}
|
||||
|
||||
anchors.fill: marqueeViewport
|
||||
layer.enabled: true
|
||||
visible: false
|
||||
|
||||
gradient: Gradient {
|
||||
orientation: Gradient.Horizontal
|
||||
|
||||
GradientStop {
|
||||
color: Qt.rgba(1, 1, 1, 1.0 - root.leftFadeStrength)
|
||||
position: 0.0
|
||||
}
|
||||
|
||||
GradientStop {
|
||||
color: Qt.rgba(1, 1, 1, 1.0)
|
||||
position: rightFadeMask.leftFadeEndPos
|
||||
}
|
||||
|
||||
GradientStop {
|
||||
color: Qt.rgba(1, 1, 1, 1.0)
|
||||
position: rightFadeMask.fadeStartPos
|
||||
}
|
||||
|
||||
GradientStop {
|
||||
color: Qt.rgba(1, 1, 1, 1.0 - root.rightFadeStrength)
|
||||
position: 1.0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import qs.Config
|
||||
|
||||
CustomText {
|
||||
property real fill
|
||||
property int grade: DynamicColors.light ? 0 : -25
|
||||
|
||||
font.family: "Material Symbols Rounded"
|
||||
font.pointSize: Appearance.font.size.larger
|
||||
font.variableAxes: ({
|
||||
FILL: fill.toFixed(1),
|
||||
GRAD: grade,
|
||||
opsz: fontInfo.pixelSize,
|
||||
wght: fontInfo.weight
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Config
|
||||
|
||||
Elevation {
|
||||
id: root
|
||||
|
||||
property MenuItem active: items[0] ?? null
|
||||
property bool expanded
|
||||
property list<MenuItem> items
|
||||
|
||||
signal itemSelected(item: MenuItem)
|
||||
|
||||
implicitHeight: root.expanded ? column.implicitHeight + Appearance.padding.small * 2 : 0
|
||||
implicitWidth: Math.max(200, column.implicitWidth)
|
||||
level: 2
|
||||
opacity: root.expanded ? 1 : 0
|
||||
radius: Appearance.rounding.normal
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||
}
|
||||
}
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||
}
|
||||
}
|
||||
|
||||
CustomClippingRect {
|
||||
anchors.fill: parent
|
||||
color: DynamicColors.palette.m3surfaceContainer
|
||||
radius: parent.radius
|
||||
|
||||
ColumnLayout {
|
||||
id: column
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 5
|
||||
|
||||
Repeater {
|
||||
model: root.items
|
||||
|
||||
CustomRect {
|
||||
id: item
|
||||
|
||||
readonly property bool active: modelData === root.active
|
||||
required property int index
|
||||
required property MenuItem modelData
|
||||
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: menuOptionRow.implicitHeight + Appearance.padding.normal * 2
|
||||
implicitWidth: menuOptionRow.implicitWidth + Appearance.padding.normal * 2
|
||||
|
||||
CustomRect {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: Appearance.padding.small
|
||||
anchors.rightMargin: Appearance.padding.small
|
||||
color: Qt.alpha(DynamicColors.palette.m3secondaryContainer, active ? 1 : 0)
|
||||
radius: Appearance.rounding.normal - Appearance.padding.small
|
||||
|
||||
StateLayer {
|
||||
function onClicked(): void {
|
||||
root.itemSelected(item.modelData);
|
||||
root.active = item.modelData;
|
||||
root.expanded = false;
|
||||
}
|
||||
|
||||
color: item.active ? DynamicColors.palette.m3onSecondaryContainer : DynamicColors.palette.m3onSurface
|
||||
disabled: !root.expanded
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: menuOptionRow
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: Appearance.padding.normal
|
||||
spacing: Appearance.spacing.small
|
||||
|
||||
MaterialIcon {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
color: item.active ? DynamicColors.palette.m3onSecondaryContainer : DynamicColors.palette.m3onSurfaceVariant
|
||||
text: item.modelData.icon
|
||||
}
|
||||
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
color: item.active ? DynamicColors.palette.m3onSecondaryContainer : DynamicColors.palette.m3onSurface
|
||||
text: item.modelData.text
|
||||
}
|
||||
|
||||
Loader {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
active: item.modelData.trailingIcon.length > 0
|
||||
visible: active
|
||||
|
||||
sourceComponent: MaterialIcon {
|
||||
color: item.active ? DynamicColors.palette.m3onSecondaryContainer : DynamicColors.palette.m3onSurface
|
||||
text: item.modelData.trailingIcon
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
property string activeIcon: icon
|
||||
property string activeText: text
|
||||
property string icon
|
||||
required property string text
|
||||
property string trailingIcon
|
||||
property var value
|
||||
|
||||
signal clicked
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
ShaderEffect {
|
||||
required property Item maskSource
|
||||
required property Item source
|
||||
|
||||
fragmentShader: Qt.resolvedUrl(`${Quickshell.shellDir}/assets/shaders/opacitymask.frag.qsb`)
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
import QtQuick
|
||||
|
||||
Path {
|
||||
id: root
|
||||
|
||||
required property real viewHeight
|
||||
required property real viewWidth
|
||||
|
||||
startX: root.viewWidth / 2
|
||||
startY: 0
|
||||
|
||||
PathAttribute {
|
||||
name: "itemOpacity"
|
||||
value: 0.25
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: root.viewWidth / 2
|
||||
y: root.viewHeight * (1 / 6)
|
||||
}
|
||||
|
||||
PathAttribute {
|
||||
name: "itemOpacity"
|
||||
value: 0.45
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: root.viewWidth / 2
|
||||
y: root.viewHeight * (2 / 6)
|
||||
}
|
||||
|
||||
PathAttribute {
|
||||
name: "itemOpacity"
|
||||
value: 0.70
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: root.viewWidth / 2
|
||||
y: root.viewHeight * (3 / 6)
|
||||
}
|
||||
|
||||
PathAttribute {
|
||||
name: "itemOpacity"
|
||||
value: 1.00
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: root.viewWidth / 2
|
||||
y: root.viewHeight * (4 / 6)
|
||||
}
|
||||
|
||||
PathAttribute {
|
||||
name: "itemOpacity"
|
||||
value: 0.70
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: root.viewWidth / 2
|
||||
y: root.viewHeight * (5 / 6)
|
||||
}
|
||||
|
||||
PathAttribute {
|
||||
name: "itemOpacity"
|
||||
value: 0.45
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: root.viewWidth / 2
|
||||
y: root.viewHeight
|
||||
}
|
||||
|
||||
PathAttribute {
|
||||
name: "itemOpacity"
|
||||
value: 0.25
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
import qs.Config
|
||||
|
||||
Elevation {
|
||||
id: root
|
||||
|
||||
required property int currentIndex
|
||||
property bool expanded
|
||||
required property int from
|
||||
property color insideTextColor: DynamicColors.palette.m3onPrimary
|
||||
property int itemHeight
|
||||
property int listHeight: 200
|
||||
property color outsideTextColor: DynamicColors.palette.m3onSurfaceVariant
|
||||
readonly property var spinnerModel: root.range(root.from, root.to)
|
||||
required property int to
|
||||
property Item triggerItem
|
||||
|
||||
signal itemSelected(item: int)
|
||||
|
||||
function range(first, last) {
|
||||
let out = [];
|
||||
for (let i = first; i <= last; ++i)
|
||||
out.push(i);
|
||||
return out;
|
||||
}
|
||||
|
||||
implicitHeight: root.expanded ? view.implicitHeight : 0
|
||||
level: root.expanded ? 2 : 0
|
||||
radius: itemHeight / 2
|
||||
visible: implicitHeight > 0
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
onExpandedChanged: {
|
||||
if (!root.expanded)
|
||||
root.itemSelected(view.currentIndex + 1);
|
||||
}
|
||||
|
||||
Component {
|
||||
id: spinnerDelegate
|
||||
|
||||
Item {
|
||||
id: wrapper
|
||||
|
||||
readonly property color delegateTextColor: wrapper.PathView.view ? wrapper.PathView.view.delegateTextColor : "white"
|
||||
required property var modelData
|
||||
|
||||
height: root.itemHeight
|
||||
opacity: wrapper.PathView.itemOpacity
|
||||
visible: wrapper.PathView.onPath
|
||||
width: wrapper.PathView.view ? wrapper.PathView.view.width : 0
|
||||
z: wrapper.PathView.isCurrentItem ? 100 : Math.round(wrapper.PathView.itemScale * 100)
|
||||
|
||||
CustomText {
|
||||
anchors.centerIn: parent
|
||||
color: wrapper.delegateTextColor
|
||||
font.pointSize: Appearance.font.size.large
|
||||
text: wrapper.modelData
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CustomClippingRect {
|
||||
anchors.fill: parent
|
||||
color: DynamicColors.palette.m3surfaceContainer
|
||||
radius: parent.radius
|
||||
|
||||
// Main visible spinner: normal/outside text color
|
||||
PathView {
|
||||
id: view
|
||||
|
||||
property color delegateTextColor: root.outsideTextColor
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
clip: true
|
||||
currentIndex: root.currentIndex - 1
|
||||
delegate: spinnerDelegate
|
||||
dragMargin: width
|
||||
highlightRangeMode: PathView.StrictlyEnforceRange
|
||||
implicitHeight: root.listHeight
|
||||
model: root.spinnerModel
|
||||
pathItemCount: 7
|
||||
preferredHighlightBegin: 0.5
|
||||
preferredHighlightEnd: 0.5
|
||||
snapMode: PathView.SnapToItem
|
||||
|
||||
path: PathMenu {
|
||||
viewHeight: view.height
|
||||
viewWidth: view.width
|
||||
}
|
||||
}
|
||||
|
||||
// The selection rectangle itself
|
||||
CustomRect {
|
||||
id: selectionRect
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: DynamicColors.palette.m3primary
|
||||
height: root.itemHeight
|
||||
radius: root.itemHeight / 2
|
||||
width: parent.width
|
||||
z: 2
|
||||
}
|
||||
|
||||
// Hidden source: same PathView, but with the "inside selection" text color
|
||||
Item {
|
||||
id: selectedTextSource
|
||||
|
||||
anchors.fill: parent
|
||||
layer.enabled: true
|
||||
visible: false
|
||||
|
||||
PathView {
|
||||
id: selectedTextView
|
||||
|
||||
property color delegateTextColor: root.insideTextColor
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
clip: true
|
||||
currentIndex: view.currentIndex
|
||||
delegate: spinnerDelegate
|
||||
dragMargin: view.dragMargin
|
||||
highlightRangeMode: view.highlightRangeMode
|
||||
implicitHeight: root.listHeight
|
||||
interactive: false
|
||||
model: view.model
|
||||
|
||||
// Keep this PathView visually locked to the real one
|
||||
offset: view.offset
|
||||
pathItemCount: view.pathItemCount
|
||||
preferredHighlightBegin: view.preferredHighlightBegin
|
||||
preferredHighlightEnd: view.preferredHighlightEnd
|
||||
snapMode: view.snapMode
|
||||
|
||||
path: PathMenu {
|
||||
viewHeight: selectedTextView.height
|
||||
viewWidth: selectedTextView.width
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Mask matching the selection rectangle
|
||||
Item {
|
||||
id: selectionMask
|
||||
|
||||
anchors.fill: parent
|
||||
layer.enabled: true
|
||||
visible: false
|
||||
|
||||
CustomRect {
|
||||
color: "white"
|
||||
height: selectionRect.height
|
||||
radius: selectionRect.radius
|
||||
width: selectionRect.width
|
||||
x: selectionRect.x
|
||||
y: selectionRect.y
|
||||
}
|
||||
}
|
||||
|
||||
// Only show the "inside selection" text where the mask exists
|
||||
MultiEffect {
|
||||
anchors.fill: selectedTextSource
|
||||
maskEnabled: true
|
||||
maskInverted: false
|
||||
maskSource: selectionMask
|
||||
source: selectedTextSource
|
||||
z: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
required property var service
|
||||
|
||||
Component.onCompleted: service.refCount++
|
||||
Component.onDestruction: service.refCount--
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Config
|
||||
|
||||
CustomRect {
|
||||
id: root
|
||||
|
||||
required property string label
|
||||
required property real max
|
||||
required property real min
|
||||
property var onValueModified: function (value) {}
|
||||
property real step: 1
|
||||
required property real value
|
||||
|
||||
Layout.fillWidth: true
|
||||
color: DynamicColors.layer(DynamicColors.palette.m3surfaceContainer, 2)
|
||||
implicitHeight: row.implicitHeight + Appearance.padding.large * 2
|
||||
radius: Appearance.rounding.normal
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: row
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.margins: Appearance.padding.large
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Appearance.spacing.normal
|
||||
|
||||
CustomText {
|
||||
Layout.fillWidth: true
|
||||
text: root.label
|
||||
}
|
||||
|
||||
CustomSpinBox {
|
||||
max: root.max
|
||||
min: root.min
|
||||
step: root.step
|
||||
value: root.value
|
||||
|
||||
onValueModified: value => {
|
||||
root.onValueModified(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import qs.Config
|
||||
import QtQuick
|
||||
|
||||
MouseArea {
|
||||
id: root
|
||||
|
||||
property color color: DynamicColors.palette.m3onSurface
|
||||
property bool disabled
|
||||
property real radius: parent?.radius ?? 0
|
||||
property alias rect: hoverLayer
|
||||
|
||||
function onClicked(): void {
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
cursorShape: disabled ? undefined : Qt.PointingHandCursor
|
||||
enabled: !disabled
|
||||
hoverEnabled: true
|
||||
|
||||
onClicked: event => !disabled && onClicked(event)
|
||||
onPressed: event => {
|
||||
if (disabled)
|
||||
return;
|
||||
|
||||
rippleAnim.x = event.x;
|
||||
rippleAnim.y = event.y;
|
||||
|
||||
const dist = (ox, oy) => ox * ox + oy * oy;
|
||||
rippleAnim.radius = Math.sqrt(Math.max(dist(event.x, event.y), dist(event.x, height - event.y), dist(width - event.x, event.y), dist(width - event.x, height - event.y)));
|
||||
|
||||
rippleAnim.restart();
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
id: rippleAnim
|
||||
|
||||
property real radius
|
||||
property real x
|
||||
property real y
|
||||
|
||||
PropertyAction {
|
||||
property: "x"
|
||||
target: ripple
|
||||
value: rippleAnim.x
|
||||
}
|
||||
|
||||
PropertyAction {
|
||||
property: "y"
|
||||
target: ripple
|
||||
value: rippleAnim.y
|
||||
}
|
||||
|
||||
PropertyAction {
|
||||
property: "opacity"
|
||||
target: ripple
|
||||
value: 0.08
|
||||
}
|
||||
|
||||
Anim {
|
||||
easing.bezierCurve: MaterialEasing.standardDecel
|
||||
from: 0
|
||||
properties: "implicitWidth,implicitHeight"
|
||||
target: ripple
|
||||
to: rippleAnim.radius * 2
|
||||
}
|
||||
|
||||
Anim {
|
||||
property: "opacity"
|
||||
target: ripple
|
||||
to: 0
|
||||
}
|
||||
}
|
||||
|
||||
CustomClippingRect {
|
||||
id: hoverLayer
|
||||
|
||||
anchors.fill: parent
|
||||
border.pixelAligned: false
|
||||
color: Qt.alpha(root.color, root.disabled ? 0 : root.pressed ? 0.1 : root.containsMouse ? 0.08 : 0)
|
||||
radius: root.radius
|
||||
|
||||
CustomRect {
|
||||
id: ripple
|
||||
|
||||
border.pixelAligned: false
|
||||
color: root.color
|
||||
opacity: 0
|
||||
radius: Appearance.rounding.full
|
||||
|
||||
transform: Translate {
|
||||
x: -ripple.width / 2
|
||||
y: -ripple.height / 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
import ZShell
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Components
|
||||
import qs.Config
|
||||
|
||||
CustomRect {
|
||||
id: root
|
||||
|
||||
required property Toast modelData
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
border.color: {
|
||||
let colour = DynamicColors.palette.m3outlineVariant;
|
||||
if (root.modelData.type === Toast.Success)
|
||||
colour = DynamicColors.palette.m3success;
|
||||
if (root.modelData.type === Toast.Warning)
|
||||
colour = DynamicColors.palette.m3secondaryContainer;
|
||||
if (root.modelData.type === Toast.Error)
|
||||
colour = DynamicColors.palette.m3error;
|
||||
return Qt.alpha(colour, 0.3);
|
||||
}
|
||||
border.width: 1
|
||||
color: {
|
||||
if (root.modelData.type === Toast.Success)
|
||||
return DynamicColors.palette.m3successContainer;
|
||||
if (root.modelData.type === Toast.Warning)
|
||||
return DynamicColors.palette.m3secondary;
|
||||
if (root.modelData.type === Toast.Error)
|
||||
return DynamicColors.palette.m3errorContainer;
|
||||
return DynamicColors.palette.m3surface;
|
||||
}
|
||||
implicitHeight: layout.implicitHeight + Appearance.padding.smaller * 2
|
||||
radius: Appearance.rounding.normal
|
||||
|
||||
Behavior on border.color {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
|
||||
Elevation {
|
||||
anchors.fill: parent
|
||||
level: 3
|
||||
opacity: parent.opacity
|
||||
radius: parent.radius
|
||||
z: -1
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: layout
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: Appearance.padding.normal
|
||||
anchors.margins: Appearance.padding.smaller
|
||||
anchors.rightMargin: Appearance.padding.normal
|
||||
spacing: Appearance.spacing.normal
|
||||
|
||||
CustomRect {
|
||||
color: {
|
||||
if (root.modelData.type === Toast.Success)
|
||||
return DynamicColors.palette.m3success;
|
||||
if (root.modelData.type === Toast.Warning)
|
||||
return DynamicColors.palette.m3secondaryContainer;
|
||||
if (root.modelData.type === Toast.Error)
|
||||
return DynamicColors.palette.m3error;
|
||||
return DynamicColors.palette.m3surfaceContainerHigh;
|
||||
}
|
||||
implicitHeight: icon.implicitHeight + Appearance.padding.smaller * 2
|
||||
implicitWidth: implicitHeight
|
||||
radius: Appearance.rounding.normal
|
||||
|
||||
MaterialIcon {
|
||||
id: icon
|
||||
|
||||
anchors.centerIn: parent
|
||||
color: {
|
||||
if (root.modelData.type === Toast.Success)
|
||||
return DynamicColors.palette.m3onSuccess;
|
||||
if (root.modelData.type === Toast.Warning)
|
||||
return DynamicColors.palette.m3onSecondaryContainer;
|
||||
if (root.modelData.type === Toast.Error)
|
||||
return DynamicColors.palette.m3onError;
|
||||
return DynamicColors.palette.m3onSurfaceVariant;
|
||||
}
|
||||
font.pointSize: Math.round(Appearance.font.size.large * 1.2)
|
||||
text: root.modelData.icon
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 0
|
||||
|
||||
CustomText {
|
||||
id: title
|
||||
|
||||
Layout.fillWidth: true
|
||||
color: {
|
||||
if (root.modelData.type === Toast.Success)
|
||||
return DynamicColors.palette.m3onSuccessContainer;
|
||||
if (root.modelData.type === Toast.Warning)
|
||||
return DynamicColors.palette.m3onSecondary;
|
||||
if (root.modelData.type === Toast.Error)
|
||||
return DynamicColors.palette.m3onErrorContainer;
|
||||
return DynamicColors.palette.m3onSurface;
|
||||
}
|
||||
elide: Text.ElideRight
|
||||
font.pointSize: Appearance.font.size.normal
|
||||
text: root.modelData.title
|
||||
}
|
||||
|
||||
CustomText {
|
||||
Layout.fillWidth: true
|
||||
color: {
|
||||
if (root.modelData.type === Toast.Success)
|
||||
return DynamicColors.palette.m3onSuccessContainer;
|
||||
if (root.modelData.type === Toast.Warning)
|
||||
return DynamicColors.palette.m3onSecondary;
|
||||
if (root.modelData.type === Toast.Error)
|
||||
return DynamicColors.palette.m3onErrorContainer;
|
||||
return DynamicColors.palette.m3onSurface;
|
||||
}
|
||||
elide: Text.ElideRight
|
||||
opacity: 0.8
|
||||
text: root.modelData.message
|
||||
textFormat: Text.StyledText
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import ZShell
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import qs.Components
|
||||
import qs.Config
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property bool flag
|
||||
readonly property int spacing: Appearance.spacing.small
|
||||
|
||||
implicitHeight: {
|
||||
let h = -spacing;
|
||||
for (let i = 0; i < repeater.count; i++) {
|
||||
const item = repeater.itemAt(i) as ToastWrapper;
|
||||
if (!item.modelData.closed && !item.previewHidden)
|
||||
h += item.implicitHeight + spacing;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
implicitWidth: Config.utilities.sizes.toastWidth - Appearance.padding.normal * 2
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
|
||||
model: ScriptModel {
|
||||
values: {
|
||||
const toasts = [];
|
||||
let count = 0;
|
||||
for (const toast of Toaster.toasts) {
|
||||
toasts.push(toast);
|
||||
if (!toast.closed) {
|
||||
count++;
|
||||
if (count > Config.utilities.maxToasts)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return toasts;
|
||||
}
|
||||
|
||||
onValuesChanged: root.flagChanged()
|
||||
}
|
||||
|
||||
ToastWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
component ToastWrapper: MouseArea {
|
||||
id: toast
|
||||
|
||||
required property int index
|
||||
required property Toast modelData
|
||||
readonly property bool previewHidden: {
|
||||
let extraHidden = 0;
|
||||
for (let i = 0; i < index; i++)
|
||||
if (Toaster.toasts[i].closed)
|
||||
extraHidden++;
|
||||
return index >= Config.utilities.maxToasts + extraHidden;
|
||||
}
|
||||
|
||||
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: {
|
||||
root.flag; // Force update
|
||||
let y = 0;
|
||||
for (let i = 0; i < index; i++) {
|
||||
const item = repeater.itemAt(i) as ToastWrapper;
|
||||
if (item && !item.modelData.closed && !item.previewHidden)
|
||||
y += item.implicitHeight + root.spacing;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
implicitHeight: toastInner.implicitHeight
|
||||
opacity: modelData.closed || previewHidden ? 0 : 1
|
||||
scale: modelData.closed || previewHidden ? 0.7 : 1
|
||||
|
||||
Behavior on anchors.bottomMargin {
|
||||
Anim {
|
||||
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||
}
|
||||
}
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: modelData.lock(this)
|
||||
onClicked: modelData.close()
|
||||
onPreviewHiddenChanged: {
|
||||
if (initAnim.running && previewHidden)
|
||||
initAnim.stop();
|
||||
}
|
||||
|
||||
Anim {
|
||||
id: initAnim
|
||||
|
||||
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||
from: 0
|
||||
properties: "opacity,scale"
|
||||
target: toast
|
||||
to: 1
|
||||
|
||||
Component.onCompleted: running = !toast.previewHidden
|
||||
}
|
||||
|
||||
ParallelAnimation {
|
||||
running: toast.modelData.closed
|
||||
|
||||
onFinished: toast.modelData.unlock(toast)
|
||||
onStarted: toast.anchors.bottomMargin = toast.anchors.bottomMargin
|
||||
|
||||
Anim {
|
||||
property: "opacity"
|
||||
target: toast
|
||||
to: 0
|
||||
}
|
||||
|
||||
Anim {
|
||||
property: "scale"
|
||||
target: toast
|
||||
to: 0.7
|
||||
}
|
||||
}
|
||||
|
||||
ToastItem {
|
||||
id: toastInner
|
||||
|
||||
modelData: toast.modelData
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import Quickshell.Io
|
||||
|
||||
JsonObject {
|
||||
property Accents accents: Accents {
|
||||
}
|
||||
|
||||
component Accents: JsonObject {
|
||||
property string primary: "#4080ff"
|
||||
property string primaryAlt: "#60a0ff"
|
||||
property string warning: "#ff6b6b"
|
||||
property string warningAlt: "#ff8787"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
|
||||
Singleton {
|
||||
readonly property AppearanceConf.Anim anim: Config.appearance.anim
|
||||
readonly property AppearanceConf.FontStuff font: Config.appearance.font
|
||||
readonly property AppearanceConf.Padding padding: Config.appearance.padding
|
||||
// Literally just here to shorten accessing stuff :woe:
|
||||
// Also kinda so I can keep accessing it with `Appearance.xxx` instead of `Conf.appearance.xxx`
|
||||
readonly property AppearanceConf.Rounding rounding: Config.appearance.rounding
|
||||
readonly property AppearanceConf.Spacing spacing: Config.appearance.spacing
|
||||
readonly property AppearanceConf.Transparency transparency: Config.appearance.transparency
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
import Quickshell.Io
|
||||
|
||||
JsonObject {
|
||||
property Anim anim: Anim {
|
||||
}
|
||||
property FontStuff font: FontStuff {
|
||||
}
|
||||
property Padding padding: Padding {
|
||||
}
|
||||
property Rounding rounding: Rounding {
|
||||
}
|
||||
property Spacing spacing: Spacing {
|
||||
}
|
||||
property Transparency transparency: Transparency {
|
||||
}
|
||||
|
||||
component Anim: JsonObject {
|
||||
property AnimCurves curves: AnimCurves {
|
||||
}
|
||||
property AnimDurations durations: AnimDurations {
|
||||
}
|
||||
property real mediaGifSpeedAdjustment: 300
|
||||
property real sessionGifSpeed: 0.7
|
||||
}
|
||||
component AnimCurves: JsonObject {
|
||||
property list<real> emphasized: [0.05, 0, 2 / 15, 0.06, 1 / 6, 0.4, 5 / 24, 0.82, 0.25, 1, 1, 1]
|
||||
property list<real> emphasizedAccel: [0.3, 0, 0.8, 0.15, 1, 1]
|
||||
property list<real> emphasizedDecel: [0.05, 0.7, 0.1, 1, 1, 1]
|
||||
property list<real> expressiveDefaultSpatial: [0.38, 1.21, 0.22, 1, 1, 1]
|
||||
property list<real> expressiveEffects: [0.34, 0.8, 0.34, 1, 1, 1]
|
||||
property list<real> expressiveFastSpatial: [0.42, 1.67, 0.21, 0.9, 1, 1]
|
||||
property list<real> standard: [0.2, 0, 0, 1, 1, 1]
|
||||
property list<real> standardAccel: [0.3, 0, 1, 1, 1, 1]
|
||||
property list<real> standardDecel: [0, 0, 0, 1, 1, 1]
|
||||
}
|
||||
component AnimDurations: JsonObject {
|
||||
property int expressiveDefaultSpatial: 500 * scale
|
||||
property int expressiveEffects: 200 * scale
|
||||
property int expressiveFastSpatial: 350 * scale
|
||||
property int extraLarge: 1000 * scale
|
||||
property int large: 600 * scale
|
||||
property int normal: 400 * scale
|
||||
property real scale: 1
|
||||
property int small: 200 * scale
|
||||
}
|
||||
component FontFamily: JsonObject {
|
||||
property string clock: "Rubik"
|
||||
property string material: "Material Symbols Rounded"
|
||||
property string mono: "CaskaydiaCove NF"
|
||||
property string sans: "Segoe UI Variable Text"
|
||||
}
|
||||
component FontSize: JsonObject {
|
||||
property int extraLarge: 28 * scale
|
||||
property int large: 18 * scale
|
||||
property int larger: 15 * scale
|
||||
property int normal: 13 * scale
|
||||
property real scale: 1
|
||||
property int small: 11 * scale
|
||||
property int smaller: 12 * scale
|
||||
}
|
||||
component FontStuff: JsonObject {
|
||||
property FontFamily family: FontFamily {
|
||||
}
|
||||
property FontSize size: FontSize {
|
||||
}
|
||||
}
|
||||
component Padding: JsonObject {
|
||||
property int large: 15 * scale
|
||||
property int larger: 12 * scale
|
||||
property int normal: 10 * scale
|
||||
property real scale: 1
|
||||
property int small: 5 * scale
|
||||
property int smaller: 7 * scale
|
||||
property int smallest: 2 * scale
|
||||
}
|
||||
component Rounding: JsonObject {
|
||||
property int full: 1000 * scale
|
||||
property int large: 25 * scale
|
||||
property int normal: 17 * scale
|
||||
property real scale: 1
|
||||
property int small: 12 * scale
|
||||
property int smallest: 8 * scale
|
||||
}
|
||||
component Spacing: JsonObject {
|
||||
property int large: 20 * scale
|
||||
property int larger: 15 * scale
|
||||
property int normal: 12 * scale
|
||||
property real scale: 1
|
||||
property int small: 7 * scale
|
||||
property int smaller: 10 * scale
|
||||
}
|
||||
component Transparency: JsonObject {
|
||||
property real base: 0.85
|
||||
property bool enabled: false
|
||||
property real layers: 0.4
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import Quickshell.Io
|
||||
import qs.Config
|
||||
|
||||
JsonObject {
|
||||
property bool enabled: true
|
||||
property int wallFadeDuration: MaterialEasing.standardTime
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
import Quickshell.Io
|
||||
|
||||
JsonObject {
|
||||
property bool autoHide: false
|
||||
property int border: 8
|
||||
property list<var> entries: [
|
||||
{
|
||||
id: "workspaces",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "audio",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "media",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "resources",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "updates",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "dash",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "spacer",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "activeWindow",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "spacer",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "tray",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "upower",
|
||||
enabled: false
|
||||
},
|
||||
{
|
||||
id: "network",
|
||||
enabled: false
|
||||
},
|
||||
{
|
||||
id: "clock",
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
id: "notifBell",
|
||||
enabled: true
|
||||
},
|
||||
]
|
||||
property int height: 34
|
||||
property Popouts popouts: Popouts {
|
||||
}
|
||||
property int rounding: 8
|
||||
|
||||
component Popouts: JsonObject {
|
||||
property bool activeWindow: true
|
||||
property bool audio: true
|
||||
property bool clock: true
|
||||
property bool network: true
|
||||
property bool resources: true
|
||||
property bool tray: true
|
||||
property bool upower: true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import Quickshell.Io
|
||||
|
||||
JsonObject {
|
||||
property string schemeType: "vibrant"
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user