Compare commits
26
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d40ce33d1 | ||
|
|
954dc10fbb | ||
|
|
15ccfd24c6 | ||
|
|
33b08523e9 | ||
|
|
742bece30b | ||
|
|
a64eadd14a | ||
|
|
f9eeb793db | ||
|
|
6bb193c78c | ||
|
|
aadecbfe44 | ||
|
|
53f0aa80ae | ||
|
|
d9856c9409 | ||
|
|
8dc9753e2b | ||
|
|
2a4bd3dfdd | ||
|
|
f75f51ef50 | ||
|
|
e0873304d1 | ||
|
|
99a0155c17 | ||
|
|
f309debea5 | ||
|
|
0979fd014d | ||
|
|
656bd0a54d | ||
|
|
f01001dcfa | ||
|
|
bc6b0d50ab | ||
|
|
f27c9afc25 | ||
|
|
5962fc8354 | ||
|
|
1adcb9841c | ||
|
|
0e0f8555ed | ||
|
|
1d63e67554 |
@@ -1,3 +0,0 @@
|
||||
|
||||
#omz revision: d2b7f557cceaddb16ba89bbf8200d8a8df35c4d8
|
||||
#omz fpath: /home/zach/.oh-my-zsh/plugins/colored-man-pages /home/zach/.oh-my-zsh/plugins/universalarchive /home/zach/.oh-my-zsh/plugins/tldr /home/zach/.oh-my-zsh/plugins/extract /home/zach/.oh-my-zsh/plugins/copypath /home/zach/.oh-my-zsh/plugins/cp /home/zach/.oh-my-zsh/plugins/conda-env /home/zach/.oh-my-zsh/plugins/command-not-found /home/zach/.oh-my-zsh/plugins/dirhistory /home/zach/.oh-my-zsh/plugins/copybuffer /home/zach/.oh-my-zsh/plugins/copyfile /home/zach/.oh-my-zsh/custom/plugins/fast-syntax-highlighting /home/zach/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting /home/zach/.oh-my-zsh/custom/plugins/zsh-autosuggestions /home/zach/.oh-my-zsh/plugins/archlinux /home/zach/.oh-my-zsh/plugins/web-search /home/zach/.oh-my-zsh/plugins/sudo /home/zach/.oh-my-zsh/plugins/git /home/zach/.oh-my-zsh/functions /home/zach/.oh-my-zsh/completions /home/zach/.oh-my-zsh/custom/functions /home/zach/.oh-my-zsh/custom/completions /home/zach/tools/ripgrep/complete /home/linuxbrew/.linuxbrew/share/zsh/site-functions /home/zach/.oh-my-zsh/plugins/colored-man-pages /home/zach/.oh-my-zsh/plugins/universalarchive /home/zach/.oh-my-zsh/plugins/tldr /home/zach/.oh-my-zsh/plugins/extract /home/zach/.oh-my-zsh/plugins/copypath /home/zach/.oh-my-zsh/plugins/cp /home/zach/.oh-my-zsh/plugins/conda-env /home/zach/.oh-my-zsh/plugins/command-not-found /home/zach/.oh-my-zsh/plugins/dirhistory /home/zach/.oh-my-zsh/plugins/copybuffer /home/zach/.oh-my-zsh/plugins/copyfile /home/zach/.oh-my-zsh/custom/plugins/fast-syntax-highlighting /home/zach/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting /home/zach/.oh-my-zsh/custom/plugins/zsh-autosuggestions /home/zach/.oh-my-zsh/plugins/archlinux /home/zach/.oh-my-zsh/plugins/web-search /home/zach/.oh-my-zsh/plugins/sudo /home/zach/.oh-my-zsh/plugins/git /home/zach/.oh-my-zsh/functions /home/zach/.oh-my-zsh/completions /home/zach/.oh-my-zsh/custom/functions /home/zach/.oh-my-zsh/custom/completions /home/zach/.oh-my-zsh/cache/completions /home/zach/tools/ripgrep/complete /home/linuxbrew/.linuxbrew/share/zsh/site-functions /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions /usr/share/zsh/functions/Calendar /usr/share/zsh/functions/Chpwd /usr/share/zsh/functions/Completion /usr/share/zsh/functions/Completion/Base /usr/share/zsh/functions/Completion/Linux /usr/share/zsh/functions/Completion/Unix /usr/share/zsh/functions/Completion/X /usr/share/zsh/functions/Completion/Zsh /usr/share/zsh/functions/Exceptions /usr/share/zsh/functions/MIME /usr/share/zsh/functions/Math /usr/share/zsh/functions/Misc /usr/share/zsh/functions/Newuser /usr/share/zsh/functions/Prompts /usr/share/zsh/functions/TCP /usr/share/zsh/functions/VCS_Info /usr/share/zsh/functions/VCS_Info/Backends /usr/share/zsh/functions/Zftp /usr/share/zsh/functions/Zle /home/zach/.zfunc
|
||||
@@ -1,5 +0,0 @@
|
||||
CompileFlags:
|
||||
Remove:
|
||||
# GCC-only flags from the system's default spec that clang/clangd cannot
|
||||
# parse. They appear in compile_commands.json but are not set by the project.
|
||||
- -mno-direct-extern-access
|
||||
@@ -38,6 +38,7 @@ body:
|
||||
attributes:
|
||||
label: OS
|
||||
options:
|
||||
- NixOS
|
||||
- Arch
|
||||
- Debian / Ubuntu
|
||||
- Fedora
|
||||
|
||||
@@ -30,7 +30,6 @@ body:
|
||||
- Refactor / style
|
||||
- CI / build / tooling
|
||||
- Documentation
|
||||
- Other (Describe in description box with header "Issue type")
|
||||
validations:
|
||||
required: true
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Docker CLI
|
||||
run: apk add --no-cache docker-cli docker-cli-buildx
|
||||
run: apk add --no-cache docker-cli
|
||||
|
||||
- name: Login to registry
|
||||
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.aramjonghu.dev --username aramjonghu --password-stdin
|
||||
|
||||
+20
-21
@@ -17,47 +17,46 @@ jobs:
|
||||
run: |
|
||||
find . \( -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) \
|
||||
-not -path './build/*' \
|
||||
-exec clang-format --dry-run -Werror --style=file {} +
|
||||
-exec clang-format -i --style=file {} +
|
||||
git diff --exit-code && echo "clang-format: passed"
|
||||
|
||||
build & lint:
|
||||
build:
|
||||
runs-on: alpine
|
||||
container:
|
||||
image: git.aramjonghu.dev/aramjonghu/zshell-ci:latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache CMake build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: build
|
||||
key: cpp-build-${{ hashFiles('CMakeLists.txt', '**/CMakeLists.txt') }}
|
||||
restore-keys: |
|
||||
cpp-build-
|
||||
- name: Configure
|
||||
run: cmake -B build -G Ninja -DENABLE_MODULES=plugin -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
- name: Cache ccache
|
||||
uses: actions/cache@v4
|
||||
- name: Build
|
||||
run: ninja -C build
|
||||
|
||||
clang-tidy:
|
||||
runs-on: alpine
|
||||
container:
|
||||
image: git.aramjonghu.dev/aramjonghu/zshell-ci:latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: ccache-${{ runner.os }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
ccache-${{ runner.os }}-
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Configure
|
||||
run: cmake -B build -G Ninja -DENABLE_MODULES=plugin -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
- name: Build
|
||||
run: ninja -C build
|
||||
env:
|
||||
CMAKE_CXX_COMPILER_LAUNCHER: ccache
|
||||
|
||||
- name: clang-tidy
|
||||
run: |
|
||||
sed -i 's/-mno-direct-extern-access //g' build/compile_commands.json
|
||||
set -o pipefail
|
||||
run-clang-tidy -p build -j "$(nproc)" \
|
||||
-source-filter="^$(pwd)/Plugins/" \
|
||||
-header-filter=".*Plugins/.*" \
|
||||
-removed-arg=-mno-direct-extern-access
|
||||
run-clang-tidy -p build -j $(nproc) -header-filter="Plugins/.*" 2>&1 | \
|
||||
grep -v 'Suppressed\|non-user\|non-system\|unknown argument.*mno-direct\|Found compiler error\|warnings generated\.\|^Use -header-filter'
|
||||
|
||||
@@ -4,7 +4,7 @@ on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
fmt & lint:
|
||||
fmt:
|
||||
runs-on: alpine
|
||||
container: node:26-alpine
|
||||
|
||||
@@ -24,6 +24,20 @@ jobs:
|
||||
else
|
||||
echo "No JS/TS files found"
|
||||
fi
|
||||
|
||||
lint:
|
||||
runs-on: alpine
|
||||
container: node:26-alpine
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
apk add --no-cache \
|
||||
git
|
||||
|
||||
- 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
|
||||
|
||||
+88
-23
@@ -1,15 +1,12 @@
|
||||
name: Python
|
||||
|
||||
env:
|
||||
APT_DEPS: git python3 python3-pip python3-venv python3-gi python3-cairo python3-dbus python3-pyudev python3-psutil python3-evdev python3-yaml python3-xlib python3-pillow gir1.2-gtk-3.0
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
fmt & lint:
|
||||
runs-on: debian
|
||||
container: node:26-trixie-slim
|
||||
fmt:
|
||||
runs-on: alpine
|
||||
container: node:26-alpine
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -17,8 +14,10 @@ jobs:
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends git python3 python3-pip python3-venv
|
||||
apk add --no-cache \
|
||||
git \
|
||||
python3 \
|
||||
py3-pip
|
||||
python3 -m venv .venv
|
||||
. .venv/bin/activate
|
||||
pip install --no-cache-dir ruff
|
||||
@@ -28,15 +27,9 @@ jobs:
|
||||
. .venv/bin/activate
|
||||
ruff format --check .
|
||||
|
||||
- name: Lint
|
||||
run: |
|
||||
. .venv/bin/activate
|
||||
ruff check .
|
||||
|
||||
test & nuitka build:
|
||||
if: always()
|
||||
runs-on: debian
|
||||
container: node:26-trixie-slim
|
||||
lint:
|
||||
runs-on: alpine
|
||||
container: node:26-alpine
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -44,16 +37,43 @@ jobs:
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends $APT_DEPS build-essential python3-dev
|
||||
python3 -m venv --system-site-packages .venv
|
||||
apk add --no-cache \
|
||||
git \
|
||||
python3 \
|
||||
py3-pip
|
||||
python3 -m venv .venv
|
||||
. .venv/bin/activate
|
||||
pip install --no-cache-dir basedpyright nuitka .
|
||||
pip install --no-cache-dir ruff
|
||||
|
||||
- name: Type check
|
||||
- name: Lint
|
||||
run: |
|
||||
. .venv/bin/activate
|
||||
basedpyright
|
||||
ruff check .
|
||||
|
||||
test:
|
||||
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 \
|
||||
py3-pillow \
|
||||
build-base
|
||||
python3 -m venv .venv
|
||||
. .venv/bin/activate
|
||||
pip install --no-cache-dir \
|
||||
typer \
|
||||
pillow \
|
||||
materialyoucolor \
|
||||
jinja2 \
|
||||
pytest
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
@@ -61,6 +81,51 @@ jobs:
|
||||
cd cli
|
||||
python -m pytest tests/ -v
|
||||
|
||||
typecheck:
|
||||
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 basedpyright typer pillow materialyoucolor jinja2
|
||||
|
||||
- name: Type check
|
||||
run: |
|
||||
. .venv/bin/activate
|
||||
basedpyright
|
||||
|
||||
buildcheck:
|
||||
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 \
|
||||
build-base \
|
||||
python3-dev \
|
||||
gcc \
|
||||
g++
|
||||
python3 -m venv .venv
|
||||
. .venv/bin/activate
|
||||
pip install --no-cache-dir nuitka
|
||||
|
||||
- name: Nuitka module check
|
||||
run: |
|
||||
. .venv/bin/activate
|
||||
|
||||
+99
-11
@@ -4,9 +4,9 @@ on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
clippy & fmt:
|
||||
build:
|
||||
runs-on: alpine
|
||||
container: node:26-alpine # keep node image for checkout to work
|
||||
container: node:26-alpine
|
||||
env:
|
||||
CARGO_HOME: ${{ github.workspace }}/.cargo
|
||||
|
||||
@@ -16,29 +16,34 @@ jobs:
|
||||
|
||||
- name: Cache cargo packages
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
cache-name: cache-cargo-packages
|
||||
with:
|
||||
path: |
|
||||
.cargo/registry
|
||||
.cargo/git
|
||||
target
|
||||
key: rust-build-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
key: rust-build-${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
rust-${{ runner.os }}-cargo-
|
||||
rust-${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
rust-${{ runner.os }}-build-
|
||||
rust-
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
apk add --no-cache git cargo rust rust-clippy rustfmt
|
||||
apk add --no-cache \
|
||||
git \
|
||||
cargo \
|
||||
rust
|
||||
|
||||
- name: Clippy (with compile check)
|
||||
- name: Cargo check
|
||||
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" -- -D warnings && \
|
||||
echo "$manifest: Clippy passed" || \
|
||||
{ echo "$manifest: Clippy failed"; status=1; }
|
||||
cargo check --manifest-path "$manifest" && \
|
||||
echo "$manifest: check passed" || \
|
||||
{ echo "$manifest: check failed"; exit 1; }
|
||||
done
|
||||
exit $status
|
||||
elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then
|
||||
echo "Rust files found but no Cargo.toml"
|
||||
exit 1
|
||||
@@ -46,6 +51,39 @@ jobs:
|
||||
echo "No Rust project found"
|
||||
fi
|
||||
|
||||
fmt:
|
||||
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-fmt-${{ runner.os }}-${{ 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
|
||||
|
||||
- name: Format check
|
||||
run: |
|
||||
if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then
|
||||
@@ -62,3 +100,53 @@ jobs:
|
||||
else
|
||||
echo "No Rust project found"
|
||||
fi
|
||||
|
||||
clippy:
|
||||
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-clippy-${{ runner.os }}-${{ 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 \
|
||||
rust-clippy
|
||||
|
||||
- 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
|
||||
|
||||
+9
-26
@@ -1,35 +1,18 @@
|
||||
**/__pycache__/
|
||||
./result/
|
||||
.pyre/
|
||||
.cache/
|
||||
.venv/
|
||||
.qmlls.ini
|
||||
build/
|
||||
compile_commands.json
|
||||
testpython
|
||||
pkg/
|
||||
*.tar.*
|
||||
uv.lock
|
||||
.qtcreator/
|
||||
dist/
|
||||
**/target/
|
||||
**/test-plugins/
|
||||
**/Charts/
|
||||
network-dev/
|
||||
**/zshell.dist/
|
||||
|
||||
# Qml
|
||||
.qtcreator/
|
||||
.qmlls.ini
|
||||
|
||||
# CMake compile artifacts
|
||||
.cache/
|
||||
compile_commands.json
|
||||
build/
|
||||
|
||||
# Python
|
||||
uv.lock
|
||||
testpython
|
||||
.venv/
|
||||
**/__pycache__/
|
||||
|
||||
# Nuitka compile
|
||||
**/zshell.pyi
|
||||
**/zshell.cpython-*
|
||||
**/zshell.build/
|
||||
|
||||
# Agents stuff
|
||||
.opencode/
|
||||
run-agent.sh
|
||||
AGENTS.md
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
.venv/
|
||||
scripts/fzf.js
|
||||
scripts/fuzzysort.js
|
||||
scripts/settings-indexer.js
|
||||
|
||||
+1
-2
@@ -3,9 +3,8 @@ FunctionsSpacing=true
|
||||
IndentWidth=4
|
||||
MaxColumnWidth=-1
|
||||
NewlineType=native
|
||||
GroupAttributesTogether=false
|
||||
NormalizeOrder=true
|
||||
ObjectsSpacing=true
|
||||
SemicolonRule=always
|
||||
SingleLineEmptyObjects=true
|
||||
SortImports=false
|
||||
UseTabs=true
|
||||
|
||||
+22
-34
@@ -26,52 +26,49 @@ if(NOT DEFINED VERSION)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED GIT_REVISION)
|
||||
execute_process(COMMAND git rev-parse HEAD
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE GIT_REVISION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if("${GIT_REVISION}" STREQUAL "")
|
||||
message(FATAL_ERROR "GIT_REVISION is not set and failed to get from git")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||
|
||||
project(ZShell VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
message(STATUS "ZShell version: ${VERSION}")
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
set(QT_NO_PRIVATE_MODULE_WARNING ON)
|
||||
set(ENABLE_MODULES "plugin;shell;cli;m3shapes" CACHE STRING "Modules to build/install")
|
||||
set(ENABLE_MODULES "plugin;shell;m3shapes" CACHE STRING "Modules to build/install")
|
||||
|
||||
set(INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/ZShell" CACHE STRING "Library install dir")
|
||||
set(INSTALL_QMLDIR "${CMAKE_INSTALL_LIBDIR}/qt6/qml" CACHE STRING "QML install dir")
|
||||
set(INSTALL_QSCONFDIR "${CMAKE_INSTALL_SYSCONFDIR}/xdg/quickshell/zshell" CACHE STRING "Quickshell config install dir")
|
||||
set(INSTALL_GREETERCONFDIR "${CMAKE_INSTALL_SYSCONFDIR}/xdg/quickshell/zshell-greeter" CACHE STRING "Quickshell greeter install dir")
|
||||
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")
|
||||
|
||||
set(CMAKE_INSTALL_MESSAGE NEVER)
|
||||
|
||||
add_compile_options(
|
||||
-Wall -Wextra -Wpedantic -Wshadow -Wconversion
|
||||
-Wnull-dereference -Wdouble-promotion
|
||||
-Wformat=2 -Wfloat-equal
|
||||
-Wold-style-cast -Wnull-dereference -Wdouble-promotion
|
||||
-Wformat=2 -Wfloat-equal -Woverloaded-virtual
|
||||
-Wsign-conversion -Wredundant-decls -Wswitch
|
||||
-Wunreachable-code
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Woverloaded-virtual>
|
||||
)
|
||||
|
||||
|
||||
if("cli" IN_LIST ENABLE_MODULES)
|
||||
if("shell" IN_LIST ENABLE_MODULES)
|
||||
# Build settings index
|
||||
find_package(Python3 COMPONENTS Interpreter REQUIRED)
|
||||
set(SETTINGS_INDEX_JSON "${CMAKE_BINARY_DIR}/settings-index.json")
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE}
|
||||
"${CMAKE_SOURCE_DIR}/scripts/build-settings-index.py"
|
||||
"${CMAKE_SOURCE_DIR}/Modules/Settings"
|
||||
"${SETTINGS_INDEX_JSON}"
|
||||
RESULT_VARIABLE SETTINGS_INDEX_RESULT
|
||||
)
|
||||
if(NOT SETTINGS_INDEX_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to build settings search index")
|
||||
endif()
|
||||
|
||||
# Nuitka compilation
|
||||
set(ZSHELL_CLI_BUILD_DIR "${CMAKE_BINARY_DIR}/zshell-cli")
|
||||
set(ZSHELL_CLI_DIST "${ZSHELL_CLI_BUILD_DIR}/zshell.dist")
|
||||
@@ -96,8 +93,6 @@ if("cli" IN_LIST ENABLE_MODULES)
|
||||
${NUITKA_EXECUTABLE}
|
||||
--standalone
|
||||
--include-data-dir=${CMAKE_SOURCE_DIR}/cli/src/zshell/assets=zshell/assets
|
||||
--include-package=gi.overrides
|
||||
--include-package-data=solaar
|
||||
--output-dir=${ZSHELL_CLI_BUILD_DIR}
|
||||
--output-filename=zshell-cli
|
||||
${CMAKE_SOURCE_DIR}/cli/src/zshell/
|
||||
@@ -191,11 +186,4 @@ if("m3shapes" IN_LIST ENABLE_MODULES)
|
||||
if(TARGET m3shapesplugin)
|
||||
set_target_properties(m3shapesplugin PROPERTIES INSTALL_RPATH "$ORIGIN")
|
||||
endif()
|
||||
|
||||
# Silence warnings that come from m3shapes files we do not manage.
|
||||
foreach(m3shapes_target m3shapes_core m3shapes_morph m3shapes_shapes m3shapes m3shapesplugin)
|
||||
if(TARGET ${m3shapes_target})
|
||||
target_compile_options(${m3shapes_target} PRIVATE -Wno-shadow -Wno-float-equal)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
@@ -27,25 +27,25 @@ AnchorAnimation {
|
||||
if (type == AnchorAnim.DefaultSpatial)
|
||||
return Tokens.anim.durations.expressiveDefaultSpatial;
|
||||
if (type == AnchorAnim.SlowSpatial)
|
||||
return Tokens.anim.durations.expressiveSlowSpatial;
|
||||
return Tokens.anim.durations.large;
|
||||
|
||||
const types = ["small", "normal", "large", "extraLarge"];
|
||||
const idx = type % 4; // 0-7 are the 4 standard types
|
||||
const idx = type % 4;
|
||||
return Tokens.anim.durations[types[idx]];
|
||||
}
|
||||
easing: {
|
||||
easing.bezierCurve: {
|
||||
if (type == AnchorAnim.FastSpatial)
|
||||
return Tokens.anim.expressiveFastSpatial;
|
||||
return Tokens.anim.curves.expressiveFastSpatial;
|
||||
if (type == AnchorAnim.DefaultSpatial)
|
||||
return Tokens.anim.expressiveDefaultSpatial;
|
||||
return Tokens.anim.curves.expressiveDefaultSpatial;
|
||||
if (type == AnchorAnim.SlowSpatial)
|
||||
return Tokens.anim.expressiveSlowSpatial;
|
||||
return Tokens.anim.curves.expressiveSlowSpatial;
|
||||
|
||||
if (type >= AnchorAnim.StandardSmall && type <= AnchorAnim.StandardExtraLarge)
|
||||
return Tokens.anim.standard;
|
||||
return Tokens.anim.curves.standard;
|
||||
if (type >= AnchorAnim.EmphasizedSmall && type <= AnchorAnim.EmphasizedExtraLarge)
|
||||
return Tokens.anim.emphasized;
|
||||
return Tokens.anim.curves.emphasized;
|
||||
|
||||
return Tokens.anim.expressiveDefaultSpatial;
|
||||
return Tokens.anim.curves.expressiveDefaultSpatial;
|
||||
}
|
||||
}
|
||||
|
||||
+12
-12
@@ -30,34 +30,34 @@ NumberAnimation {
|
||||
if (type === Anim.DefaultSpatial)
|
||||
return Tokens.anim.durations.expressiveDefaultSpatial;
|
||||
if (type === Anim.SlowSpatial)
|
||||
return Tokens.anim.durations.expressiveSlowSpatial;
|
||||
return Tokens.anim.durations.large;
|
||||
if (type === Anim.FastEffects)
|
||||
return Tokens.anim.durations.expressiveFastEffects;
|
||||
if (type === Anim.DefaultEffects)
|
||||
return Tokens.anim.durations.expressiveDefaultEffects;
|
||||
return Tokens.anim.durations.expressiveEffects;
|
||||
if (type === Anim.SlowEffects)
|
||||
return Tokens.anim.durations.expressiveSlowEffects;
|
||||
|
||||
const types = ["small", "normal", "large", "extraLarge"];
|
||||
const idx = type % 4; // 0-7 are the 4 standard types
|
||||
const idx = type % 4;
|
||||
return Tokens.anim.durations[types[idx]];
|
||||
}
|
||||
easing: {
|
||||
easing.bezierCurve: {
|
||||
if (type === Anim.FastSpatial)
|
||||
return Tokens.anim.expressiveFastSpatial;
|
||||
return Tokens.anim.curves.expressiveFastSpatial;
|
||||
if (type === Anim.DefaultSpatial)
|
||||
return Tokens.anim.expressiveDefaultSpatial;
|
||||
return Tokens.anim.curves.expressiveDefaultSpatial;
|
||||
if (type === Anim.SlowSpatial)
|
||||
return Tokens.anim.expressiveSlowSpatial;
|
||||
return Tokens.anim.curves.expressiveSlowSpatial;
|
||||
if (type === Anim.FastEffects)
|
||||
return Tokens.anim.expressiveFastEffects;
|
||||
return Tokens.anim.curves.expressiveFastEffects;
|
||||
if (type === Anim.DefaultEffects)
|
||||
return Tokens.anim.expressiveDefaultEffects;
|
||||
return Tokens.anim.curves.expressiveDefaultEffects;
|
||||
if (type === Anim.SlowEffects)
|
||||
return Tokens.anim.expressiveSlowEffects;
|
||||
return Tokens.anim.curves.expressiveSlowEffects;
|
||||
|
||||
if (type >= Anim.EmphasizedSmall && type <= Anim.EmphasizedExtraLarge)
|
||||
return Tokens.anim.emphasized;
|
||||
return Tokens.anim.standard;
|
||||
return Tokens.anim.curves.emphasized;
|
||||
return Tokens.anim.curves.standard;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,29 +80,49 @@ Slider {
|
||||
|
||||
property bool moving
|
||||
|
||||
anchors.centerIn: parent
|
||||
anchors.verticalCenterOffset: 1
|
||||
text: moving ? Math.round(root.value * 100) : root.icon
|
||||
color: Colors.palette.m3inverseOnSurface
|
||||
font: moving ? Tokens.font.body.small : Tokens.font.icon.medium
|
||||
function update(): void {
|
||||
animate = !moving;
|
||||
binding.when = moving;
|
||||
font.pointSize = moving ? Tokens.font.size.small : Tokens.font.size.larger;
|
||||
font.family = moving ? Config.appearance.font.family.sans : Config.appearance.font.family.material;
|
||||
}
|
||||
|
||||
Behavior on moving {
|
||||
SequentialAnimation {
|
||||
Anim {
|
||||
target: icon
|
||||
property: "scale"
|
||||
to: 0.3
|
||||
duration: Tokens.anim.durations.small / 2
|
||||
easing: Tokens.anim.standardAccel
|
||||
}
|
||||
PropertyAction {}
|
||||
Anim {
|
||||
target: icon
|
||||
property: "scale"
|
||||
to: 1
|
||||
duration: Tokens.anim.durations.normal / 2
|
||||
easing: Tokens.anim.standardDecel
|
||||
}
|
||||
anchors.centerIn: parent
|
||||
color: Colors.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: Tokens.anim.durations.normal / 2
|
||||
easing.bezierCurve: Tokens.anim.curves.standardAccel
|
||||
property: "scale"
|
||||
target: icon
|
||||
to: 0
|
||||
}
|
||||
|
||||
ScriptAction {
|
||||
script: icon.update()
|
||||
}
|
||||
|
||||
Anim {
|
||||
duration: Tokens.anim.durations.normal / 2
|
||||
easing.bezierCurve: Tokens.anim.curves.standardDecel
|
||||
property: "scale"
|
||||
target: icon
|
||||
to: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,7 +130,7 @@ Slider {
|
||||
}
|
||||
Behavior on value {
|
||||
Anim {
|
||||
type: Anim.StandardLarge
|
||||
duration: Tokens.anim.durations.large
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,6 +138,7 @@ Slider {
|
||||
onValueChanged: {
|
||||
if (!initialized) {
|
||||
initialized = true;
|
||||
oldValue = value;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import QtQuick
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import qs.Services
|
||||
|
||||
CustomRect {
|
||||
@@ -16,11 +15,15 @@ CustomRect {
|
||||
property color activeOnColor
|
||||
property bool checked
|
||||
property real checkedRadius: Tokens.rounding.medium
|
||||
property real defaultRadius: Tokens.rounding.large
|
||||
property real defaultRadius: Math.min(width, height) / 2
|
||||
property color disabledColor: Qt.alpha(Colors.palette.m3onSurface, 0.1)
|
||||
property color disabledOnColor: Qt.alpha(Colors.palette.m3onSurface, 0.38)
|
||||
property bool fillWidth
|
||||
property font font: Tokens.font.body.small
|
||||
property font font: ({
|
||||
family: Config.appearance.font.family.sans,
|
||||
pointSize: Tokens.font.size.larger,
|
||||
bold: false
|
||||
})
|
||||
property real horizontalPadding: padding
|
||||
readonly property alias hovered: stateLayer.containsMouse
|
||||
required implicitHeight
|
||||
@@ -33,7 +36,7 @@ CustomRect {
|
||||
readonly property color onColor: !enabled ? disabledOnColor : internalChecked ? activeOnColor : inactiveOnColor
|
||||
property real padding
|
||||
readonly property alias pressed: stateLayer.pressed
|
||||
property real pressedRadius: Tokens.rounding.small
|
||||
property real pressedRadius: Tokens.rounding.smallest
|
||||
readonly property alias radiusAnim: radiusAnim
|
||||
property bool radiusMorph: true
|
||||
property alias shapeMorph: stateLayer.shapeMorph
|
||||
@@ -51,7 +54,7 @@ CustomRect {
|
||||
if (internalChecked)
|
||||
return checkedRadius;
|
||||
if (isRound)
|
||||
return implicitHeight / 2 * Math.min(1, Tokens.rounding.scale);
|
||||
return (height || implicitHeight) / 2 * Math.min(1, Tokens.rounding.scale);
|
||||
return defaultRadius;
|
||||
}
|
||||
|
||||
|
||||
+58
-2
@@ -2,6 +2,62 @@ import QtQuick
|
||||
import ZShell.Config
|
||||
|
||||
ColorAnimation {
|
||||
duration: Tokens.anim.durations.expressiveSlowEffects
|
||||
easing: Tokens.anim.expressiveSlowEffects
|
||||
enum Type {
|
||||
StandardSmall = 0,
|
||||
Standard,
|
||||
StandardLarge,
|
||||
StandardExtraLarge,
|
||||
EmphasizedSmall,
|
||||
Emphasized,
|
||||
EmphasizedLarge,
|
||||
EmphasizedExtraLarge,
|
||||
FastSpatial,
|
||||
DefaultSpatial,
|
||||
SlowSpatial,
|
||||
FastEffects,
|
||||
DefaultEffects,
|
||||
SlowEffects
|
||||
}
|
||||
|
||||
property int type: CAnim.DefaultSpatial
|
||||
|
||||
duration: {
|
||||
if (type < CAnim.StandardSmall || type > Anim.SlowEffects)
|
||||
return Tokens.anim.durations.normal;
|
||||
|
||||
if (type === CAnim.FastSpatial)
|
||||
return Tokens.anim.durations.expressiveFastSpatial;
|
||||
if (type === CAnim.DefaultSpatial)
|
||||
return Tokens.anim.durations.expressiveDefaultSpatial;
|
||||
if (type === CAnim.SlowSpatial)
|
||||
return Tokens.anim.durations.large;
|
||||
if (type === CAnim.FastEffects)
|
||||
return Tokens.anim.durations.expressiveFastEffects;
|
||||
if (type === CAnim.DefaultEffects)
|
||||
return Tokens.anim.durations.expressiveEffects;
|
||||
if (type === CAnim.SlowEffects)
|
||||
return Tokens.anim.durations.expressiveSlowEffects;
|
||||
|
||||
const types = ["small", "normal", "large", "extraLarge"];
|
||||
const idx = type % 4;
|
||||
return Tokens.anim.durations[types[idx]];
|
||||
}
|
||||
easing.bezierCurve: {
|
||||
if (type === CAnim.FastSpatial)
|
||||
return Tokens.anim.curves.expressiveFastSpatial;
|
||||
if (type === CAnim.DefaultSpatial)
|
||||
return Tokens.anim.curves.expressiveDefaultSpatial;
|
||||
if (type === CAnim.SlowSpatial)
|
||||
return Tokens.anim.curves.expressiveSlowSpatial;
|
||||
if (type === CAnim.FastEffects)
|
||||
return Tokens.anim.curves.expressiveFastEffects;
|
||||
if (type === CAnim.DefaultEffects)
|
||||
return Tokens.anim.curves.expressiveDefaultEffects;
|
||||
if (type === CAnim.SlowEffects)
|
||||
return Tokens.anim.curves.expressiveSlowEffects;
|
||||
|
||||
if (type >= CAnim.EmphasizedSmall && type <= Anim.EmphasizedExtraLarge)
|
||||
return Tokens.anim.curves.emphasized;
|
||||
return Tokens.anim.curves.standard;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,10 @@ BusyIndicator {
|
||||
property int animState
|
||||
property color bgColor: Colors.palette.m3secondaryContainer
|
||||
property color fgColor: Colors.palette.m3primary
|
||||
property real implicitSize: Tokens.font.body.medium.pointSize * 3
|
||||
property real implicitSize: Tokens.font.size.normal * 3
|
||||
property real internalStrokeWidth: strokeWidth
|
||||
readonly property alias progress: manager.progress
|
||||
property real strokeWidth: Tokens.padding.extraSmall * 0.8
|
||||
property real strokeWidth: Tokens.padding.small * 0.8
|
||||
property alias type: manager.indeterminateAnimationType
|
||||
|
||||
implicitHeight: implicitSize
|
||||
@@ -34,6 +34,7 @@ BusyIndicator {
|
||||
anchors.fill: parent
|
||||
bgColor: root.bgColor
|
||||
fgColor: root.fgColor
|
||||
hasEndIndicator: false
|
||||
padding: root.padding
|
||||
rotation: manager.rotation
|
||||
startAngle: manager.startFraction * 360
|
||||
@@ -53,6 +54,7 @@ BusyIndicator {
|
||||
Anim {
|
||||
duration: manager.completeEndDuration * Tokens.anim.durations.scale
|
||||
properties: "opacity,internalStrokeWidth"
|
||||
type: Anim.DefaultEffects
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ Item {
|
||||
readonly property real size: Math.min(width, height)
|
||||
property int spacing: Tokens.spacing.small
|
||||
property int startAngle: -90
|
||||
property int strokeWidth: Tokens.padding.extraSmall
|
||||
property int strokeWidth: Tokens.padding.small
|
||||
property int sweepAngle: 360
|
||||
readonly property real thickness: strokeWidth * (1 + waveAmplitude) * 2
|
||||
property real value
|
||||
@@ -46,7 +46,8 @@ Item {
|
||||
strokeWidth: Math.min(1, remainingArc.sweepAngle) * root.strokeWidth
|
||||
|
||||
Behavior on strokeColor {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
|
||||
PathAngleArc {
|
||||
@@ -83,7 +84,8 @@ Item {
|
||||
}
|
||||
}
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
Anim on waveProgress {
|
||||
id: waveProgAnim
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import ZShell.Components
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property real radius
|
||||
property real topLeftRadius: radius
|
||||
property real topRightRadius: radius
|
||||
property real bottomRightRadius: radius
|
||||
property real bottomLeftRadius: radius
|
||||
property color color: "transparent"
|
||||
default property alias contentData: contentItem.data
|
||||
|
||||
Item {
|
||||
id: contentItem
|
||||
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
ShaderEffectSource {
|
||||
id: src
|
||||
|
||||
hideSource: true
|
||||
sourceItem: contentItem
|
||||
}
|
||||
|
||||
RoundedMask {
|
||||
anchors.fill: parent
|
||||
source: src
|
||||
topLeftRadius: root.topLeftRadius
|
||||
topRightRadius: root.topRightRadius
|
||||
bottomRightRadius: root.bottomRightRadius
|
||||
bottomLeftRadius: root.bottomLeftRadius
|
||||
color: root.color
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
}
|
||||
}
|
||||
@@ -46,10 +46,10 @@ Item {
|
||||
}
|
||||
|
||||
function syncFromPenColor() {
|
||||
if (!drawing.screenState)
|
||||
if (!drawing.drawingState)
|
||||
return;
|
||||
|
||||
const c = drawing.screenState.penColor;
|
||||
const c = drawing.drawingState.penColor;
|
||||
|
||||
if (c.hsvSaturation > 0) {
|
||||
currentHue = c.hsvHue;
|
||||
@@ -86,7 +86,7 @@ Item {
|
||||
|
||||
currentHue = relative / arcSweep;
|
||||
lastChromaticHue = currentHue;
|
||||
drawing.screenState.penColor = Qt.hsva(currentHue, drawing.screenState.penColor.hsvSaturation, drawing.screenState.penColor.hsvValue, drawing.screenState.penColor.a);
|
||||
drawing.drawingState.penColor = Qt.hsva(currentHue, drawing.drawingState.penColor.hsvSaturation, drawing.drawingState.penColor.hsvValue, drawing.drawingState.penColor.a);
|
||||
}
|
||||
|
||||
implicitHeight: 180
|
||||
@@ -112,7 +112,7 @@ Item {
|
||||
root.syncFromPenColor();
|
||||
}
|
||||
|
||||
target: root.drawing.screenState
|
||||
target: root.drawing.drawingState
|
||||
}
|
||||
|
||||
Canvas {
|
||||
@@ -152,7 +152,7 @@ Item {
|
||||
|
||||
CustomRect {
|
||||
anchors.centerIn: parent
|
||||
color: root.drawing?.screenState.penColor
|
||||
color: root.drawing?.drawingState.penColor
|
||||
implicitHeight: implicitWidth
|
||||
implicitWidth: canvas.height - root.handleSize - Tokens.padding.extraLarge * 2
|
||||
radius: Tokens.rounding.full
|
||||
@@ -160,7 +160,8 @@ Item {
|
||||
Behavior on color {
|
||||
enabled: false
|
||||
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ MultiEffect {
|
||||
colorization: 1
|
||||
|
||||
Behavior on colorizationColor {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ CheckBox {
|
||||
color: Colors.palette.m3surfaceVariant
|
||||
implicitHeight: control.checkHeight
|
||||
implicitWidth: control.checkWidth
|
||||
radius: Tokens.rounding.small / 2
|
||||
radius: Tokens.rounding.smallest / 2
|
||||
|
||||
CustomRect {
|
||||
color: Colors.palette.m3primary
|
||||
|
||||
@@ -7,6 +7,7 @@ ClippingRectangle {
|
||||
color: "transparent"
|
||||
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ ClippingWrapperRectangle {
|
||||
color: "transparent"
|
||||
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import QtQuick
|
||||
import qs.Services
|
||||
import qs.Helpers
|
||||
|
||||
Flickable {
|
||||
id: root
|
||||
|
||||
property bool doneFakeFlick
|
||||
|
||||
interactive: !ShellState.forActive().isDrawing
|
||||
interactive: !Visibilities.getForActive().isDrawing
|
||||
maximumFlickVelocity: 3000
|
||||
|
||||
rebound: Transition {
|
||||
@@ -28,9 +28,6 @@ Flickable {
|
||||
interval: 10
|
||||
running: root.doneFakeFlick
|
||||
|
||||
onTriggered: {
|
||||
root.doneFakeFlick = false;
|
||||
root.returnToBounds();
|
||||
}
|
||||
onTriggered: root.doneFakeFlick = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,33 @@
|
||||
import QtQuick
|
||||
import qs.Services
|
||||
import qs.Helpers
|
||||
|
||||
ListView {
|
||||
id: root
|
||||
|
||||
property bool doneFakeFlick
|
||||
|
||||
interactive: !ShellState.forActive()?.isDrawing
|
||||
interactive: !Visibilities.getForActive()?.isDrawing
|
||||
maximumFlickVelocity: 3000
|
||||
|
||||
rebound: Transition {
|
||||
// onRunningChanged: {
|
||||
// if (!running && !root.doneFakeFlick) {
|
||||
// root.doneFakeFlick = true;
|
||||
// root.flick(1, 1);
|
||||
// root.flick(-1, -1);
|
||||
// Qt.callLater(() => root.cancelFlick());
|
||||
// }
|
||||
// }
|
||||
onRunningChanged: {
|
||||
if (!running && !root.doneFakeFlick) {
|
||||
root.doneFakeFlick = true;
|
||||
root.flick(1, 1);
|
||||
root.flick(-1, -1);
|
||||
Qt.callLater(() => root.cancelFlick());
|
||||
}
|
||||
}
|
||||
|
||||
Anim {
|
||||
properties: "x,y"
|
||||
type: Anim.DefaultEffects
|
||||
}
|
||||
}
|
||||
|
||||
// Timer {
|
||||
// interval: 10
|
||||
// running: root.doneFakeFlick
|
||||
//
|
||||
// onTriggered: {
|
||||
// root.doneFakeFlick = false;
|
||||
// }
|
||||
// }
|
||||
Timer {
|
||||
interval: 10
|
||||
running: root.doneFakeFlick
|
||||
|
||||
onTriggered: root.doneFakeFlick = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ MouseArea {
|
||||
property int scrollAccumulatedY: 0
|
||||
|
||||
function onWheel(event: WheelEvent): void {
|
||||
event.accepted = false;
|
||||
}
|
||||
|
||||
onWheel: event => {
|
||||
|
||||
@@ -124,7 +124,8 @@ ProgressBar {
|
||||
anchors.left: parent.left
|
||||
|
||||
Behavior on implicitWidth {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: implicitWidth = Qt.binding(() => parent.width * root.visualPosition)
|
||||
@@ -221,7 +222,8 @@ ProgressBar {
|
||||
}
|
||||
}
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
Anim on waveProgress {
|
||||
duration: root.waveDuration
|
||||
|
||||
@@ -6,7 +6,7 @@ import qs.Services
|
||||
RadioButton {
|
||||
id: root
|
||||
|
||||
font: Tokens.font.body.medium
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
implicitHeight: Math.max(implicitIndicatorHeight, implicitContentHeight)
|
||||
implicitWidth: implicitIndicatorWidth + implicitContentWidth + contentItem.anchors.leftMargin
|
||||
|
||||
@@ -14,7 +14,7 @@ RadioButton {
|
||||
anchors.left: outerCircle.right
|
||||
anchors.leftMargin: 10
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font: root.font
|
||||
font.pointSize: root.font.pointSize
|
||||
text: root.text
|
||||
}
|
||||
indicator: Rectangle {
|
||||
@@ -29,7 +29,8 @@ RadioButton {
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
Behavior on border.color {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
|
||||
@@ -6,6 +6,7 @@ Rectangle {
|
||||
color: "transparent"
|
||||
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,32 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Templates
|
||||
import qs.Services
|
||||
import qs.Helpers
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
ScrollBar {
|
||||
id: root
|
||||
|
||||
required property Flickable flickable
|
||||
|
||||
readonly property bool isHorizontal: flickable && flickable.ScrollBar.horizontal === root
|
||||
readonly property real axisSize: isHorizontal ? flickable.width : flickable.height
|
||||
readonly property real axisContentSize: isHorizontal ? flickable.contentWidth : flickable.contentHeight
|
||||
readonly property real axisContentPos: isHorizontal ? (reversed ? flickable.contentX : (flickable.contentX - flickable.originX)) : (reversed ? flickable.contentY : (flickable.contentY - flickable.originY))
|
||||
readonly property real axisLength: isHorizontal ? root.width : root.height
|
||||
readonly property real effectiveSize: Math.max(nonAnimHeight, root.minimumSize)
|
||||
readonly property real effectiveTravel: Math.max(0, 1 - root.effectiveSize)
|
||||
readonly property real nonAnimHeight: root.axisSize / root.axisContentSize
|
||||
readonly property real nonAnimY: root.axisContentPos / root.axisContentSize
|
||||
required property Flickable flickable
|
||||
readonly property real nonAnimHeight: flickable.height / flickable.contentHeight
|
||||
readonly property real nonAnimY: flickable.contentY / flickable.contentHeight
|
||||
readonly property real rawTravel: Math.max(0, 1 - root.nonAnimHeight)
|
||||
readonly property bool reversed: isHorizontal ? (flickable instanceof ListView && flickable.layoutDirection === Qt.RightToLeft) : (flickable instanceof ListView && flickable.verticalLayoutDirection === ListView.BottomToTop)
|
||||
readonly property bool reversed: flickable instanceof ListView && flickable.verticalLayoutDirection === ListView.BottomToTop
|
||||
property bool shouldBeActive
|
||||
readonly property real travelScale: root.rawTravel > 0 ? root.effectiveTravel / root.rawTravel : 0
|
||||
|
||||
property bool shouldBeActive
|
||||
property bool inverted
|
||||
enabled: !Visibilities.getForActive().isDrawing
|
||||
implicitWidth: Tokens.padding.extraSmall * 2
|
||||
|
||||
enabled: !ShellState.forActive().isDrawing
|
||||
|
||||
implicitWidth: size === 1 ? 0 : isHorizontal ? 0 : Tokens.padding.extraSmall * 2
|
||||
implicitHeight: size === 1 ? 0 : isHorizontal ? Tokens.padding.extraSmall * 2 : 0
|
||||
|
||||
contentItem: Item {}
|
||||
contentItem: Item {
|
||||
}
|
||||
Behavior on position {
|
||||
enabled: !fullMouse.pressed
|
||||
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
onHoveredChanged: {
|
||||
@@ -56,27 +47,54 @@ ScrollBar {
|
||||
target: root.flickable
|
||||
}
|
||||
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
active: root.size < 1
|
||||
sourceComponent: root.isHorizontal ? horizontalTrack : verticalTrack
|
||||
}
|
||||
CustomClippingRect {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
implicitWidth: handle.implicitWidth
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
Component {
|
||||
id: verticalTrack
|
||||
CustomRect {
|
||||
id: handle
|
||||
|
||||
VerticalScrollBarTrack {
|
||||
scrollBar: root
|
||||
mouseArea: fullMouse
|
||||
}
|
||||
}
|
||||
anchors.right: parent.right
|
||||
color: Colors.palette.m3secondary
|
||||
implicitHeight: root.height * root.effectiveSize
|
||||
implicitWidth: fullMouse.pressed || fullMouse.containsMouse ? Tokens.padding.extraSmall * 2 : Tokens.padding.extraSmall
|
||||
opacity: {
|
||||
if (!root.enabled)
|
||||
return 0;
|
||||
if (root.size === 1)
|
||||
return 0;
|
||||
if (fullMouse.pressed)
|
||||
return 1;
|
||||
if (fullMouse.containsMouse)
|
||||
return 0.8;
|
||||
if (root.policy === ScrollBar.AlwaysOn || root.shouldBeActive)
|
||||
return 0.6;
|
||||
return 0;
|
||||
}
|
||||
radius: Tokens.rounding.full
|
||||
y: root.reversed ? root.height * (1 + root.nonAnimY) * root.travelScale : root.height * root.nonAnimY * root.travelScale
|
||||
|
||||
Component {
|
||||
id: horizontalTrack
|
||||
Behavior on implicitWidth {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
type: Anim.DefaultEffects
|
||||
}
|
||||
}
|
||||
|
||||
HorizontalScrollBarTrack {
|
||||
scrollBar: root
|
||||
mouseArea: fullMouse
|
||||
MouseArea {
|
||||
id: mouse
|
||||
|
||||
acceptedButtons: Qt.NoButton
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,40 +111,25 @@ ScrollBar {
|
||||
|
||||
property real pressOffset: 0
|
||||
|
||||
function contentPosFromThumbStart(thumbStart) {
|
||||
var visualPos = root.effectiveTravel > 0 ? thumbStart / root.travelScale : 0;
|
||||
return root.reversed ? (visualPos - 1) * root.axisContentSize : visualPos * root.axisContentSize;
|
||||
function contentYFromThumbTop(thumbTop) {
|
||||
var visualPos = root.effectiveTravel > 0 ? thumbTop / root.travelScale : 0;
|
||||
|
||||
return root.reversed ? (visualPos - 1) * root.flickable.contentHeight : visualPos * root.flickable.contentHeight;
|
||||
}
|
||||
|
||||
function updateFromEvent(event) {
|
||||
var eventPos = root.isHorizontal ? event.x : event.y;
|
||||
var posInTrack = eventPos / root.axisLength;
|
||||
var thumbStart = posInTrack - pressOffset;
|
||||
thumbStart = Math.max(0, Math.min(root.effectiveTravel, thumbStart));
|
||||
var posInTrack = event.y / root.height;
|
||||
var thumbTop = posInTrack - pressOffset;
|
||||
thumbTop = Math.max(0, Math.min(root.effectiveTravel, thumbTop));
|
||||
|
||||
var newPos = contentPosFromThumbStart(thumbStart);
|
||||
if (root.isHorizontal)
|
||||
root.flickable.contentX = newPos + (root.flickable.originX + (root.reversed ? root.flickable.contentWidth : 0));
|
||||
else
|
||||
root.flickable.contentY = newPos + (root.flickable.originY + (root.reversed ? root.flickable.contentHeight : 0));
|
||||
root.flickable.contentY = contentYFromThumbTop(thumbTop);
|
||||
}
|
||||
|
||||
function visualThumbStart() {
|
||||
function visualThumbTop() {
|
||||
const visualPos = root.reversed ? (1 + root.nonAnimY) : root.nonAnimY;
|
||||
return visualPos * root.travelScale;
|
||||
}
|
||||
|
||||
function onWheel(event: WheelEvent): void {
|
||||
if (root.horizontal) {
|
||||
event.accepted = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var delta = event.angleDelta.y > 0 ? -0.1 : 0.1;
|
||||
var newPos = Math.max(0, Math.min(1 - root.size, root.position + (root.inverted ? -delta : delta)));
|
||||
root.position = newPos;
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
cursorShape: undefined
|
||||
hoverEnabled: true
|
||||
@@ -137,15 +140,24 @@ ScrollBar {
|
||||
updateFromEvent(event);
|
||||
}
|
||||
onPressed: event => {
|
||||
var currentStart = visualThumbStart();
|
||||
var currentEnd = currentStart + root.effectiveSize;
|
||||
var eventPos = root.isHorizontal ? event.x : event.y;
|
||||
var clickPos = eventPos / root.axisLength;
|
||||
var currentTop = visualThumbTop();
|
||||
var currentBottom = currentTop + root.effectiveSize;
|
||||
var clickPos = event.y / root.height;
|
||||
|
||||
var clickedInsideThumb = clickPos >= currentStart && clickPos <= currentEnd;
|
||||
pressOffset = clickedInsideThumb ? (clickPos - currentStart) : root.effectiveSize / 2;
|
||||
var clickedInsideThumb = clickPos >= currentTop && clickPos <= currentBottom;
|
||||
|
||||
if (clickedInsideThumb) {
|
||||
pressOffset = clickPos - currentTop;
|
||||
} else {
|
||||
pressOffset = root.effectiveSize / 2;
|
||||
}
|
||||
|
||||
updateFromEvent(event);
|
||||
}
|
||||
onWheel: event => {
|
||||
var delta = event.angleDelta.y > 0 ? -0.1 : 0.1;
|
||||
var newPos = Math.max(0, Math.min(1 - root.size, root.position + delta));
|
||||
root.position = newPos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,13 +13,11 @@ Slider {
|
||||
|
||||
property bool animateWave
|
||||
property color bgColor: enabled ? Colors.palette.m3secondaryContainer : Qt.alpha(Colors.palette.m3onSurface, 0.1)
|
||||
readonly property bool dragging: mouse.pressed
|
||||
property color fgColor: enabled ? Colors.palette.m3primary : Qt.alpha(Colors.palette.m3onSurface, 0.38)
|
||||
property real filledWidth
|
||||
property alias inset: inset
|
||||
property color insetColor: enabled ? (inset.attached ? Colors.palette.m3onSecondaryContainer : Colors.palette.m3onPrimary) : Colors.palette.m3onSurface
|
||||
property string insetIcon: ""
|
||||
property bool interactionOnMove: true
|
||||
property real pos: visualPosition
|
||||
property int radius: Tokens.rounding.small
|
||||
property int waveDuration: 1000
|
||||
@@ -100,19 +98,15 @@ Slider {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.top: parent.top
|
||||
color: root.insetColor
|
||||
fontStyle: {
|
||||
if (root.height < 96)
|
||||
return Tokens.font.icon.pixelSize(24).build();
|
||||
else
|
||||
return Tokens.font.icon.pixelSize(32).build();
|
||||
}
|
||||
font.pixelSize: Tokens.font.size.smaller * 2
|
||||
text: root.insetIcon
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
visible: !root.wavy && root.insetIcon !== ""
|
||||
x: Tokens.spacing.extraSmall + dockT * (handle.x + Tokens.spacing.small)
|
||||
|
||||
Behavior on dockT {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +136,8 @@ Slider {
|
||||
startX: x
|
||||
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
Anim on waveProgress {
|
||||
duration: root.waveDuration
|
||||
@@ -159,7 +154,8 @@ Slider {
|
||||
Behavior on filledWidth {
|
||||
id: widthBehavior
|
||||
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
@@ -190,8 +186,7 @@ Slider {
|
||||
|
||||
onPositionChanged: e => {
|
||||
dragMovement = (e.x - pressStartX) / width;
|
||||
if (root.interactionOnMove)
|
||||
root.interaction(posBinding.value);
|
||||
root.interaction(posBinding.value);
|
||||
}
|
||||
onPressed: e => {
|
||||
widthBehavior.enabled = false;
|
||||
|
||||
@@ -38,9 +38,9 @@ DoubleSpinBox {
|
||||
horizontalAlignment: TextField.AlignHCenter
|
||||
implicitWidth: 65
|
||||
inputMethodHints: Qt.ImhFormattedNumbersOnly
|
||||
leftPadding: Tokens.padding.small
|
||||
leftPadding: Tokens.padding.larger
|
||||
readOnly: !root.editable
|
||||
rightPadding: Tokens.padding.small
|
||||
rightPadding: Tokens.padding.larger
|
||||
text: root.textFromValue(root.value, root.locale)
|
||||
validator: root.validator
|
||||
|
||||
|
||||
@@ -12,14 +12,14 @@ Row {
|
||||
}
|
||||
|
||||
property alias active: menu.active
|
||||
property color color: type == SplitButton.Filled ? Colors.palette.m3primary : Colors.palette.m3secondaryContainer
|
||||
property color color: type == CustomSplitButton.Filled ? Colors.palette.m3primary : Colors.palette.m3secondaryContainer
|
||||
property color disabledColor: Qt.alpha(Colors.palette.m3onSurface, 0.1)
|
||||
property color disabledTextColor: Qt.alpha(Colors.palette.m3onSurface, 0.38)
|
||||
readonly property alias expandBtn: expandBtn
|
||||
property alias expanded: menu.expanded
|
||||
property string fallbackIcon
|
||||
property string fallbackText
|
||||
property real horizontalPadding: Tokens.padding.medium
|
||||
property real horizontalPadding: Tokens.padding.larger
|
||||
readonly property alias iconLabel: iconLabel
|
||||
readonly property alias label: label
|
||||
readonly property alias menu: menu
|
||||
@@ -27,20 +27,20 @@ Row {
|
||||
property bool menuOnTop
|
||||
property real minLeftWidth
|
||||
readonly property alias stateLayer: stateLayer
|
||||
property color textColor: type == SplitButton.Filled ? Colors.palette.m3onPrimary : Colors.palette.m3onSecondaryContainer
|
||||
property color textColor: type == CustomSplitButton.Filled ? Colors.palette.m3onPrimary : Colors.palette.m3onSecondaryContainer
|
||||
readonly property alias textRow: textRow
|
||||
property int type: SplitButton.Filled
|
||||
property int type: CustomSplitButton.Filled
|
||||
property real verticalPadding: Tokens.padding.small
|
||||
|
||||
spacing: Math.floor(Tokens.spacing.extraSmall / 2)
|
||||
spacing: Math.floor(Tokens.spacing.extraSmall)
|
||||
|
||||
CustomRect {
|
||||
bottomRightRadius: Tokens.rounding.medium / 2
|
||||
bottomRightRadius: Tokens.rounding.small / 2
|
||||
color: !root.enabled ? root.disabledColor : root.color
|
||||
implicitHeight: expandBtn.implicitHeight
|
||||
implicitWidth: Math.max(root.minLeftWidth, textRow.implicitWidth + root.horizontalPadding * 2)
|
||||
radius: implicitHeight / 2 * Math.min(1, Tokens.rounding.scale)
|
||||
topRightRadius: Tokens.rounding.medium / 2
|
||||
topRightRadius: Tokens.rounding.small / 2
|
||||
|
||||
StateLayer {
|
||||
id: stateLayer
|
||||
@@ -92,7 +92,7 @@ Row {
|
||||
CustomRect {
|
||||
id: expandBtn
|
||||
|
||||
property real rad: root.expanded ? implicitHeight / 2 * Math.min(1, Tokens.rounding.scale) : Tokens.rounding.medium / 2
|
||||
property real rad: root.expanded ? implicitHeight / 2 * Math.min(1, Tokens.rounding.scale) : Tokens.rounding.small / 2
|
||||
|
||||
bottomLeftRadius: rad
|
||||
color: !root.enabled ? root.disabledColor : root.color
|
||||
@@ -102,7 +102,8 @@ Row {
|
||||
topLeftRadius: rad
|
||||
|
||||
Behavior on rad {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
@@ -126,10 +127,12 @@ Row {
|
||||
text: "expand_more"
|
||||
|
||||
Behavior on anchors.horizontalCenterOffset {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on rotation {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property alias active: splitButton.active
|
||||
property alias buttonAlias: splitButton
|
||||
property alias expanded: splitButton.expanded
|
||||
property int expandedZ: 100
|
||||
required property string label
|
||||
property alias menuItems: splitButton.menuItems
|
||||
property bool shouldBeActive: true
|
||||
property alias type: splitButton.type
|
||||
|
||||
signal selected(item: MenuItem)
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
clip: false
|
||||
implicitHeight: row.implicitHeight + Tokens.padding.smaller * 2
|
||||
opacity: shouldBeActive ? 1 : 0
|
||||
scale: shouldBeActive ? 1 : 0.8
|
||||
z: splitButton.menu.implicitHeight > 0 ? expandedZ : 1
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: row
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.margins: Tokens.padding.small
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Tokens.spacing.normal
|
||||
|
||||
CustomText {
|
||||
Layout.fillWidth: true
|
||||
color: root.enabled ? Colors.palette.m3onSurface : Colors.palette.m3onSurfaceVariant
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
text: root.label
|
||||
}
|
||||
|
||||
CustomSplitButton {
|
||||
id: splitButton
|
||||
|
||||
enabled: root.enabled
|
||||
type: CustomSplitButton.Filled
|
||||
z: 2
|
||||
|
||||
menu.onItemSelected: item => {
|
||||
root.selected(item);
|
||||
}
|
||||
stateLayer.onClicked: {
|
||||
splitButton.expanded = !splitButton.expanded;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
-25
@@ -13,12 +13,8 @@ Switch {
|
||||
implicitWidth: implicitIndicatorWidth
|
||||
|
||||
indicator: CustomRect {
|
||||
color: {
|
||||
if (!root.enabled)
|
||||
return root.checked ? Qt.alpha(Colors.palette.m3onSurface, 0.12) : Qt.alpha(Colors.palette.m3surfaceContainerHighest, 0.38);
|
||||
return root.checked ? Colors.palette.m3primary : Colors.layer(Colors.palette.m3surfaceContainerHighest, root.cLayer);
|
||||
}
|
||||
implicitHeight: 14 + Tokens.padding.small * 2
|
||||
color: root.checked && root.enabled ? Colors.palette.m3primary : Colors.layer(Colors.palette.m3surfaceContainerHighest, root.cLayer)
|
||||
implicitHeight: Tokens.font.size.medium + Tokens.padding.normal * 2
|
||||
implicitWidth: implicitHeight * 1.7
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
@@ -26,11 +22,7 @@ Switch {
|
||||
readonly property real nonAnimWidth: root.pressed ? implicitHeight * 1.2 : implicitHeight
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: {
|
||||
if (!root.enabled)
|
||||
return root.checked ? Qt.alpha(Colors.palette.m3surface, 0.7) : Qt.alpha(Colors.palette.m3onSurface, 0.12);
|
||||
return root.checked ? Colors.palette.m3onPrimary : Colors.layer(Colors.palette.m3outline, root.cLayer + 1);
|
||||
}
|
||||
color: root.checked && root.enabled ? Colors.palette.m3onPrimary : Colors.layer(Colors.palette.m3outline, root.cLayer + 1)
|
||||
implicitHeight: parent.implicitHeight - Tokens.padding.extraSmall
|
||||
implicitWidth: nonAnimWidth
|
||||
radius: Tokens.rounding.full
|
||||
@@ -100,37 +92,38 @@ Switch {
|
||||
|
||||
anchors.centerIn: parent
|
||||
asynchronous: true
|
||||
height: parent.implicitHeight - Tokens.padding.medium
|
||||
height: parent.implicitHeight - Tokens.padding.larger
|
||||
preferredRendererType: Shape.CurveRenderer
|
||||
width: height
|
||||
|
||||
Behavior on end1 {
|
||||
PropAnim {}
|
||||
PropAnim {
|
||||
}
|
||||
}
|
||||
Behavior on end2 {
|
||||
PropAnim {}
|
||||
PropAnim {
|
||||
}
|
||||
}
|
||||
Behavior on start1 {
|
||||
PropAnim {}
|
||||
PropAnim {
|
||||
}
|
||||
}
|
||||
Behavior on start2 {
|
||||
PropAnim {}
|
||||
PropAnim {
|
||||
}
|
||||
}
|
||||
|
||||
ShapePath {
|
||||
capStyle: Tokens.rounding.scale === 0 ? ShapePath.SquareCap : ShapePath.RoundCap
|
||||
capStyle: ShapePath.RoundCap
|
||||
fillColor: "transparent"
|
||||
startX: icon.start1.x
|
||||
startY: icon.start1.y
|
||||
strokeColor: {
|
||||
if (!root.enabled)
|
||||
return root.checked ? Colors.palette.m3outline : Colors.palette.m3surfaceContainer;
|
||||
return root.checked ? Colors.palette.m3primary : Colors.palette.m3surfaceContainerHighest;
|
||||
}
|
||||
strokeWidth: 16 * 0.15
|
||||
strokeColor: root.checked && root.enabled ? Colors.palette.m3primary : Colors.palette.m3surfaceContainerHighest
|
||||
strokeWidth: Tokens.font.size.larger * 0.15
|
||||
|
||||
Behavior on strokeColor {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
|
||||
PathLine {
|
||||
@@ -160,6 +153,6 @@ Switch {
|
||||
|
||||
component PropAnim: PropertyAnimation {
|
||||
duration: Tokens.anim.durations.expressiveFastSpatial
|
||||
easing: Tokens.anim.expressiveFastSpatial
|
||||
easing.bezierCurve: Tokens.anim.curves.expressiveFastSpatial
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,15 @@ Text {
|
||||
property real animateTo: 1
|
||||
|
||||
color: Colors.palette.m3onSurface
|
||||
font: Tokens.font.body.small
|
||||
font.family: Config.appearance.font.family.sans
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
linkColor: Colors.palette.m3onPrimaryFixedVariant
|
||||
renderType: Text.QtRendering
|
||||
renderType: Text.NativeRendering
|
||||
textFormat: Text.PlainText
|
||||
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
Behavior on text {
|
||||
enabled: root.animate
|
||||
@@ -32,7 +34,8 @@ Text {
|
||||
type: Anim.FastEffects
|
||||
}
|
||||
|
||||
PropertyAction {}
|
||||
PropertyAction {
|
||||
}
|
||||
|
||||
TAnim {
|
||||
target: root
|
||||
|
||||
@@ -15,33 +15,29 @@ TextFieldBase {
|
||||
|
||||
readonly property int clampedRadius: Math.min(horizontalPadding, Math.min(width, height) / 2, radius)
|
||||
readonly property string effectiveSupportingText: isError && errorText ? errorText : supportingText
|
||||
readonly property int filledOffset: type === CustomTextField.Filled ? Tokens.spacing.small : 0
|
||||
readonly property int leadingOffset: leadingIcon ? leadingIconLoader.width + leadingIconLoader.anchors.leftMargin : 0
|
||||
readonly property real smallFontScale: smallFontSize / font.pointSize
|
||||
readonly property int supportingTextOffset: effectiveSupportingText ? supportingTextLoader.height + Tokens.spacing.extraSmall : 0
|
||||
readonly property int trailingOffset: trailingIcon ? trailingIconLoader.width + trailingIconLoader.anchors.rightMargin : 0
|
||||
readonly property bool valid: !validate || (!text && emptyIsValid) || (validate instanceof RegExp ? validate.test(text) : !!validate(text))
|
||||
|
||||
property int horizontalPadding: Tokens.padding.large
|
||||
property int verticalPadding: Tokens.padding.large
|
||||
|
||||
property int radius: Tokens.rounding.small
|
||||
|
||||
property string supportingText
|
||||
property string trailingIcon
|
||||
property int smallFontSize: Tokens.font.label.small.pointSize
|
||||
|
||||
property int type: CustomTextField.Outlined
|
||||
property var validate // Regex or function
|
||||
property bool emptyIsValid: true
|
||||
property string errorText
|
||||
readonly property int filledOffset: type === CustomTextField.Filled ? Tokens.spacing.small : 0
|
||||
readonly property int horizontalPadding: Tokens.padding.large
|
||||
property bool isError
|
||||
property string leadingIcon
|
||||
readonly property int leadingOffset: leadingIcon ? leadingIconLoader.width + leadingIconLoader.anchors.leftMargin : 0
|
||||
property int radius: Tokens.rounding.small
|
||||
property alias sLayer: stateLayer
|
||||
readonly property real smallFontScale: smallFontSize / font.pointSize
|
||||
property int smallFontSize: Tokens.font.size.small
|
||||
property string supportingText
|
||||
readonly property int supportingTextOffset: effectiveSupportingText ? supportingTextLoader.height + Tokens.spacing.extraSmall : 0
|
||||
property string trailingIcon
|
||||
readonly property int trailingOffset: trailingIcon ? trailingIconLoader.width + trailingIconLoader.anchors.rightMargin : 0
|
||||
property int type: CustomTextField.Outlined
|
||||
readonly property bool valid: !validate || (!text && emptyIsValid) || (validate instanceof RegExp ? validate.test(text) : !!validate(text))
|
||||
property var validate // Regex or function
|
||||
|
||||
bottomPadding: verticalPadding + supportingTextOffset - filledOffset
|
||||
bottomPadding: Tokens.padding.large + supportingTextOffset - filledOffset
|
||||
leftPadding: horizontalPadding + leadingOffset
|
||||
rightPadding: horizontalPadding + trailingOffset
|
||||
topPadding: verticalPadding + filledOffset
|
||||
topPadding: Tokens.padding.large + filledOffset
|
||||
|
||||
background: Loader {
|
||||
anchors.bottomMargin: root.supportingTextOffset
|
||||
@@ -134,8 +130,8 @@ TextFieldBase {
|
||||
}
|
||||
|
||||
AnchorAnim {
|
||||
duration: Tokens.anim.durations.expressiveDefaultEffects
|
||||
easing: Tokens.anim.expressiveDefaultEffects
|
||||
duration: Tokens.anim.durations.expressiveEffects
|
||||
easing.bezierCurve: Tokens.anim.curves.expressiveEffects
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,13 +141,13 @@ TextFieldBase {
|
||||
|
||||
active: root.leadingIcon
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Tokens.padding.small
|
||||
anchors.leftMargin: Tokens.padding.normal
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
sourceComponent: MaterialIcon {
|
||||
color: Colors.palette.m3onSurfaceVariant
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
text: root.leadingIcon
|
||||
fontStyle: Tokens.font.icon.builders.medium.scale(0.9).build()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,13 +156,12 @@ TextFieldBase {
|
||||
|
||||
active: root.trailingIcon
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Tokens.padding.small
|
||||
anchors.rightMargin: Tokens.padding.normal
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
sourceComponent: MaterialIcon {
|
||||
color: Colors.palette.m3onSurfaceVariant
|
||||
text: root.trailingIcon
|
||||
fontStyle: Tokens.font.icon.builders.medium.scale(0.9).build()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,7 +176,7 @@ TextFieldBase {
|
||||
|
||||
sourceComponent: CustomText {
|
||||
color: root.isError ? Colors.palette.m3error : Colors.palette.m3onSurfaceVariant
|
||||
font: Tokens.font.label.small
|
||||
font.pointSize: Tokens.font.size.small
|
||||
text: root.effectiveSupportingText
|
||||
}
|
||||
}
|
||||
@@ -219,10 +214,12 @@ TextFieldBase {
|
||||
}
|
||||
}
|
||||
Behavior on strokeColor {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
Behavior on strokeWidth {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
PathLine {
|
||||
@@ -297,7 +294,8 @@ TextFieldBase {
|
||||
implicitHeight: root.activeFocus ? 2 : 1
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,8 @@ Image {
|
||||
value: root.source
|
||||
}
|
||||
|
||||
PropertyAction {}
|
||||
PropertyAction {
|
||||
}
|
||||
|
||||
ScriptAction {
|
||||
script: root.maybeStartInAnim()
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
|
||||
ShaderEffect {
|
||||
id: root
|
||||
|
||||
property Item target: parent
|
||||
|
||||
property real glowSize: 40
|
||||
property real innerGlow: 0
|
||||
property real lineWidth: 2
|
||||
property real intensity: 1.0
|
||||
property real speed: 1.0
|
||||
property int period: 6000
|
||||
property bool running: true
|
||||
|
||||
property color color1: "#4285F4"
|
||||
property color color2: "#9B72CB"
|
||||
property color color3: "#D96570"
|
||||
property color color4: "#F2A54A"
|
||||
|
||||
readonly property size itemSize: Qt.size(width, height)
|
||||
readonly property size rectSize: target ? Qt.size(target.width, target.height) : Qt.size(0, 0)
|
||||
readonly property real radius: (target as Rectangle).radius ?? 0
|
||||
property real phase: 0
|
||||
|
||||
anchors.fill: target
|
||||
anchors.margins: -glowSize
|
||||
z: -1
|
||||
|
||||
enabled: false
|
||||
|
||||
fragmentShader: Qt.resolvedUrl(`${Quickshell.shellDir}/assets/shaders/geminiglow.frag.qsb`)
|
||||
|
||||
FrameAnimation {
|
||||
running: root.running && root.visible
|
||||
onTriggered: {
|
||||
const dt = frameTime * 1000;
|
||||
root.phase = (root.phase + dt * root.speed / root.period) % 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
import QtQuick
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
Item {
|
||||
id: track
|
||||
|
||||
required property var scrollBar
|
||||
required property var mouseArea
|
||||
|
||||
ClipRect {
|
||||
radius: Tokens.rounding.full
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
implicitHeight: handle.implicitHeight
|
||||
|
||||
CustomRect {
|
||||
id: handle
|
||||
|
||||
anchors.bottom: parent.bottom
|
||||
color: Colors.palette.m3secondary
|
||||
implicitWidth: track.scrollBar.width * track.scrollBar.effectiveSize
|
||||
implicitHeight: track.mouseArea.pressed || track.mouseArea.containsMouse ? Tokens.padding.extraSmall * 2 : Tokens.padding.extraSmall
|
||||
opacity: {
|
||||
if (!track.scrollBar.enabled)
|
||||
return 0;
|
||||
if (track.scrollBar.size === 1)
|
||||
return 0;
|
||||
if (track.mouseArea.pressed)
|
||||
return 1;
|
||||
if (track.mouseArea.containsMouse)
|
||||
return 0.8;
|
||||
if (track.scrollBar.policy === CustomScrollBar.AlwaysOn || track.scrollBar.shouldBeActive)
|
||||
return 0.6;
|
||||
return 0;
|
||||
}
|
||||
radius: Tokens.rounding.full
|
||||
x: track.scrollBar.reversed ? track.scrollBar.width * (1 + track.scrollBar.nonAnimY) * track.scrollBar.travelScale : track.scrollBar.width * track.scrollBar.nonAnimY * track.scrollBar.travelScale
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Anim {}
|
||||
}
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
type: Anim.DefaultEffects
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
acceptedButtons: Qt.NoButton
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ ButtonBase {
|
||||
property alias icon: label.text
|
||||
readonly property alias label: label
|
||||
|
||||
font: Tokens.font.icon.medium
|
||||
activeColor: type === IconButton.Filled ? Colors.palette.m3primary : Colors.palette.m3secondary
|
||||
activeOnColor: type === IconButton.Filled ? Colors.palette.m3onPrimary : type === IconButton.Tonal ? Colors.palette.m3onSecondary : Colors.palette.m3primary
|
||||
implicitHeight: {
|
||||
@@ -28,7 +27,7 @@ ButtonBase {
|
||||
return Colors.palette.m3onPrimary;
|
||||
return type === IconButton.Tonal ? Colors.palette.m3onSecondaryContainer : Colors.palette.m3onSurfaceVariant;
|
||||
}
|
||||
padding: type === IconButton.Text ? Tokens.padding.extraSmall / 2 : Tokens.padding.extraSmall
|
||||
padding: type === IconButton.Text ? Tokens.padding.extraSmall / 2 : Tokens.padding.small
|
||||
|
||||
MaterialIcon {
|
||||
id: label
|
||||
@@ -37,7 +36,7 @@ ButtonBase {
|
||||
anchors.verticalCenterOffset: 1
|
||||
color: root.onColor
|
||||
fill: !root.isToggle || root.internalChecked ? 1 : 0
|
||||
fontStyle: root.font
|
||||
font.pointSize: root.font.pointSize
|
||||
|
||||
Behavior on fill {
|
||||
Anim {
|
||||
|
||||
@@ -17,7 +17,7 @@ ButtonBase {
|
||||
return Colors.palette.m3primary;
|
||||
return type === TextButton.Filled ? Colors.palette.m3onPrimary : Colors.palette.m3onSecondary;
|
||||
}
|
||||
horizontalPadding: Tokens.padding.small
|
||||
horizontalPadding: Tokens.padding.larger
|
||||
implicitHeight: row.implicitHeight + verticalPadding * 2
|
||||
implicitWidth: row.implicitWidth + horizontalPadding * 2
|
||||
inactiveColor: {
|
||||
@@ -32,7 +32,7 @@ ButtonBase {
|
||||
return Colors.palette.m3primary;
|
||||
return type === TextButton.Filled ? Colors.palette.m3onSurface : Colors.palette.m3onSecondaryContainer;
|
||||
}
|
||||
verticalPadding: Tokens.padding.extraSmall
|
||||
verticalPadding: Tokens.padding.small
|
||||
|
||||
RowLayout {
|
||||
id: row
|
||||
@@ -46,9 +46,10 @@ ButtonBase {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
color: root.onColor
|
||||
fill: root.internalChecked ? 1 : 0
|
||||
fontStyle: {
|
||||
font: {
|
||||
const f = Qt.font(root.font);
|
||||
f.pointSize = Math.round(root.font.pointSize * 1.2);
|
||||
f.family = "Material Symbols Rounded";
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,470 +0,0 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property list<var> values
|
||||
|
||||
property int xSteps: 24
|
||||
property real yMin: NaN
|
||||
property real yMax: NaN
|
||||
property real yPaddingTop: 0
|
||||
property real yPaddingBottom: 0
|
||||
|
||||
property int verticalLineStep: 0
|
||||
property int horizontalLineStep: 0
|
||||
property bool firstXLine: true
|
||||
property bool lastXLine: false
|
||||
property int minHorizontalLines: 0
|
||||
|
||||
property var xLabel: null
|
||||
property var yLabel: null
|
||||
|
||||
property real smoothing: 0
|
||||
property bool curveSmoothing: true
|
||||
property real markerX: -1
|
||||
property real markerGap: 2 // px gap between line and marker dot edge, each side
|
||||
|
||||
property color lineColor: "white"
|
||||
property color gridColor: "white"
|
||||
property color markerColor: "white"
|
||||
property color labelColor: "white"
|
||||
property real gridAlpha: 0.12
|
||||
property real labelAlpha: 0.6
|
||||
property real fillAlpha: 0.15
|
||||
property real lineWidth: 2
|
||||
property real markerDotRadius: 4
|
||||
property real labelFontSize: 10
|
||||
|
||||
Canvas {
|
||||
id: canvas
|
||||
|
||||
anchors.fill: parent
|
||||
renderStrategy: Canvas.Immediate
|
||||
|
||||
onWidthChanged: requestPaint()
|
||||
onHeightChanged: requestPaint()
|
||||
|
||||
function strokeCurve(ctx, pts) {
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(pts[0].x, pts[0].y);
|
||||
|
||||
if (root.curveSmoothing && pts.length > 2) {
|
||||
const k = 1 / 6;
|
||||
const n = pts.length;
|
||||
|
||||
for (let i = 0; i < n - 1; i++) {
|
||||
const p0 = pts[Math.max(i - 1, 0)];
|
||||
const p1 = pts[i];
|
||||
const p2 = pts[i + 1];
|
||||
const p3 = pts[Math.min(i + 2, n - 1)];
|
||||
|
||||
let c1x = p1.x + (p2.x - p0.x) * k;
|
||||
let c1y = p1.y + (p2.y - p0.y) * k;
|
||||
let c2x = p2.x - (p3.x - p1.x) * k;
|
||||
let c2y = p2.y - (p3.y - p1.y) * k;
|
||||
|
||||
const minY = Math.min(p1.y, p2.y);
|
||||
const maxY = Math.max(p1.y, p2.y);
|
||||
c1y = Math.max(minY, Math.min(maxY, c1y));
|
||||
c2y = Math.max(minY, Math.min(maxY, c2y));
|
||||
|
||||
ctx.bezierCurveTo(c1x, c1y, c2x, c2y, p2.x, p2.y);
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < pts.length - 1; i++) {
|
||||
const p0 = pts[i];
|
||||
const p1 = pts[i + 1];
|
||||
const cx = (p0.x + p1.x) * 0.5;
|
||||
ctx.bezierCurveTo(cx, p0.y, cx, p1.y, p1.x, p1.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Control points for segment i (pts[i] -> pts[i+1]), matching strokeCurve
|
||||
function segmentControls(pts, i) {
|
||||
const p0 = pts[Math.max(i - 1, 0)];
|
||||
const p1 = pts[i];
|
||||
const p2 = pts[i + 1];
|
||||
const p3 = pts[Math.min(i + 2, pts.length - 1)];
|
||||
|
||||
if (root.curveSmoothing && pts.length > 2) {
|
||||
const k = 1 / 6;
|
||||
let c1x = p1.x + (p2.x - p0.x) * k;
|
||||
let c1y = p1.y + (p2.y - p0.y) * k;
|
||||
let c2x = p2.x - (p3.x - p1.x) * k;
|
||||
let c2y = p2.y - (p3.y - p1.y) * k;
|
||||
|
||||
const minY = Math.min(p1.y, p2.y);
|
||||
const maxY = Math.max(p1.y, p2.y);
|
||||
c1y = Math.max(minY, Math.min(maxY, c1y));
|
||||
c2y = Math.max(minY, Math.min(maxY, c2y));
|
||||
|
||||
return [c1x, c1y, c2x, c2y];
|
||||
}
|
||||
|
||||
const cx = (p1.x + p2.x) * 0.5;
|
||||
return [cx, p1.y, cx, p2.y];
|
||||
}
|
||||
|
||||
// Point on the curve at a given x (x is monotonic per segment)
|
||||
function pointAtX(pts, targetX) {
|
||||
let j = pts.length - 2;
|
||||
for (let i = 0; i < pts.length - 1; i++) {
|
||||
if (targetX <= pts[i + 1].x) {
|
||||
j = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const p1 = pts[j];
|
||||
const p2 = pts[j + 1];
|
||||
const [c1x, c1y, c2x, c2y] = segmentControls(pts, j);
|
||||
|
||||
let tlo = 0;
|
||||
let thi = 1;
|
||||
for (let it = 0; it < 24; it++) {
|
||||
const tm = (tlo + thi) / 2;
|
||||
const u = 1 - tm;
|
||||
const x = u * u * u * p1.x + 3 * u * u * tm * c1x + 3 * u * tm * tm * c2x + tm * tm * tm * p2.x;
|
||||
if (x < targetX)
|
||||
tlo = tm;
|
||||
else
|
||||
thi = tm;
|
||||
}
|
||||
|
||||
const t = (tlo + thi) / 2;
|
||||
const u = 1 - t;
|
||||
const y = u * u * u * p1.y + 3 * u * u * t * c1y + 3 * u * t * t * c2y + t * t * t * p2.y;
|
||||
return {
|
||||
x: targetX,
|
||||
y
|
||||
};
|
||||
}
|
||||
|
||||
// Part of the curve left/right of a cut x, including the cut point
|
||||
function cutLeft(pts, targetX) {
|
||||
if (targetX <= pts[0].x)
|
||||
return [];
|
||||
if (targetX >= pts[pts.length - 1].x)
|
||||
return pts.slice();
|
||||
|
||||
let j = pts.length - 2;
|
||||
for (let i = 0; i < pts.length - 1; i++) {
|
||||
if (targetX <= pts[i + 1].x) {
|
||||
j = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const left = pts.slice(0, j + 1);
|
||||
if (targetX > pts[j].x)
|
||||
left.push(pointAtX(pts, targetX));
|
||||
return left;
|
||||
}
|
||||
|
||||
function cutRight(pts, targetX) {
|
||||
if (targetX >= pts[pts.length - 1].x)
|
||||
return [];
|
||||
if (targetX <= pts[0].x)
|
||||
return pts.slice();
|
||||
|
||||
let j = pts.length - 2;
|
||||
for (let i = 0; i < pts.length - 1; i++) {
|
||||
if (targetX <= pts[i + 1].x) {
|
||||
j = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const right = pts.slice(j + 1);
|
||||
if (targetX < pts[j + 1].x)
|
||||
right.unshift(pointAtX(pts, targetX));
|
||||
return right;
|
||||
}
|
||||
|
||||
onPaint: {
|
||||
const ctx = getContext("2d");
|
||||
ctx.reset();
|
||||
|
||||
const W = width;
|
||||
const H = height;
|
||||
if (W < 2 || H < 2)
|
||||
return;
|
||||
|
||||
const padLeft = root.labelFontSize * 3.4;
|
||||
const padRight = 2;
|
||||
const padTop = 2;
|
||||
const padBottom = root.labelFontSize + 8;
|
||||
const plot = {
|
||||
x: padLeft,
|
||||
y: padTop,
|
||||
w: W - padLeft - padRight,
|
||||
h: H - padTop - padBottom
|
||||
};
|
||||
if (plot.w < 2 || plot.h < 2)
|
||||
return;
|
||||
|
||||
// Auto-fit: NaN yMin/yMax derive from the data, snapped to the
|
||||
// horizontal step grid, honoring minHorizontalLines
|
||||
let lo = root.yMin;
|
||||
let hi = root.yMax;
|
||||
const loAuto = Number.isNaN(lo);
|
||||
const hiAuto = Number.isNaN(hi);
|
||||
|
||||
if (loAuto || hiAuto) {
|
||||
let dmin = Infinity;
|
||||
let dmax = -Infinity;
|
||||
for (const v of root.values) {
|
||||
if (v == null)
|
||||
continue;
|
||||
if (v < dmin)
|
||||
dmin = v;
|
||||
if (v > dmax)
|
||||
dmax = v;
|
||||
}
|
||||
if (dmin === Infinity) {
|
||||
dmin = 0;
|
||||
dmax = 1;
|
||||
}
|
||||
|
||||
const step = root.horizontalLineStep;
|
||||
const minSteps = root.minHorizontalLines > 1 ? root.minHorizontalLines - 1 : 0;
|
||||
|
||||
if (step > 0) {
|
||||
if (hiAuto) {
|
||||
const baseLo = loAuto ? Math.floor(dmin / step) * step : lo;
|
||||
const span = Math.max(Math.ceil((dmax - baseLo) / step), minSteps, 1);
|
||||
lo = baseLo;
|
||||
hi = baseLo + span * step;
|
||||
} else {
|
||||
const span = Math.max(Math.ceil((hi - dmin) / step), minSteps, 1);
|
||||
lo = hi - span * step;
|
||||
}
|
||||
} else {
|
||||
if (loAuto)
|
||||
lo = dmin;
|
||||
if (hiAuto)
|
||||
hi = dmax;
|
||||
if (hi <= lo)
|
||||
hi = lo + 1;
|
||||
}
|
||||
}
|
||||
|
||||
const scaleBottom = lo - root.yPaddingBottom;
|
||||
const scaleTop = hi + root.yPaddingTop;
|
||||
const range = scaleTop - scaleBottom;
|
||||
if (range <= 0 || root.xSteps < 1)
|
||||
return;
|
||||
|
||||
let series = root.values;
|
||||
if (root.smoothing > 0 && series.length > 0) {
|
||||
const radius = Math.round(root.smoothing);
|
||||
const raw = series;
|
||||
series = raw.map((v, i) => {
|
||||
if (v == null)
|
||||
return null;
|
||||
|
||||
let sum = 0;
|
||||
let n = 0;
|
||||
for (let j = -radius; j <= radius; j++) {
|
||||
const u = raw[i + j];
|
||||
if (u != null) {
|
||||
sum += u;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
return n > 0 ? sum / n : null;
|
||||
});
|
||||
}
|
||||
|
||||
const xAt = i => plot.x + (i / root.xSteps) * plot.w;
|
||||
const yAt = v => plot.y + (1 - (v - scaleBottom) / range) * plot.h;
|
||||
const crisp = v => Math.floor(v) + 0.5;
|
||||
|
||||
// 1. Grid lines
|
||||
ctx.strokeStyle = Qt.alpha(root.gridColor, root.gridAlpha);
|
||||
ctx.lineWidth = 1;
|
||||
|
||||
if (root.verticalLineStep > 0) {
|
||||
for (let i = 0; i <= root.xSteps; i += root.verticalLineStep) {
|
||||
if (i === 0 && !root.firstXLine)
|
||||
continue;
|
||||
if (i === root.xSteps && !root.lastXLine)
|
||||
continue;
|
||||
|
||||
const x = crisp(xAt(i));
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x, plot.y);
|
||||
ctx.lineTo(x, H);
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
// Lines extend down into yPaddingBottom, snapped to the grid
|
||||
const vStart = lo - (root.yPaddingBottom > 0 ? Math.floor(root.yPaddingBottom / root.horizontalLineStep) * root.horizontalLineStep : 0);
|
||||
|
||||
if (root.horizontalLineStep > 0) {
|
||||
for (let v = vStart; v <= hi + 0.001; v += root.horizontalLineStep) {
|
||||
const y = crisp(yAt(v));
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0, y);
|
||||
ctx.lineTo(plot.x + plot.w, y);
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Labels
|
||||
ctx.fillStyle = Qt.alpha(root.labelColor, root.labelAlpha);
|
||||
ctx.font = root.labelFontSize + "px sans-serif";
|
||||
|
||||
ctx.textAlign = "left";
|
||||
ctx.textBaseline = "top";
|
||||
if (root.verticalLineStep > 0 && root.xLabel) {
|
||||
for (let i = 0; i <= root.xSteps; i += root.verticalLineStep) {
|
||||
if (i === 0 && !root.firstXLine)
|
||||
continue;
|
||||
if (i === root.xSteps && !root.lastXLine)
|
||||
continue;
|
||||
|
||||
const text = root.xLabel(i);
|
||||
if (text)
|
||||
ctx.fillText(text, xAt(i) + 4, plot.y + plot.h + 4);
|
||||
}
|
||||
}
|
||||
|
||||
ctx.textBaseline = "bottom";
|
||||
if (root.horizontalLineStep > 0 && root.yLabel) {
|
||||
for (let v = vStart; v <= hi + 0.001; v += root.horizontalLineStep) {
|
||||
const text = root.yLabel(v);
|
||||
if (text)
|
||||
ctx.fillText(text, 2, yAt(v) - 2);
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Curve, split into segments at null gaps
|
||||
const segments = [];
|
||||
let current = null;
|
||||
for (let i = 0; i < series.length; i++) {
|
||||
if (series[i] == null) {
|
||||
if (current)
|
||||
segments.push(current);
|
||||
current = null;
|
||||
continue;
|
||||
}
|
||||
const pt = {
|
||||
x: xAt(i),
|
||||
y: yAt(series[i])
|
||||
};
|
||||
if (!current)
|
||||
current = [];
|
||||
current.push(pt);
|
||||
}
|
||||
if (current)
|
||||
segments.push(current);
|
||||
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
const hasMarker = root.markerX >= 0 && root.markerX <= root.xSteps;
|
||||
const markerPx = hasMarker ? xAt(root.markerX) : 0;
|
||||
let gapPx = 0;
|
||||
if (hasMarker) {
|
||||
// markerGap is measured from the dot edge, perpendicular to the
|
||||
// curve; project onto x via the local curve slope
|
||||
let slope = 0;
|
||||
const seg = segments.find(s => s[0].x <= markerPx && markerPx <= s[s.length - 1].x);
|
||||
if (seg && seg.length > 2 && markerPx - 1 >= seg[0].x && markerPx + 1 <= seg[seg.length - 1].x)
|
||||
slope = (pointAtX(seg, markerPx + 1).y - pointAtX(seg, markerPx - 1).y) / 2;
|
||||
gapPx = (root.markerDotRadius + root.markerGap) / Math.sqrt(1 + slope * slope);
|
||||
}
|
||||
|
||||
for (const seg of segments) {
|
||||
if (seg.length < 2)
|
||||
continue;
|
||||
|
||||
// Fill stays continuous under the marker
|
||||
ctx.fillStyle = Qt.alpha(root.lineColor, root.fillAlpha);
|
||||
strokeCurve(ctx, seg);
|
||||
ctx.lineTo(seg[seg.length - 1].x, plot.y + plot.h);
|
||||
ctx.lineTo(seg[0].x, plot.y + plot.h);
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
|
||||
// Stroke has a gap around the marker
|
||||
const pieces = hasMarker ? [cutLeft(seg, markerPx - gapPx), cutRight(seg, markerPx + gapPx)] : [seg];
|
||||
|
||||
for (const pts of pieces) {
|
||||
if (pts.length < 2)
|
||||
continue;
|
||||
|
||||
ctx.strokeStyle = root.lineColor;
|
||||
ctx.lineWidth = root.lineWidth;
|
||||
strokeCurve(ctx, pts);
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Marker: dashed vertical + dot
|
||||
if (root.markerX >= 0 && root.markerX <= root.xSteps) {
|
||||
const x = markerPx;
|
||||
|
||||
ctx.setLineDash([4, 4]);
|
||||
ctx.strokeStyle = Qt.alpha(root.markerColor, 0.6);
|
||||
ctx.lineWidth = 1;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(crisp(x), plot.y);
|
||||
ctx.lineTo(crisp(x), H);
|
||||
ctx.stroke();
|
||||
ctx.setLineDash([]);
|
||||
|
||||
const i0 = Math.floor(root.markerX);
|
||||
const v0 = series[i0];
|
||||
const v1 = series[i0 + 1];
|
||||
let y = null;
|
||||
|
||||
if (v0 != null && v1 != null)
|
||||
y = yAt(v0 + (v1 - v0) * (root.markerX - i0));
|
||||
else if (v0 != null)
|
||||
y = yAt(v0);
|
||||
|
||||
if (y != null) {
|
||||
ctx.fillStyle = root.markerColor;
|
||||
ctx.beginPath();
|
||||
ctx.arc(x, y, root.markerDotRadius, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onValuesChanged: canvas.requestPaint()
|
||||
onXStepsChanged: canvas.requestPaint()
|
||||
onYMinChanged: canvas.requestPaint()
|
||||
onYMaxChanged: canvas.requestPaint()
|
||||
onYPaddingTopChanged: canvas.requestPaint()
|
||||
onYPaddingBottomChanged: canvas.requestPaint()
|
||||
onVerticalLineStepChanged: canvas.requestPaint()
|
||||
onHorizontalLineStepChanged: canvas.requestPaint()
|
||||
onFirstXLineChanged: canvas.requestPaint()
|
||||
onLastXLineChanged: canvas.requestPaint()
|
||||
onMinHorizontalLinesChanged: canvas.requestPaint()
|
||||
onXLabelChanged: canvas.requestPaint()
|
||||
onYLabelChanged: canvas.requestPaint()
|
||||
onSmoothingChanged: canvas.requestPaint()
|
||||
onCurveSmoothingChanged: canvas.requestPaint()
|
||||
onMarkerXChanged: canvas.requestPaint()
|
||||
onMarkerGapChanged: canvas.requestPaint()
|
||||
onLineColorChanged: canvas.requestPaint()
|
||||
onGridColorChanged: canvas.requestPaint()
|
||||
onMarkerColorChanged: canvas.requestPaint()
|
||||
onLabelColorChanged: canvas.requestPaint()
|
||||
onGridAlphaChanged: canvas.requestPaint()
|
||||
onLabelAlphaChanged: canvas.requestPaint()
|
||||
onFillAlphaChanged: canvas.requestPaint()
|
||||
onLineWidthChanged: canvas.requestPaint()
|
||||
onMarkerDotRadiusChanged: canvas.requestPaint()
|
||||
onLabelFontSizeChanged: canvas.requestPaint()
|
||||
}
|
||||
@@ -64,7 +64,8 @@ MaterialShape {
|
||||
to: 360
|
||||
}
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
|
||||
ElapsedTimer {
|
||||
|
||||
+134
-150
@@ -18,14 +18,13 @@ Item {
|
||||
property real leftFadeStrength: overflowing && leftFadeEnabled ? fadeStrengthMoving : fadeStrengthIdle
|
||||
property int leftFadeWidth: 28
|
||||
property bool marqueeEnabled: true
|
||||
readonly property bool overflowing: metrics.width > content.width
|
||||
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
|
||||
property bool vertical: false
|
||||
|
||||
function durationForDistance(px): int {
|
||||
return Math.max(1, Math.round(Math.abs(px) / root.pixelsPerSecond * 1000));
|
||||
@@ -42,198 +41,183 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
clip: false
|
||||
implicitHeight: vertical ? elideText.implicitWidth : elideText.implicitHeight
|
||||
implicitWidth: vertical ? elideText.implicitHeight : elideText.implicitWidth
|
||||
clip: true
|
||||
implicitHeight: elideText.implicitHeight
|
||||
|
||||
Behavior on leftFadeStrength {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on rightFadeStrength {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
onHeightChanged: resetMarquee()
|
||||
onTextChanged: resetMarquee()
|
||||
onVerticalChanged: 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: content
|
||||
id: marqueeViewport
|
||||
|
||||
anchors.centerIn: parent
|
||||
height: root.vertical ? root.width : root.height
|
||||
width: root.vertical ? root.height : root.width
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
layer.enabled: true
|
||||
visible: root.overflowing
|
||||
|
||||
transform: Rotation {
|
||||
angle: root.vertical ? -90 : 0
|
||||
origin.x: content.width / 2
|
||||
origin.y: content.height / 2
|
||||
}
|
||||
|
||||
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: content.width
|
||||
layer.effect: OpacityMask {
|
||||
maskSource: rightFadeMask
|
||||
}
|
||||
|
||||
Item {
|
||||
id: marqueeViewport
|
||||
id: strip
|
||||
|
||||
anchors.fill: parent
|
||||
clip: false
|
||||
layer.enabled: true
|
||||
visible: root.overflowing
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
height: t1.implicitHeight
|
||||
width: t1.width + root.gap + t2.width
|
||||
x: 0
|
||||
|
||||
layer.effect: OpacityMask {
|
||||
maskSource: rightFadeMask
|
||||
CustomText {
|
||||
id: t1
|
||||
|
||||
animate: root.animate
|
||||
animateProp: "opacity"
|
||||
color: root.color
|
||||
font.pointSize: elideText.font.pointSize
|
||||
text: elideText.text
|
||||
}
|
||||
|
||||
Item {
|
||||
id: strip
|
||||
CustomText {
|
||||
id: t2
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
height: t1.implicitHeight
|
||||
width: t1.width + root.gap + t2.width
|
||||
x: 0
|
||||
animate: root.animate
|
||||
animateProp: "opacity"
|
||||
color: root.color
|
||||
font.pointSize: elideText.font.pointSize
|
||||
text: t1.text
|
||||
x: t1.width + root.gap
|
||||
}
|
||||
}
|
||||
|
||||
CustomText {
|
||||
id: t1
|
||||
SequentialAnimation {
|
||||
id: marqueeAnim
|
||||
|
||||
animate: root.animate
|
||||
animateProp: "opacity"
|
||||
color: root.color
|
||||
font.pointSize: elideText.font.pointSize
|
||||
text: elideText.text
|
||||
}
|
||||
running: false
|
||||
|
||||
CustomText {
|
||||
id: t2
|
||||
onFinished: pauseTimer.restart()
|
||||
|
||||
animate: root.animate
|
||||
animateProp: "opacity"
|
||||
color: root.color
|
||||
font.pointSize: elideText.font.pointSize
|
||||
text: t1.text
|
||||
x: t1.width + root.gap
|
||||
ScriptAction {
|
||||
script: {
|
||||
root.sliding = true;
|
||||
root.leftFadeEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
id: marqueeAnim
|
||||
Anim {
|
||||
duration: root.durationForDistance(t1.width)
|
||||
easing.bezierCurve: Easing.Linear
|
||||
easing.type: Easing.Linear
|
||||
from: 0
|
||||
property: "x"
|
||||
target: strip
|
||||
to: -t1.width
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
ScriptAction {
|
||||
script: {
|
||||
root.leftFadeEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: pauseTimer
|
||||
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)
|
||||
}
|
||||
|
||||
interval: root.pauseMs
|
||||
repeat: false
|
||||
running: true
|
||||
|
||||
onTriggered: {
|
||||
if (root.marqueeEnabled)
|
||||
marqueeAnim.start();
|
||||
ScriptAction {
|
||||
script: {
|
||||
root.sliding = false;
|
||||
strip.x = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: rightFadeMask
|
||||
Timer {
|
||||
id: pauseTimer
|
||||
|
||||
readonly property real fadeStartPos: {
|
||||
const w = Math.max(1, width);
|
||||
return Math.max(0, Math.min(1, (w - root.rightFadeWidth) / w));
|
||||
interval: root.pauseMs
|
||||
repeat: false
|
||||
running: true
|
||||
|
||||
onTriggered: {
|
||||
if (root.marqueeEnabled)
|
||||
marqueeAnim.start();
|
||||
}
|
||||
readonly property real leftFadeEndPos: {
|
||||
const w = Math.max(1, width);
|
||||
return Math.max(0, Math.min(1, root.leftFadeWidth / w));
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
anchors.fill: marqueeViewport
|
||||
layer.enabled: true
|
||||
visible: false
|
||||
GradientStop {
|
||||
color: Qt.rgba(1, 1, 1, 1.0)
|
||||
position: rightFadeMask.leftFadeEndPos
|
||||
}
|
||||
|
||||
gradient: Gradient {
|
||||
orientation: Gradient.Horizontal
|
||||
GradientStop {
|
||||
color: Qt.rgba(1, 1, 1, 1.0)
|
||||
position: rightFadeMask.fadeStartPos
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
GradientStop {
|
||||
color: Qt.rgba(1, 1, 1, 1.0 - root.rightFadeStrength)
|
||||
position: 1.0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,27 @@
|
||||
import QtQuick
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
CustomText {
|
||||
id: root
|
||||
|
||||
readonly property list<int> allowed: [20, 24, 40, 48]
|
||||
property real fill: 0
|
||||
property int grade: Colors.light ? 0 : -25
|
||||
property font fontStyle: Tokens.font.icon.small
|
||||
readonly property int opsz: clampOpsz(optical)
|
||||
property int optical: fontInfo.pixelSize
|
||||
|
||||
renderType: Text.NativeRendering
|
||||
font: Tokens.font.icon.size(fontStyle.pointSize).weight(fontStyle.weight).vaxes(fontStyle.variableAxes).fill(fill.toFixed(1)).grade(grade).build()
|
||||
function clampOpsz(value): int {
|
||||
return allowed.reduce((closest, current) => {
|
||||
return Math.abs(current - value) < Math.abs(closest - value) ? current : closest;
|
||||
});
|
||||
}
|
||||
|
||||
font.family: "Material Symbols Rounded"
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
font.variableAxes: ({
|
||||
FILL: fill,
|
||||
GRAD: grade,
|
||||
opsz: opsz,
|
||||
wght: fontInfo.weight
|
||||
})
|
||||
}
|
||||
|
||||
+23
-22
@@ -34,7 +34,7 @@ MouseArea {
|
||||
cursorShape: expanded ? Qt.ArrowCursor : undefined
|
||||
enabled: expanded
|
||||
hoverEnabled: expanded
|
||||
layer.enabled: false
|
||||
layer.enabled: opacity < 1
|
||||
opacity: expanded ? 1 : 0
|
||||
parent: {
|
||||
const win = QsWindow.window;
|
||||
@@ -78,7 +78,7 @@ MouseArea {
|
||||
implicitHeight: column.implicitHeight + column.anchors.margins * 2
|
||||
implicitWidth: Math.max(200, column.implicitWidth + column.anchors.margins * 2)
|
||||
level: 2
|
||||
radius: Tokens.rounding.large
|
||||
radius: Tokens.rounding.medium
|
||||
x: {
|
||||
watcher.transform;
|
||||
const item = root.attachTo;
|
||||
@@ -101,7 +101,8 @@ MouseArea {
|
||||
yScale: root.expanded ? 1 : 0.1
|
||||
|
||||
Behavior on yScale {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,30 +124,31 @@ MouseArea {
|
||||
model: root.items
|
||||
|
||||
CustomRect {
|
||||
id: menuItem
|
||||
id: item
|
||||
|
||||
readonly property bool active: modelData === root?.active
|
||||
readonly property bool active: modelData === root.active
|
||||
required property int index
|
||||
required property MenuItem modelData
|
||||
|
||||
Layout.fillWidth: true
|
||||
color: Qt.alpha(Colors.palette.m3tertiaryContainer, active ? 1 : 0)
|
||||
implicitHeight: menuOptionRow.implicitHeight + Tokens.padding.medium * 2
|
||||
implicitWidth: menuOptionRow.implicitWidth + Tokens.padding.medium * 2
|
||||
radius: menu.radius - column.anchors.margins
|
||||
implicitHeight: menuOptionRow.implicitHeight + Tokens.padding.larger * 2
|
||||
implicitWidth: menuOptionRow.implicitWidth + Tokens.padding.larger * 2
|
||||
radius: Tokens.rounding.small
|
||||
|
||||
Behavior on radius {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
color: menuItem.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurface
|
||||
color: item.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurface
|
||||
enabled: root.expanded
|
||||
|
||||
onClicked: {
|
||||
root.itemSelected(menuItem.modelData);
|
||||
root.active = menuItem.modelData;
|
||||
menuItem.modelData.clicked();
|
||||
root.itemSelected(item.modelData);
|
||||
root.active = item.modelData;
|
||||
item.modelData.clicked();
|
||||
root.expanded = false;
|
||||
}
|
||||
}
|
||||
@@ -155,32 +157,31 @@ MouseArea {
|
||||
id: menuOptionRow
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: Tokens.padding.medium
|
||||
anchors.margins: Tokens.padding.larger
|
||||
spacing: Tokens.spacing.small
|
||||
|
||||
MaterialIcon {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
color: menuItem.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurfaceVariant
|
||||
text: menuItem.modelData?.icon ?? ""
|
||||
visible: text !== ""
|
||||
color: item.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurfaceVariant
|
||||
text: item.modelData.icon
|
||||
}
|
||||
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
color: menuItem.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurface
|
||||
text: menuItem.modelData?.text ?? ""
|
||||
color: item.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurface
|
||||
text: item.modelData.text
|
||||
}
|
||||
|
||||
Loader {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
active: menuItem.modelData?.trailingIcon.length > 0
|
||||
active: item.modelData.trailingIcon.length > 0
|
||||
asynchronous: true
|
||||
visible: active
|
||||
|
||||
sourceComponent: MaterialIcon {
|
||||
color: menuItem.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurfaceVariant
|
||||
text: menuItem.modelData.trailingIcon
|
||||
color: item.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurfaceVariant
|
||||
text: item.modelData.trailingIcon
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
|
||||
PersistentProperties {
|
||||
required property ShellScreen modelData
|
||||
|
||||
reloadableId: "screenState"
|
||||
|
||||
// Drawer visibilities
|
||||
property bool bar
|
||||
property bool clipboard
|
||||
property bool dashboard
|
||||
property bool dock
|
||||
property bool isDrawing
|
||||
property bool launcher
|
||||
property bool osd
|
||||
property bool resources
|
||||
property bool settings
|
||||
property bool sidebar
|
||||
|
||||
// Dashboard state
|
||||
property int dashboardTab: 0
|
||||
property date dashboardDate: new Date()
|
||||
|
||||
// Sidebar state
|
||||
property int sidebarTab: 0
|
||||
property list<string> expandedNotifs: []
|
||||
|
||||
// Utilities state
|
||||
property string recordingConfirmDelete
|
||||
property bool recordingListExpanded
|
||||
property string recordingMode
|
||||
|
||||
// Drawing state
|
||||
property color penColor: "white"
|
||||
property int penWidth: 4
|
||||
|
||||
// Screenshot state
|
||||
property bool screenshot
|
||||
}
|
||||
@@ -62,7 +62,7 @@ TextFieldBase {
|
||||
anchors.leftMargin: Tokens.padding.large
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: Colors.palette.m3onSurfaceVariant
|
||||
fontStyle: Tokens.font.icon.builders.medium.scale(0.9).build()
|
||||
font.pointSize: Tokens.font.size.large
|
||||
text: "search"
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ TextFieldBase {
|
||||
id: clearIcon
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Tokens.padding.small
|
||||
anchors.rightMargin: Tokens.padding.larger
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
enabled: root.text
|
||||
icon: "clear"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
import ZShell
|
||||
import ZShell.Components
|
||||
import qs.Helpers
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
@@ -51,7 +53,7 @@ MouseArea {
|
||||
|
||||
anchors.fill: parent
|
||||
cursorShape: !enabled ? undefined : Qt.PointingHandCursor
|
||||
enabled: parent.enabled && !ShellState.forActive()?.isDrawing
|
||||
enabled: parent.enabled && !Visibilities.getForActive()?.isDrawing
|
||||
hoverEnabled: true
|
||||
|
||||
Behavior on stateOpacity {
|
||||
@@ -79,7 +81,7 @@ MouseArea {
|
||||
|
||||
alwaysRunToEnd: true
|
||||
duration: Tokens.anim.durations.expressiveSlowEffects * 2
|
||||
easing: Tokens.anim.standard
|
||||
easing.bezierCurve: Tokens.anim.curves.standard
|
||||
property: "circleRadius"
|
||||
target: root
|
||||
to: root.endRadius
|
||||
@@ -98,13 +100,13 @@ MouseArea {
|
||||
id: base
|
||||
|
||||
anchors.fill: parent
|
||||
bottomLeftRadius: root.parent?.bottomLeftRadius ?? radius ?? 0
|
||||
bottomRightRadius: root.parent?.bottomRightRadius ?? radius ?? 0
|
||||
color: Colors.palette.m3onSurface
|
||||
opacity: root.stateOpacity
|
||||
// Pick up radius from parent if it has one (parent can be anything with radius props)
|
||||
// qmllint disable missing-property
|
||||
radius: root.parent?.radius ?? 0
|
||||
bottomLeftRadius: root.parent?.bottomLeftRadius ?? radius ?? 0
|
||||
bottomRightRadius: root.parent?.bottomRightRadius ?? radius ?? 0
|
||||
topLeftRadius: root.parent?.topLeftRadius ?? radius ?? 0
|
||||
topRightRadius: root.parent?.topRightRadius ?? radius ?? 0
|
||||
// qmllint enable missing-property
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Templates
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
TextArea {
|
||||
id: root
|
||||
|
||||
color: Colors.palette.m3onSurface
|
||||
cursorVisible: !readOnly
|
||||
font: Tokens.font.body.small
|
||||
implicitHeight: contentHeight + topPadding + bottomPadding
|
||||
implicitWidth: contentWidth + leftPadding + rightPadding
|
||||
placeholderTextColor: Colors.palette.m3onSurfaceVariant // No anim cause placeholder is custom
|
||||
renderType: TextArea.NativeRendering
|
||||
selectedTextColor: color
|
||||
selectionColor: Qt.alpha(Colors.palette.m3primary, 0.4)
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
}
|
||||
Behavior on selectionColor {
|
||||
CAnim {}
|
||||
}
|
||||
cursorDelegate: Item {}
|
||||
|
||||
CustomRect {
|
||||
id: cursor
|
||||
|
||||
property bool disableBlink
|
||||
|
||||
color: Colors.palette.m3primary
|
||||
implicitHeight: root.cursorRectangle.height
|
||||
implicitWidth: 1.5
|
||||
radius: Tokens.rounding.largeIncreased
|
||||
x: root.cursorRectangle.x
|
||||
y: root.cursorRectangle.y
|
||||
|
||||
Behavior on x {
|
||||
Anim {
|
||||
duration: Tokens.anim.durations.expressiveFastEffects
|
||||
easing.bezierCurve: [0.2, 1, 0.21, 1, 1, 1]
|
||||
}
|
||||
}
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
type: Anim.StandardSmall
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onCursorPositionChanged(): void {
|
||||
if (root.activeFocus && root.cursorVisible) {
|
||||
cursor.opacity = 1;
|
||||
cursor.disableBlink = true;
|
||||
enableBlink.restart();
|
||||
}
|
||||
}
|
||||
|
||||
target: root
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: enableBlink
|
||||
|
||||
interval: 500
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ ButtonBase {
|
||||
return Colors.palette.m3primary;
|
||||
return type === TextButton.Filled ? Colors.palette.m3onPrimary : Colors.palette.m3onSecondary;
|
||||
}
|
||||
horizontalPadding: Tokens.padding.small
|
||||
horizontalPadding: Tokens.padding.normal
|
||||
implicitHeight: label.implicitHeight + verticalPadding * 2
|
||||
implicitWidth: label.implicitWidth + horizontalPadding * 2
|
||||
inactiveColor: {
|
||||
@@ -29,7 +29,7 @@ ButtonBase {
|
||||
return Colors.palette.m3primary;
|
||||
return type === TextButton.Filled ? Colors.palette.m3onSurface : Colors.palette.m3onSecondaryContainer;
|
||||
}
|
||||
verticalPadding: Tokens.padding.extraSmall
|
||||
verticalPadding: Tokens.padding.small
|
||||
|
||||
CustomText {
|
||||
id: label
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Templates
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
TextEdit {
|
||||
id: root
|
||||
|
||||
property bool animateCursor: true
|
||||
property alias cursor: cursor
|
||||
|
||||
color: Colors.palette.m3onSurface
|
||||
cursorVisible: !readOnly
|
||||
font: Tokens.font.body.small
|
||||
renderType: TextField.NativeRendering
|
||||
selectedTextColor: color
|
||||
selectionColor: Qt.alpha(Colors.palette.m3primary, 0.4)
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
}
|
||||
cursorDelegate: Item {}
|
||||
Behavior on selectionColor {
|
||||
CAnim {}
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
id: cursor
|
||||
|
||||
property bool disableBlink
|
||||
|
||||
color: Colors.palette.m3primary
|
||||
implicitHeight: root.cursorRectangle.height
|
||||
implicitWidth: 1.5
|
||||
radius: Tokens.rounding.largeIncreased
|
||||
x: root.cursorRectangle.x
|
||||
y: root.cursorRectangle.y
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
type: Anim.StandardSmall
|
||||
}
|
||||
}
|
||||
Behavior on x {
|
||||
enabled: root.animateCursor
|
||||
|
||||
Anim {
|
||||
duration: Tokens.anim.durations.expressiveFastEffects
|
||||
easing.bezierCurve: [0.2, 1, 0.21, 1, 1, 1]
|
||||
}
|
||||
}
|
||||
Behavior on y {
|
||||
enabled: root.animateCursor
|
||||
|
||||
Anim {
|
||||
duration: Tokens.anim.durations.expressiveFastEffects
|
||||
easing.bezierCurve: [0.2, 1, 0.21, 1, 1, 1]
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onCursorPositionChanged(): void {
|
||||
if (root.activeFocus && root.cursorVisible) {
|
||||
cursor.opacity = 1;
|
||||
cursor.disableBlink = true;
|
||||
enableBlink.restart();
|
||||
}
|
||||
}
|
||||
|
||||
target: root
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: enableBlink
|
||||
|
||||
interval: 500
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,21 +8,24 @@ TextField {
|
||||
|
||||
color: Colors.palette.m3onSurface
|
||||
cursorVisible: !readOnly
|
||||
font: Tokens.font.body.small
|
||||
font.pointSize: Tokens.font.size.small
|
||||
implicitHeight: contentHeight + topPadding + bottomPadding
|
||||
implicitWidth: contentWidth + leftPadding + rightPadding
|
||||
placeholderTextColor: Colors.palette.m3onSurfaceVariant // No anim cause placeholder is custom
|
||||
renderType: TextField.QtRendering
|
||||
renderType: echoMode === TextField.Password ? TextField.QtRendering : TextField.NativeRendering
|
||||
selectedTextColor: color
|
||||
selectionColor: Qt.alpha(Colors.palette.m3primary, 0.4)
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
cursorDelegate: Item {
|
||||
}
|
||||
cursorDelegate: Item {}
|
||||
Behavior on selectionColor {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
@@ -33,7 +36,7 @@ TextField {
|
||||
color: Colors.palette.m3primary
|
||||
implicitHeight: root.cursorRectangle.height
|
||||
implicitWidth: 1.5
|
||||
radius: Tokens.rounding.largeIncreased
|
||||
radius: Tokens.rounding.large
|
||||
x: root.cursorRectangle.x
|
||||
y: root.cursorRectangle.y
|
||||
|
||||
|
||||
@@ -32,11 +32,12 @@ CustomRect {
|
||||
return Colors.palette.m3errorContainer;
|
||||
return Colors.palette.m3surface;
|
||||
}
|
||||
implicitHeight: layout.implicitHeight + Tokens.padding.small * 2
|
||||
radius: Tokens.rounding.medium
|
||||
implicitHeight: layout.implicitHeight + Tokens.padding.smaller * 2
|
||||
radius: Tokens.rounding.normal
|
||||
|
||||
Behavior on border.color {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
|
||||
Elevation {
|
||||
@@ -51,10 +52,10 @@ CustomRect {
|
||||
id: layout
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: Tokens.padding.small
|
||||
anchors.margins: Tokens.padding.small
|
||||
anchors.rightMargin: Tokens.padding.small
|
||||
spacing: Tokens.spacing.medium
|
||||
anchors.leftMargin: Tokens.padding.normal
|
||||
anchors.margins: Tokens.padding.smaller
|
||||
anchors.rightMargin: Tokens.padding.normal
|
||||
spacing: Tokens.spacing.normal
|
||||
|
||||
CustomRect {
|
||||
color: {
|
||||
@@ -66,9 +67,9 @@ CustomRect {
|
||||
return Colors.palette.m3error;
|
||||
return Colors.palette.m3surfaceContainerHigh;
|
||||
}
|
||||
implicitHeight: icon.implicitHeight + Tokens.padding.small * 2
|
||||
implicitHeight: icon.implicitHeight + Tokens.padding.smaller * 2
|
||||
implicitWidth: implicitHeight
|
||||
radius: Tokens.rounding.medium
|
||||
radius: Tokens.rounding.normal
|
||||
|
||||
MaterialIcon {
|
||||
id: icon
|
||||
@@ -83,7 +84,7 @@ CustomRect {
|
||||
return Colors.palette.m3onError;
|
||||
return Colors.palette.m3onSurfaceVariant;
|
||||
}
|
||||
fontStyle: Tokens.font.icon.builders.large.scale(1.2).build()
|
||||
font.pointSize: Math.round(Tokens.font.size.large * 1.2)
|
||||
text: root.modelData.icon
|
||||
}
|
||||
}
|
||||
@@ -106,7 +107,7 @@ CustomRect {
|
||||
return Colors.palette.m3onSurface;
|
||||
}
|
||||
elide: Text.ElideRight
|
||||
font: Tokens.font.title.small
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
text: root.modelData.title
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ Item {
|
||||
}
|
||||
return h;
|
||||
}
|
||||
implicitWidth: Config.utilities.sizes.toastWidth - Tokens.padding.small * 2
|
||||
implicitWidth: Config.utilities.sizes.toastWidth - Tokens.padding.normal * 2
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
@@ -44,7 +44,8 @@ Item {
|
||||
onValuesChanged: root.flagChanged()
|
||||
}
|
||||
|
||||
ToastWrapper {}
|
||||
ToastWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
component ToastWrapper: MouseArea {
|
||||
@@ -81,14 +82,16 @@ Item {
|
||||
Behavior on anchors.bottomMargin {
|
||||
Anim {
|
||||
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
||||
easing: Tokens.anim.expressiveDefaultSpatial
|
||||
easing.bezierCurve: Tokens.anim.curves.expressiveDefaultSpatial
|
||||
}
|
||||
}
|
||||
Behavior on opacity {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: modelData.lock(this)
|
||||
@@ -102,7 +105,7 @@ Item {
|
||||
id: initAnim
|
||||
|
||||
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
||||
easing: Tokens.anim.expressiveDefaultSpatial
|
||||
easing.bezierCurve: Tokens.anim.curves.expressiveDefaultSpatial
|
||||
from: 0
|
||||
properties: "opacity,scale"
|
||||
target: toast
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Effects
|
||||
|
||||
CustomFlickable {
|
||||
@@ -10,7 +9,6 @@ CustomFlickable {
|
||||
property real bottomFadeOpacity: fadeShouldBeActive(false) ? 0 : 1
|
||||
property real fadeAmount: 0.1
|
||||
property real topFadeOpacity: fadeShouldBeActive(true) ? 0 : 1
|
||||
readonly property real dpr: Math.ceil((QsWindow.window as QsWindow)?.devicePixelRatio ?? 1)
|
||||
|
||||
function fadeShouldBeActive(isStart: bool): bool {
|
||||
// When content is smaller than flickable size, hide fade when rebound starts
|
||||
@@ -30,7 +28,6 @@ CustomFlickable {
|
||||
type: Anim.SlowEffects
|
||||
}
|
||||
}
|
||||
layer.textureSize: Qt.size(width * dpr, height * dpr)
|
||||
layer.effect: Mask {
|
||||
maskSource: mask
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@ CustomListView {
|
||||
id: root
|
||||
|
||||
property real endFadeOpacity: fadeShouldBeActive(false) ? 0 : 1
|
||||
property bool fadeEnabled: true
|
||||
property real fadeAmount: 0.1
|
||||
property real fadeThreshold: 0.0
|
||||
readonly property bool horizontal: orientation === ListView.Horizontal
|
||||
property real startFadeOpacity: fadeShouldBeActive(true) ? 0 : 1
|
||||
|
||||
@@ -18,9 +16,7 @@ CustomListView {
|
||||
}
|
||||
|
||||
function fadeShouldBeActive(isStart: bool): bool {
|
||||
if (!fadeEnabled)
|
||||
return false;
|
||||
|
||||
// When content is smaller than flickable size, hide fade when rebound starts.
|
||||
if (contentSize() + marginStart() + marginEnd() < viewportSize() && rebound.running && ((isStart ? overshootStart() > 0 : overshootStart() < 0))) {
|
||||
return false;
|
||||
}
|
||||
@@ -32,11 +28,11 @@ CustomListView {
|
||||
}
|
||||
|
||||
function marginEnd(): real {
|
||||
return horizontal ? rightMargin - fadeThreshold : bottomMargin - fadeThreshold;
|
||||
return horizontal ? rightMargin : bottomMargin;
|
||||
}
|
||||
|
||||
function marginStart(): real {
|
||||
return horizontal ? leftMargin - fadeThreshold : topMargin - fadeThreshold;
|
||||
return horizontal ? leftMargin : topMargin;
|
||||
}
|
||||
|
||||
function overshootStart(): real {
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
import QtQuick
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
Item {
|
||||
id: track
|
||||
|
||||
required property var scrollBar
|
||||
required property var mouseArea
|
||||
|
||||
ClipRect {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
radius: Tokens.rounding.full
|
||||
implicitWidth: handle.implicitWidth
|
||||
|
||||
CustomRect {
|
||||
id: handle
|
||||
|
||||
anchors.right: parent.right
|
||||
color: Colors.palette.m3secondary
|
||||
implicitHeight: track.scrollBar.height * track.scrollBar.effectiveSize
|
||||
implicitWidth: track.mouseArea.pressed || track.mouseArea.containsMouse ? Tokens.padding.extraSmall * 2 : Tokens.padding.extraSmall
|
||||
opacity: {
|
||||
if (!track.scrollBar.enabled)
|
||||
return 0;
|
||||
if (track.scrollBar.size === 1)
|
||||
return 0;
|
||||
if (track.mouseArea.pressed)
|
||||
return 1;
|
||||
if (track.mouseArea.containsMouse)
|
||||
return 0.8;
|
||||
if (track.scrollBar.policy === CustomScrollBar.AlwaysOn || track.scrollBar.shouldBeActive)
|
||||
return 0.6;
|
||||
return 0;
|
||||
}
|
||||
radius: Tokens.rounding.full
|
||||
y: track.scrollBar.reversed ? track.scrollBar.height * (1 + track.scrollBar.nonAnimY) * track.scrollBar.travelScale : track.scrollBar.height * track.scrollBar.nonAnimY * track.scrollBar.travelScale
|
||||
|
||||
Behavior on implicitWidth {
|
||||
Anim {}
|
||||
}
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
type: Anim.DefaultEffects
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
acceptedButtons: Qt.NoButton
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,8 @@ Shape {
|
||||
strokeWidth: 0
|
||||
|
||||
Behavior on fillColor {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
|
||||
PathSvg {
|
||||
|
||||
@@ -141,6 +141,7 @@ Singleton {
|
||||
|
||||
BeatTracker {
|
||||
id: beatTracker
|
||||
|
||||
}
|
||||
|
||||
PwObjectTracker {
|
||||
|
||||
+2
-1
@@ -295,7 +295,8 @@ Singleton {
|
||||
Component {
|
||||
id: apComp
|
||||
|
||||
AccessPoint {}
|
||||
AccessPoint {
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
|
||||
+5
-2
@@ -1081,13 +1081,15 @@ Singleton {
|
||||
Component {
|
||||
id: commandProc
|
||||
|
||||
CommandProcess {}
|
||||
CommandProcess {
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: apComp
|
||||
|
||||
AccessPoint {}
|
||||
AccessPoint {
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
@@ -1308,6 +1310,7 @@ Singleton {
|
||||
}
|
||||
stdout: StdioCollector {
|
||||
id: stdoutCollector
|
||||
|
||||
}
|
||||
|
||||
onExited: code => {
|
||||
|
||||
@@ -10,7 +10,6 @@ import ZShell
|
||||
import qs.Components
|
||||
import qs.Modules
|
||||
import qs.Helpers
|
||||
import qs.Services
|
||||
import qs.Paths
|
||||
import ZShell.Config
|
||||
|
||||
@@ -26,7 +25,7 @@ Singleton {
|
||||
property alias server: server
|
||||
|
||||
function shouldThrottle(appName: string): bool {
|
||||
if (props.dnd || ShellState.anySidebarOpen())
|
||||
if (props.dnd || [...Visibilities.screens.values()].some(v => v.sidebar))
|
||||
return false;
|
||||
|
||||
const key = (appName || "unknown").trim().toLowerCase();
|
||||
@@ -164,7 +163,8 @@ Singleton {
|
||||
Component {
|
||||
id: notifComp
|
||||
|
||||
Notif {}
|
||||
Notif {
|
||||
}
|
||||
}
|
||||
|
||||
component Notif: QtObject {
|
||||
|
||||
+2
-33
@@ -11,46 +11,15 @@ Variants {
|
||||
|
||||
required property ShellScreen modelData
|
||||
|
||||
function rebuild(): void {
|
||||
loader.active = false;
|
||||
loader.active = true;
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: loader
|
||||
|
||||
active: true
|
||||
|
||||
Drawer {
|
||||
screen: scope.modelData
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onConfigPositionChanged(): void {
|
||||
Qt.callLater(scope.rebuild);
|
||||
}
|
||||
|
||||
target: (loader.item as Drawer)?.geometry ?? null
|
||||
}
|
||||
}
|
||||
|
||||
component Drawer: Scope {
|
||||
id: drawer
|
||||
|
||||
readonly property alias geometry: content.geometry
|
||||
required property ShellScreen screen
|
||||
|
||||
Exclusions {
|
||||
bar: content.bar
|
||||
geometry: content.geometry
|
||||
screen: drawer.screen
|
||||
screen: scope.modelData
|
||||
}
|
||||
|
||||
Windows {
|
||||
id: content
|
||||
|
||||
screen: drawer.screen
|
||||
screen: scope.modelData
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-5
@@ -3,23 +3,28 @@ pragma ComponentBehavior: Bound
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import ZShell.Internal
|
||||
import qs.Components
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
readonly property alias content: contentLoader.item
|
||||
required property ScreenState screenState
|
||||
readonly property PersistentProperties drawingState: PersistentProperties {
|
||||
property color penColor: "white"
|
||||
property int penWidth: 4
|
||||
|
||||
reloadableId: "drawingState"
|
||||
}
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
Loader {
|
||||
id: contentLoader
|
||||
|
||||
active: root.screenState.isDrawing
|
||||
active: root.visibilities.isDrawing
|
||||
anchors.fill: parent
|
||||
|
||||
sourceComponent: StrokeCanvas {
|
||||
penColor: root.screenState.penColor
|
||||
penWidth: root.screenState.penWidth
|
||||
penColor: root.drawingState.penColor
|
||||
penWidth: root.drawingState.penWidth
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
import QtQuick
|
||||
import qs.Modules.Bar as Bar
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
required property Bar.BarLoader bar
|
||||
readonly property real barClamped: bar.clampedExtent
|
||||
readonly property real barExtent: bar.extent
|
||||
readonly property bool barOnBottom: position === "bottom"
|
||||
readonly property bool barOnLeft: position === "left"
|
||||
readonly property bool barOnTop: position === "top"
|
||||
required property string configPosition
|
||||
readonly property bool horizontal: position !== "left"
|
||||
readonly property string position: configPosition === "top" || configPosition === "bottom" ? configPosition : "left"
|
||||
required property var win
|
||||
|
||||
function axisPos(x: real, y: real): real {
|
||||
return horizontal ? x : y;
|
||||
}
|
||||
|
||||
function barContains(x: real, y: real, clamped = false): bool {
|
||||
const extent = clamped ? barClamped : barExtent;
|
||||
if (barOnTop)
|
||||
return y < extent;
|
||||
if (barOnBottom)
|
||||
return y > win.height - extent;
|
||||
return x < extent;
|
||||
}
|
||||
|
||||
function insetBottom(border: real, clamped = false): real {
|
||||
return barOnBottom ? (clamped ? barClamped : barExtent) : border;
|
||||
}
|
||||
|
||||
function insetLeft(border: real, clamped = false): real {
|
||||
return barOnLeft ? (clamped ? barClamped : barExtent) : border;
|
||||
}
|
||||
|
||||
function insetTop(border: real, clamped = false): real {
|
||||
return barOnTop ? (clamped ? barClamped : barExtent) : border;
|
||||
}
|
||||
|
||||
function inwardDrag(dragX: real, dragY: real): real {
|
||||
if (barOnTop)
|
||||
return dragY;
|
||||
if (barOnBottom)
|
||||
return -dragY;
|
||||
return dragX;
|
||||
}
|
||||
|
||||
onConfigPositionChanged: {
|
||||
if (!["left", "top", "bottom"].includes(configPosition))
|
||||
console.warn(`Invalid bar position '${configPosition}', falling back to left`);
|
||||
}
|
||||
}
|
||||
+11
-12
@@ -1,7 +1,6 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import QtQuick
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
@@ -10,24 +9,19 @@ Scope {
|
||||
id: root
|
||||
|
||||
required property Item bar
|
||||
required property EdgeGeometry geometry
|
||||
required property ShellScreen screen
|
||||
|
||||
ExclusionZone {
|
||||
id: top
|
||||
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
anchors.left: true
|
||||
anchors.right: true
|
||||
anchors.top: true
|
||||
hasBar: root.geometry.barOnTop
|
||||
exclusiveZone: root.bar.exclusiveZone
|
||||
}
|
||||
|
||||
ExclusionZone {
|
||||
id: left
|
||||
|
||||
anchors.left: true
|
||||
hasBar: root.geometry.barOnLeft
|
||||
}
|
||||
|
||||
ExclusionZone {
|
||||
@@ -40,18 +34,23 @@ Scope {
|
||||
id: bottom
|
||||
|
||||
anchors.bottom: true
|
||||
hasBar: root.geometry.barOnBottom
|
||||
}
|
||||
|
||||
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 {
|
||||
property bool hasBar
|
||||
|
||||
exclusiveZone: hasBar ? root.bar.exclusiveZone : Config.bar.border
|
||||
exclusiveZone: Config.bar.border
|
||||
implicitHeight: 1
|
||||
implicitWidth: 1
|
||||
name: "Bar-Exclusion"
|
||||
screen: root.screen
|
||||
|
||||
mask: Region {}
|
||||
mask: Region {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+71
-113
@@ -1,9 +1,9 @@
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import ZShell.Config
|
||||
import qs.Helpers
|
||||
import qs.Modules.Bar.Popouts
|
||||
import qs.Modules as BarPopouts
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@@ -12,47 +12,43 @@ Item {
|
||||
required property real borderThickness
|
||||
property bool dashboardShortcutActive
|
||||
required property Drawing drawing
|
||||
required property EdgeGeometry geometry
|
||||
property bool osdShortcutActive
|
||||
required property Panels panels
|
||||
required property Wrapper popouts
|
||||
required property BarPopouts.Wrapper popouts
|
||||
required property ShellScreen screen
|
||||
property bool singleGestureTriggered: false
|
||||
property bool utilitiesShortcutActive
|
||||
required property ScreenState screenState
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
function inBottomPanel(panel: Item, x: real, y: real): bool {
|
||||
const panelHeight = panel.height * (1 - (panel.offsetScale ?? 0));
|
||||
return y > root.height - (panelHeight + geometry.insetBottom(borderThickness)) && withinPanelWidth(panel, x, y);
|
||||
return y > root.height - panel.height - Config.bar.border && withinPanelWidth(panel, x, y);
|
||||
}
|
||||
|
||||
function inLeftPanel(panel: Item, x: real, y: real): bool {
|
||||
return x < panel.x + panel.width + geometry.insetLeft(borderThickness) && withinPanelHeight(panel, x, y);
|
||||
}
|
||||
|
||||
function inPopoutArea(x: real, y: real): bool {
|
||||
const panel = panels.popoutsWrapper;
|
||||
if (!geometry.horizontal)
|
||||
return inLeftPanel(panel, x, y);
|
||||
return withinPanelWidth(panel, x, y) && withinPanelHeight(panel, x, y);
|
||||
return x < panel.x + panel.width + Config.bar.border && withinPanelHeight(panel, x, y);
|
||||
}
|
||||
|
||||
function inRightPanel(panel: Item, x: real, y: real): bool {
|
||||
return x > panel.x + geometry.insetLeft(borderThickness) && withinPanelHeight(panel, x, y);
|
||||
return x > panel.x - Config.bar.border && withinPanelHeight(panel, x, y);
|
||||
}
|
||||
|
||||
function inTopPanel(panel: Item, x: real, y: real): bool {
|
||||
const panelHeight = panel.height * (1 - (panel.offsetScale ?? 0));
|
||||
return y < geometry.insetTop(borderThickness) + panelHeight && withinPanelWidth(panel, x, y);
|
||||
return y < bar.implicitHeight + panel.height && withinPanelWidth(panel, x, y);
|
||||
}
|
||||
|
||||
function onWheel(event: WheelEvent): void {
|
||||
if (event.x < bar.implicitWidth) {
|
||||
bar.handleWheel(event.y, event.angleDelta);
|
||||
}
|
||||
}
|
||||
|
||||
function withinPanelHeight(panel: Item, x: real, y: real): bool {
|
||||
const panelY = panel.y + geometry.insetTop(borderThickness);
|
||||
const panelY = panel.y + bar.implicitHeight;
|
||||
return y >= panelY && y <= panelY + panel.height;
|
||||
}
|
||||
|
||||
function withinPanelWidth(panel: Item, x: real, y: real): bool {
|
||||
const panelX = panel.x + geometry.insetLeft(borderThickness);
|
||||
const panelX = panel.x + root.borderThickness;
|
||||
return x >= panelX && x <= panelX + panel.width;
|
||||
}
|
||||
|
||||
@@ -63,7 +59,7 @@ Item {
|
||||
|
||||
cursorShape: (active && centroid.pressPosition.y < root.bar.implicitHeight) ? Qt.ClosedHandCursor : undefined
|
||||
dragThreshold: 0
|
||||
enabled: !root.screenState.isDrawing
|
||||
enabled: !root.visibilities.isDrawing
|
||||
grabPermissions: PointerHandler.CanTakeOverFromHandlersOfSameType | PointerHandler.ApprovesTakeOverByAnything
|
||||
maximumPointCount: 1
|
||||
minimumPointCount: 1
|
||||
@@ -76,59 +72,45 @@ Item {
|
||||
onCentroidChanged: {
|
||||
const x = centroid.position.x;
|
||||
const y = centroid.position.y;
|
||||
const pressX = centroid.pressPosition.x;
|
||||
const pressY = centroid.pressPosition.y;
|
||||
const dragX = x - pressX;
|
||||
const dragY = y - pressY;
|
||||
const dragX = x - centroid.pressPosition.x;
|
||||
const dragY = y - centroid.pressPosition.y;
|
||||
|
||||
if (pressY >= root.screen.height - Config.bar.border && pressX > root.screen.width / 5 && dragY < -Config.launcher.dragThreshold)
|
||||
root.screenState.launcher = true;
|
||||
if (centroid.pressPosition.y >= root.screen.height - Config.bar.border && centroid.pressPosition.x > root.screen.width / 5 && dragY < -Config.launcher.dragThreshold)
|
||||
root.visibilities.launcher = true;
|
||||
|
||||
if (root.singleGestureTriggered)
|
||||
return;
|
||||
|
||||
const inDashboard = root.inTopPanel(root.panels.dashboardWrapper, pressX, pressY);
|
||||
|
||||
if (inDashboard && root.withinPanelWidth(root.panels.dashboardWrapper, x, y)) {
|
||||
if (dragY > Config.dashboard.dragThreshold) {
|
||||
root.screenState.dashboard = true;
|
||||
root.singleGestureTriggered = true;
|
||||
} else if (dragY < -Config.dashboard.dragThreshold) {
|
||||
root.screenState.dashboard = false;
|
||||
root.singleGestureTriggered = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (root.geometry.insetTop(root.borderThickness) > pressY && (Config.dashboard.showOnHover || !inDashboard)) {
|
||||
if (centroid.pressPosition.y < root.bar.implicitHeight) {
|
||||
if (dragY > 20) {
|
||||
root.screenState.settings = true;
|
||||
root.visibilities.settings = true;
|
||||
root.singleGestureTriggered = true;
|
||||
} else if (dragY < -20) {
|
||||
root.screenState.settings = false;
|
||||
root.visibilities.settings = false;
|
||||
root.singleGestureTriggered = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (pressY > root.screen.height - root.geometry.insetBottom(root.borderThickness) && pressX < root.screen.width / 5 && dragY < -50)
|
||||
root.screenState.clipboard = true;
|
||||
if (centroid.pressPosition.y > root.screen.height - Config.bar.border && centroid.pressPosition.x < root.screen.width / 5 && dragY < -50)
|
||||
root.visibilities.clipboard = true;
|
||||
|
||||
if (!Config.dock.hoverToReveal && pressY > root.screen.height - root.geometry.insetTop(root.borderThickness) && pressX > root.screen.width / 5 && !root.screenState.launcher)
|
||||
if (!Config.dock.hoverToReveal && centroid.pressPosition.y > root.screen.height - root.bar.implicitHeight && centroid.pressPosition.x > root.screen.width / 5 && !root.visibilities.launcher)
|
||||
if (dragY < -10) {
|
||||
root.screenState.dock = true;
|
||||
root.visibilities.dock = true;
|
||||
root.singleGestureTriggered = true;
|
||||
}
|
||||
|
||||
if (pressX > root.screen.width - Config.bar.border && pressY < (root.screen.height / 2) && dragX < -Config.sidebar.dragThreshold) {
|
||||
root.screenState.sidebar = true;
|
||||
if (centroid.pressPosition.x > root.screen.width - Config.bar.border && centroid.pressPosition.y < (root.screen.height / 2) && dragX < -Config.sidebar.dragThreshold) {
|
||||
root.visibilities.sidebar = true;
|
||||
root.singleGestureTriggered = true;
|
||||
}
|
||||
|
||||
if (pressX >= root.screen.width - Config.bar.border && pressY > (root.screen.height / 2) && dragX < -20) {
|
||||
if (centroid.pressPosition.x >= root.screen.width - Config.bar.border && centroid.pressPosition.y > (root.screen.height / 2) && dragX < -20) {
|
||||
Hypr.dispatch(`hl.dsp.focus({ workspace = 'r+1', on_current_monitor = true })`);
|
||||
root.singleGestureTriggered = true;
|
||||
}
|
||||
|
||||
if (pressX <= Config.bar.border && dragX > 20) {
|
||||
if (centroid.pressPosition.x <= Config.bar.border && dragX > 20) {
|
||||
Hypr.dispatch(`hl.dsp.focus({ workspace = 'r-1', on_current_monitor = true })`);
|
||||
root.singleGestureTriggered = true;
|
||||
}
|
||||
@@ -141,7 +123,7 @@ Item {
|
||||
property bool setInitialPoint: false
|
||||
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
enabled: root.screenState.isDrawing && (!root.inLeftPanel(root.panels.drawing, hoverHandler.point.position.x, hoverHandler.point.position.y) || !root.panels.drawing.expanded)
|
||||
enabled: root.visibilities.isDrawing && (!root.inLeftPanel(root.panels.drawing, hoverHandler.point.position.x, hoverHandler.point.position.y) || !root.panels.drawing.expanded)
|
||||
|
||||
onActiveChanged: {
|
||||
if (!active) {
|
||||
@@ -176,28 +158,15 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: unhideTimer
|
||||
|
||||
interval: Config.bar.revealDelay
|
||||
repeat: false
|
||||
running: false
|
||||
|
||||
onTriggered: {
|
||||
if (hoverHandler.hovered)
|
||||
root.bar.isHovered = true;
|
||||
}
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: hoverHandler
|
||||
|
||||
cursorShape: root.screenState.isDrawing && !root.inLeftPanel(root.panels.drawing, point.position.x, point.position.y) ? Qt.BlankCursor : undefined
|
||||
cursorShape: root.visibilities.isDrawing && !root.inLeftPanel(root.panels.drawing, point.position.x, point.position.y) ? Qt.BlankCursor : undefined
|
||||
|
||||
onHoveredChanged: {
|
||||
if (!hovered) {
|
||||
if (!root.osdShortcutActive) {
|
||||
root.screenState.osd = false;
|
||||
root.visibilities.osd = false;
|
||||
root.panels.osd.hovered = false;
|
||||
}
|
||||
|
||||
@@ -205,18 +174,15 @@ Item {
|
||||
root.popouts.hasCurrent = false;
|
||||
}
|
||||
|
||||
if (Config.bar.autoHide || root.bar.fullscreen)
|
||||
if (Config.bar.autoHide)
|
||||
root.bar.isHovered = false;
|
||||
|
||||
if (root.screenState.dashboard && Config.dashboard.showOnHover)
|
||||
root.screenState.dashboard = false;
|
||||
}
|
||||
}
|
||||
onPointChanged: {
|
||||
const x = point.position.x;
|
||||
const y = point.position.y;
|
||||
|
||||
if (root.screenState.isDrawing) {
|
||||
if (root.visibilities.isDrawing) {
|
||||
if (root.inLeftPanel(root.panels.drawing, x, y) && !(drawingHandler.point.pressedButtons & Qt.LeftButton)) {
|
||||
root.panels.drawing.expand();
|
||||
root.drawing.content.hideHover();
|
||||
@@ -227,12 +193,9 @@ Item {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!root.screenState.bar && Config.bar.autoHide && root.geometry.barContains(x, y, true))
|
||||
if (!root.visibilities.bar && Config.bar.autoHide && y < root.bar.implicitHeight)
|
||||
root.bar.isHovered = true;
|
||||
|
||||
if (root.bar.fullscreen && !root.bar.isHovered)
|
||||
unhideTimer.start();
|
||||
|
||||
if (root.panels.sidebar.offsetScale === 1) {
|
||||
const showOsd = root.inRightPanel(root.panels.osdWrapper, x, y);
|
||||
|
||||
@@ -245,7 +208,7 @@ Item {
|
||||
const showOsd = outOfSidebar && root.inRightPanel(root.panels.osdWrapper, x, y);
|
||||
|
||||
if (!root.osdShortcutActive) {
|
||||
root.screenState.osd = showOsd;
|
||||
root.visibilities.osd = showOsd;
|
||||
root.panels.osd.hovered = showOsd;
|
||||
} else if (showOsd) {
|
||||
root.osdShortcutActive = false;
|
||||
@@ -253,32 +216,26 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.dock.enable && Config.dock.hoverToReveal && !root.screenState.dock && !root.screenState.launcher && root.inBottomPanel(root.panels.dock, x, y))
|
||||
root.screenState.dock = true;
|
||||
if (Config.dock.enabled && Config.dock.hoverToReveal && !root.visibilities.dock && !root.visibilities.launcher && root.inBottomPanel(root.panels.dock, x, y))
|
||||
root.visibilities.dock = true;
|
||||
|
||||
const inDashboard = root.inTopPanel(root.panels.dashboardWrapper, x, y);
|
||||
|
||||
if (Config.dashboard.showOnHover)
|
||||
root.screenState.dashboard = inDashboard;
|
||||
|
||||
if (root.geometry.barContains(x, y))
|
||||
root.bar.checkPopout(root.geometry.axisPos(x, y));
|
||||
if (y < root.bar.implicitHeight)
|
||||
root.bar.checkPopout(x);
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onDashboardChanged() {
|
||||
if (root.screenState.dashboard) {
|
||||
if (root.visibilities.dashboard) {
|
||||
const inDashboardArea = root.inTopPanel(root.panels.dashboard, root.mouseX, root.mouseY);
|
||||
if (!inDashboardArea) {
|
||||
root.dashboardShortcutActive = true;
|
||||
}
|
||||
if (root.panels.launcher.x + root.panels.launcher.width > root.panels.dashboardWrapper.x)
|
||||
root.screenState.launcher = false;
|
||||
root.visibilities.launcher = false;
|
||||
|
||||
root.screenState.settings = false;
|
||||
root.screenState.sidebar = false;
|
||||
root.screenState.resources = false;
|
||||
root.visibilities.settings = false;
|
||||
root.visibilities.sidebar = false;
|
||||
root.popouts.hasCurrent = false;
|
||||
} else {
|
||||
root.dashboardShortcutActive = false;
|
||||
@@ -286,12 +243,12 @@ Item {
|
||||
}
|
||||
|
||||
function onIsDrawingChanged() {
|
||||
if (!root.screenState.isDrawing)
|
||||
if (!root.visibilities.isDrawing)
|
||||
root.drawing.clear();
|
||||
}
|
||||
|
||||
function onLauncherChanged() {
|
||||
if (!root.screenState.launcher) {
|
||||
if (!root.visibilities.launcher) {
|
||||
root.dashboardShortcutActive = false;
|
||||
root.osdShortcutActive = false;
|
||||
root.utilitiesShortcutActive = false;
|
||||
@@ -299,23 +256,23 @@ Item {
|
||||
const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY);
|
||||
|
||||
if (!inOsdArea) {
|
||||
root.screenState.osd = false;
|
||||
root.visibilities.osd = false;
|
||||
root.panels.osd.hovered = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (root.screenState.launcher) {
|
||||
if (root.visibilities.launcher) {
|
||||
if (root.panels.dashboardWrapper.x < root.panels.launcher.x + root.panels.launcher.width) {
|
||||
root.screenState.dashboard = false;
|
||||
root.visibilities.dashboard = false;
|
||||
}
|
||||
|
||||
root.screenState.dock = false;
|
||||
root.screenState.settings = false;
|
||||
root.visibilities.dock = false;
|
||||
root.visibilities.settings = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onOsdChanged() {
|
||||
if (root.screenState.osd) {
|
||||
if (root.visibilities.osd) {
|
||||
const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY);
|
||||
if (!inOsdArea) {
|
||||
root.osdShortcutActive = true;
|
||||
@@ -326,33 +283,34 @@ Item {
|
||||
}
|
||||
|
||||
function onResourcesChanged() {
|
||||
if (root.screenState.resources) {
|
||||
if (root.popouts.currentName.startsWith("audio") || root.popouts.currentName.startsWith("updates"))
|
||||
root.popouts.hasCurrent = false;
|
||||
|
||||
root.screenState.settings = false;
|
||||
root.screenState.dashboard = false;
|
||||
if (root.visibilities.resources && (root.popouts.currentName.startsWith("audio") || root.popouts.currentName.startsWith("updates"))) {
|
||||
root.popouts.hasCurrent = false;
|
||||
}
|
||||
|
||||
if (root.visibilities.resources)
|
||||
root.visibilities.settings = false;
|
||||
}
|
||||
|
||||
function onSettingsChanged() {
|
||||
if (root.screenState.settings) {
|
||||
root.screenState.resources = false;
|
||||
root.screenState.dashboard = false;
|
||||
root.screenState.sidebar = false;
|
||||
if (root.visibilities.settings) {
|
||||
root.visibilities.resources = false;
|
||||
root.visibilities.dashboard = false;
|
||||
root.visibilities.sidebar = false;
|
||||
root.panels.popouts.hasCurrent = false;
|
||||
root.screenState.launcher = false;
|
||||
root.visibilities.launcher = false;
|
||||
} else {
|
||||
Config.save();
|
||||
}
|
||||
}
|
||||
|
||||
function onSidebarChanged() {
|
||||
if (root.screenState.sidebar) {
|
||||
root.screenState.dashboard = false;
|
||||
root.screenState.settings = false;
|
||||
if (root.visibilities.sidebar) {
|
||||
root.visibilities.dashboard = false;
|
||||
root.visibilities.settings = false;
|
||||
root.popouts.hasCurrent = false;
|
||||
}
|
||||
}
|
||||
|
||||
target: root.screenState
|
||||
target: root.visibilities
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,315 +0,0 @@
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import ZShell.Config
|
||||
import ZShell.Internal
|
||||
import qs.Components
|
||||
import qs.Helpers
|
||||
import qs.Modules.Bar.Popouts
|
||||
|
||||
CustomMouseArea {
|
||||
id: root
|
||||
|
||||
required property Item bar
|
||||
required property real borderThickness
|
||||
property bool dashboardShortcutActive
|
||||
property point dragStart
|
||||
required property Drawing drawing
|
||||
required property EdgeGeometry geometry
|
||||
property bool osdShortcutActive
|
||||
required property Panels panels
|
||||
required property Wrapper popouts
|
||||
required property ShellScreen screen
|
||||
required property ScreenState screenState
|
||||
property bool setInitialPoint: false
|
||||
property bool singleGestureTriggered: false
|
||||
property bool utilitiesShortcutActive
|
||||
|
||||
function inBottomPanel(panel: Item, x: real, y: real): bool {
|
||||
const panelHeight = panel.height * (1 - (panel.offsetScale ?? 0));
|
||||
return y > root.height - (panelHeight + geometry.insetBottom(borderThickness)) && withinPanelWidth(panel, x, y);
|
||||
}
|
||||
|
||||
function inLeftPanel(panel: Item, x: real, y: real): bool {
|
||||
return x < panel.x + panel.width + geometry.insetLeft(borderThickness) && withinPanelHeight(panel, x, y);
|
||||
}
|
||||
|
||||
function inPopoutArea(x: real, y: real): bool {
|
||||
const panel = panels.popoutsWrapper;
|
||||
if (!geometry.horizontal)
|
||||
return inLeftPanel(panel, x, y);
|
||||
return withinPanelWidth(panel, x, y) && withinPanelHeight(panel, x, y);
|
||||
}
|
||||
|
||||
function inRightPanel(panel: Item, x: real, y: real): bool {
|
||||
return x > panel.x + geometry.insetLeft(borderThickness) && withinPanelHeight(panel, x, y);
|
||||
}
|
||||
|
||||
function inTopPanel(panel: Item, x: real, y: real): bool {
|
||||
const panelHeight = panel.height * (1 - (panel.offsetScale ?? 0));
|
||||
return y < geometry.insetTop(borderThickness) + panelHeight && withinPanelWidth(panel, x, y);
|
||||
}
|
||||
|
||||
function withinPanelHeight(panel: Item, x: real, y: real): bool {
|
||||
const panelY = panel.y + geometry.insetTop(borderThickness);
|
||||
return y >= panelY && y <= panelY + panel.height;
|
||||
}
|
||||
|
||||
function withinPanelWidth(panel: Item, x: real, y: real): bool {
|
||||
const panelX = panel.x + geometry.insetLeft(borderThickness);
|
||||
return x >= panelX && x <= panelX + panel.width;
|
||||
}
|
||||
|
||||
acceptedButtons: bar.fullscreen ? Qt.NoButton : Qt.AllButtons
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
onContainsMouseChanged: {
|
||||
if (!containsMouse) {
|
||||
if (!osdShortcutActive) {
|
||||
screenState.osd = false;
|
||||
panels.osd.hovered = false;
|
||||
}
|
||||
|
||||
if (!popouts.currentName.startsWith("traymenu") || Config.bar.tray.showOnHover) {
|
||||
popouts.hasCurrent = false;
|
||||
}
|
||||
|
||||
if (Config.bar.autoHide || bar.fullscreen)
|
||||
bar.isHovered = false;
|
||||
|
||||
if (screenState.dashboard && Config.dashboard.showOnHover)
|
||||
screenState.dashboard = false;
|
||||
}
|
||||
}
|
||||
onPositionChanged: event => {
|
||||
const x = event.x;
|
||||
const y = event.y;
|
||||
const dragX = x - dragStart.x;
|
||||
const dragY = y - dragStart.y;
|
||||
|
||||
if (screenState.isDrawing) {
|
||||
if (pressed) {
|
||||
drawing.content.appendPoint(x, y);
|
||||
} else {
|
||||
if (inLeftPanel(panels.drawing, x, y)) {
|
||||
if (!(pressedButtons & Qt.LeftButton)) {
|
||||
panels.drawing.expand();
|
||||
drawing.content.hideHover();
|
||||
Cursor.clearOverride();
|
||||
}
|
||||
} else {
|
||||
Cursor.setOverride(Qt.BlankCursor);
|
||||
drawing.content.showHover(x, y);
|
||||
}
|
||||
}
|
||||
if (drawing.content.hoverVisible)
|
||||
drawing.content.showHover(x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
if (root.bar.fullscreen && !root.bar.isHovered)
|
||||
unhideTimer.start();
|
||||
|
||||
if (pressed && dragStart.y >= screen.height - Config.bar.border && dragStart.x > screen.width / 5 && dragY < -Config.launcher.dragThreshold)
|
||||
screenState.launcher = true;
|
||||
|
||||
const entryAt = bar.entryAt(geometry.axisPos(x, y));
|
||||
const showDashboard = Config.dashboard.showOnHover && inTopPanel(panels.dashboardWrapper, x, y) && (!entryAt || entryAt === "activeWindow");
|
||||
|
||||
if (!dashboardShortcutActive) {
|
||||
screenState.dashboard = showDashboard;
|
||||
} else if (showDashboard) {
|
||||
dashboardShortcutActive = false;
|
||||
}
|
||||
|
||||
if (pressed && geometry.insetTop(borderThickness) > dragStart.y && withinPanelWidth(panels.dashboardWrapper, x, y)) {
|
||||
if (dragY > Config.dashboard.dragThreshold)
|
||||
screenState.dashboard = true;
|
||||
else if (dragY < -Config.dashboard.dragThreshold)
|
||||
screenState.dashboard = false;
|
||||
}
|
||||
|
||||
if (pressed && geometry.insetTop(borderThickness) > dragStart.y && !inTopPanel(panels.dashboardWrapper, dragStart.x, dragStart.y)) {
|
||||
if (dragY > 20) {
|
||||
screenState.settings = true;
|
||||
} else if (dragY < -20) {
|
||||
screenState.settings = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (pressed && dragStart.y > screen.height - geometry.insetBottom(borderThickness) && dragStart.x < screen.width / 5 && dragY < -50)
|
||||
screenState.clipboard = true;
|
||||
|
||||
if (pressed && !Config.dock.hoverToReveal && dragStart.y > screen.height - geometry.insetTop(borderThickness) && dragStart.x > screen.width / 5 && !screenState.launcher)
|
||||
if (dragY < -10)
|
||||
screenState.dock = true;
|
||||
|
||||
if (pressed && dragStart.x > screen.width - Config.bar.border && dragStart.y < (screen.height / 2) && dragX < -Config.sidebar.dragThreshold)
|
||||
screenState.sidebar = true;
|
||||
|
||||
if (pressed && dragStart.x >= screen.width - Config.bar.border && dragStart.y > (screen.height / 2) && dragX < -20)
|
||||
Hypr.dispatch(`hl.dsp.focus({ workspace = 'r+1', on_current_monitor = true })`);
|
||||
|
||||
if (pressed && dragStart.x <= Config.bar.border && dragX > 20)
|
||||
Hypr.dispatch(`hl.dsp.focus({ workspace = 'r-1', on_current_monitor = true })`);
|
||||
|
||||
if (!screenState.bar && Config.bar.autoHide && geometry.barContains(x, y, true))
|
||||
bar.isHovered = true;
|
||||
|
||||
if (panels.sidebar.offsetScale === 1) {
|
||||
const showOsd = inRightPanel(panels.osdWrapper, x, y);
|
||||
|
||||
if (showOsd) {
|
||||
osdShortcutActive = false;
|
||||
panels.osd.hovered = true;
|
||||
}
|
||||
} else {
|
||||
const outOfSidebar = x < width - panels.sidebar.width * (1 - panels.sidebar.offsetScale);
|
||||
const showOsd = outOfSidebar && inRightPanel(panels.osdWrapper, x, y);
|
||||
|
||||
if (!osdShortcutActive) {
|
||||
screenState.osd = showOsd;
|
||||
panels.osd.hovered = showOsd;
|
||||
} else if (showOsd) {
|
||||
osdShortcutActive = false;
|
||||
panels.osd.hovered = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.dock.enable && Config.dock.hoverToReveal && !screenState.dock && !screenState.launcher && inBottomPanel(panels.dock, x, y))
|
||||
screenState.dock = true;
|
||||
|
||||
if (geometry.barContains(x, y))
|
||||
bar.checkPopout(geometry.axisPos(x, y));
|
||||
}
|
||||
onPressed: event => {
|
||||
dragStart = Qt.point(event.x, event.y);
|
||||
|
||||
if (screenState.isDrawing) {
|
||||
if (event.button & Qt.RightButton) {
|
||||
drawing.content.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!inLeftPanel(panels.drawing, mouseX, mouseY))
|
||||
drawing.content.beginStroke(event.x, event.y);
|
||||
}
|
||||
}
|
||||
onPressedChanged: {
|
||||
if (!pressed) {
|
||||
if (screenState.isDrawing) {
|
||||
setInitialPoint = false;
|
||||
drawing.content.endStroke();
|
||||
if (!inLeftPanel(panels.drawing, mouseX, mouseY))
|
||||
drawing.content.showHover(mouseX, mouseY);
|
||||
}
|
||||
} else {
|
||||
if (screenState.isDrawing) {
|
||||
panels.drawing.collapse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: unhideTimer
|
||||
|
||||
interval: Config.bar.revealDelay
|
||||
repeat: false
|
||||
running: false
|
||||
|
||||
onTriggered: {
|
||||
if (root.containsMouse)
|
||||
root.bar.isHovered = true;
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onDashboardChanged(): void {
|
||||
if (root.screenState.dashboard) {
|
||||
const inDashboardArea = root.inTopPanel(root.panels.dashboardWrapper, root.mouseX, root.mouseY);
|
||||
if (!inDashboardArea) {
|
||||
root.dashboardShortcutActive = true;
|
||||
}
|
||||
|
||||
root.screenState.launcher = false;
|
||||
root.screenState.settings = false;
|
||||
root.screenState.sidebar = false;
|
||||
root.screenState.resources = false;
|
||||
root.popouts.hasCurrent = false;
|
||||
} else {
|
||||
root.dashboardShortcutActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onIsDrawingChanged(): void {
|
||||
if (root.screenState.isDrawing) {
|
||||
Cursor.setOverride(Qt.BlankCursor);
|
||||
} else {
|
||||
Cursor.clearOverride();
|
||||
}
|
||||
}
|
||||
|
||||
function onLauncherChanged(): void {
|
||||
if (!root.screenState.launcher) {
|
||||
root.dashboardShortcutActive = false;
|
||||
root.osdShortcutActive = false;
|
||||
root.utilitiesShortcutActive = false;
|
||||
|
||||
const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY);
|
||||
|
||||
if (!inOsdArea) {
|
||||
root.screenState.osd = false;
|
||||
root.panels.osd.hovered = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (root.screenState.launcher) {
|
||||
root.screenState.dashboard = false;
|
||||
root.screenState.dock = false;
|
||||
root.screenState.settings = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onOsdChanged(): void {
|
||||
if (root.screenState.osd) {
|
||||
const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY);
|
||||
if (!inOsdArea) {
|
||||
root.osdShortcutActive = true;
|
||||
}
|
||||
} else {
|
||||
root.osdShortcutActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onResourcesChanged(): void {
|
||||
if (root.screenState.resources) {
|
||||
if (root.popouts.currentName.startsWith("audio") || root.popouts.currentName.startsWith("updates"))
|
||||
root.popouts.hasCurrent = false;
|
||||
|
||||
root.screenState.settings = false;
|
||||
root.screenState.dashboard = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onSettingsChanged(): void {
|
||||
if (root.screenState.settings) {
|
||||
root.screenState.resources = false;
|
||||
root.screenState.dashboard = false;
|
||||
root.screenState.sidebar = false;
|
||||
root.panels.popouts.hasCurrent = false;
|
||||
root.screenState.launcher = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onSidebarChanged(): void {
|
||||
if (root.screenState.sidebar) {
|
||||
if (root.panels.dashboardWrapper.x + root.panels.dashboardWrapper.width > root.panels.sidebar.x)
|
||||
root.screenState.dashboard = false;
|
||||
root.screenState.settings = false;
|
||||
root.popouts.hasCurrent = false;
|
||||
}
|
||||
}
|
||||
|
||||
target: root.screenState
|
||||
}
|
||||
}
|
||||
+35
-35
@@ -1,10 +1,10 @@
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import qs.Components
|
||||
import qs.Modules.Bar.Popouts as Popouts
|
||||
import qs.Modules as Modules
|
||||
import qs.Modules.Notifications as Notifications
|
||||
import qs.Modules.Sidebar as Sidebar
|
||||
import qs.Modules.Sidebar.Utils as Utils
|
||||
import qs.Modules.Notifications.Sidebar as Sidebar
|
||||
import qs.Modules.Notifications.Sidebar.Utils as Utils
|
||||
import qs.Modules.Dashboard as Dashboard
|
||||
import qs.Modules.Osd as Osd
|
||||
import qs.Components.Toast as Toasts
|
||||
@@ -19,11 +19,14 @@ import ZShell.Config
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property Item bar
|
||||
required property real borderThickness
|
||||
readonly property alias clipboard: clipboard
|
||||
readonly property alias dashboard: dashboard
|
||||
readonly property alias dashboardWrapper: dashboardWrapper
|
||||
readonly property alias dock: dock
|
||||
readonly property alias drawing: drawing
|
||||
required property var drawingItem
|
||||
readonly property alias launcher: launcher
|
||||
readonly property alias notifications: notifications
|
||||
readonly property alias osd: osd
|
||||
@@ -32,40 +35,33 @@ Item {
|
||||
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 utilities: utilities
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
required property Item bar
|
||||
required property real borderThickness
|
||||
required property var drawingItem
|
||||
required property EdgeGeometry geometry
|
||||
required property ShellScreen screen
|
||||
required property ScreenState screenState
|
||||
|
||||
anchors.bottomMargin: geometry.insetBottom(borderThickness)
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: geometry.insetLeft(borderThickness)
|
||||
anchors.margins: borderThickness
|
||||
anchors.topMargin: geometry.insetTop(borderThickness)
|
||||
anchors.topMargin: bar.implicitHeight
|
||||
|
||||
Item {
|
||||
id: resourcesWrapper
|
||||
|
||||
anchors.bottom: root.geometry.position === "bottom" ? parent.bottom : undefined
|
||||
anchors.left: parent.left
|
||||
anchors.top: root.geometry.position !== "bottom" ? parent.top : undefined
|
||||
anchors.top: parent.top
|
||||
clip: true
|
||||
implicitHeight: root.geometry.horizontal ? resources.implicitHeight * (1 - resources.offsetScale) : resources.implicitHeight
|
||||
implicitWidth: root.geometry.horizontal ? resources.implicitWidth : resources.implicitWidth * (1 - resources.offsetScale)
|
||||
implicitHeight: resources.implicitHeight * (1 - resources.offsetScale)
|
||||
implicitWidth: resources.implicitWidth
|
||||
|
||||
Resources.Wrapper {
|
||||
id: resources
|
||||
|
||||
position: root.geometry.position
|
||||
screenState: root.screenState
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,8 +81,8 @@ Item {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
screen: root.screen
|
||||
screenState: root.screenState
|
||||
sidebarOrSessionVisible: sidebar.visible
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,14 +93,14 @@ Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
drawing: root.drawingItem
|
||||
screen: root.screen
|
||||
screenState: root.screenState
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
|
||||
Popouts.ClipWrapper {
|
||||
Modules.ClipWrapper {
|
||||
id: popouts
|
||||
|
||||
anchors.top: parent.top
|
||||
borderThickness: root.borderThickness
|
||||
position: root.geometry.position
|
||||
screen: root.screen
|
||||
}
|
||||
|
||||
@@ -112,7 +108,7 @@ Item {
|
||||
id: toasts
|
||||
|
||||
anchors.bottom: sidebar.visible ? parent.bottom : utilities.top
|
||||
anchors.margins: Tokens.padding.small
|
||||
anchors.margins: Tokens.padding.normal
|
||||
anchors.right: sidebar.left
|
||||
}
|
||||
|
||||
@@ -122,8 +118,8 @@ Item {
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
panels: root
|
||||
screenState: root.screenState
|
||||
sidebarPanel: sidebar
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
|
||||
Launcher.Wrapper {
|
||||
@@ -133,7 +129,7 @@ Item {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
panels: root
|
||||
screen: root.screen
|
||||
screenState: root.screenState
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
|
||||
Utils.Wrapper {
|
||||
@@ -141,8 +137,9 @@ Item {
|
||||
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
screenState: root.screenState
|
||||
popouts: popouts
|
||||
sidebar: sidebar
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
|
||||
Item {
|
||||
@@ -150,24 +147,27 @@ Item {
|
||||
|
||||
property real offsetScale: dashboard.shouldBeActive ? 0 : 1
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
clip: offsetScale > 0
|
||||
clip: true
|
||||
implicitHeight: dashboard.implicitHeight * (1 - offsetScale)
|
||||
implicitWidth: dashboard.implicitWidth
|
||||
|
||||
Behavior on offsetScale {
|
||||
Anim {
|
||||
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
||||
easing: Tokens.anim.expressiveDefaultSpatial
|
||||
easing.bezierCurve: Tokens.anim.curves.expressiveDefaultSpatial
|
||||
}
|
||||
}
|
||||
|
||||
Dashboard.Wrapper {
|
||||
id: dashboard
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: (-implicitHeight - 5) * offsetScale
|
||||
offsetScale: dashboardWrapper.offsetScale
|
||||
screenState: root.screenState
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ Item {
|
||||
anchors.right: parent.right
|
||||
anchors.top: notifications.bottom
|
||||
panels: root
|
||||
screenState: root.screenState
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
|
||||
Item {
|
||||
@@ -194,7 +194,7 @@ Item {
|
||||
anchors.verticalCenterOffset: (-implicitHeight - 5 - ((root.height - implicitHeight) / 2)) * offsetScale
|
||||
panels: root
|
||||
screen: root.screen
|
||||
screenState: root.screenState
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ Item {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
panels: root
|
||||
screen: root.screen
|
||||
screenState: root.screenState
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
|
||||
Clipboard.Wrapper {
|
||||
@@ -214,6 +214,6 @@ Item {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
screen: root.screen
|
||||
screenState: root.screenState
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
||||
|
||||
+8
-13
@@ -7,18 +7,17 @@ import qs.Modules.Bar as Bar
|
||||
Region {
|
||||
id: root
|
||||
|
||||
// required property Bar.BarLoader bar
|
||||
required property Bar.BarLoader bar
|
||||
readonly property real borderThickness: win.borderThickness
|
||||
required property EdgeGeometry geometry
|
||||
readonly property alias menuPopoutRegion: menuPopoutRegion
|
||||
required property Panels panels
|
||||
required property var win
|
||||
|
||||
height: win.height - geometry.insetTop(borderThickness, true) - geometry.insetBottom(borderThickness, true) - win.dragMaskPadding * 2
|
||||
height: win.height - bar.implicitHeight - win.borderThickness - win.dragMaskPadding * 2
|
||||
intersection: Intersection.Xor
|
||||
width: win.width - geometry.insetLeft(borderThickness, true) * 2 - win.dragMaskPadding * 2
|
||||
x: geometry.insetLeft(borderThickness, true) + win.dragMaskPadding
|
||||
y: geometry.insetTop(borderThickness, true) + win.dragMaskPadding
|
||||
width: win.width - win.borderThickness * 2 - win.dragMaskPadding * 2
|
||||
x: win.borderThickness + win.dragMaskPadding
|
||||
y: bar.implicitHeight + win.dragMaskPadding
|
||||
|
||||
R {
|
||||
panel: root.panels.dashboardWrapper
|
||||
@@ -42,21 +41,17 @@ Region {
|
||||
}
|
||||
|
||||
R {
|
||||
height: panel.height + root.geometry.insetTop(root.borderThickness)
|
||||
panel: root.panels.notifications
|
||||
y: 0
|
||||
}
|
||||
|
||||
R {
|
||||
height: panel.height * (1 - root.panels.utilities.offsetScale) + root.geometry.insetBottom(root.borderThickness)
|
||||
height: panel.height * (1 - root.panels.utilities.offsetScale) + root.borderThickness
|
||||
panel: root.panels.utilities
|
||||
y: root.win.height - height
|
||||
}
|
||||
|
||||
R {
|
||||
height: root.geometry.horizontal ? panel.height * (1 - root.panels.popoutsWrapper.offsetScale) : panel.height
|
||||
panel: root.panels.popoutsWrapper
|
||||
width: root.geometry.horizontal ? panel.width : panel.width * (1 - root.panels.popoutsWrapper.offsetScale)
|
||||
}
|
||||
|
||||
R {
|
||||
@@ -87,7 +82,7 @@ Region {
|
||||
height: panel.height
|
||||
intersection: Intersection.Subtract
|
||||
width: panel.width
|
||||
x: panel.x + root.geometry.insetLeft(root.borderThickness)
|
||||
y: panel.y + root.geometry.insetTop(root.borderThickness)
|
||||
x: panel.x + root.borderThickness
|
||||
y: panel.y + root.bar.implicitHeight
|
||||
}
|
||||
}
|
||||
|
||||
+139
-141
@@ -8,6 +8,7 @@ import Quickshell.Io
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Hyprland
|
||||
import ZShell.Blobs
|
||||
import qs.Modules.SysTray.Popouts.Network as N
|
||||
import qs.Daemons
|
||||
import qs.Components
|
||||
import qs.Modules.Bar
|
||||
@@ -33,7 +34,6 @@ CustomWindow {
|
||||
return 100;
|
||||
}
|
||||
property real fsTransitionProg: hasFullscreen ? 1 : 0
|
||||
readonly property alias geometry: geometry
|
||||
readonly property bool hasFullscreen: {
|
||||
if (hasSpecialWorkspace) {
|
||||
const specialName = monitor?.lastIpcObject.specialWorkspace?.name;
|
||||
@@ -50,65 +50,59 @@ CustomWindow {
|
||||
readonly property alias menuRegion: regions.menuPopoutRegion
|
||||
readonly property HyprlandMonitor monitor: Hypr.monitorFor(screen)
|
||||
property var root: Quickshell.shellDir
|
||||
readonly property ScreenState screenState: ShellState.forScreen(screen)
|
||||
readonly property real sdfBorderOffset: 2 * fsTransitionProg
|
||||
readonly property real shadowOpacity: 0.5 * (1 - (bar.isHovered ? 0 : fsTransitionProg))
|
||||
readonly property real shadowOpacity: 0.7 * (1 - fsTransitionProg)
|
||||
property color surfaceColor: Colors.tPalette.m3surface
|
||||
|
||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||
WlrLayershell.keyboardFocus: screenState.screenshot ? WlrKeyboardFocus.Exclusive : screenState.launcher || screenState.settings || screenState.sidebar ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||
WlrLayershell.keyboardFocus: visibilities.launcher || visibilities.settings ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||
WlrLayershell.layer: (fsTransitionProg > 0 && Config.general.showOverFullscreen) || (hasSpecialWorkspace && hasFullscreenOnNormalWs) ? WlrLayer.Overlay : WlrLayer.Top
|
||||
color: "transparent"
|
||||
mask: screenState.isDrawing || screenState.screenshot ? null : (hasFullscreen && !bar.isHovered ? emptyRegion : regions)
|
||||
contentItem.focus: true
|
||||
mask: visibilities.isDrawing ? null : (hasFullscreen ? emptyRegion : regions)
|
||||
name: "Bar"
|
||||
|
||||
Behavior on fsTransitionProg {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on surfaceColor {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
|
||||
contentItem.Keys.onEscapePressed: {
|
||||
if (Config.bar.autoHide)
|
||||
screenState.bar = false;
|
||||
screenState.launcher = false;
|
||||
screenState.sidebar = false;
|
||||
screenState.dashboard = false;
|
||||
screenState.osd = false;
|
||||
screenState.settings = false;
|
||||
screenState.resources = false;
|
||||
screenState.dock = false;
|
||||
screenState.clipboard = false;
|
||||
visibilities.bar = false;
|
||||
visibilities.launcher = false;
|
||||
visibilities.sidebar = false;
|
||||
visibilities.dashboard = false;
|
||||
visibilities.osd = false;
|
||||
visibilities.settings = false;
|
||||
visibilities.resources = false;
|
||||
visibilities.dock = false;
|
||||
visibilities.clipboard = false;
|
||||
panels.popouts.hasCurrent = false;
|
||||
}
|
||||
onHasFullscreenChanged: {
|
||||
screenState.launcher = false;
|
||||
screenState.sidebar = false;
|
||||
screenState.dashboard = false;
|
||||
screenState.osd = false;
|
||||
screenState.settings = false;
|
||||
screenState.resources = false;
|
||||
screenState.clipboard = false;
|
||||
screenState.dock = false;
|
||||
visibilities.launcher = false;
|
||||
visibilities.sidebar = false;
|
||||
visibilities.dashboard = false;
|
||||
visibilities.osd = false;
|
||||
visibilities.settings = false;
|
||||
visibilities.resources = false;
|
||||
visibilities.clipboard = false;
|
||||
visibilities.dock = false;
|
||||
panels.popouts.hasCurrent = false;
|
||||
}
|
||||
|
||||
EdgeGeometry {
|
||||
id: geometry
|
||||
|
||||
bar: bar
|
||||
configPosition: Config.bar.position
|
||||
win: root
|
||||
}
|
||||
|
||||
Region {
|
||||
id: emptyRegion
|
||||
|
||||
height: panels.notifications.height
|
||||
width: panels.notifications.width
|
||||
x: panels.notifications.x + geometry.insetLeft(root.borderThickness)
|
||||
y: panels.notifications.y + geometry.insetTop(root.borderThickness)
|
||||
x: panels.notifications.x + root.borderThickness
|
||||
y: panels.notifications.y + bar.implicitHeight
|
||||
|
||||
Region {
|
||||
height: panels.osd.height
|
||||
@@ -116,18 +110,12 @@ CustomWindow {
|
||||
x: root.width - width
|
||||
y: panels.osdWrapper.y + bar.implicitHeight
|
||||
}
|
||||
|
||||
Region {
|
||||
height: geometry.horizontal ? 1 : root.screen.height
|
||||
width: geometry.horizontal ? root.screen.width : 1
|
||||
y: geometry.position === "bottom" ? root.screen.height - 1 : 0
|
||||
}
|
||||
}
|
||||
|
||||
Regions {
|
||||
id: regions
|
||||
|
||||
geometry: geometry
|
||||
bar: bar
|
||||
panels: panels
|
||||
win: root
|
||||
}
|
||||
@@ -143,40 +131,53 @@ CustomWindow {
|
||||
id: focusGrab
|
||||
|
||||
active: {
|
||||
const s = root.screenState;
|
||||
const c = Config;
|
||||
|
||||
if ((s.launcher && c.launcher.enabled) || (s.sidebar && c.sidebar.enabled) || (s.resources && c.dashboard.performance.enabled) || (s.clipboard && c.clipboard.enabled))
|
||||
const v = visibilities;
|
||||
const conf = Config;
|
||||
if (!N.PopupManager.closed && panels.popouts.hasCurrent)
|
||||
return true;
|
||||
if (s.dashboard && !c.dashboard.showOnHover && c.dashboard.enabled)
|
||||
if ((v.launcher && conf.launcher.enabled) || (v.sidebar && conf.sidebar.enabled) || (v.resources && conf.dashboard.performance.enabled) || (v.dashboard && conf.dashboard.enabled) || v.settings || (v.clipboard && conf.clipboard.enabled) || (v.dock && conf.dock.enabled))
|
||||
return true;
|
||||
if (!c.dock.hoverToReveal && s.dock && c.dock.enable)
|
||||
return true;
|
||||
if (panels.popouts.currentName.startsWith("traymenu") && (panels.popouts.current as StackView)?.depth > 1)
|
||||
return true;
|
||||
if (s.settings)
|
||||
if (panels.popouts.hasCurrent && panels.popouts.currentName.startsWith("traymenu") && (!conf.bar.tray.showOnHover || (panels.popouts.current as StackView)?.depth > 1))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
windows: [root]
|
||||
|
||||
onCleared: {
|
||||
root.screenState.launcher = false;
|
||||
root.screenState.sidebar = false;
|
||||
root.screenState.dashboard = false;
|
||||
root.screenState.osd = false;
|
||||
root.screenState.settings = false;
|
||||
root.screenState.resources = false;
|
||||
root.screenState.clipboard = false;
|
||||
root.screenState.dock = false;
|
||||
visibilities.launcher = false;
|
||||
visibilities.sidebar = false;
|
||||
visibilities.dashboard = false;
|
||||
visibilities.osd = false;
|
||||
visibilities.settings = false;
|
||||
visibilities.resources = false;
|
||||
visibilities.clipboard = false;
|
||||
visibilities.dock = false;
|
||||
panels.popouts.hasCurrent = false;
|
||||
}
|
||||
}
|
||||
|
||||
PersistentProperties {
|
||||
id: visibilities
|
||||
|
||||
property bool bar
|
||||
property bool clipboard
|
||||
property bool dashboard
|
||||
property bool dock
|
||||
property bool isDrawing
|
||||
property bool launcher
|
||||
property bool notif: NotifServer.popups.length > 0
|
||||
property bool osd
|
||||
property bool resources
|
||||
property bool settings
|
||||
property bool sidebar
|
||||
|
||||
Component.onCompleted: Visibilities.load(root.screen, this)
|
||||
}
|
||||
|
||||
Binding {
|
||||
property: "bar"
|
||||
target: root.screenState
|
||||
value: root.screenState.sidebar || root.screenState.dashboard || root.screenState.osd || (!Config.bar.hideWhenNotif && NotifServer.popups.length > 0) || root.screenState.resources || root.screenState.settings || bar.isHovered
|
||||
target: visibilities
|
||||
value: visibilities.sidebar || visibilities.dashboard || visibilities.osd || (!Config.bar.hideWhenNotif && visibilities.notif) || visibilities.resources || visibilities.settings || bar.isHovered
|
||||
when: Config.bar.autoHide
|
||||
}
|
||||
|
||||
@@ -184,25 +185,29 @@ CustomWindow {
|
||||
id: surface
|
||||
|
||||
anchors.fill: parent
|
||||
layer.enabled: true
|
||||
opacity: root.surfaceColor.a
|
||||
|
||||
BlobGroup2 {
|
||||
layer.effect: MultiEffect {
|
||||
blurMax: 32
|
||||
shadowColor: Qt.alpha(Colors.palette.m3shadow, Math.max(0, root.shadowOpacity))
|
||||
shadowEnabled: true
|
||||
}
|
||||
|
||||
BlobGroup {
|
||||
id: blobGroup
|
||||
|
||||
anchors.fill: parent
|
||||
color: root.surfaceColor
|
||||
shadowColor: Qt.alpha(Colors.palette.m3shadow, Math.max(0, root.shadowOpacity))
|
||||
shadowRadius: 18
|
||||
smoothing: Config.bar.smoothing
|
||||
}
|
||||
|
||||
BlobInvertedRect2 {
|
||||
BlobInvertedRect {
|
||||
anchors.fill: parent
|
||||
anchors.margins: -50
|
||||
borderBottom: geometry.insetBottom(root.borderThickness) - anchors.margins - root.sdfBorderOffset
|
||||
borderLeft: geometry.insetLeft(root.borderThickness) - anchors.margins - root.sdfBorderOffset
|
||||
borderBottom: root.borderThickness - anchors.margins - root.sdfBorderOffset
|
||||
borderLeft: root.borderThickness - anchors.margins - root.sdfBorderOffset
|
||||
borderRight: root.borderThickness - anchors.margins - root.sdfBorderOffset
|
||||
borderTop: geometry.insetTop(root.borderThickness) - anchors.margins - root.sdfBorderOffset
|
||||
borderTop: bar.implicitHeight - anchors.margins - root.sdfBorderOffset
|
||||
group: blobGroup
|
||||
radius: root.borderRounding
|
||||
}
|
||||
@@ -210,15 +215,15 @@ CustomWindow {
|
||||
PanelBg {
|
||||
id: dashBg
|
||||
|
||||
property real extraExtent: 0.2
|
||||
property real extraHeight: 0.2
|
||||
|
||||
deformAmount: 0.06
|
||||
implicitHeight: panels.dashboard.height * (geometry.horizontal ? 1 + extraExtent : 1)
|
||||
implicitWidth: panels.dashboard.width * (geometry.horizontal ? 1 : 1 + extraExtent)
|
||||
implicitHeight: panels.dashboard.height * (1 + extraHeight)
|
||||
implicitWidth: panels.dashboard.width
|
||||
panel: panels.dashboardWrapper
|
||||
radius: Tokens.rounding.extraLarge
|
||||
x: panels.dashboardWrapper.x + panels.dashboard.x + geometry.insetLeft(root.borderThickness) - (geometry.horizontal ? 0 : panels.dashboard.width * extraExtent)
|
||||
y: panels.dashboardWrapper.y + panels.dashboard.y + geometry.insetTop(root.borderThickness) - (geometry.horizontal && geometry.position !== "bottom" ? panels.dashboard.height * extraExtent : 0)
|
||||
radius: Tokens.rounding.normal
|
||||
x: panels.dashboardWrapper.x + panels.dashboard.x + root.borderThickness
|
||||
y: panels.dashboardWrapper.y + panels.dashboard.y + bar.implicitHeight - panels.dashboard.height * extraHeight
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
@@ -229,8 +234,8 @@ CustomWindow {
|
||||
deformAmount: 0.06
|
||||
implicitHeight: panels.launcher.height * (1 + extraHeight)
|
||||
panel: panels.launcher
|
||||
radius: Tokens.rounding.medium + (Tokens.padding.largeIncreased / 4)
|
||||
y: panels.launcher.y + geometry.insetTop(root.borderThickness)
|
||||
radius: Tokens.rounding.smallest + 5
|
||||
y: panels.launcher.y + bar.implicitHeight
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
@@ -246,21 +251,20 @@ CustomWindow {
|
||||
PanelBg {
|
||||
id: osdBg
|
||||
|
||||
atRestOverride: panels.osd.offsetScale < 0.99
|
||||
deformAmount: 0.1
|
||||
implicitHeight: panels.osd.height
|
||||
implicitWidth: panels.osd.width
|
||||
panel: panels.osdWrapper
|
||||
radius: 20
|
||||
x: panels.osdWrapper.x + panels.osd.x + geometry.insetLeft(root.borderThickness)
|
||||
x: panels.osdWrapper.x + panels.osd.x + root.borderThickness
|
||||
y: panels.osdWrapper.y + panels.osd.y + bar.implicitHeight
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: notifsBg
|
||||
|
||||
atRestOverride: panel.implicitHeight > 0
|
||||
panel: panels.notifications
|
||||
radius: Tokens.rounding.large
|
||||
radius: Tokens.rounding.normal
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
@@ -275,34 +279,32 @@ CustomWindow {
|
||||
PanelBg {
|
||||
id: popoutBg
|
||||
|
||||
property real extraExtent: 0.2
|
||||
property real extraHeight: 0.2
|
||||
|
||||
deformAmount: panels.popouts.currentName.startsWith("traymenu") ? 0.15 : 0.08
|
||||
implicitHeight: panels.popouts.height * (geometry.horizontal ? 1 + extraExtent : 1)
|
||||
implicitWidth: panels.popouts.width * (geometry.horizontal ? 1 : 1 + extraExtent)
|
||||
implicitHeight: panels.popouts.height * (1 + extraHeight)
|
||||
implicitWidth: panels.popouts.width
|
||||
panel: panels.popoutsWrapper
|
||||
radius: panels.popouts.current?.panelRadius ?? Tokens.rounding.large
|
||||
x: panels.popoutsWrapper.x + panels.popouts.x + geometry.insetLeft(root.borderThickness) - (geometry.horizontal ? 0 : panels.popouts.width * extraExtent)
|
||||
y: panels.popoutsWrapper.y + panels.popouts.y + geometry.insetTop(root.borderThickness) - (geometry.barOnTop ? panels.popouts.height * extraExtent : 0)
|
||||
radius: panels.popouts.current?.panelRadius ?? Tokens.rounding.normal
|
||||
x: panels.popoutsWrapper.x + panels.popouts.x + root.borderThickness
|
||||
y: panels.popoutsWrapper.y + panels.popouts.y + bar.implicitHeight - panels.popouts.height * extraHeight
|
||||
|
||||
Behavior on extraExtent {
|
||||
Anim {}
|
||||
Behavior on extraHeight {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: resourcesBg
|
||||
|
||||
property real extraExtent: 0.2
|
||||
|
||||
atRestOverride: panels.resources.offsetScale < 0.99
|
||||
deformAmount: 0.05
|
||||
implicitHeight: panels.resources.height * (1 + extraExtent)
|
||||
implicitWidth: panels.resources.width * (1 + extraExtent)
|
||||
implicitHeight: panels.resources.height
|
||||
implicitWidth: panels.resources.width
|
||||
panel: panels.resourcesWrapper
|
||||
radius: Tokens.rounding.largeIncreased + Tokens.padding.small
|
||||
x: panels.resourcesWrapper.x + panels.resources.x + geometry.insetLeft(root.borderThickness) - panels.resources.width * extraExtent
|
||||
y: panels.resourcesWrapper.y + panels.resources.y + geometry.insetTop(root.borderThickness) - panels.resources.height * extraExtent
|
||||
radius: Tokens.rounding.large
|
||||
x: panels.resourcesWrapper.x + panels.resources.x + root.borderThickness
|
||||
y: panels.resourcesWrapper.y + panels.resources.y + bar.implicitHeight
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
@@ -310,7 +312,7 @@ CustomWindow {
|
||||
|
||||
deformAmount: 0.03
|
||||
panel: panels.settings
|
||||
radius: Tokens.rounding.largeIncreased + Tokens.padding.small
|
||||
radius: Tokens.rounding.large + Tokens.padding.normal
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
@@ -318,7 +320,7 @@ CustomWindow {
|
||||
|
||||
deformAmount: 0.08
|
||||
panel: panels.dock
|
||||
radius: Tokens.rounding.medium
|
||||
radius: Tokens.rounding.normal
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
@@ -326,21 +328,15 @@ CustomWindow {
|
||||
|
||||
deformAmount: 0.08
|
||||
panel: panels.drawing
|
||||
radius: Tokens.rounding.medium
|
||||
radius: Tokens.rounding.normal
|
||||
}
|
||||
|
||||
PanelBg {
|
||||
id: clipboardBg
|
||||
|
||||
property real extraExtent: 0.2
|
||||
|
||||
deformAmount: 0.03
|
||||
implicitHeight: panels.clipboard.height * (1 + extraExtent)
|
||||
implicitWidth: panels.clipboard.width * (1 + extraExtent)
|
||||
panel: panels.clipboard
|
||||
radius: 29
|
||||
x: panels.clipboard.x + geometry.insetLeft(root.borderThickness) - panels.clipboard.width * extraExtent
|
||||
y: panels.clipboard.y + geometry.insetTop(root.borderThickness)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,11 +344,37 @@ CustomWindow {
|
||||
id: drawing
|
||||
|
||||
anchors.fill: parent
|
||||
screenState: root.screenState
|
||||
layer.enabled: true
|
||||
visibilities: visibilities
|
||||
z: 2
|
||||
|
||||
layer.effect: MultiEffect {
|
||||
maskEnabled: true
|
||||
maskInverted: true
|
||||
maskSource: maskSource
|
||||
}
|
||||
}
|
||||
|
||||
Interactions2 {
|
||||
Item {
|
||||
id: maskSource
|
||||
|
||||
anchors.fill: parent
|
||||
layer.enabled: true
|
||||
visible: false
|
||||
|
||||
CustomRect {
|
||||
readonly property int extraWidth: radius
|
||||
|
||||
color: "white"
|
||||
implicitHeight: panels.drawing.height
|
||||
implicitWidth: panels.drawing.width + extraWidth
|
||||
radius: drawingBg.radius
|
||||
x: -extraWidth + root.borderThickness + panels.drawing.x
|
||||
y: panels.drawing.y + bar.implicitHeight
|
||||
}
|
||||
}
|
||||
|
||||
Interactions {
|
||||
id: interactions
|
||||
|
||||
anchors.fill: parent
|
||||
@@ -360,11 +382,10 @@ CustomWindow {
|
||||
borderThickness: root.borderLayoutThickness
|
||||
drawing: drawing
|
||||
enabled: true
|
||||
geometry: geometry
|
||||
panels: panels
|
||||
popouts: panels.popouts
|
||||
screen: root.screen
|
||||
screenState: root.screenState
|
||||
visibilities: visibilities
|
||||
|
||||
Panels {
|
||||
id: panels
|
||||
@@ -372,9 +393,8 @@ CustomWindow {
|
||||
bar: bar
|
||||
borderThickness: root.borderThickness
|
||||
drawingItem: drawing
|
||||
geometry: geometry
|
||||
screen: root.screen
|
||||
screenState: root.screenState
|
||||
visibilities: visibilities
|
||||
|
||||
clipboard.transform: Matrix4x4 {
|
||||
matrix: clipboardBg.deformMatrix
|
||||
@@ -414,49 +434,27 @@ CustomWindow {
|
||||
BarLoader {
|
||||
id: bar
|
||||
|
||||
anchors.bottom: geometry.barOnBottom ? parent.bottom : undefined
|
||||
anchors.left: parent.left
|
||||
anchors.top: geometry.barOnBottom ? undefined : parent.top
|
||||
enabled: !screenState.isDrawing
|
||||
anchors.right: parent.right
|
||||
enabled: !visibilities.isDrawing
|
||||
fullscreen: root.hasFullscreen
|
||||
height: geometry.horizontal ? implicitHeight : parent.height
|
||||
popouts: panels.popouts
|
||||
popoutsWrapper: panels.popoutsWrapper
|
||||
position: geometry.position
|
||||
screen: root.screen
|
||||
screenState: root.screenState
|
||||
width: geometry.horizontal ? parent.width : implicitWidth
|
||||
visibilities: visibilities
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: loader
|
||||
|
||||
property bool closing: !root.screenState.screenshot
|
||||
|
||||
onClosingChanged: if (!closing)
|
||||
activeAsync = true
|
||||
|
||||
Picker {
|
||||
loader: loader
|
||||
parent: root.contentItem
|
||||
screen: root.screen
|
||||
screenState: root.screenState
|
||||
}
|
||||
}
|
||||
|
||||
component PanelBg: BlobRect2 {
|
||||
component PanelBg: BlobRect {
|
||||
property real deformAmount: 0.15
|
||||
required property Item panel
|
||||
|
||||
atRestOverride: panel?.offsetScale < 0.99 ?? false
|
||||
damping: 28.3
|
||||
deformScale: (deformAmount * Config.appearance.deform.scale) / 10000
|
||||
group: blobGroup
|
||||
implicitHeight: panel.height
|
||||
implicitWidth: panel.width
|
||||
radius: Tokens.rounding.small
|
||||
x: panel.x + geometry.insetLeft(root.borderThickness)
|
||||
y: panel.y + geometry.insetTop(root.borderThickness)
|
||||
radius: Tokens.rounding.smallest
|
||||
x: panel.x + root.borderThickness
|
||||
y: panel.y + bar.implicitHeight
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property real radius
|
||||
|
||||
Rectangle {
|
||||
id: shadowRect
|
||||
|
||||
anchors.fill: root
|
||||
color: "black"
|
||||
layer.enabled: true
|
||||
radius: root.radius
|
||||
visible: false
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
id: effects
|
||||
|
||||
anchors.fill: shadowRect
|
||||
autoPaddingEnabled: true
|
||||
maskEnabled: true
|
||||
maskInverted: true
|
||||
maskSource: shadowRect
|
||||
shadowBlur: 2.0
|
||||
shadowColor: "black"
|
||||
shadowEnabled: true
|
||||
shadowOpacity: 1
|
||||
source: shadowRect
|
||||
}
|
||||
}
|
||||
+36
-20
@@ -18,7 +18,7 @@ ColumnLayout {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: false
|
||||
Layout.preferredWidth: centerWidth
|
||||
spacing: Tokens.spacing.largeIncreased * 2
|
||||
spacing: Tokens.spacing.large * 2
|
||||
|
||||
RowLayout {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
@@ -27,21 +27,27 @@ ColumnLayout {
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
color: Colors.palette.m3secondary
|
||||
font: Tokens.font.headline.builders.large.scale(3 * root.centerScale).weight(Font.Bold).width(30).build()
|
||||
font.bold: true
|
||||
font.family: Config.appearance.font.family.clock
|
||||
font.pointSize: Math.floor(Tokens.font.size.extraLarge * 3 * root.centerScale)
|
||||
text: Time.hourStr
|
||||
}
|
||||
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
color: Colors.palette.m3primary
|
||||
font: Tokens.font.headline.builders.large.scale(3 * root.centerScale).weight(Font.Bold).width(30).build()
|
||||
font.bold: true
|
||||
font.family: Config.appearance.font.family.clock
|
||||
font.pointSize: Math.floor(Tokens.font.size.extraLarge * 3 * root.centerScale)
|
||||
text: ":"
|
||||
}
|
||||
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
color: Colors.palette.m3secondary
|
||||
font: Tokens.font.headline.builders.large.scale(3 * root.centerScale).weight(Font.Bold).width(30).build()
|
||||
font.bold: true
|
||||
font.family: Config.appearance.font.family.clock
|
||||
font.pointSize: Math.floor(Tokens.font.size.extraLarge * 3 * root.centerScale)
|
||||
text: Time.minuteStr
|
||||
}
|
||||
}
|
||||
@@ -50,13 +56,15 @@ ColumnLayout {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.topMargin: -Tokens.padding.large * 2
|
||||
color: Colors.palette.m3tertiary
|
||||
font: Tokens.font.title.builders.medium.weight(Font.DemiBold).build()
|
||||
font.bold: true
|
||||
font.family: Config.appearance.font.family.mono
|
||||
font.pointSize: Math.floor(Tokens.font.size.extraLarge * root.centerScale)
|
||||
text: Time.format("dddd, d MMMM yyyy")
|
||||
}
|
||||
|
||||
ClipRect {
|
||||
CustomClippingRect {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.topMargin: Tokens.spacing.largeIncreased * 2
|
||||
Layout.topMargin: Tokens.spacing.large * 2
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: root.centerWidth / 2
|
||||
implicitWidth: root.centerWidth / 2
|
||||
@@ -65,7 +73,7 @@ ColumnLayout {
|
||||
MaterialIcon {
|
||||
anchors.centerIn: parent
|
||||
color: Colors.palette.m3onSurfaceVariant
|
||||
fontStyle: Tokens.font.icon.size(root.centerWidth / 4).build()
|
||||
font.pointSize: Math.floor(root.centerWidth / 4)
|
||||
text: "person"
|
||||
}
|
||||
|
||||
@@ -80,7 +88,9 @@ ColumnLayout {
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: Colors.palette.m3onSurfaceVariant
|
||||
font: Tokens.font.body.large
|
||||
font.family: Config.appearance.font.family.mono
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
font.weight: 600
|
||||
text: root.greeter.username
|
||||
visible: text.length > 0
|
||||
}
|
||||
@@ -89,7 +99,7 @@ ColumnLayout {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
focus: true
|
||||
implicitHeight: input.implicitHeight + Tokens.padding.extraSmall * 2
|
||||
implicitHeight: input.implicitHeight + Tokens.padding.small * 2
|
||||
implicitWidth: root.centerWidth * 0.8
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
@@ -120,11 +130,11 @@ ColumnLayout {
|
||||
id: input
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: Tokens.padding.extraSmall
|
||||
spacing: Tokens.spacing.medium
|
||||
anchors.margins: Tokens.padding.small
|
||||
spacing: Tokens.spacing.normal
|
||||
|
||||
Item {
|
||||
implicitHeight: statusIcon.implicitHeight + Tokens.padding.extraSmall * 2
|
||||
implicitHeight: statusIcon.implicitHeight + Tokens.padding.small * 2
|
||||
implicitWidth: implicitHeight
|
||||
|
||||
MaterialIcon {
|
||||
@@ -145,7 +155,8 @@ ColumnLayout {
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +174,7 @@ ColumnLayout {
|
||||
|
||||
CustomRect {
|
||||
color: root.greeter.buffer && !root.greeter.launching ? Colors.palette.m3primary : Colors.layer(Colors.palette.m3surfaceContainerHigh, 2)
|
||||
implicitHeight: enterIcon.implicitHeight + Tokens.padding.extraSmall * 2
|
||||
implicitHeight: enterIcon.implicitHeight + Tokens.padding.small * 2
|
||||
implicitWidth: implicitHeight
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
@@ -180,6 +191,7 @@ ColumnLayout {
|
||||
|
||||
anchors.centerIn: parent
|
||||
color: root.greeter.buffer && !root.greeter.launching ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||
font.weight: 500
|
||||
text: root.greeter.launching ? "hourglass_top" : "arrow_forward"
|
||||
}
|
||||
}
|
||||
@@ -188,11 +200,12 @@ ColumnLayout {
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -Tokens.spacing.largeIncreased
|
||||
Layout.topMargin: -Tokens.spacing.large
|
||||
implicitHeight: Math.max(message.implicitHeight, stateMessage.implicitHeight)
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
CustomText {
|
||||
@@ -232,10 +245,12 @@ ColumnLayout {
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
onMsgChanged: {
|
||||
@@ -277,7 +292,8 @@ ColumnLayout {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
color: isError ? Colors.palette.m3error : Colors.palette.m3primary
|
||||
font: Tokens.font.mono.medium
|
||||
font.family: Config.appearance.font.family.mono
|
||||
font.pointSize: Tokens.font.size.small
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
opacity: 0
|
||||
scale: 0.7
|
||||
|
||||
+11
-11
@@ -30,11 +30,11 @@ NumberAnimation {
|
||||
if (type === Anim.DefaultSpatial)
|
||||
return Tokens.anim.durations.expressiveDefaultSpatial;
|
||||
if (type === Anim.SlowSpatial)
|
||||
return Tokens.anim.durations.expressiveSlowSpatial;
|
||||
return Tokens.anim.durations.large;
|
||||
if (type === Anim.FastEffects)
|
||||
return Tokens.anim.durations.expressiveFastEffects;
|
||||
if (type === Anim.DefaultEffects)
|
||||
return Tokens.anim.durations.expressiveDefaultEffects;
|
||||
return Tokens.anim.durations.expressiveEffects;
|
||||
if (type === Anim.SlowEffects)
|
||||
return Tokens.anim.durations.expressiveSlowEffects;
|
||||
|
||||
@@ -42,22 +42,22 @@ NumberAnimation {
|
||||
const idx = type % 4; // 0-7 are the 4 standard types
|
||||
return Tokens.anim.durations[types[idx]];
|
||||
}
|
||||
easing: {
|
||||
easing.bezierCurve: {
|
||||
if (type === Anim.FastSpatial)
|
||||
return Tokens.anim.expressiveFastSpatial;
|
||||
return Tokens.anim.curves.expressiveFastSpatial;
|
||||
if (type === Anim.DefaultSpatial)
|
||||
return Tokens.anim.expressiveDefaultSpatial;
|
||||
return Tokens.anim.curves.expressiveDefaultSpatial;
|
||||
if (type === Anim.SlowSpatial)
|
||||
return Tokens.anim.expressiveSlowSpatial;
|
||||
return Tokens.anim.curves.expressiveSlowSpatial;
|
||||
if (type === Anim.FastEffects)
|
||||
return Tokens.anim.expressiveFastEffects;
|
||||
return Tokens.anim.curves.expressiveFastEffects;
|
||||
if (type === Anim.DefaultEffects)
|
||||
return Tokens.anim.expressiveDefaultEffects;
|
||||
return Tokens.anim.curves.expressiveDefaultEffects;
|
||||
if (type === Anim.SlowEffects)
|
||||
return Tokens.anim.expressiveSlowEffects;
|
||||
return Tokens.anim.curves.expressiveSlowEffects;
|
||||
|
||||
if (type >= Anim.EmphasizedSmall && type <= Anim.EmphasizedExtraLarge)
|
||||
return Tokens.anim.emphasized;
|
||||
return Tokens.anim.standard;
|
||||
return Tokens.anim.curves.emphasized;
|
||||
return Tokens.anim.curves.standard;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,62 @@ import QtQuick
|
||||
import ZShell.Config
|
||||
|
||||
ColorAnimation {
|
||||
duration: Tokens.anim.durations.expressiveSlowEffects
|
||||
easing: Tokens.anim.expressiveSlowEffects
|
||||
enum Type {
|
||||
StandardSmall = 0,
|
||||
Standard,
|
||||
StandardLarge,
|
||||
StandardExtraLarge,
|
||||
EmphasizedSmall,
|
||||
Emphasized,
|
||||
EmphasizedLarge,
|
||||
EmphasizedExtraLarge,
|
||||
FastSpatial,
|
||||
DefaultSpatial,
|
||||
SlowSpatial,
|
||||
FastEffects,
|
||||
DefaultEffects,
|
||||
SlowEffects
|
||||
}
|
||||
|
||||
property int type: CAnim.DefaultSpatial
|
||||
|
||||
duration: {
|
||||
if (type < CAnim.StandardSmall || type > Anim.SlowEffects)
|
||||
return Tokens.anim.durations.normal;
|
||||
|
||||
if (type === CAnim.FastSpatial)
|
||||
return Tokens.anim.durations.expressiveFastSpatial;
|
||||
if (type === CAnim.DefaultSpatial)
|
||||
return Tokens.anim.durations.expressiveDefaultSpatial;
|
||||
if (type === CAnim.SlowSpatial)
|
||||
return Tokens.anim.durations.large;
|
||||
if (type === CAnim.FastEffects)
|
||||
return Tokens.anim.durations.expressiveFastEffects;
|
||||
if (type === CAnim.DefaultEffects)
|
||||
return Tokens.anim.durations.expressiveEffects;
|
||||
if (type === CAnim.SlowEffects)
|
||||
return Tokens.anim.durations.expressiveSlowEffects;
|
||||
|
||||
const types = ["small", "normal", "large", "extraLarge"];
|
||||
const idx = type % 4;
|
||||
return Tokens.anim.durations[types[idx]];
|
||||
}
|
||||
easing.bezierCurve: {
|
||||
if (type === CAnim.FastSpatial)
|
||||
return Tokens.anim.curves.expressiveFastSpatial;
|
||||
if (type === CAnim.DefaultSpatial)
|
||||
return Tokens.anim.curves.expressiveDefaultSpatial;
|
||||
if (type === CAnim.SlowSpatial)
|
||||
return Tokens.anim.curves.expressiveSlowSpatial;
|
||||
if (type === CAnim.FastEffects)
|
||||
return Tokens.anim.curves.expressiveFastEffects;
|
||||
if (type === CAnim.DefaultEffects)
|
||||
return Tokens.anim.curves.expressiveDefaultEffects;
|
||||
if (type === CAnim.SlowEffects)
|
||||
return Tokens.anim.curves.expressiveSlowEffects;
|
||||
|
||||
if (type >= CAnim.EmphasizedSmall && type <= Anim.EmphasizedExtraLarge)
|
||||
return Tokens.anim.curves.emphasized;
|
||||
return Tokens.anim.curves.standard;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,10 @@ BusyIndicator {
|
||||
property int animState
|
||||
property color bgColor: Colors.palette.m3secondaryContainer
|
||||
property color fgColor: Colors.palette.m3primary
|
||||
property real implicitSize: Tokens.font.body.medium.pointSize * 3
|
||||
property real implicitSize: Tokens.font.size.normal * 3
|
||||
property real internalStrokeWidth: strokeWidth
|
||||
readonly property alias progress: manager.progress
|
||||
property real strokeWidth: Tokens.padding.extraSmall * 0.8
|
||||
property real strokeWidth: Tokens.padding.small * 0.8
|
||||
property alias type: manager.indeterminateAnimationType
|
||||
|
||||
implicitHeight: implicitSize
|
||||
|
||||
@@ -21,7 +21,7 @@ Item {
|
||||
readonly property real size: Math.min(width, height)
|
||||
property int spacing: Tokens.spacing.small
|
||||
property int startAngle: -90
|
||||
property int strokeWidth: Tokens.padding.extraSmall
|
||||
property int strokeWidth: Tokens.padding.small
|
||||
property int sweepAngle: 360
|
||||
readonly property real thickness: strokeWidth * (1 + waveAmplitude) * 2
|
||||
property real value
|
||||
@@ -46,7 +46,8 @@ Item {
|
||||
strokeWidth: Math.min(1, remainingArc.sweepAngle) * root.strokeWidth
|
||||
|
||||
Behavior on strokeColor {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
|
||||
PathAngleArc {
|
||||
@@ -83,7 +84,8 @@ Item {
|
||||
}
|
||||
}
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
Anim on waveProgress {
|
||||
id: waveProgAnim
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
import QtQuick
|
||||
import ZShell.Components
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property real radius
|
||||
property real topLeftRadius: radius
|
||||
property real topRightRadius: radius
|
||||
property real bottomRightRadius: radius
|
||||
property real bottomLeftRadius: radius
|
||||
property color color: "transparent"
|
||||
default property alias contentData: contentItem.data
|
||||
|
||||
Item {
|
||||
id: contentItem
|
||||
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
ShaderEffectSource {
|
||||
id: source
|
||||
|
||||
hideSource: true
|
||||
sourceItem: contentItem
|
||||
}
|
||||
|
||||
RoundedMask {
|
||||
anchors.fill: parent
|
||||
source: source
|
||||
topLeftRadius: root.topLeftRadius
|
||||
topRightRadius: root.topRightRadius
|
||||
bottomRightRadius: root.bottomRightRadius
|
||||
bottomLeftRadius: root.bottomLeftRadius
|
||||
color: root.color
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ ClippingRectangle {
|
||||
color: "transparent"
|
||||
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,13 @@
|
||||
import QtQuick
|
||||
import qs.Services
|
||||
|
||||
Flickable {
|
||||
id: root
|
||||
|
||||
property bool doneFakeFlick
|
||||
|
||||
interactive: !ShellState.forActive().isDrawing
|
||||
maximumFlickVelocity: 3000
|
||||
|
||||
rebound: Transition {
|
||||
onRunningChanged: {
|
||||
if (!running && !root.doneFakeFlick) {
|
||||
root.doneFakeFlick = true;
|
||||
root.flick(1, 1);
|
||||
root.flick(-1, -1);
|
||||
Qt.callLater(() => root.cancelFlick());
|
||||
}
|
||||
}
|
||||
|
||||
Anim {
|
||||
properties: "x,y"
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 10
|
||||
running: root.doneFakeFlick
|
||||
|
||||
onTriggered: {
|
||||
root.doneFakeFlick = false;
|
||||
root.returnToBounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,13 @@
|
||||
import QtQuick
|
||||
import qs.Services
|
||||
|
||||
ListView {
|
||||
id: root
|
||||
|
||||
property bool doneFakeFlick
|
||||
|
||||
interactive: !ShellState.forActive()?.isDrawing
|
||||
maximumFlickVelocity: 3000
|
||||
|
||||
rebound: Transition {
|
||||
// onRunningChanged: {
|
||||
// if (!running && !root.doneFakeFlick) {
|
||||
// root.doneFakeFlick = true;
|
||||
// root.flick(1, 1);
|
||||
// root.flick(-1, -1);
|
||||
// Qt.callLater(() => root.cancelFlick());
|
||||
// }
|
||||
// }
|
||||
|
||||
Anim {
|
||||
properties: "x,y"
|
||||
type: Anim.DefaultEffects
|
||||
}
|
||||
}
|
||||
|
||||
// Timer {
|
||||
// interval: 10
|
||||
// running: root.doneFakeFlick
|
||||
//
|
||||
// onTriggered: {
|
||||
// root.doneFakeFlick = false;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ MouseArea {
|
||||
property int scrollAccumulatedY: 0
|
||||
|
||||
function onWheel(event: WheelEvent): void {
|
||||
event.accepted = false;
|
||||
}
|
||||
|
||||
onWheel: event => {
|
||||
|
||||
@@ -6,6 +6,7 @@ Rectangle {
|
||||
color: "transparent"
|
||||
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,36 +14,36 @@ Text {
|
||||
property real animateTo: 1
|
||||
|
||||
color: Colors.palette.m3onSurface
|
||||
font: Tokens.font.body.small
|
||||
font.family: Config.appearance.font.family.sans
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
linkColor: Colors.palette.m3onPrimaryFixedVariant
|
||||
renderType: Text.QtRendering
|
||||
renderType: Text.NativeRendering
|
||||
textFormat: Text.PlainText
|
||||
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
Behavior on text {
|
||||
enabled: root.animate
|
||||
|
||||
SequentialAnimation {
|
||||
TAnim {
|
||||
target: root
|
||||
Anim {
|
||||
to: root.animateFrom
|
||||
type: Anim.FastEffects
|
||||
}
|
||||
|
||||
PropertyAction {}
|
||||
PropertyAction {
|
||||
}
|
||||
|
||||
TAnim {
|
||||
target: root
|
||||
Anim {
|
||||
to: root.animateTo
|
||||
type: Anim.DefaultEffects
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component TAnim: Anim {
|
||||
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
|
||||
|
||||
@@ -1,305 +1,76 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
import QtQuick.Controls
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
TextFieldBase {
|
||||
TextField {
|
||||
id: root
|
||||
|
||||
enum TextFieldType {
|
||||
Outlined,
|
||||
Filled
|
||||
}
|
||||
background: null
|
||||
color: Colors.palette.m3onSurface
|
||||
cursorVisible: !readOnly
|
||||
font.family: Config.appearance.font.family.sans
|
||||
font.pointSize: Tokens.font.size.smaller
|
||||
placeholderTextColor: Colors.palette.m3outline
|
||||
renderType: echoMode === TextField.Password ? TextField.QtRendering : TextField.NativeRendering
|
||||
|
||||
readonly property int clampedRadius: Math.min(horizontalPadding, Math.min(width, height) / 2, radius)
|
||||
readonly property string effectiveSupportingText: isError && errorText ? errorText : supportingText
|
||||
readonly property int filledOffset: type === CustomTextField.Filled ? Tokens.spacing.small : 0
|
||||
readonly property int leadingOffset: leadingIcon ? leadingIconLoader.width + leadingIconLoader.anchors.leftMargin : 0
|
||||
readonly property real smallFontScale: smallFontSize / font.pointSize
|
||||
readonly property int supportingTextOffset: effectiveSupportingText ? supportingTextLoader.height + Tokens.spacing.extraSmall : 0
|
||||
readonly property int trailingOffset: trailingIcon ? trailingIconLoader.width + trailingIconLoader.anchors.rightMargin : 0
|
||||
readonly property bool valid: !validate || (!text && emptyIsValid) || (validate instanceof RegExp ? validate.test(text) : !!validate(text))
|
||||
|
||||
property int horizontalPadding: Tokens.padding.large
|
||||
property int verticalPadding: Tokens.padding.large
|
||||
|
||||
property int radius: Tokens.rounding.small
|
||||
|
||||
property string supportingText
|
||||
property string trailingIcon
|
||||
property int smallFontSize: Tokens.font.label.small.pointSize
|
||||
|
||||
property int type: CustomTextField.Outlined
|
||||
property var validate // Regex or function
|
||||
property bool emptyIsValid: true
|
||||
property string errorText
|
||||
property bool isError
|
||||
property string leadingIcon
|
||||
|
||||
bottomPadding: verticalPadding + supportingTextOffset - filledOffset
|
||||
leftPadding: horizontalPadding + leadingOffset
|
||||
rightPadding: horizontalPadding + trailingOffset
|
||||
topPadding: verticalPadding + filledOffset
|
||||
|
||||
background: Loader {
|
||||
anchors.bottomMargin: root.supportingTextOffset
|
||||
anchors.fill: parent
|
||||
sourceComponent: root.type === CustomTextField.Filled ? filledComp : outlineComp
|
||||
|
||||
StateLayer {
|
||||
id: stateLayer
|
||||
|
||||
cursorShape: Qt.IBeamCursor
|
||||
enabled: !root.activeFocus
|
||||
manualPressOverride: tapHandler.pressed
|
||||
radius: root.type === CustomTextField.Outlined ? root.clampedRadius : 0
|
||||
topLeftRadius: root.clampedRadius
|
||||
topRightRadius: root.clampedRadius
|
||||
|
||||
onClicked: root.focus = true
|
||||
Behavior on color {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
cursorDelegate: CustomRect {
|
||||
id: cursor
|
||||
|
||||
onEditingFinished: {
|
||||
if (!valid)
|
||||
isError = true;
|
||||
}
|
||||
onPressed: {
|
||||
if (stateLayer.enabled)
|
||||
stateLayer.press(stateLayer.mouseX, stateLayer.mouseY);
|
||||
}
|
||||
onTextEdited: {
|
||||
if (isError)
|
||||
isError = false;
|
||||
}
|
||||
property bool disableBlink
|
||||
|
||||
Item {
|
||||
id: contentWrapper
|
||||
color: Colors.palette.m3primary
|
||||
implicitWidth: 2
|
||||
radius: Tokens.rounding.normal
|
||||
|
||||
anchors.bottomMargin: root.supportingTextOffset
|
||||
anchors.fill: parent
|
||||
|
||||
CustomText {
|
||||
id: placeholder
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: root.leftPadding
|
||||
anchors.topMargin: Tokens.padding.extraSmall
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: root.isError ? Colors.palette.m3error : (root.activeFocus ? Colors.palette.m3primary : root.text ? Colors.palette.m3outline : root.placeholderTextColor)
|
||||
font.family: root.font.family
|
||||
font.pointSize: root.font.pointSize
|
||||
font.variableAxes: root.font.variableAxes
|
||||
font.weight: root.font.weight
|
||||
renderType: Text.QtRendering
|
||||
text: root.placeholderText
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "smallOutlined"
|
||||
when: root.type === CustomTextField.Outlined && (root.activeFocus || root.text)
|
||||
|
||||
PropertyChanges {
|
||||
placeholder.anchors.leftMargin: -(1 - root.smallFontScale) * placeholder.width / 2 + root.horizontalPadding
|
||||
placeholder.scale: root.smallFontScale
|
||||
}
|
||||
|
||||
AnchorChanges {
|
||||
anchors.verticalCenter: contentWrapper.top
|
||||
target: placeholder
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "smallFilled"
|
||||
when: root.type === CustomTextField.Filled && (root.activeFocus || root.text)
|
||||
|
||||
PropertyChanges {
|
||||
placeholder.anchors.leftMargin: -(1 - root.smallFontScale) * placeholder.width / 2 + root.horizontalPadding + root.leadingOffset
|
||||
placeholder.scale: root.smallFontScale
|
||||
}
|
||||
|
||||
AnchorChanges {
|
||||
anchors.top: contentWrapper.top
|
||||
anchors.verticalCenter: undefined
|
||||
target: placeholder
|
||||
}
|
||||
}
|
||||
]
|
||||
transitions: Transition {
|
||||
Anim {
|
||||
properties: "scale,leftMargin"
|
||||
type: Anim.DefaultEffects
|
||||
}
|
||||
|
||||
AnchorAnim {
|
||||
duration: Tokens.anim.durations.expressiveDefaultEffects
|
||||
easing: Tokens.anim.expressiveDefaultEffects
|
||||
}
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
duration: Tokens.anim.durations.small
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: leadingIconLoader
|
||||
|
||||
active: root.leadingIcon
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Tokens.padding.small
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
sourceComponent: MaterialIcon {
|
||||
color: Colors.palette.m3onSurfaceVariant
|
||||
text: root.leadingIcon
|
||||
fontStyle: Tokens.font.icon.builders.medium.scale(0.9).build()
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: trailingIconLoader
|
||||
|
||||
active: root.trailingIcon
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Tokens.padding.small
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
sourceComponent: MaterialIcon {
|
||||
color: Colors.palette.m3onSurfaceVariant
|
||||
text: root.trailingIcon
|
||||
fontStyle: Tokens.font.icon.builders.medium.scale(0.9).build()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: supportingTextLoader
|
||||
|
||||
active: root.effectiveSupportingText
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: root.horizontalPadding
|
||||
|
||||
sourceComponent: CustomText {
|
||||
color: root.isError ? Colors.palette.m3error : Colors.palette.m3onSurfaceVariant
|
||||
font: Tokens.font.label.small
|
||||
text: root.effectiveSupportingText
|
||||
}
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
id: tapHandler
|
||||
}
|
||||
|
||||
Component {
|
||||
id: outlineComp
|
||||
|
||||
Shape {
|
||||
id: bg
|
||||
|
||||
asynchronous: true
|
||||
preferredRendererType: Shape.CurveRenderer
|
||||
|
||||
ShapePath {
|
||||
id: path
|
||||
|
||||
readonly property real inset: strokeWidth / 2
|
||||
readonly property real outlineGap: placeholder.width * root.smallFontScale + Tokens.spacing.small * 2
|
||||
property real outlineGapScale: root.activeFocus || root.text ? 1 : 0
|
||||
|
||||
capStyle: ShapePath.RoundCap
|
||||
fillColor: "transparent"
|
||||
startX: path.inset + root.horizontalPadding - root.clampedRadius + path.outlineGap * (1 - path.outlineGapScale) / 2 + path.outlineGap * path.outlineGapScale
|
||||
startY: path.inset
|
||||
strokeColor: root.isError ? Colors.palette.m3error : (root.activeFocus ? Colors.palette.m3primary : Colors.palette.m3outline)
|
||||
strokeWidth: root.activeFocus ? 2 : 1
|
||||
|
||||
Behavior on outlineGapScale {
|
||||
Anim {
|
||||
type: Anim.DefaultEffects
|
||||
}
|
||||
}
|
||||
Behavior on strokeColor {
|
||||
CAnim {}
|
||||
}
|
||||
Behavior on strokeWidth {
|
||||
Anim {}
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: bg.width - path.inset - root.clampedRadius
|
||||
y: path.inset
|
||||
}
|
||||
|
||||
PathArc {
|
||||
radiusX: root.clampedRadius
|
||||
radiusY: root.clampedRadius
|
||||
x: bg.width - path.inset
|
||||
y: path.inset + root.clampedRadius
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: bg.width - path.inset
|
||||
y: bg.height - path.inset - root.clampedRadius
|
||||
}
|
||||
|
||||
PathArc {
|
||||
radiusX: root.clampedRadius
|
||||
radiusY: root.clampedRadius
|
||||
x: bg.width - path.inset - root.clampedRadius
|
||||
y: bg.height - path.inset
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: path.inset + root.clampedRadius
|
||||
y: bg.height - path.inset
|
||||
}
|
||||
|
||||
PathArc {
|
||||
radiusX: root.clampedRadius
|
||||
radiusY: root.clampedRadius
|
||||
x: path.inset
|
||||
y: bg.height - path.inset - root.clampedRadius
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: path.inset
|
||||
y: path.inset + root.clampedRadius
|
||||
}
|
||||
|
||||
PathArc {
|
||||
radiusX: root.clampedRadius
|
||||
radiusY: root.clampedRadius
|
||||
x: path.inset + root.clampedRadius
|
||||
y: path.inset
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: path.inset + root.horizontalPadding - root.clampedRadius / 2 + path.outlineGap * (1 - path.outlineGapScale) / 2
|
||||
y: path.inset
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: filledComp
|
||||
|
||||
CustomRect {
|
||||
color: root.activeFocus ? Colors.tPalette.m3surfaceContainerHighest : Colors.tPalette.m3surfaceContainerHigh
|
||||
topLeftRadius: root.clampedRadius
|
||||
topRightRadius: root.clampedRadius
|
||||
|
||||
CustomRect {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
color: root.isError ? Colors.palette.m3error : (root.activeFocus ? Colors.palette.m3primary : Colors.palette.m3outline)
|
||||
implicitHeight: root.activeFocus ? 2 : 1
|
||||
|
||||
Behavior on implicitHeight {
|
||||
Anim {}
|
||||
}
|
||||
}
|
||||
Behavior on placeholderTextColor {
|
||||
CAnim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import qs.Services
|
||||
TextInput {
|
||||
renderType: Text.NativeRendering
|
||||
selectedTextColor: Colors.palette.m3onSecondaryContainer
|
||||
selectionColor: Colors.tPalette.colSecondaryContainer
|
||||
selectionColor: Colors.tPalette.m3onSecondaryContainer
|
||||
|
||||
font {
|
||||
family: Config.appearance?.font.family.sans ?? "sans-serif"
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import ZShell.Config
|
||||
|
||||
Image {
|
||||
id: root
|
||||
|
||||
property int fadeInAnim: Anim.DefaultEffects
|
||||
property int fadeInLargeAnim: Anim.StandardLarge
|
||||
property int fadeOutAnim: Anim.FastEffects
|
||||
property bool fadingOut
|
||||
property bool hadPrevious
|
||||
property bool preventInit
|
||||
|
||||
function maybeStartInAnim(): void {
|
||||
if (!preventInit && !opacityInAnim.running && status === Image.Ready) {
|
||||
opacityInAnim.type = hadPrevious ? fadeInAnim : fadeInLargeAnim;
|
||||
opacityInAnim.start();
|
||||
}
|
||||
}
|
||||
|
||||
asynchronous: true
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
opacity: 0
|
||||
retainWhileLoading: true
|
||||
sourceSize: {
|
||||
const dpr = (QsWindow.window as QsWindow)?.devicePixelRatio ?? 1;
|
||||
return Qt.size(width * dpr, height * dpr);
|
||||
}
|
||||
|
||||
Anim on opacity {
|
||||
id: opacityInAnim
|
||||
|
||||
running: false
|
||||
to: 1
|
||||
}
|
||||
Behavior on source {
|
||||
SequentialAnimation {
|
||||
ScriptAction {
|
||||
script: opacityInAnim.stop()
|
||||
}
|
||||
|
||||
PropertyAction {
|
||||
property: "fadingOut"
|
||||
target: root
|
||||
value: true
|
||||
}
|
||||
|
||||
Anim {
|
||||
property: "opacity"
|
||||
target: root
|
||||
to: 0
|
||||
type: root.fadeOutAnim
|
||||
}
|
||||
|
||||
PropertyAction {
|
||||
property: "fadingOut"
|
||||
target: root
|
||||
value: false
|
||||
}
|
||||
|
||||
PropertyAction {
|
||||
property: "hadPrevious"
|
||||
target: root
|
||||
value: root.source
|
||||
}
|
||||
|
||||
PropertyAction {}
|
||||
|
||||
ScriptAction {
|
||||
script: root.maybeStartInAnim()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onPreventInitChanged: maybeStartInAnim()
|
||||
onStatusChanged: maybeStartInAnim()
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import M3Shapes
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
MaterialShape {
|
||||
id: root
|
||||
|
||||
property bool animated: true
|
||||
property real cRotation
|
||||
property bool containsIcon
|
||||
property real dampingRatio: 0.6
|
||||
property real lRotation
|
||||
property int morphAnimRotation: 60
|
||||
property real morphScale: 0.14
|
||||
property alias rotateAnimDuration: rotateAnim.duration
|
||||
property int shapeIndex
|
||||
property list<int> shapes: {
|
||||
if (containsIcon)
|
||||
return [MaterialShape.SoftBurst, MaterialShape.Cookie9Sided, MaterialShape.Pill, MaterialShape.Sunny, MaterialShape.Cookie4Sided, MaterialShape.Oval];
|
||||
return [MaterialShape.SoftBurst, MaterialShape.Cookie9Sided, MaterialShape.Pentagon, MaterialShape.Pill, MaterialShape.Sunny, MaterialShape.Cookie4Sided, MaterialShape.Oval];
|
||||
}
|
||||
readonly property real springDuration: {
|
||||
const wn = Math.sqrt(stiffness);
|
||||
const r = -dampingRatio * wn;
|
||||
const c = 1 / Math.sqrt(1 - dampingRatio * dampingRatio);
|
||||
return Math.log(visibilityThreshold / c) / r;
|
||||
}
|
||||
readonly property real springMaxVelocity: {
|
||||
const wn = Math.sqrt(stiffness);
|
||||
const factor = Math.exp(-z * Math.acos(z) / Math.sqrt(1 - z * z));
|
||||
return wn * factor;
|
||||
}
|
||||
property bool springSettled: true
|
||||
property real stiffness: 180
|
||||
property real thisLRotation
|
||||
property real visibilityThreshold: 0.075
|
||||
|
||||
function spring(t: real): var {
|
||||
const wn = Math.sqrt(stiffness);
|
||||
const za = dampingRatio * wn;
|
||||
|
||||
const wd = wn * Math.sqrt(1 - dampingRatio * dampingRatio);
|
||||
const r = za / wd;
|
||||
const pos = 1 - Math.exp(-za * t) * (Math.cos(wd * t) + r * Math.sin(wd * t));
|
||||
const vel = Math.exp(-za * t) * (wn * wn / wd) * Math.sin(wd * t);
|
||||
|
||||
return [pos, vel];
|
||||
}
|
||||
|
||||
color: Colors.palette.m3primary
|
||||
implicitSize: 38
|
||||
toShape: shapes[0]
|
||||
|
||||
RotationAnimation on cRotation {
|
||||
id: rotateAnim
|
||||
|
||||
duration: 4666
|
||||
easing.type: Easing.Linear
|
||||
from: 0
|
||||
loops: Animation.Infinite
|
||||
running: root.animated
|
||||
to: 360
|
||||
}
|
||||
Behavior on color {
|
||||
CAnim {}
|
||||
}
|
||||
|
||||
ElapsedTimer {
|
||||
id: timer
|
||||
}
|
||||
|
||||
FrameAnimation {
|
||||
running: root.animated && !root.springSettled
|
||||
|
||||
onTriggered: {
|
||||
const t = timer.elapsed();
|
||||
|
||||
if (t >= root.springDuration) {
|
||||
root.springSettled = true;
|
||||
} else {
|
||||
const [pos, vel] = root.spring(t);
|
||||
root.morphProgress = Math.min(1, pos); // Overshooting the morph looks weird
|
||||
root.thisLRotation = pos * root.morphAnimRotation;
|
||||
root.scale = 1 + vel * root.morphScale / root.springMaxVelocity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 650
|
||||
repeat: true
|
||||
running: root.animated
|
||||
triggeredOnStart: true
|
||||
|
||||
onTriggered: {
|
||||
root.beginBatchUpdate();
|
||||
root.fromShape = root.toShape;
|
||||
root.shapeIndex = (root.shapeIndex + 1) % root.shapes.length;
|
||||
root.toShape = root.shapes[root.shapeIndex];
|
||||
root.morphProgress = 0;
|
||||
|
||||
root.rotation = root.rotation;
|
||||
root.lRotation = (root.lRotation + root.thisLRotation) % 360;
|
||||
root.thisLRotation = 0;
|
||||
root.rotation = Qt.binding(() => root.cRotation + root.lRotation + root.thisLRotation);
|
||||
|
||||
root.springSettled = false;
|
||||
timer.restart();
|
||||
root.endBatchUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
import QtQuick
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
CustomText {
|
||||
id: root
|
||||
|
||||
property real fill: 0
|
||||
property real fill
|
||||
property int grade: Colors.light ? 0 : -25
|
||||
property font fontStyle: Tokens.font.icon.small
|
||||
|
||||
renderType: Text.NativeRendering
|
||||
font: Tokens.font.icon.size(fontStyle.pointSize).weight(fontStyle.weight).vaxes(fontStyle.variableAxes).fill(fill.toFixed(1)).grade(grade).build()
|
||||
font.family: "Material Symbols Rounded"
|
||||
font.pointSize: Tokens.font.size.larger
|
||||
font.variableAxes: ({
|
||||
FILL: fill.toFixed(1),
|
||||
GRAD: grade,
|
||||
opsz: fontInfo.pixelSize,
|
||||
wght: fontInfo.weight
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
import ZShell
|
||||
import ZShell.Components
|
||||
import qs.Helpers
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
|
||||
@@ -11,6 +13,7 @@ MouseArea {
|
||||
property alias bottomRightRadius: base.bottomRightRadius
|
||||
property real circleRadius
|
||||
property alias color: base.color
|
||||
property bool disabled
|
||||
readonly property real endRadius: {
|
||||
const d1 = distSq(0, 0);
|
||||
const d2 = distSq(width, 0);
|
||||
@@ -19,7 +22,6 @@ MouseArea {
|
||||
return (Math.sqrt(Math.max(d1, d2, d3, d4)) + (shapeMorph ? 24 : 0)) * 1.3;
|
||||
}
|
||||
property real endRadiusAtPress
|
||||
property bool manualHoverOverride
|
||||
property bool manualPressOverride
|
||||
property real pressX: width / 2
|
||||
property real pressY: height / 2
|
||||
@@ -27,7 +29,7 @@ MouseArea {
|
||||
readonly property alias rect: base
|
||||
property bool shapeMorph
|
||||
property bool showHoverBackground: true
|
||||
property real stateOpacity: containsMouse || manualHoverOverride ? 0.08 : 0
|
||||
property real stateOpacity: containsMouse ? 0.08 : 0
|
||||
property alias topLeftRadius: base.topLeftRadius
|
||||
property alias topRightRadius: base.topRightRadius
|
||||
|
||||
@@ -50,8 +52,8 @@ MouseArea {
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
cursorShape: !enabled ? undefined : Qt.PointingHandCursor
|
||||
enabled: parent.enabled
|
||||
cursorShape: disabled ? undefined : Qt.PointingHandCursor
|
||||
enabled: !disabled
|
||||
hoverEnabled: true
|
||||
|
||||
Behavior on stateOpacity {
|
||||
@@ -79,7 +81,7 @@ MouseArea {
|
||||
|
||||
alwaysRunToEnd: true
|
||||
duration: Tokens.anim.durations.expressiveSlowEffects * 2
|
||||
easing: Tokens.anim.standard
|
||||
easing.bezierCurve: Tokens.anim.curves.standard
|
||||
property: "circleRadius"
|
||||
target: root
|
||||
to: root.endRadius
|
||||
@@ -98,13 +100,13 @@ MouseArea {
|
||||
id: base
|
||||
|
||||
anchors.fill: parent
|
||||
bottomLeftRadius: root.parent?.bottomLeftRadius ?? radius ?? 0
|
||||
bottomRightRadius: root.parent?.bottomRightRadius ?? radius ?? 0
|
||||
color: Colors.palette.m3onSurface
|
||||
opacity: root.stateOpacity
|
||||
// Pick up radius from parent if it has one (parent can be anything with radius props)
|
||||
// qmllint disable missing-property
|
||||
radius: root.parent?.radius ?? 0
|
||||
bottomLeftRadius: root.parent?.bottomLeftRadius ?? radius ?? 0
|
||||
bottomRightRadius: root.parent?.bottomRightRadius ?? radius ?? 0
|
||||
topLeftRadius: root.parent?.topLeftRadius ?? radius ?? 0
|
||||
topRightRadius: root.parent?.topRightRadius ?? radius ?? 0
|
||||
// qmllint enable missing-property
|
||||
|
||||
+40
-17
@@ -11,18 +11,36 @@ RowLayout {
|
||||
required property var greeter
|
||||
required property real screenHeight
|
||||
|
||||
spacing: Tokens.spacing.largeIncreased * 2
|
||||
spacing: Tokens.spacing.large * 2
|
||||
|
||||
CustomRect {
|
||||
Layout.fillHeight: true
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
topLeftRadius: Tokens.rounding.largeIncreased
|
||||
bottomLeftRadius: Tokens.rounding.largeIncreased
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
radius: Tokens.rounding.small
|
||||
spacing: Tokens.spacing.normal
|
||||
|
||||
UserDock {
|
||||
greeter: root.greeter
|
||||
CustomRect {
|
||||
Layout.fillWidth: true
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: weather.implicitHeight
|
||||
radius: Tokens.rounding.small
|
||||
topLeftRadius: Tokens.rounding.large
|
||||
|
||||
WeatherInfo {
|
||||
id: weather
|
||||
|
||||
rootHeight: root.height
|
||||
}
|
||||
}
|
||||
|
||||
CustomClippingRect {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
bottomLeftRadius: Tokens.rounding.large
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
radius: Tokens.rounding.small
|
||||
|
||||
UserDock {
|
||||
greeter: root.greeter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,16 +49,21 @@ RowLayout {
|
||||
screenHeight: root.screenHeight
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
Layout.fillHeight: true
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
bottomRightRadius: Tokens.rounding.largeIncreased
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
radius: Tokens.rounding.small
|
||||
topRightRadius: Tokens.rounding.largeIncreased
|
||||
spacing: Tokens.spacing.normal
|
||||
|
||||
SessionDock {
|
||||
greeter: root.greeter
|
||||
CustomRect {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
bottomRightRadius: Tokens.rounding.large
|
||||
color: Colors.tPalette.m3surfaceContainer
|
||||
radius: Tokens.rounding.small
|
||||
topRightRadius: Tokens.rounding.large
|
||||
|
||||
SessionDock {
|
||||
greeter: root.greeter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ Scope {
|
||||
ParallelAnimation {
|
||||
Anim {
|
||||
duration: Tokens.anim.durations.expressiveFastSpatial
|
||||
easing: Tokens.anim.expressiveFastSpatial
|
||||
easing.bezierCurve: Tokens.anim.curves.expressiveFastSpatial
|
||||
property: "scale"
|
||||
target: lockContent
|
||||
to: 1
|
||||
@@ -65,7 +65,7 @@ Scope {
|
||||
|
||||
Anim {
|
||||
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
||||
easing: Tokens.anim.expressiveDefaultSpatial
|
||||
easing.bezierCurve: Tokens.anim.curves.expressiveDefaultSpatial
|
||||
property: "scale"
|
||||
target: content
|
||||
to: 1
|
||||
@@ -74,12 +74,12 @@ Scope {
|
||||
Anim {
|
||||
property: "radius"
|
||||
target: lockBg
|
||||
to: Tokens.rounding.largeIncreased * 1.5
|
||||
to: Tokens.rounding.large * 1.5
|
||||
}
|
||||
|
||||
Anim {
|
||||
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
||||
easing: Tokens.anim.expressiveDefaultSpatial
|
||||
easing.bezierCurve: Tokens.anim.curves.expressiveDefaultSpatial
|
||||
property: "implicitWidth"
|
||||
target: lockContent
|
||||
to: (win.screen?.height ?? 0) * Config.lock.sizes.heightMult * Config.lock.sizes.ratio
|
||||
@@ -87,7 +87,7 @@ Scope {
|
||||
|
||||
Anim {
|
||||
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
||||
easing: Tokens.anim.expressiveDefaultSpatial
|
||||
easing.bezierCurve: Tokens.anim.curves.expressiveDefaultSpatial
|
||||
property: "implicitHeight"
|
||||
target: lockContent
|
||||
to: (win.screen?.height ?? 0) * Config.lock.sizes.heightMult
|
||||
@@ -134,7 +134,8 @@ Scope {
|
||||
id: lockIcon
|
||||
|
||||
anchors.centerIn: parent
|
||||
fontStyle: Tokens.font.icon.builders.extraLarge.size(Tokens.font.icon.extraLarge.pointSize * 3).build()
|
||||
font.bold: true
|
||||
font.pointSize: Tokens.font.size.extraLarge * 4
|
||||
text: "lock"
|
||||
}
|
||||
|
||||
|
||||
@@ -200,5 +200,6 @@ Singleton {
|
||||
|
||||
ElapsedTimer {
|
||||
id: timer
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+16
-9
@@ -39,7 +39,8 @@ Item {
|
||||
anchors.centerIn: parent
|
||||
animate: true
|
||||
color: root.greeter.launching ? Colors.palette.m3secondary : Colors.palette.m3outline
|
||||
font: Tokens.font.mono.medium
|
||||
font.family: Config.appearance.font.family.mono
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
opacity: root.buffer ? 0 : 1
|
||||
text: {
|
||||
if (root.greeter.launching)
|
||||
@@ -50,7 +51,8 @@ Item {
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,13 +64,15 @@ Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: Colors.palette.m3onSurface
|
||||
elide: Text.ElideLeft
|
||||
font: Tokens.font.mono.medium
|
||||
font.family: Config.appearance.font.family.mono
|
||||
font.pointSize: Tokens.font.size.normal
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
opacity: root.greeter.echoResponse && root.buffer ? 1 : 0
|
||||
text: root.buffer
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +89,7 @@ Item {
|
||||
|
||||
anchors.centerIn: parent
|
||||
anchors.horizontalCenterOffset: implicitWidth > root.width ? -(implicitWidth - root.width) / 2 : 0
|
||||
implicitHeight: Tokens.font.body.medium
|
||||
implicitHeight: Tokens.font.size.normal
|
||||
implicitWidth: fullWidth
|
||||
interactive: false
|
||||
opacity: root.greeter.echoResponse ? 0 : 1
|
||||
@@ -103,12 +107,13 @@ Item {
|
||||
scale: 0
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
Anim {
|
||||
duration: Tokens.anim.durations.expressiveFastSpatial
|
||||
easing: Tokens.anim.expressiveFastSpatial
|
||||
easing.bezierCurve: Tokens.anim.curves.expressiveFastSpatial
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,13 +156,15 @@ Item {
|
||||
Behavior on implicitWidth {
|
||||
id: imWidthBehavior
|
||||
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
model: ScriptModel {
|
||||
values: root.buffer.split("")
|
||||
}
|
||||
Behavior on opacity {
|
||||
Anim {}
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user