Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3345906b9 | ||
|
|
08d42e1f8a | ||
|
|
45aa6c9005 | ||
|
|
1763b03287 | ||
|
|
72ff6ad42a | ||
|
|
2a45740020 | ||
|
|
0a503bc27c | ||
|
|
1fe8a3a959 | ||
|
|
ae25f33fc8
|
||
|
|
02267ec9a6
|
||
|
|
4b8d74a7e5
|
||
|
|
1fa3c84a56
|
||
|
|
fc81be922f | ||
|
|
8d54e1ce6f | ||
|
|
bee8cd061b | ||
|
|
b9e818faa9 | ||
|
|
2cabd72fc0 | ||
|
|
255db9e533 | ||
|
|
a4f6aa1d4a | ||
|
|
3883917228 | ||
|
|
bf6a7027e4 | ||
|
|
873b2eb01b | ||
|
|
d70fb61e4a | ||
|
|
4c410d638c | ||
|
|
aef7cd5918 | ||
|
|
a13fa8442b | ||
|
|
4d75b317cd | ||
|
|
76823eff79 | ||
|
|
909b5113fb | ||
|
|
c06cbea854 | ||
|
|
376595cd0b | ||
|
|
a00bbe50f2 | ||
|
|
11e94fbb4b | ||
|
|
9f5e62f9c7 | ||
|
|
b91befa9f7 | ||
|
|
f90e9bb1a0 | ||
|
|
99fdfbc465 | ||
|
|
2c88b7abcb | ||
|
|
e148a0f843 | ||
|
|
f1918172c3 | ||
|
|
5507b99fdc | ||
|
|
506b69165d | ||
|
|
dc99d6677c | ||
|
|
add3beed59 | ||
|
|
fc672924d1 | ||
|
|
4b67cc1d88 | ||
|
|
765b84a19c | ||
|
|
c64088441b | ||
|
|
ad36b4ed8f | ||
|
|
e8bf8b9727 | ||
|
|
54f966b4ea | ||
|
|
c1f26e7dcb | ||
|
|
8dd65a90a8 | ||
|
|
3c359ce25f | ||
|
|
63b96471b0 | ||
|
|
42026ba5e5 | ||
|
|
e86d1e8220 | ||
|
|
4f797a9741 | ||
|
|
83bc153ee3 | ||
|
|
ca51f660ad | ||
|
|
5153cc4f17 | ||
|
|
bdfb9fc241 | ||
|
|
13f1a3fede | ||
|
|
d8a3d5732e | ||
|
|
51ed270774 | ||
|
|
83f6f95f6e | ||
|
|
cafdce2352 | ||
|
|
5fc6fda804 | ||
|
|
a59e4286ad | ||
|
|
e2786a3f1e | ||
|
|
e700a4f96b | ||
|
|
a8fdc31b8d | ||
|
|
bc927b16af | ||
|
|
57a6e48dcb | ||
|
|
15769ba78e | ||
|
|
be541d8f8d | ||
|
|
0d4c08cfbb | ||
|
|
d3ac675492 | ||
|
|
e58440fea4 | ||
|
|
d5d2311c24 | ||
|
|
5ec682d780 | ||
|
|
79bedd5119 | ||
|
|
14b54206b1 | ||
|
|
2df1cfe9aa | ||
|
|
88bb413f9a | ||
|
|
1ab49d4b38 | ||
|
|
7cc673430c | ||
|
|
08bb221699 | ||
|
|
60293abe61 | ||
|
|
a22022e969 | ||
|
|
62e19b5261 | ||
|
|
d76aaf093b | ||
|
|
4ebb4ce859 | ||
|
|
be3c938c39 | ||
|
|
f6fa2f0230 | ||
|
|
4a021d81ac | ||
|
|
10d763cfe5 | ||
|
|
133d453f6f | ||
|
|
3373f11193 | ||
|
|
359f832609 | ||
|
|
0bfda04e91 | ||
|
|
f825e4d53b | ||
|
|
2c90339c77 | ||
|
|
d259c6ffbe | ||
|
|
5330ae71d2 | ||
|
|
23d2b31c0a | ||
|
|
731b323670 | ||
|
|
520020b7f8 | ||
|
|
82ca5b5335 | ||
|
|
bd699e72a7 | ||
|
|
ed7ec326b1 | ||
|
|
04869656aa | ||
|
|
2f6847ce0e | ||
|
|
e5e52802de | ||
|
|
42f02f4dd2 | ||
|
|
9df3a64815 | ||
|
|
9370284c6b | ||
|
|
293bf67e09 | ||
|
|
c33dbc147f | ||
|
|
78988700be | ||
|
|
3946541f87 | ||
|
|
e18875a752 | ||
|
|
5598f4f435 | ||
|
|
7e02c87b91 | ||
|
|
aae3757daf | ||
|
|
37c6a9986e | ||
|
|
9657e5092a | ||
|
|
47bab21e22 | ||
|
|
d3e61efd86 | ||
|
|
de95b6c8f9 | ||
|
|
4ff4afa279 | ||
|
|
8a83181f11 | ||
|
|
f778335600 | ||
|
|
6de7672c05 | ||
|
|
eb65e44ac8 | ||
|
|
d74daf96ca | ||
|
|
de44096132 | ||
|
|
59213cf30d | ||
|
|
7e9c05d90a | ||
|
|
f9a17caaf3 | ||
|
|
7d6f3cc275 | ||
|
|
8ec454306f | ||
|
|
968055a24e | ||
|
|
46855b6a7f | ||
|
|
dfc203f905 | ||
|
|
78c0a6fdfc | ||
|
|
98fc9aa97a | ||
|
|
db76ae7dc6 | ||
|
|
de55b5f1e4 | ||
|
|
2c62ad093c | ||
|
|
97c48d03f4 | ||
|
|
69d8f6d727 | ||
|
|
ddfa6cd3c4 | ||
|
|
c35e73886a | ||
|
|
c7bf7cdc0b | ||
|
|
177b0f319c | ||
|
|
d3e781731e | ||
|
|
abb180c947 | ||
|
|
babfe4b3de | ||
|
|
31f73b05e4 | ||
|
|
a6c1985bff | ||
|
|
69c2bfae9d | ||
|
|
43647dd486 | ||
|
|
43f070f887 | ||
|
|
4e75f21446 | ||
|
|
654632128f | ||
|
|
797fe31b2b | ||
|
|
4037a1dd0f | ||
|
|
03ef51cd0c | ||
|
|
a41c0adb3e | ||
|
|
33c9432390 | ||
|
|
bfaba488f3 | ||
|
|
0c788ca4dc | ||
|
|
4f4b3ce8c6 | ||
|
|
c42feec312 | ||
|
|
ba567efc22 | ||
|
|
cbb24a2c40 | ||
|
|
da21675f03 | ||
|
|
8883d98b00
|
||
|
|
cf907089da
|
||
|
|
070fe7add0 | ||
|
|
052e3a7800 | ||
|
|
ec80adf0a5 | ||
|
|
88a2808a47 | ||
|
|
a13daf27a6 | ||
|
|
75de349ff4 | ||
|
|
439a14d29e | ||
|
|
bf5a8b8049 | ||
|
|
a9bbb21f54 | ||
|
|
bb50cf756d | ||
|
|
57147dc7c1 | ||
|
|
620fe001a4 | ||
|
|
85320e9ea1 | ||
|
|
259a4dde7a | ||
|
|
d6230bef34 | ||
|
|
4ee9bb3f12 | ||
|
|
8789d2d322 |
@@ -0,0 +1,5 @@
|
|||||||
|
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,7 +38,6 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: OS
|
label: OS
|
||||||
options:
|
options:
|
||||||
- NixOS
|
|
||||||
- Arch
|
- Arch
|
||||||
- Debian / Ubuntu
|
- Debian / Ubuntu
|
||||||
- Fedora
|
- Fedora
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ body:
|
|||||||
- Refactor / style
|
- Refactor / style
|
||||||
- CI / build / tooling
|
- CI / build / tooling
|
||||||
- Documentation
|
- Documentation
|
||||||
|
- Other (Describe in description box with header "Issue type")
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
|
|||||||
+22
-87
@@ -1,12 +1,15 @@
|
|||||||
name: Python
|
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:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
fmt:
|
static:
|
||||||
runs-on: alpine
|
runs-on: debian
|
||||||
container: node:26-alpine
|
container: node:26-trixie-slim
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -14,10 +17,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Install tools
|
- name: Install tools
|
||||||
run: |
|
run: |
|
||||||
apk add --no-cache \
|
apt-get update
|
||||||
git \
|
apt-get install -y --no-install-recommends git python3 python3-pip python3-venv
|
||||||
python3 \
|
|
||||||
py3-pip
|
|
||||||
python3 -m venv .venv
|
python3 -m venv .venv
|
||||||
. .venv/bin/activate
|
. .venv/bin/activate
|
||||||
pip install --no-cache-dir ruff
|
pip install --no-cache-dir ruff
|
||||||
@@ -27,32 +28,15 @@ jobs:
|
|||||||
. .venv/bin/activate
|
. .venv/bin/activate
|
||||||
ruff format --check .
|
ruff format --check .
|
||||||
|
|
||||||
lint:
|
|
||||||
runs-on: alpine
|
|
||||||
container: node:26-alpine
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install tools
|
|
||||||
run: |
|
|
||||||
apk add --no-cache \
|
|
||||||
git \
|
|
||||||
python3 \
|
|
||||||
py3-pip
|
|
||||||
python3 -m venv .venv
|
|
||||||
. .venv/bin/activate
|
|
||||||
pip install --no-cache-dir ruff
|
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: |
|
run: |
|
||||||
. .venv/bin/activate
|
. .venv/bin/activate
|
||||||
ruff check .
|
ruff check .
|
||||||
|
|
||||||
test:
|
verify:
|
||||||
runs-on: alpine
|
if: always()
|
||||||
container: node:26-alpine
|
runs-on: debian
|
||||||
|
container: node:26-trixie-slim
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -60,20 +44,16 @@ jobs:
|
|||||||
|
|
||||||
- name: Install tools
|
- name: Install tools
|
||||||
run: |
|
run: |
|
||||||
apk add --no-cache \
|
apt-get update
|
||||||
git \
|
apt-get install -y --no-install-recommends $APT_DEPS build-essential python3-dev
|
||||||
python3 \
|
python3 -m venv --system-site-packages .venv
|
||||||
py3-pip \
|
|
||||||
py3-pillow \
|
|
||||||
build-base
|
|
||||||
python3 -m venv .venv
|
|
||||||
. .venv/bin/activate
|
. .venv/bin/activate
|
||||||
pip install --no-cache-dir \
|
pip install --no-cache-dir basedpyright nuitka .
|
||||||
typer \
|
|
||||||
pillow \
|
- name: Type check
|
||||||
materialyoucolor \
|
run: |
|
||||||
jinja2 \
|
. .venv/bin/activate
|
||||||
pytest
|
basedpyright
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
@@ -81,52 +61,7 @@ jobs:
|
|||||||
cd cli
|
cd cli
|
||||||
python -m pytest tests/ -v
|
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
|
- name: Nuitka module check
|
||||||
run: |
|
run: |
|
||||||
. .venv/bin/activate
|
. .venv/bin/activate
|
||||||
nuitka --module --include-package=zshell cli/src/zshell/
|
nuitka --module --include-package=zshell cli/src/zshell/
|
||||||
@@ -16,3 +16,8 @@ dist/
|
|||||||
**/test-plugins/
|
**/test-plugins/
|
||||||
**/Charts/
|
**/Charts/
|
||||||
network-dev/
|
network-dev/
|
||||||
|
**/zshell.build/
|
||||||
|
**/zshell.dist/
|
||||||
|
.opencode/
|
||||||
|
run-agent.sh
|
||||||
|
AGENTS.md
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
.venv/
|
.venv/
|
||||||
scripts/fzf.js
|
scripts/fzf.js
|
||||||
scripts/fuzzysort.js
|
scripts/fuzzysort.js
|
||||||
|
scripts/settings-indexer.js
|
||||||
|
|||||||
+2
-1
@@ -3,8 +3,9 @@ FunctionsSpacing=true
|
|||||||
IndentWidth=4
|
IndentWidth=4
|
||||||
MaxColumnWidth=-1
|
MaxColumnWidth=-1
|
||||||
NewlineType=native
|
NewlineType=native
|
||||||
NormalizeOrder=true
|
GroupAttributesTogether=false
|
||||||
ObjectsSpacing=true
|
ObjectsSpacing=true
|
||||||
SemicolonRule=always
|
SemicolonRule=always
|
||||||
|
SingleLineEmptyObjects=true
|
||||||
SortImports=false
|
SortImports=false
|
||||||
UseTabs=true
|
UseTabs=true
|
||||||
|
|||||||
+33
-22
@@ -26,49 +26,51 @@ if(NOT DEFINED VERSION)
|
|||||||
endif()
|
endif()
|
||||||
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}")
|
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||||
|
|
||||||
project(ZShell VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
project(ZShell VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||||
message(STATUS "ZShell version: ${VERSION}")
|
message(STATUS "ZShell version: ${VERSION}")
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
set(ENABLE_MODULES "plugin;shell;m3shapes" CACHE STRING "Modules to build/install")
|
set(ENABLE_MODULES "plugin;shell;cli;m3shapes" CACHE STRING "Modules to build/install")
|
||||||
|
|
||||||
set(INSTALL_LIBDIR "usr/lib/ZShell" CACHE STRING "Library install dir")
|
set(INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/ZShell" CACHE STRING "Library install dir")
|
||||||
set(INSTALL_QMLDIR "usr/lib/qt6/qml" CACHE STRING "QML install dir")
|
set(INSTALL_QMLDIR "${CMAKE_INSTALL_LIBDIR}/qt6/qml" CACHE STRING "QML install dir")
|
||||||
set(INSTALL_QSCONFDIR "etc/xdg/quickshell/zshell" CACHE STRING "Quickshell config install dir")
|
set(INSTALL_QSCONFDIR "${CMAKE_INSTALL_SYSCONFDIR}/xdg/quickshell/zshell" CACHE STRING "Quickshell config install dir")
|
||||||
set(INSTALL_GREETERCONFDIR "etc/xdg/quickshell/zshell-greeter" CACHE STRING "Quickshell greeter install dir")
|
set(INSTALL_GREETERCONFDIR "${CMAKE_INSTALL_SYSCONFDIR}/xdg/quickshell/zshell-greeter" CACHE STRING "Quickshell greeter install dir")
|
||||||
|
|
||||||
set(CMAKE_INSTALL_MESSAGE NEVER)
|
set(CMAKE_INSTALL_MESSAGE NEVER)
|
||||||
|
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
-Wall -Wextra -Wpedantic -Wshadow -Wconversion
|
-Wall -Wextra -Wpedantic -Wshadow -Wconversion
|
||||||
-Wold-style-cast -Wnull-dereference -Wdouble-promotion
|
-Wnull-dereference -Wdouble-promotion
|
||||||
-Wformat=2 -Wfloat-equal -Woverloaded-virtual
|
-Wformat=2 -Wfloat-equal
|
||||||
-Wsign-conversion -Wredundant-decls -Wswitch
|
-Wsign-conversion -Wredundant-decls -Wswitch
|
||||||
-Wunreachable-code
|
-Wunreachable-code
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast>
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:-Woverloaded-virtual>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if("shell" IN_LIST ENABLE_MODULES)
|
if("cli" 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
|
# Nuitka compilation
|
||||||
set(ZSHELL_CLI_BUILD_DIR "${CMAKE_BINARY_DIR}/zshell-cli")
|
set(ZSHELL_CLI_BUILD_DIR "${CMAKE_BINARY_DIR}/zshell-cli")
|
||||||
set(ZSHELL_CLI_DIST "${ZSHELL_CLI_BUILD_DIR}/zshell.dist")
|
set(ZSHELL_CLI_DIST "${ZSHELL_CLI_BUILD_DIR}/zshell.dist")
|
||||||
@@ -93,6 +95,8 @@ if("shell" IN_LIST ENABLE_MODULES)
|
|||||||
${NUITKA_EXECUTABLE}
|
${NUITKA_EXECUTABLE}
|
||||||
--standalone
|
--standalone
|
||||||
--include-data-dir=${CMAKE_SOURCE_DIR}/cli/src/zshell/assets=zshell/assets
|
--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-dir=${ZSHELL_CLI_BUILD_DIR}
|
||||||
--output-filename=zshell-cli
|
--output-filename=zshell-cli
|
||||||
${CMAKE_SOURCE_DIR}/cli/src/zshell/
|
${CMAKE_SOURCE_DIR}/cli/src/zshell/
|
||||||
@@ -186,4 +190,11 @@ if("m3shapes" IN_LIST ENABLE_MODULES)
|
|||||||
if(TARGET m3shapesplugin)
|
if(TARGET m3shapesplugin)
|
||||||
set_target_properties(m3shapesplugin PROPERTIES INSTALL_RPATH "$ORIGIN")
|
set_target_properties(m3shapesplugin PROPERTIES INSTALL_RPATH "$ORIGIN")
|
||||||
endif()
|
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()
|
endif()
|
||||||
|
|||||||
@@ -27,25 +27,25 @@ AnchorAnimation {
|
|||||||
if (type == AnchorAnim.DefaultSpatial)
|
if (type == AnchorAnim.DefaultSpatial)
|
||||||
return Tokens.anim.durations.expressiveDefaultSpatial;
|
return Tokens.anim.durations.expressiveDefaultSpatial;
|
||||||
if (type == AnchorAnim.SlowSpatial)
|
if (type == AnchorAnim.SlowSpatial)
|
||||||
return Tokens.anim.durations.large;
|
return Tokens.anim.durations.expressiveSlowSpatial;
|
||||||
|
|
||||||
const types = ["small", "normal", "large", "extraLarge"];
|
const types = ["small", "normal", "large", "extraLarge"];
|
||||||
const idx = type % 4;
|
const idx = type % 4; // 0-7 are the 4 standard types
|
||||||
return Tokens.anim.durations[types[idx]];
|
return Tokens.anim.durations[types[idx]];
|
||||||
}
|
}
|
||||||
easing.bezierCurve: {
|
easing: {
|
||||||
if (type == AnchorAnim.FastSpatial)
|
if (type == AnchorAnim.FastSpatial)
|
||||||
return Tokens.anim.curves.expressiveFastSpatial;
|
return Tokens.anim.expressiveFastSpatial;
|
||||||
if (type == AnchorAnim.DefaultSpatial)
|
if (type == AnchorAnim.DefaultSpatial)
|
||||||
return Tokens.anim.curves.expressiveDefaultSpatial;
|
return Tokens.anim.expressiveDefaultSpatial;
|
||||||
if (type == AnchorAnim.SlowSpatial)
|
if (type == AnchorAnim.SlowSpatial)
|
||||||
return Tokens.anim.curves.expressiveSlowSpatial;
|
return Tokens.anim.expressiveSlowSpatial;
|
||||||
|
|
||||||
if (type >= AnchorAnim.StandardSmall && type <= AnchorAnim.StandardExtraLarge)
|
if (type >= AnchorAnim.StandardSmall && type <= AnchorAnim.StandardExtraLarge)
|
||||||
return Tokens.anim.curves.standard;
|
return Tokens.anim.standard;
|
||||||
if (type >= AnchorAnim.EmphasizedSmall && type <= AnchorAnim.EmphasizedExtraLarge)
|
if (type >= AnchorAnim.EmphasizedSmall && type <= AnchorAnim.EmphasizedExtraLarge)
|
||||||
return Tokens.anim.curves.emphasized;
|
return Tokens.anim.emphasized;
|
||||||
|
|
||||||
return Tokens.anim.curves.expressiveDefaultSpatial;
|
return Tokens.anim.expressiveDefaultSpatial;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-12
@@ -30,34 +30,34 @@ NumberAnimation {
|
|||||||
if (type === Anim.DefaultSpatial)
|
if (type === Anim.DefaultSpatial)
|
||||||
return Tokens.anim.durations.expressiveDefaultSpatial;
|
return Tokens.anim.durations.expressiveDefaultSpatial;
|
||||||
if (type === Anim.SlowSpatial)
|
if (type === Anim.SlowSpatial)
|
||||||
return Tokens.anim.durations.large;
|
return Tokens.anim.durations.expressiveSlowSpatial;
|
||||||
if (type === Anim.FastEffects)
|
if (type === Anim.FastEffects)
|
||||||
return Tokens.anim.durations.expressiveFastEffects;
|
return Tokens.anim.durations.expressiveFastEffects;
|
||||||
if (type === Anim.DefaultEffects)
|
if (type === Anim.DefaultEffects)
|
||||||
return Tokens.anim.durations.expressiveEffects;
|
return Tokens.anim.durations.expressiveDefaultEffects;
|
||||||
if (type === Anim.SlowEffects)
|
if (type === Anim.SlowEffects)
|
||||||
return Tokens.anim.durations.expressiveSlowEffects;
|
return Tokens.anim.durations.expressiveSlowEffects;
|
||||||
|
|
||||||
const types = ["small", "normal", "large", "extraLarge"];
|
const types = ["small", "normal", "large", "extraLarge"];
|
||||||
const idx = type % 4;
|
const idx = type % 4; // 0-7 are the 4 standard types
|
||||||
return Tokens.anim.durations[types[idx]];
|
return Tokens.anim.durations[types[idx]];
|
||||||
}
|
}
|
||||||
easing.bezierCurve: {
|
easing: {
|
||||||
if (type === Anim.FastSpatial)
|
if (type === Anim.FastSpatial)
|
||||||
return Tokens.anim.curves.expressiveFastSpatial;
|
return Tokens.anim.expressiveFastSpatial;
|
||||||
if (type === Anim.DefaultSpatial)
|
if (type === Anim.DefaultSpatial)
|
||||||
return Tokens.anim.curves.expressiveDefaultSpatial;
|
return Tokens.anim.expressiveDefaultSpatial;
|
||||||
if (type === Anim.SlowSpatial)
|
if (type === Anim.SlowSpatial)
|
||||||
return Tokens.anim.curves.expressiveSlowSpatial;
|
return Tokens.anim.expressiveSlowSpatial;
|
||||||
if (type === Anim.FastEffects)
|
if (type === Anim.FastEffects)
|
||||||
return Tokens.anim.curves.expressiveFastEffects;
|
return Tokens.anim.expressiveFastEffects;
|
||||||
if (type === Anim.DefaultEffects)
|
if (type === Anim.DefaultEffects)
|
||||||
return Tokens.anim.curves.expressiveDefaultEffects;
|
return Tokens.anim.expressiveDefaultEffects;
|
||||||
if (type === Anim.SlowEffects)
|
if (type === Anim.SlowEffects)
|
||||||
return Tokens.anim.curves.expressiveSlowEffects;
|
return Tokens.anim.expressiveSlowEffects;
|
||||||
|
|
||||||
if (type >= Anim.EmphasizedSmall && type <= Anim.EmphasizedExtraLarge)
|
if (type >= Anim.EmphasizedSmall && type <= Anim.EmphasizedExtraLarge)
|
||||||
return Tokens.anim.curves.emphasized;
|
return Tokens.anim.emphasized;
|
||||||
return Tokens.anim.curves.standard;
|
return Tokens.anim.standard;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,49 +80,29 @@ Slider {
|
|||||||
|
|
||||||
property bool moving
|
property bool moving
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
anchors.verticalCenterOffset: 1
|
||||||
|
text: moving ? Math.round(root.value * 100) : root.icon
|
||||||
color: Colors.palette.m3inverseOnSurface
|
color: Colors.palette.m3inverseOnSurface
|
||||||
text: root.icon
|
font: moving ? Tokens.font.body.small : Tokens.font.icon.medium
|
||||||
|
|
||||||
onMovingChanged: anim.restart()
|
Behavior on moving {
|
||||||
|
SequentialAnimation {
|
||||||
Binding {
|
Anim {
|
||||||
id: binding
|
target: icon
|
||||||
|
property: "scale"
|
||||||
property: "text"
|
to: 0.3
|
||||||
target: icon
|
duration: Tokens.anim.durations.small / 2
|
||||||
value: Math.round(root.value * root.multiplier)
|
easing: Tokens.anim.standardAccel
|
||||||
when: false
|
}
|
||||||
}
|
PropertyAction {}
|
||||||
|
Anim {
|
||||||
SequentialAnimation {
|
target: icon
|
||||||
id: anim
|
property: "scale"
|
||||||
|
to: 1
|
||||||
Anim {
|
duration: Tokens.anim.durations.normal / 2
|
||||||
duration: Tokens.anim.durations.normal / 2
|
easing: Tokens.anim.standardDecel
|
||||||
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,7 +110,7 @@ Slider {
|
|||||||
}
|
}
|
||||||
Behavior on value {
|
Behavior on value {
|
||||||
Anim {
|
Anim {
|
||||||
duration: Tokens.anim.durations.large
|
type: Anim.StandardLarge
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +118,6 @@ Slider {
|
|||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
initialized = true;
|
initialized = true;
|
||||||
oldValue = value;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
|
import qs.Components
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
CustomRect {
|
CustomRect {
|
||||||
@@ -19,11 +20,7 @@ CustomRect {
|
|||||||
property color disabledColor: Qt.alpha(Colors.palette.m3onSurface, 0.1)
|
property color disabledColor: Qt.alpha(Colors.palette.m3onSurface, 0.1)
|
||||||
property color disabledOnColor: Qt.alpha(Colors.palette.m3onSurface, 0.38)
|
property color disabledOnColor: Qt.alpha(Colors.palette.m3onSurface, 0.38)
|
||||||
property bool fillWidth
|
property bool fillWidth
|
||||||
property font font: ({
|
property font font: Tokens.font.body.small
|
||||||
family: Config.appearance.font.family.sans,
|
|
||||||
pointSize: Tokens.font.size.larger,
|
|
||||||
bold: false
|
|
||||||
})
|
|
||||||
property real horizontalPadding: padding
|
property real horizontalPadding: padding
|
||||||
readonly property alias hovered: stateLayer.containsMouse
|
readonly property alias hovered: stateLayer.containsMouse
|
||||||
required implicitHeight
|
required implicitHeight
|
||||||
@@ -36,7 +33,7 @@ CustomRect {
|
|||||||
readonly property color onColor: !enabled ? disabledOnColor : internalChecked ? activeOnColor : inactiveOnColor
|
readonly property color onColor: !enabled ? disabledOnColor : internalChecked ? activeOnColor : inactiveOnColor
|
||||||
property real padding
|
property real padding
|
||||||
readonly property alias pressed: stateLayer.pressed
|
readonly property alias pressed: stateLayer.pressed
|
||||||
property real pressedRadius: Tokens.rounding.smallest
|
property real pressedRadius: Tokens.rounding.small
|
||||||
readonly property alias radiusAnim: radiusAnim
|
readonly property alias radiusAnim: radiusAnim
|
||||||
property bool radiusMorph: true
|
property bool radiusMorph: true
|
||||||
property alias shapeMorph: stateLayer.shapeMorph
|
property alias shapeMorph: stateLayer.shapeMorph
|
||||||
@@ -54,7 +51,7 @@ CustomRect {
|
|||||||
if (internalChecked)
|
if (internalChecked)
|
||||||
return checkedRadius;
|
return checkedRadius;
|
||||||
if (isRound)
|
if (isRound)
|
||||||
return (height || implicitHeight) / 2 * Math.min(1, Tokens.rounding.scale);
|
return implicitHeight / 2 * Math.min(1, Tokens.rounding.scale);
|
||||||
return defaultRadius;
|
return defaultRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-58
@@ -2,62 +2,6 @@ import QtQuick
|
|||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
|
|
||||||
ColorAnimation {
|
ColorAnimation {
|
||||||
enum Type {
|
duration: Tokens.anim.durations.expressiveSlowEffects
|
||||||
StandardSmall = 0,
|
easing: Tokens.anim.expressiveSlowEffects
|
||||||
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 int animState
|
||||||
property color bgColor: Colors.palette.m3secondaryContainer
|
property color bgColor: Colors.palette.m3secondaryContainer
|
||||||
property color fgColor: Colors.palette.m3primary
|
property color fgColor: Colors.palette.m3primary
|
||||||
property real implicitSize: Tokens.font.size.normal * 3
|
property real implicitSize: Tokens.font.body.medium.pointSize * 3
|
||||||
property real internalStrokeWidth: strokeWidth
|
property real internalStrokeWidth: strokeWidth
|
||||||
readonly property alias progress: manager.progress
|
readonly property alias progress: manager.progress
|
||||||
property real strokeWidth: Tokens.padding.small * 0.8
|
property real strokeWidth: Tokens.padding.extraSmall * 0.8
|
||||||
property alias type: manager.indeterminateAnimationType
|
property alias type: manager.indeterminateAnimationType
|
||||||
|
|
||||||
implicitHeight: implicitSize
|
implicitHeight: implicitSize
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ Item {
|
|||||||
readonly property real size: Math.min(width, height)
|
readonly property real size: Math.min(width, height)
|
||||||
property int spacing: Tokens.spacing.small
|
property int spacing: Tokens.spacing.small
|
||||||
property int startAngle: -90
|
property int startAngle: -90
|
||||||
property int strokeWidth: Tokens.padding.small
|
property int strokeWidth: Tokens.padding.extraSmall
|
||||||
property int sweepAngle: 360
|
property int sweepAngle: 360
|
||||||
readonly property real thickness: strokeWidth * (1 + waveAmplitude) * 2
|
readonly property real thickness: strokeWidth * (1 + waveAmplitude) * 2
|
||||||
property real value
|
property real value
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function syncFromPenColor() {
|
function syncFromPenColor() {
|
||||||
if (!drawing.drawingState)
|
if (!drawing.screenState)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const c = drawing.drawingState.penColor;
|
const c = drawing.screenState.penColor;
|
||||||
|
|
||||||
if (c.hsvSaturation > 0) {
|
if (c.hsvSaturation > 0) {
|
||||||
currentHue = c.hsvHue;
|
currentHue = c.hsvHue;
|
||||||
@@ -86,7 +86,7 @@ Item {
|
|||||||
|
|
||||||
currentHue = relative / arcSweep;
|
currentHue = relative / arcSweep;
|
||||||
lastChromaticHue = currentHue;
|
lastChromaticHue = currentHue;
|
||||||
drawing.drawingState.penColor = Qt.hsva(currentHue, drawing.drawingState.penColor.hsvSaturation, drawing.drawingState.penColor.hsvValue, drawing.drawingState.penColor.a);
|
drawing.screenState.penColor = Qt.hsva(currentHue, drawing.screenState.penColor.hsvSaturation, drawing.screenState.penColor.hsvValue, drawing.screenState.penColor.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
implicitHeight: 180
|
implicitHeight: 180
|
||||||
@@ -112,7 +112,7 @@ Item {
|
|||||||
root.syncFromPenColor();
|
root.syncFromPenColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
target: root.drawing.drawingState
|
target: root.drawing.screenState
|
||||||
}
|
}
|
||||||
|
|
||||||
Canvas {
|
Canvas {
|
||||||
@@ -152,7 +152,7 @@ Item {
|
|||||||
|
|
||||||
CustomRect {
|
CustomRect {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: root.drawing?.drawingState.penColor
|
color: root.drawing?.screenState.penColor
|
||||||
implicitHeight: implicitWidth
|
implicitHeight: implicitWidth
|
||||||
implicitWidth: canvas.height - root.handleSize - Tokens.padding.extraLarge * 2
|
implicitWidth: canvas.height - root.handleSize - Tokens.padding.extraLarge * 2
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ CheckBox {
|
|||||||
color: Colors.palette.m3surfaceVariant
|
color: Colors.palette.m3surfaceVariant
|
||||||
implicitHeight: control.checkHeight
|
implicitHeight: control.checkHeight
|
||||||
implicitWidth: control.checkWidth
|
implicitWidth: control.checkWidth
|
||||||
radius: Tokens.rounding.smallest / 2
|
radius: Tokens.rounding.small / 2
|
||||||
|
|
||||||
CustomRect {
|
CustomRect {
|
||||||
color: Colors.palette.m3primary
|
color: Colors.palette.m3primary
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Helpers
|
import qs.Services
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool doneFakeFlick
|
property bool doneFakeFlick
|
||||||
|
|
||||||
interactive: !Visibilities.getForActive().isDrawing
|
interactive: !ShellState.forActive().isDrawing
|
||||||
maximumFlickVelocity: 3000
|
maximumFlickVelocity: 3000
|
||||||
|
|
||||||
rebound: Transition {
|
rebound: Transition {
|
||||||
@@ -28,6 +28,9 @@ Flickable {
|
|||||||
interval: 10
|
interval: 10
|
||||||
running: root.doneFakeFlick
|
running: root.doneFakeFlick
|
||||||
|
|
||||||
onTriggered: root.doneFakeFlick = false
|
onTriggered: {
|
||||||
|
root.doneFakeFlick = false;
|
||||||
|
root.returnToBounds();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,36 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Helpers
|
import qs.Services
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool doneFakeFlick
|
property bool doneFakeFlick
|
||||||
|
|
||||||
interactive: !Visibilities.getForActive()?.isDrawing
|
interactive: !ShellState.forActive()?.isDrawing
|
||||||
maximumFlickVelocity: 3000
|
maximumFlickVelocity: 3000
|
||||||
|
|
||||||
rebound: Transition {
|
rebound: Transition {
|
||||||
onRunningChanged: {
|
// onRunningChanged: {
|
||||||
if (!running && !root.doneFakeFlick) {
|
// if (!running && !root.doneFakeFlick) {
|
||||||
root.doneFakeFlick = true;
|
// root.doneFakeFlick = true;
|
||||||
root.flick(1, 1);
|
// root.flick(1, 1);
|
||||||
root.flick(-1, -1);
|
// root.flick(-1, -1);
|
||||||
Qt.callLater(() => root.cancelFlick());
|
// Qt.callLater(() => root.cancelFlick());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
Anim {
|
Anim {
|
||||||
properties: "x,y"
|
properties: "x,y"
|
||||||
|
type: Anim.DefaultEffects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
// Timer {
|
||||||
interval: 10
|
// interval: 10
|
||||||
running: root.doneFakeFlick
|
// running: root.doneFakeFlick
|
||||||
|
//
|
||||||
onTriggered: root.doneFakeFlick = false
|
// onTriggered: {
|
||||||
}
|
// root.doneFakeFlick = false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ MouseArea {
|
|||||||
property int scrollAccumulatedY: 0
|
property int scrollAccumulatedY: 0
|
||||||
|
|
||||||
function onWheel(event: WheelEvent): void {
|
function onWheel(event: WheelEvent): void {
|
||||||
|
event.accepted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
onWheel: event => {
|
onWheel: event => {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import qs.Services
|
|||||||
RadioButton {
|
RadioButton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
font.pointSize: Tokens.font.size.normal
|
font: Tokens.font.body.medium
|
||||||
implicitHeight: Math.max(implicitIndicatorHeight, implicitContentHeight)
|
implicitHeight: Math.max(implicitIndicatorHeight, implicitContentHeight)
|
||||||
implicitWidth: implicitIndicatorWidth + implicitContentWidth + contentItem.anchors.leftMargin
|
implicitWidth: implicitIndicatorWidth + implicitContentWidth + contentItem.anchors.leftMargin
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ RadioButton {
|
|||||||
anchors.left: outerCircle.right
|
anchors.left: outerCircle.right
|
||||||
anchors.leftMargin: 10
|
anchors.leftMargin: 10
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
font.pointSize: root.font.pointSize
|
font: root.font
|
||||||
text: root.text
|
text: root.text
|
||||||
}
|
}
|
||||||
indicator: Rectangle {
|
indicator: Rectangle {
|
||||||
@@ -29,8 +29,7 @@ RadioButton {
|
|||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
Behavior on border.color {
|
Behavior on border.color {
|
||||||
CAnim {
|
CAnim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ Rectangle {
|
|||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
CAnim {
|
CAnim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +1,41 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Templates
|
import QtQuick.Templates
|
||||||
import qs.Helpers
|
|
||||||
import ZShell.Config
|
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
import ZShell.Config
|
||||||
|
|
||||||
ScrollBar {
|
ScrollBar {
|
||||||
id: root
|
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 effectiveSize: Math.max(nonAnimHeight, root.minimumSize)
|
||||||
readonly property real effectiveTravel: Math.max(0, 1 - root.effectiveSize)
|
readonly property real effectiveTravel: Math.max(0, 1 - root.effectiveSize)
|
||||||
required property Flickable flickable
|
readonly property real nonAnimHeight: root.axisSize / root.axisContentSize
|
||||||
readonly property real nonAnimHeight: flickable.height / flickable.contentHeight
|
readonly property real nonAnimY: root.axisContentPos / root.axisContentSize
|
||||||
readonly property real nonAnimY: flickable.contentY / flickable.contentHeight
|
|
||||||
readonly property real rawTravel: Math.max(0, 1 - root.nonAnimHeight)
|
readonly property real rawTravel: Math.max(0, 1 - root.nonAnimHeight)
|
||||||
readonly property bool reversed: flickable instanceof ListView && flickable.verticalLayoutDirection === ListView.BottomToTop
|
readonly property bool reversed: isHorizontal ? (flickable instanceof ListView && flickable.layoutDirection === Qt.RightToLeft) : (flickable instanceof ListView && flickable.verticalLayoutDirection === ListView.BottomToTop)
|
||||||
property bool shouldBeActive
|
|
||||||
readonly property real travelScale: root.rawTravel > 0 ? root.effectiveTravel / root.rawTravel : 0
|
readonly property real travelScale: root.rawTravel > 0 ? root.effectiveTravel / root.rawTravel : 0
|
||||||
|
|
||||||
enabled: !Visibilities.getForActive().isDrawing
|
property bool shouldBeActive
|
||||||
implicitWidth: Tokens.padding.extraSmall * 2
|
property bool inverted
|
||||||
|
|
||||||
contentItem: Item {
|
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 {}
|
||||||
Behavior on position {
|
Behavior on position {
|
||||||
enabled: !fullMouse.pressed
|
enabled: !fullMouse.pressed
|
||||||
|
|
||||||
Anim {
|
Anim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onHoveredChanged: {
|
onHoveredChanged: {
|
||||||
@@ -47,54 +56,27 @@ ScrollBar {
|
|||||||
target: root.flickable
|
target: root.flickable
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomClippingRect {
|
Loader {
|
||||||
anchors.bottom: parent.bottom
|
anchors.fill: parent
|
||||||
anchors.right: parent.right
|
active: root.size < 1
|
||||||
anchors.top: parent.top
|
sourceComponent: root.isHorizontal ? horizontalTrack : verticalTrack
|
||||||
implicitWidth: handle.implicitWidth
|
}
|
||||||
radius: Tokens.rounding.full
|
|
||||||
|
|
||||||
CustomRect {
|
Component {
|
||||||
id: handle
|
id: verticalTrack
|
||||||
|
|
||||||
anchors.right: parent.right
|
VerticalScrollBarTrack {
|
||||||
color: Colors.palette.m3secondary
|
scrollBar: root
|
||||||
implicitHeight: root.height * root.effectiveSize
|
mouseArea: fullMouse
|
||||||
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
|
|
||||||
|
|
||||||
Behavior on implicitWidth {
|
Component {
|
||||||
Anim {
|
id: horizontalTrack
|
||||||
}
|
|
||||||
}
|
|
||||||
Behavior on opacity {
|
|
||||||
Anim {
|
|
||||||
type: Anim.DefaultEffects
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
HorizontalScrollBarTrack {
|
||||||
id: mouse
|
scrollBar: root
|
||||||
|
mouseArea: fullMouse
|
||||||
acceptedButtons: Qt.NoButton
|
|
||||||
anchors.fill: parent
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
hoverEnabled: true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,25 +93,40 @@ ScrollBar {
|
|||||||
|
|
||||||
property real pressOffset: 0
|
property real pressOffset: 0
|
||||||
|
|
||||||
function contentYFromThumbTop(thumbTop) {
|
function contentPosFromThumbStart(thumbStart) {
|
||||||
var visualPos = root.effectiveTravel > 0 ? thumbTop / root.travelScale : 0;
|
var visualPos = root.effectiveTravel > 0 ? thumbStart / root.travelScale : 0;
|
||||||
|
return root.reversed ? (visualPos - 1) * root.axisContentSize : visualPos * root.axisContentSize;
|
||||||
return root.reversed ? (visualPos - 1) * root.flickable.contentHeight : visualPos * root.flickable.contentHeight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFromEvent(event) {
|
function updateFromEvent(event) {
|
||||||
var posInTrack = event.y / root.height;
|
var eventPos = root.isHorizontal ? event.x : event.y;
|
||||||
var thumbTop = posInTrack - pressOffset;
|
var posInTrack = eventPos / root.axisLength;
|
||||||
thumbTop = Math.max(0, Math.min(root.effectiveTravel, thumbTop));
|
var thumbStart = posInTrack - pressOffset;
|
||||||
|
thumbStart = Math.max(0, Math.min(root.effectiveTravel, thumbStart));
|
||||||
|
|
||||||
root.flickable.contentY = contentYFromThumbTop(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));
|
||||||
}
|
}
|
||||||
|
|
||||||
function visualThumbTop() {
|
function visualThumbStart() {
|
||||||
const visualPos = root.reversed ? (1 + root.nonAnimY) : root.nonAnimY;
|
const visualPos = root.reversed ? (1 + root.nonAnimY) : root.nonAnimY;
|
||||||
return visualPos * root.travelScale;
|
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
|
anchors.fill: parent
|
||||||
cursorShape: undefined
|
cursorShape: undefined
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
@@ -140,24 +137,15 @@ ScrollBar {
|
|||||||
updateFromEvent(event);
|
updateFromEvent(event);
|
||||||
}
|
}
|
||||||
onPressed: event => {
|
onPressed: event => {
|
||||||
var currentTop = visualThumbTop();
|
var currentStart = visualThumbStart();
|
||||||
var currentBottom = currentTop + root.effectiveSize;
|
var currentEnd = currentStart + root.effectiveSize;
|
||||||
var clickPos = event.y / root.height;
|
var eventPos = root.isHorizontal ? event.x : event.y;
|
||||||
|
var clickPos = eventPos / root.axisLength;
|
||||||
|
|
||||||
var clickedInsideThumb = clickPos >= currentTop && clickPos <= currentBottom;
|
var clickedInsideThumb = clickPos >= currentStart && clickPos <= currentEnd;
|
||||||
|
pressOffset = clickedInsideThumb ? (clickPos - currentStart) : root.effectiveSize / 2;
|
||||||
if (clickedInsideThumb) {
|
|
||||||
pressOffset = clickPos - currentTop;
|
|
||||||
} else {
|
|
||||||
pressOffset = root.effectiveSize / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateFromEvent(event);
|
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,11 +13,13 @@ Slider {
|
|||||||
|
|
||||||
property bool animateWave
|
property bool animateWave
|
||||||
property color bgColor: enabled ? Colors.palette.m3secondaryContainer : Qt.alpha(Colors.palette.m3onSurface, 0.1)
|
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 color fgColor: enabled ? Colors.palette.m3primary : Qt.alpha(Colors.palette.m3onSurface, 0.38)
|
||||||
property real filledWidth
|
property real filledWidth
|
||||||
property alias inset: inset
|
property alias inset: inset
|
||||||
property color insetColor: enabled ? (inset.attached ? Colors.palette.m3onSecondaryContainer : Colors.palette.m3onPrimary) : Colors.palette.m3onSurface
|
property color insetColor: enabled ? (inset.attached ? Colors.palette.m3onSecondaryContainer : Colors.palette.m3onPrimary) : Colors.palette.m3onSurface
|
||||||
property string insetIcon: ""
|
property string insetIcon: ""
|
||||||
|
property bool interactionOnMove: true
|
||||||
property real pos: visualPosition
|
property real pos: visualPosition
|
||||||
property int radius: Tokens.rounding.small
|
property int radius: Tokens.rounding.small
|
||||||
property int waveDuration: 1000
|
property int waveDuration: 1000
|
||||||
@@ -98,15 +100,19 @@ Slider {
|
|||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
color: root.insetColor
|
color: root.insetColor
|
||||||
font.pixelSize: Tokens.font.size.smaller * 2
|
fontStyle: {
|
||||||
|
if (root.height < 96)
|
||||||
|
return Tokens.font.icon.pixelSize(24).build();
|
||||||
|
else
|
||||||
|
return Tokens.font.icon.pixelSize(32).build();
|
||||||
|
}
|
||||||
text: root.insetIcon
|
text: root.insetIcon
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
visible: !root.wavy && root.insetIcon !== ""
|
visible: !root.wavy && root.insetIcon !== ""
|
||||||
x: Tokens.spacing.extraSmall + dockT * (handle.x + Tokens.spacing.small)
|
x: Tokens.spacing.extraSmall + dockT * (handle.x + Tokens.spacing.small)
|
||||||
|
|
||||||
Behavior on dockT {
|
Behavior on dockT {
|
||||||
Anim {
|
Anim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,8 +142,7 @@ Slider {
|
|||||||
startX: x
|
startX: x
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
CAnim {
|
CAnim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Anim on waveProgress {
|
Anim on waveProgress {
|
||||||
duration: root.waveDuration
|
duration: root.waveDuration
|
||||||
@@ -154,8 +159,7 @@ Slider {
|
|||||||
Behavior on filledWidth {
|
Behavior on filledWidth {
|
||||||
id: widthBehavior
|
id: widthBehavior
|
||||||
|
|
||||||
Anim {
|
Anim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
@@ -186,7 +190,8 @@ Slider {
|
|||||||
|
|
||||||
onPositionChanged: e => {
|
onPositionChanged: e => {
|
||||||
dragMovement = (e.x - pressStartX) / width;
|
dragMovement = (e.x - pressStartX) / width;
|
||||||
root.interaction(posBinding.value);
|
if (root.interactionOnMove)
|
||||||
|
root.interaction(posBinding.value);
|
||||||
}
|
}
|
||||||
onPressed: e => {
|
onPressed: e => {
|
||||||
widthBehavior.enabled = false;
|
widthBehavior.enabled = false;
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ DoubleSpinBox {
|
|||||||
horizontalAlignment: TextField.AlignHCenter
|
horizontalAlignment: TextField.AlignHCenter
|
||||||
implicitWidth: 65
|
implicitWidth: 65
|
||||||
inputMethodHints: Qt.ImhFormattedNumbersOnly
|
inputMethodHints: Qt.ImhFormattedNumbersOnly
|
||||||
leftPadding: Tokens.padding.larger
|
leftPadding: Tokens.padding.small
|
||||||
readOnly: !root.editable
|
readOnly: !root.editable
|
||||||
rightPadding: Tokens.padding.larger
|
rightPadding: Tokens.padding.small
|
||||||
text: root.textFromValue(root.value, root.locale)
|
text: root.textFromValue(root.value, root.locale)
|
||||||
validator: root.validator
|
validator: root.validator
|
||||||
|
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,8 +13,12 @@ Switch {
|
|||||||
implicitWidth: implicitIndicatorWidth
|
implicitWidth: implicitIndicatorWidth
|
||||||
|
|
||||||
indicator: CustomRect {
|
indicator: CustomRect {
|
||||||
color: root.checked && root.enabled ? Colors.palette.m3primary : Colors.layer(Colors.palette.m3surfaceContainerHighest, root.cLayer)
|
color: {
|
||||||
implicitHeight: Tokens.font.size.medium + Tokens.padding.normal * 2
|
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
|
||||||
implicitWidth: implicitHeight * 1.7
|
implicitWidth: implicitHeight * 1.7
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
@@ -22,7 +26,11 @@ Switch {
|
|||||||
readonly property real nonAnimWidth: root.pressed ? implicitHeight * 1.2 : implicitHeight
|
readonly property real nonAnimWidth: root.pressed ? implicitHeight * 1.2 : implicitHeight
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: root.checked && root.enabled ? Colors.palette.m3onPrimary : Colors.layer(Colors.palette.m3outline, root.cLayer + 1)
|
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);
|
||||||
|
}
|
||||||
implicitHeight: parent.implicitHeight - Tokens.padding.extraSmall
|
implicitHeight: parent.implicitHeight - Tokens.padding.extraSmall
|
||||||
implicitWidth: nonAnimWidth
|
implicitWidth: nonAnimWidth
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
@@ -92,7 +100,7 @@ Switch {
|
|||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
height: parent.implicitHeight - Tokens.padding.larger
|
height: parent.implicitHeight - Tokens.padding.medium
|
||||||
preferredRendererType: Shape.CurveRenderer
|
preferredRendererType: Shape.CurveRenderer
|
||||||
width: height
|
width: height
|
||||||
|
|
||||||
@@ -114,12 +122,16 @@ Switch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ShapePath {
|
ShapePath {
|
||||||
capStyle: ShapePath.RoundCap
|
capStyle: Tokens.rounding.scale === 0 ? ShapePath.SquareCap : ShapePath.RoundCap
|
||||||
fillColor: "transparent"
|
fillColor: "transparent"
|
||||||
startX: icon.start1.x
|
startX: icon.start1.x
|
||||||
startY: icon.start1.y
|
startY: icon.start1.y
|
||||||
strokeColor: root.checked && root.enabled ? Colors.palette.m3primary : Colors.palette.m3surfaceContainerHighest
|
strokeColor: {
|
||||||
strokeWidth: Tokens.font.size.larger * 0.15
|
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
|
||||||
|
|
||||||
Behavior on strokeColor {
|
Behavior on strokeColor {
|
||||||
CAnim {
|
CAnim {
|
||||||
@@ -153,6 +165,6 @@ Switch {
|
|||||||
|
|
||||||
component PropAnim: PropertyAnimation {
|
component PropAnim: PropertyAnimation {
|
||||||
duration: Tokens.anim.durations.expressiveFastSpatial
|
duration: Tokens.anim.durations.expressiveFastSpatial
|
||||||
easing.bezierCurve: Tokens.anim.curves.expressiveFastSpatial
|
easing: Tokens.anim.expressiveFastSpatial
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,9 @@ Text {
|
|||||||
property real animateTo: 1
|
property real animateTo: 1
|
||||||
|
|
||||||
color: Colors.palette.m3onSurface
|
color: Colors.palette.m3onSurface
|
||||||
font.family: Config.appearance.font.family.sans
|
font: Tokens.font.body.small
|
||||||
font.pointSize: Tokens.font.size.normal
|
|
||||||
linkColor: Colors.palette.m3onPrimaryFixedVariant
|
linkColor: Colors.palette.m3onPrimaryFixedVariant
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.QtRendering
|
||||||
textFormat: Text.PlainText
|
textFormat: Text.PlainText
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
|
|||||||
@@ -15,28 +15,33 @@ TextFieldBase {
|
|||||||
|
|
||||||
readonly property int clampedRadius: Math.min(horizontalPadding, Math.min(width, height) / 2, radius)
|
readonly property int clampedRadius: Math.min(horizontalPadding, Math.min(width, height) / 2, radius)
|
||||||
readonly property string effectiveSupportingText: isError && errorText ? errorText : supportingText
|
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 bool emptyIsValid: true
|
||||||
property string errorText
|
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 bool isError
|
||||||
property string leadingIcon
|
property string leadingIcon
|
||||||
readonly property int leadingOffset: leadingIcon ? leadingIconLoader.width + leadingIconLoader.anchors.leftMargin : 0
|
|
||||||
property int radius: Tokens.rounding.small
|
|
||||||
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: Tokens.padding.large + supportingTextOffset - filledOffset
|
bottomPadding: verticalPadding + supportingTextOffset - filledOffset
|
||||||
leftPadding: horizontalPadding + leadingOffset
|
leftPadding: horizontalPadding + leadingOffset
|
||||||
rightPadding: horizontalPadding + trailingOffset
|
rightPadding: horizontalPadding + trailingOffset
|
||||||
topPadding: Tokens.padding.large + filledOffset
|
topPadding: verticalPadding + filledOffset
|
||||||
|
|
||||||
background: Loader {
|
background: Loader {
|
||||||
anchors.bottomMargin: root.supportingTextOffset
|
anchors.bottomMargin: root.supportingTextOffset
|
||||||
@@ -129,8 +134,8 @@ TextFieldBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AnchorAnim {
|
AnchorAnim {
|
||||||
duration: Tokens.anim.durations.expressiveEffects
|
duration: Tokens.anim.durations.expressiveDefaultEffects
|
||||||
easing.bezierCurve: Tokens.anim.curves.expressiveEffects
|
easing: Tokens.anim.expressiveDefaultEffects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,12 +145,13 @@ TextFieldBase {
|
|||||||
|
|
||||||
active: root.leadingIcon
|
active: root.leadingIcon
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: Tokens.padding.normal
|
anchors.leftMargin: Tokens.padding.small
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
sourceComponent: MaterialIcon {
|
sourceComponent: MaterialIcon {
|
||||||
color: Colors.palette.m3onSurfaceVariant
|
color: Colors.palette.m3onSurfaceVariant
|
||||||
text: root.leadingIcon
|
text: root.leadingIcon
|
||||||
|
fontStyle: Tokens.font.icon.builders.medium.scale(0.9).build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,12 +160,13 @@ TextFieldBase {
|
|||||||
|
|
||||||
active: root.trailingIcon
|
active: root.trailingIcon
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: Tokens.padding.normal
|
anchors.rightMargin: Tokens.padding.small
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
sourceComponent: MaterialIcon {
|
sourceComponent: MaterialIcon {
|
||||||
color: Colors.palette.m3onSurfaceVariant
|
color: Colors.palette.m3onSurfaceVariant
|
||||||
text: root.trailingIcon
|
text: root.trailingIcon
|
||||||
|
fontStyle: Tokens.font.icon.builders.medium.scale(0.9).build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,7 +181,7 @@ TextFieldBase {
|
|||||||
|
|
||||||
sourceComponent: CustomText {
|
sourceComponent: CustomText {
|
||||||
color: root.isError ? Colors.palette.m3error : Colors.palette.m3onSurfaceVariant
|
color: root.isError ? Colors.palette.m3error : Colors.palette.m3onSurfaceVariant
|
||||||
font.pointSize: Tokens.font.size.small
|
font: Tokens.font.label.small
|
||||||
text: root.effectiveSupportingText
|
text: root.effectiveSupportingText
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,12 +219,10 @@ TextFieldBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on strokeColor {
|
Behavior on strokeColor {
|
||||||
CAnim {
|
CAnim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Behavior on strokeWidth {
|
Behavior on strokeWidth {
|
||||||
Anim {
|
Anim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PathLine {
|
PathLine {
|
||||||
@@ -292,8 +297,7 @@ TextFieldBase {
|
|||||||
implicitHeight: root.activeFocus ? 2 : 1
|
implicitHeight: root.activeFocus ? 2 : 1
|
||||||
|
|
||||||
Behavior on implicitHeight {
|
Behavior on implicitHeight {
|
||||||
Anim {
|
Anim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
import QtQuick
|
||||||
|
import ZShell.Config
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
|
CustomClippingRect {
|
||||||
|
id: track
|
||||||
|
|
||||||
|
required property var scrollBar
|
||||||
|
required property var mouseArea
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
implicitHeight: handle.implicitHeight
|
||||||
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
|
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,6 +8,7 @@ ButtonBase {
|
|||||||
property alias icon: label.text
|
property alias icon: label.text
|
||||||
readonly property alias label: label
|
readonly property alias label: label
|
||||||
|
|
||||||
|
font: Tokens.font.icon.medium
|
||||||
activeColor: type === IconButton.Filled ? Colors.palette.m3primary : Colors.palette.m3secondary
|
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
|
activeOnColor: type === IconButton.Filled ? Colors.palette.m3onPrimary : type === IconButton.Tonal ? Colors.palette.m3onSecondary : Colors.palette.m3primary
|
||||||
implicitHeight: {
|
implicitHeight: {
|
||||||
@@ -27,7 +28,7 @@ ButtonBase {
|
|||||||
return Colors.palette.m3onPrimary;
|
return Colors.palette.m3onPrimary;
|
||||||
return type === IconButton.Tonal ? Colors.palette.m3onSecondaryContainer : Colors.palette.m3onSurfaceVariant;
|
return type === IconButton.Tonal ? Colors.palette.m3onSecondaryContainer : Colors.palette.m3onSurfaceVariant;
|
||||||
}
|
}
|
||||||
padding: type === IconButton.Text ? Tokens.padding.extraSmall / 2 : Tokens.padding.small
|
padding: type === IconButton.Text ? Tokens.padding.extraSmall / 2 : Tokens.padding.extraSmall
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
id: label
|
id: label
|
||||||
@@ -36,7 +37,7 @@ ButtonBase {
|
|||||||
anchors.verticalCenterOffset: 1
|
anchors.verticalCenterOffset: 1
|
||||||
color: root.onColor
|
color: root.onColor
|
||||||
fill: !root.isToggle || root.internalChecked ? 1 : 0
|
fill: !root.isToggle || root.internalChecked ? 1 : 0
|
||||||
font.pointSize: root.font.pointSize
|
fontStyle: root.font
|
||||||
|
|
||||||
Behavior on fill {
|
Behavior on fill {
|
||||||
Anim {
|
Anim {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ ButtonBase {
|
|||||||
return Colors.palette.m3primary;
|
return Colors.palette.m3primary;
|
||||||
return type === TextButton.Filled ? Colors.palette.m3onPrimary : Colors.palette.m3onSecondary;
|
return type === TextButton.Filled ? Colors.palette.m3onPrimary : Colors.palette.m3onSecondary;
|
||||||
}
|
}
|
||||||
horizontalPadding: Tokens.padding.larger
|
horizontalPadding: Tokens.padding.small
|
||||||
implicitHeight: row.implicitHeight + verticalPadding * 2
|
implicitHeight: row.implicitHeight + verticalPadding * 2
|
||||||
implicitWidth: row.implicitWidth + horizontalPadding * 2
|
implicitWidth: row.implicitWidth + horizontalPadding * 2
|
||||||
inactiveColor: {
|
inactiveColor: {
|
||||||
@@ -32,7 +32,7 @@ ButtonBase {
|
|||||||
return Colors.palette.m3primary;
|
return Colors.palette.m3primary;
|
||||||
return type === TextButton.Filled ? Colors.palette.m3onSurface : Colors.palette.m3onSecondaryContainer;
|
return type === TextButton.Filled ? Colors.palette.m3onSurface : Colors.palette.m3onSecondaryContainer;
|
||||||
}
|
}
|
||||||
verticalPadding: Tokens.padding.small
|
verticalPadding: Tokens.padding.extraSmall
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: row
|
id: row
|
||||||
@@ -46,10 +46,9 @@ ButtonBase {
|
|||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
color: root.onColor
|
color: root.onColor
|
||||||
fill: root.internalChecked ? 1 : 0
|
fill: root.internalChecked ? 1 : 0
|
||||||
font: {
|
fontStyle: {
|
||||||
const f = Qt.font(root.font);
|
const f = Qt.font(root.font);
|
||||||
f.pointSize = Math.round(root.font.pointSize * 1.2);
|
f.pointSize = Math.round(root.font.pointSize * 1.2);
|
||||||
f.family = "Material Symbols Rounded";
|
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,467 @@
|
|||||||
|
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()
|
||||||
|
}
|
||||||
@@ -1,27 +1,14 @@
|
|||||||
|
import QtQuick
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property list<int> allowed: [20, 24, 40, 48]
|
|
||||||
property real fill: 0
|
property real fill: 0
|
||||||
property int grade: Colors.light ? 0 : -25
|
property int grade: Colors.light ? 0 : -25
|
||||||
readonly property int opsz: clampOpsz(optical)
|
property font fontStyle: Tokens.font.icon.small
|
||||||
property int optical: fontInfo.pixelSize
|
|
||||||
|
|
||||||
function clampOpsz(value): int {
|
renderType: Text.NativeRendering
|
||||||
return allowed.reduce((closest, current) => {
|
font: Tokens.font.icon.size(fontStyle.pointSize).weight(fontStyle.weight).vaxes(fontStyle.variableAxes).fill(fill.toFixed(1)).grade(grade).build()
|
||||||
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
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-17
@@ -78,7 +78,7 @@ MouseArea {
|
|||||||
implicitHeight: column.implicitHeight + column.anchors.margins * 2
|
implicitHeight: column.implicitHeight + column.anchors.margins * 2
|
||||||
implicitWidth: Math.max(200, column.implicitWidth + column.anchors.margins * 2)
|
implicitWidth: Math.max(200, column.implicitWidth + column.anchors.margins * 2)
|
||||||
level: 2
|
level: 2
|
||||||
radius: Tokens.rounding.medium
|
radius: Tokens.rounding.large
|
||||||
x: {
|
x: {
|
||||||
watcher.transform;
|
watcher.transform;
|
||||||
const item = root.attachTo;
|
const item = root.attachTo;
|
||||||
@@ -124,7 +124,7 @@ MouseArea {
|
|||||||
model: root.items
|
model: root.items
|
||||||
|
|
||||||
CustomRect {
|
CustomRect {
|
||||||
id: item
|
id: menuItem
|
||||||
|
|
||||||
readonly property bool active: modelData === root?.active
|
readonly property bool active: modelData === root?.active
|
||||||
required property int index
|
required property int index
|
||||||
@@ -132,9 +132,9 @@ MouseArea {
|
|||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
color: Qt.alpha(Colors.palette.m3tertiaryContainer, active ? 1 : 0)
|
color: Qt.alpha(Colors.palette.m3tertiaryContainer, active ? 1 : 0)
|
||||||
implicitHeight: menuOptionRow.implicitHeight + Tokens.padding.larger * 2
|
implicitHeight: menuOptionRow.implicitHeight + Tokens.padding.medium * 2
|
||||||
implicitWidth: menuOptionRow.implicitWidth + Tokens.padding.larger * 2
|
implicitWidth: menuOptionRow.implicitWidth + Tokens.padding.medium * 2
|
||||||
radius: Tokens.rounding.small
|
radius: menu.radius - column.anchors.margins
|
||||||
|
|
||||||
Behavior on radius {
|
Behavior on radius {
|
||||||
Anim {
|
Anim {
|
||||||
@@ -142,13 +142,13 @@ MouseArea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
color: item.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurface
|
color: menuItem.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurface
|
||||||
enabled: root.expanded
|
enabled: root.expanded
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.itemSelected(item.modelData);
|
root.itemSelected(menuItem.modelData);
|
||||||
root.active = item.modelData;
|
root.active = menuItem.modelData;
|
||||||
item.modelData.clicked();
|
menuItem.modelData.clicked();
|
||||||
root.expanded = false;
|
root.expanded = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,31 +157,32 @@ MouseArea {
|
|||||||
id: menuOptionRow
|
id: menuOptionRow
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Tokens.padding.larger
|
anchors.margins: Tokens.padding.medium
|
||||||
spacing: Tokens.spacing.small
|
spacing: Tokens.spacing.small
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
color: item.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurfaceVariant
|
color: menuItem.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurfaceVariant
|
||||||
text: item.modelData?.icon ?? ""
|
text: menuItem.modelData?.icon ?? ""
|
||||||
|
visible: text !== ""
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
color: item.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurface
|
color: menuItem.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurface
|
||||||
text: item.modelData?.text ?? ""
|
text: menuItem.modelData?.text ?? ""
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
active: item.modelData?.trailingIcon.length > 0
|
active: menuItem.modelData?.trailingIcon.length > 0
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
visible: active
|
visible: active
|
||||||
|
|
||||||
sourceComponent: MaterialIcon {
|
sourceComponent: MaterialIcon {
|
||||||
color: item.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurfaceVariant
|
color: menuItem.active ? Colors.palette.m3onTertiaryContainer : Colors.palette.m3onSurfaceVariant
|
||||||
text: item.modelData.trailingIcon
|
text: menuItem.modelData.trailingIcon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
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.leftMargin: Tokens.padding.large
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: Colors.palette.m3onSurfaceVariant
|
color: Colors.palette.m3onSurfaceVariant
|
||||||
font.pointSize: Tokens.font.size.large
|
fontStyle: Tokens.font.icon.builders.medium.scale(0.9).build()
|
||||||
text: "search"
|
text: "search"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ TextFieldBase {
|
|||||||
id: clearIcon
|
id: clearIcon
|
||||||
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: Tokens.padding.larger
|
anchors.rightMargin: Tokens.padding.small
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
enabled: root.text
|
enabled: root.text
|
||||||
icon: "clear"
|
icon: "clear"
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ Row {
|
|||||||
}
|
}
|
||||||
|
|
||||||
property alias active: menu.active
|
property alias active: menu.active
|
||||||
property color color: type == CustomSplitButton.Filled ? Colors.palette.m3primary : Colors.palette.m3secondaryContainer
|
property color color: type == SplitButton.Filled ? Colors.palette.m3primary : Colors.palette.m3secondaryContainer
|
||||||
property color disabledColor: Qt.alpha(Colors.palette.m3onSurface, 0.1)
|
property color disabledColor: Qt.alpha(Colors.palette.m3onSurface, 0.1)
|
||||||
property color disabledTextColor: Qt.alpha(Colors.palette.m3onSurface, 0.38)
|
property color disabledTextColor: Qt.alpha(Colors.palette.m3onSurface, 0.38)
|
||||||
readonly property alias expandBtn: expandBtn
|
readonly property alias expandBtn: expandBtn
|
||||||
property alias expanded: menu.expanded
|
property alias expanded: menu.expanded
|
||||||
property string fallbackIcon
|
property string fallbackIcon
|
||||||
property string fallbackText
|
property string fallbackText
|
||||||
property real horizontalPadding: Tokens.padding.larger
|
property real horizontalPadding: Tokens.padding.medium
|
||||||
readonly property alias iconLabel: iconLabel
|
readonly property alias iconLabel: iconLabel
|
||||||
readonly property alias label: label
|
readonly property alias label: label
|
||||||
readonly property alias menu: menu
|
readonly property alias menu: menu
|
||||||
@@ -27,20 +27,20 @@ Row {
|
|||||||
property bool menuOnTop
|
property bool menuOnTop
|
||||||
property real minLeftWidth
|
property real minLeftWidth
|
||||||
readonly property alias stateLayer: stateLayer
|
readonly property alias stateLayer: stateLayer
|
||||||
property color textColor: type == CustomSplitButton.Filled ? Colors.palette.m3onPrimary : Colors.palette.m3onSecondaryContainer
|
property color textColor: type == SplitButton.Filled ? Colors.palette.m3onPrimary : Colors.palette.m3onSecondaryContainer
|
||||||
readonly property alias textRow: textRow
|
readonly property alias textRow: textRow
|
||||||
property int type: CustomSplitButton.Filled
|
property int type: SplitButton.Filled
|
||||||
property real verticalPadding: Tokens.padding.small
|
property real verticalPadding: Tokens.padding.small
|
||||||
|
|
||||||
spacing: Math.floor(Tokens.spacing.extraSmall)
|
spacing: Math.floor(Tokens.spacing.extraSmall / 2)
|
||||||
|
|
||||||
CustomRect {
|
CustomRect {
|
||||||
bottomRightRadius: Tokens.rounding.small / 2
|
bottomRightRadius: Tokens.rounding.medium / 2
|
||||||
color: !root.enabled ? root.disabledColor : root.color
|
color: !root.enabled ? root.disabledColor : root.color
|
||||||
implicitHeight: expandBtn.implicitHeight
|
implicitHeight: expandBtn.implicitHeight
|
||||||
implicitWidth: Math.max(root.minLeftWidth, textRow.implicitWidth + root.horizontalPadding * 2)
|
implicitWidth: Math.max(root.minLeftWidth, textRow.implicitWidth + root.horizontalPadding * 2)
|
||||||
radius: implicitHeight / 2 * Math.min(1, Tokens.rounding.scale)
|
radius: implicitHeight / 2 * Math.min(1, Tokens.rounding.scale)
|
||||||
topRightRadius: Tokens.rounding.small / 2
|
topRightRadius: Tokens.rounding.medium / 2
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
id: stateLayer
|
id: stateLayer
|
||||||
@@ -92,7 +92,7 @@ Row {
|
|||||||
CustomRect {
|
CustomRect {
|
||||||
id: expandBtn
|
id: expandBtn
|
||||||
|
|
||||||
property real rad: root.expanded ? implicitHeight / 2 * Math.min(1, Tokens.rounding.scale) : Tokens.rounding.small / 2
|
property real rad: root.expanded ? implicitHeight / 2 * Math.min(1, Tokens.rounding.scale) : Tokens.rounding.medium / 2
|
||||||
|
|
||||||
bottomLeftRadius: rad
|
bottomLeftRadius: rad
|
||||||
color: !root.enabled ? root.disabledColor : root.color
|
color: !root.enabled ? root.disabledColor : root.color
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Shapes
|
import QtQuick.Shapes
|
||||||
import ZShell
|
import ZShell
|
||||||
import ZShell.Components
|
|
||||||
import qs.Helpers
|
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
@@ -53,7 +51,7 @@ MouseArea {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: !enabled ? undefined : Qt.PointingHandCursor
|
cursorShape: !enabled ? undefined : Qt.PointingHandCursor
|
||||||
enabled: parent.enabled && !Visibilities.getForActive()?.isDrawing
|
enabled: parent.enabled && !ShellState.forActive()?.isDrawing
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
Behavior on stateOpacity {
|
Behavior on stateOpacity {
|
||||||
@@ -81,7 +79,7 @@ MouseArea {
|
|||||||
|
|
||||||
alwaysRunToEnd: true
|
alwaysRunToEnd: true
|
||||||
duration: Tokens.anim.durations.expressiveSlowEffects * 2
|
duration: Tokens.anim.durations.expressiveSlowEffects * 2
|
||||||
easing.bezierCurve: Tokens.anim.curves.standard
|
easing: Tokens.anim.standard
|
||||||
property: "circleRadius"
|
property: "circleRadius"
|
||||||
target: root
|
target: root
|
||||||
to: root.endRadius
|
to: root.endRadius
|
||||||
@@ -100,13 +98,13 @@ MouseArea {
|
|||||||
id: base
|
id: base
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
bottomLeftRadius: root.parent?.bottomLeftRadius ?? radius ?? 0
|
|
||||||
bottomRightRadius: root.parent?.bottomRightRadius ?? radius ?? 0
|
|
||||||
color: Colors.palette.m3onSurface
|
color: Colors.palette.m3onSurface
|
||||||
opacity: root.stateOpacity
|
opacity: root.stateOpacity
|
||||||
// Pick up radius from parent if it has one (parent can be anything with radius props)
|
// Pick up radius from parent if it has one (parent can be anything with radius props)
|
||||||
// qmllint disable missing-property
|
// qmllint disable missing-property
|
||||||
radius: root.parent?.radius ?? 0
|
radius: root.parent?.radius ?? 0
|
||||||
|
bottomLeftRadius: root.parent?.bottomLeftRadius ?? radius ?? 0
|
||||||
|
bottomRightRadius: root.parent?.bottomRightRadius ?? radius ?? 0
|
||||||
topLeftRadius: root.parent?.topLeftRadius ?? radius ?? 0
|
topLeftRadius: root.parent?.topLeftRadius ?? radius ?? 0
|
||||||
topRightRadius: root.parent?.topRightRadius ?? radius ?? 0
|
topRightRadius: root.parent?.topRightRadius ?? radius ?? 0
|
||||||
// qmllint enable missing-property
|
// qmllint enable missing-property
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
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 Colors.palette.m3primary;
|
||||||
return type === TextButton.Filled ? Colors.palette.m3onPrimary : Colors.palette.m3onSecondary;
|
return type === TextButton.Filled ? Colors.palette.m3onPrimary : Colors.palette.m3onSecondary;
|
||||||
}
|
}
|
||||||
horizontalPadding: Tokens.padding.normal
|
horizontalPadding: Tokens.padding.small
|
||||||
implicitHeight: label.implicitHeight + verticalPadding * 2
|
implicitHeight: label.implicitHeight + verticalPadding * 2
|
||||||
implicitWidth: label.implicitWidth + horizontalPadding * 2
|
implicitWidth: label.implicitWidth + horizontalPadding * 2
|
||||||
inactiveColor: {
|
inactiveColor: {
|
||||||
@@ -29,7 +29,7 @@ ButtonBase {
|
|||||||
return Colors.palette.m3primary;
|
return Colors.palette.m3primary;
|
||||||
return type === TextButton.Filled ? Colors.palette.m3onSurface : Colors.palette.m3onSecondaryContainer;
|
return type === TextButton.Filled ? Colors.palette.m3onSurface : Colors.palette.m3onSecondaryContainer;
|
||||||
}
|
}
|
||||||
verticalPadding: Tokens.padding.small
|
verticalPadding: Tokens.padding.extraSmall
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
id: label
|
id: label
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
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,7 +8,7 @@ TextField {
|
|||||||
|
|
||||||
color: Colors.palette.m3onSurface
|
color: Colors.palette.m3onSurface
|
||||||
cursorVisible: !readOnly
|
cursorVisible: !readOnly
|
||||||
font.pointSize: Tokens.font.size.small
|
font: Tokens.font.body.small
|
||||||
implicitHeight: contentHeight + topPadding + bottomPadding
|
implicitHeight: contentHeight + topPadding + bottomPadding
|
||||||
implicitWidth: contentWidth + leftPadding + rightPadding
|
implicitWidth: contentWidth + leftPadding + rightPadding
|
||||||
placeholderTextColor: Colors.palette.m3onSurfaceVariant // No anim cause placeholder is custom
|
placeholderTextColor: Colors.palette.m3onSurfaceVariant // No anim cause placeholder is custom
|
||||||
@@ -18,14 +18,11 @@ TextField {
|
|||||||
verticalAlignment: TextInput.AlignVCenter
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
CAnim {
|
CAnim {}
|
||||||
}
|
|
||||||
}
|
|
||||||
cursorDelegate: Item {
|
|
||||||
}
|
}
|
||||||
|
cursorDelegate: Item {}
|
||||||
Behavior on selectionColor {
|
Behavior on selectionColor {
|
||||||
CAnim {
|
CAnim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomRect {
|
CustomRect {
|
||||||
@@ -36,7 +33,7 @@ TextField {
|
|||||||
color: Colors.palette.m3primary
|
color: Colors.palette.m3primary
|
||||||
implicitHeight: root.cursorRectangle.height
|
implicitHeight: root.cursorRectangle.height
|
||||||
implicitWidth: 1.5
|
implicitWidth: 1.5
|
||||||
radius: Tokens.rounding.large
|
radius: Tokens.rounding.largeIncreased
|
||||||
x: root.cursorRectangle.x
|
x: root.cursorRectangle.x
|
||||||
y: root.cursorRectangle.y
|
y: root.cursorRectangle.y
|
||||||
|
|
||||||
|
|||||||
@@ -32,12 +32,11 @@ CustomRect {
|
|||||||
return Colors.palette.m3errorContainer;
|
return Colors.palette.m3errorContainer;
|
||||||
return Colors.palette.m3surface;
|
return Colors.palette.m3surface;
|
||||||
}
|
}
|
||||||
implicitHeight: layout.implicitHeight + Tokens.padding.smaller * 2
|
implicitHeight: layout.implicitHeight + Tokens.padding.small * 2
|
||||||
radius: Tokens.rounding.normal
|
radius: Tokens.rounding.medium
|
||||||
|
|
||||||
Behavior on border.color {
|
Behavior on border.color {
|
||||||
CAnim {
|
CAnim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Elevation {
|
Elevation {
|
||||||
@@ -52,10 +51,10 @@ CustomRect {
|
|||||||
id: layout
|
id: layout
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: Tokens.padding.normal
|
anchors.leftMargin: Tokens.padding.small
|
||||||
anchors.margins: Tokens.padding.smaller
|
anchors.margins: Tokens.padding.small
|
||||||
anchors.rightMargin: Tokens.padding.normal
|
anchors.rightMargin: Tokens.padding.small
|
||||||
spacing: Tokens.spacing.normal
|
spacing: Tokens.spacing.medium
|
||||||
|
|
||||||
CustomRect {
|
CustomRect {
|
||||||
color: {
|
color: {
|
||||||
@@ -67,9 +66,9 @@ CustomRect {
|
|||||||
return Colors.palette.m3error;
|
return Colors.palette.m3error;
|
||||||
return Colors.palette.m3surfaceContainerHigh;
|
return Colors.palette.m3surfaceContainerHigh;
|
||||||
}
|
}
|
||||||
implicitHeight: icon.implicitHeight + Tokens.padding.smaller * 2
|
implicitHeight: icon.implicitHeight + Tokens.padding.small * 2
|
||||||
implicitWidth: implicitHeight
|
implicitWidth: implicitHeight
|
||||||
radius: Tokens.rounding.normal
|
radius: Tokens.rounding.medium
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
id: icon
|
id: icon
|
||||||
@@ -84,7 +83,7 @@ CustomRect {
|
|||||||
return Colors.palette.m3onError;
|
return Colors.palette.m3onError;
|
||||||
return Colors.palette.m3onSurfaceVariant;
|
return Colors.palette.m3onSurfaceVariant;
|
||||||
}
|
}
|
||||||
font.pointSize: Math.round(Tokens.font.size.large * 1.2)
|
fontStyle: Tokens.font.icon.builders.large.scale(1.2).build()
|
||||||
text: root.modelData.icon
|
text: root.modelData.icon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,7 +106,7 @@ CustomRect {
|
|||||||
return Colors.palette.m3onSurface;
|
return Colors.palette.m3onSurface;
|
||||||
}
|
}
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font.pointSize: Tokens.font.size.normal
|
font: Tokens.font.title.small
|
||||||
text: root.modelData.title
|
text: root.modelData.title
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ Item {
|
|||||||
}
|
}
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
implicitWidth: Config.utilities.sizes.toastWidth - Tokens.padding.normal * 2
|
implicitWidth: Config.utilities.sizes.toastWidth - Tokens.padding.small * 2
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: repeater
|
id: repeater
|
||||||
@@ -82,7 +82,7 @@ Item {
|
|||||||
Behavior on anchors.bottomMargin {
|
Behavior on anchors.bottomMargin {
|
||||||
Anim {
|
Anim {
|
||||||
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
||||||
easing.bezierCurve: Tokens.anim.curves.expressiveDefaultSpatial
|
easing: Tokens.anim.expressiveDefaultSpatial
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
@@ -105,7 +105,7 @@ Item {
|
|||||||
id: initAnim
|
id: initAnim
|
||||||
|
|
||||||
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
||||||
easing.bezierCurve: Tokens.anim.curves.expressiveDefaultSpatial
|
easing: Tokens.anim.expressiveDefaultSpatial
|
||||||
from: 0
|
from: 0
|
||||||
properties: "opacity,scale"
|
properties: "opacity,scale"
|
||||||
target: toast
|
target: toast
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ CustomListView {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property real endFadeOpacity: fadeShouldBeActive(false) ? 0 : 1
|
property real endFadeOpacity: fadeShouldBeActive(false) ? 0 : 1
|
||||||
|
property bool fadeEnabled: true
|
||||||
property real fadeAmount: 0.1
|
property real fadeAmount: 0.1
|
||||||
|
property real fadeThreshold: 0.0
|
||||||
readonly property bool horizontal: orientation === ListView.Horizontal
|
readonly property bool horizontal: orientation === ListView.Horizontal
|
||||||
property real startFadeOpacity: fadeShouldBeActive(true) ? 0 : 1
|
property real startFadeOpacity: fadeShouldBeActive(true) ? 0 : 1
|
||||||
|
|
||||||
@@ -16,7 +18,9 @@ CustomListView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function fadeShouldBeActive(isStart: bool): bool {
|
function fadeShouldBeActive(isStart: bool): bool {
|
||||||
// When content is smaller than flickable size, hide fade when rebound starts.
|
if (!fadeEnabled)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (contentSize() + marginStart() + marginEnd() < viewportSize() && rebound.running && ((isStart ? overshootStart() > 0 : overshootStart() < 0))) {
|
if (contentSize() + marginStart() + marginEnd() < viewportSize() && rebound.running && ((isStart ? overshootStart() > 0 : overshootStart() < 0))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -28,11 +32,11 @@ CustomListView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function marginEnd(): real {
|
function marginEnd(): real {
|
||||||
return horizontal ? rightMargin : bottomMargin;
|
return horizontal ? rightMargin - fadeThreshold : bottomMargin - fadeThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
function marginStart(): real {
|
function marginStart(): real {
|
||||||
return horizontal ? leftMargin : topMargin;
|
return horizontal ? leftMargin - fadeThreshold : topMargin - fadeThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
function overshootStart(): real {
|
function overshootStart(): real {
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
import QtQuick
|
||||||
|
import ZShell.Config
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
|
CustomClippingRect {
|
||||||
|
id: track
|
||||||
|
|
||||||
|
required property var scrollBar
|
||||||
|
required property var mouseArea
|
||||||
|
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
implicitWidth: handle.implicitWidth
|
||||||
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import ZShell
|
|||||||
import qs.Components
|
import qs.Components
|
||||||
import qs.Modules
|
import qs.Modules
|
||||||
import qs.Helpers
|
import qs.Helpers
|
||||||
|
import qs.Services
|
||||||
import qs.Paths
|
import qs.Paths
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ Singleton {
|
|||||||
property alias server: server
|
property alias server: server
|
||||||
|
|
||||||
function shouldThrottle(appName: string): bool {
|
function shouldThrottle(appName: string): bool {
|
||||||
if (props.dnd || [...Visibilities.screens.values()].some(v => v.sidebar))
|
if (props.dnd || ShellState.anySidebarOpen())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const key = (appName || "unknown").trim().toLowerCase();
|
const key = (appName || "unknown").trim().toLowerCase();
|
||||||
|
|||||||
+5
-10
@@ -3,28 +3,23 @@ pragma ComponentBehavior: Bound
|
|||||||
import Quickshell
|
import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import ZShell.Internal
|
import ZShell.Internal
|
||||||
|
import qs.Components
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property alias content: contentLoader.item
|
readonly property alias content: contentLoader.item
|
||||||
readonly property PersistentProperties drawingState: PersistentProperties {
|
required property ScreenState screenState
|
||||||
property color penColor: "white"
|
|
||||||
property int penWidth: 4
|
|
||||||
|
|
||||||
reloadableId: "drawingState"
|
|
||||||
}
|
|
||||||
required property PersistentProperties visibilities
|
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: contentLoader
|
id: contentLoader
|
||||||
|
|
||||||
active: root.visibilities.isDrawing
|
active: root.screenState.isDrawing
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
sourceComponent: StrokeCanvas {
|
sourceComponent: StrokeCanvas {
|
||||||
penColor: root.drawingState.penColor
|
penColor: root.screenState.penColor
|
||||||
penWidth: root.drawingState.penWidth
|
penWidth: root.screenState.penWidth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Components
|
import qs.Components
|
||||||
@@ -15,6 +16,9 @@ Scope {
|
|||||||
ExclusionZone {
|
ExclusionZone {
|
||||||
id: top
|
id: top
|
||||||
|
|
||||||
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
|
anchors.left: true
|
||||||
|
anchors.right: true
|
||||||
anchors.top: true
|
anchors.top: true
|
||||||
hasBar: root.geometry.barOnTop
|
hasBar: root.geometry.barOnTop
|
||||||
}
|
}
|
||||||
|
|||||||
+95
-55
@@ -1,7 +1,7 @@
|
|||||||
import Quickshell
|
import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Components
|
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
|
import qs.Components
|
||||||
import qs.Helpers
|
import qs.Helpers
|
||||||
import qs.Modules.Bar.Popouts
|
import qs.Modules.Bar.Popouts
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ Item {
|
|||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
property bool singleGestureTriggered: false
|
property bool singleGestureTriggered: false
|
||||||
property bool utilitiesShortcutActive
|
property bool utilitiesShortcutActive
|
||||||
required property PersistentProperties visibilities
|
required property ScreenState screenState
|
||||||
|
|
||||||
function inBottomPanel(panel: Item, x: real, y: real): bool {
|
function inBottomPanel(panel: Item, x: real, y: real): bool {
|
||||||
const panelHeight = panel.height * (1 - (panel.offsetScale ?? 0));
|
const panelHeight = panel.height * (1 - (panel.offsetScale ?? 0));
|
||||||
@@ -63,7 +63,7 @@ Item {
|
|||||||
|
|
||||||
cursorShape: (active && centroid.pressPosition.y < root.bar.implicitHeight) ? Qt.ClosedHandCursor : undefined
|
cursorShape: (active && centroid.pressPosition.y < root.bar.implicitHeight) ? Qt.ClosedHandCursor : undefined
|
||||||
dragThreshold: 0
|
dragThreshold: 0
|
||||||
enabled: !root.visibilities.isDrawing
|
enabled: !root.screenState.isDrawing
|
||||||
grabPermissions: PointerHandler.CanTakeOverFromHandlersOfSameType | PointerHandler.ApprovesTakeOverByAnything
|
grabPermissions: PointerHandler.CanTakeOverFromHandlersOfSameType | PointerHandler.ApprovesTakeOverByAnything
|
||||||
maximumPointCount: 1
|
maximumPointCount: 1
|
||||||
minimumPointCount: 1
|
minimumPointCount: 1
|
||||||
@@ -76,45 +76,59 @@ Item {
|
|||||||
onCentroidChanged: {
|
onCentroidChanged: {
|
||||||
const x = centroid.position.x;
|
const x = centroid.position.x;
|
||||||
const y = centroid.position.y;
|
const y = centroid.position.y;
|
||||||
const dragX = x - centroid.pressPosition.x;
|
const pressX = centroid.pressPosition.x;
|
||||||
const dragY = y - centroid.pressPosition.y;
|
const pressY = centroid.pressPosition.y;
|
||||||
|
const dragX = x - pressX;
|
||||||
|
const dragY = y - pressY;
|
||||||
|
|
||||||
if (centroid.pressPosition.y >= root.screen.height - Config.bar.border && centroid.pressPosition.x > root.screen.width / 5 && dragY < -Config.launcher.dragThreshold)
|
if (pressY >= root.screen.height - Config.bar.border && pressX > root.screen.width / 5 && dragY < -Config.launcher.dragThreshold)
|
||||||
root.visibilities.launcher = true;
|
root.screenState.launcher = true;
|
||||||
|
|
||||||
if (root.singleGestureTriggered)
|
if (root.singleGestureTriggered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (root.geometry.insetTop(root.borderThickness) > centroid.pressPosition.y) {
|
const inDashboard = root.inTopPanel(root.panels.dashboardWrapper, pressX, pressY);
|
||||||
if (dragY > 20) {
|
|
||||||
root.visibilities.settings = true;
|
if (inDashboard && root.withinPanelWidth(root.panels.dashboardWrapper, x, y)) {
|
||||||
|
if (dragY > Config.dashboard.dragThreshold) {
|
||||||
|
root.screenState.dashboard = true;
|
||||||
root.singleGestureTriggered = true;
|
root.singleGestureTriggered = true;
|
||||||
} else if (dragY < -20) {
|
} else if (dragY < -Config.dashboard.dragThreshold) {
|
||||||
root.visibilities.settings = false;
|
root.screenState.dashboard = false;
|
||||||
root.singleGestureTriggered = true;
|
root.singleGestureTriggered = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (centroid.pressPosition.y > root.screen.height - root.geometry.insetBottom(root.borderThickness) && centroid.pressPosition.x < root.screen.width / 5 && dragY < -50)
|
if (root.geometry.insetTop(root.borderThickness) > pressY && (Config.dashboard.showOnHover || !inDashboard)) {
|
||||||
root.visibilities.clipboard = true;
|
if (dragY > 20) {
|
||||||
|
root.screenState.settings = true;
|
||||||
|
root.singleGestureTriggered = true;
|
||||||
|
} else if (dragY < -20) {
|
||||||
|
root.screenState.settings = false;
|
||||||
|
root.singleGestureTriggered = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!Config.dock.hoverToReveal && centroid.pressPosition.y > root.screen.height - root.geometry.insetTop(root.borderThickness) && centroid.pressPosition.x > root.screen.width / 5 && !root.visibilities.launcher)
|
if (pressY > root.screen.height - root.geometry.insetBottom(root.borderThickness) && pressX < root.screen.width / 5 && dragY < -50)
|
||||||
|
root.screenState.clipboard = true;
|
||||||
|
|
||||||
|
if (!Config.dock.hoverToReveal && pressY > root.screen.height - root.geometry.insetTop(root.borderThickness) && pressX > root.screen.width / 5 && !root.screenState.launcher)
|
||||||
if (dragY < -10) {
|
if (dragY < -10) {
|
||||||
root.visibilities.dock = true;
|
root.screenState.dock = true;
|
||||||
root.singleGestureTriggered = true;
|
root.singleGestureTriggered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (centroid.pressPosition.x > root.screen.width - Config.bar.border && centroid.pressPosition.y < (root.screen.height / 2) && dragX < -Config.sidebar.dragThreshold) {
|
if (pressX > root.screen.width - Config.bar.border && pressY < (root.screen.height / 2) && dragX < -Config.sidebar.dragThreshold) {
|
||||||
root.visibilities.sidebar = true;
|
root.screenState.sidebar = true;
|
||||||
root.singleGestureTriggered = true;
|
root.singleGestureTriggered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (centroid.pressPosition.x >= root.screen.width - Config.bar.border && centroid.pressPosition.y > (root.screen.height / 2) && dragX < -20) {
|
if (pressX >= root.screen.width - Config.bar.border && pressY > (root.screen.height / 2) && dragX < -20) {
|
||||||
Hypr.dispatch(`hl.dsp.focus({ workspace = 'r+1', on_current_monitor = true })`);
|
Hypr.dispatch(`hl.dsp.focus({ workspace = 'r+1', on_current_monitor = true })`);
|
||||||
root.singleGestureTriggered = true;
|
root.singleGestureTriggered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (centroid.pressPosition.x <= Config.bar.border && dragX > 20) {
|
if (pressX <= Config.bar.border && dragX > 20) {
|
||||||
Hypr.dispatch(`hl.dsp.focus({ workspace = 'r-1', on_current_monitor = true })`);
|
Hypr.dispatch(`hl.dsp.focus({ workspace = 'r-1', on_current_monitor = true })`);
|
||||||
root.singleGestureTriggered = true;
|
root.singleGestureTriggered = true;
|
||||||
}
|
}
|
||||||
@@ -127,7 +141,7 @@ Item {
|
|||||||
property bool setInitialPoint: false
|
property bool setInitialPoint: false
|
||||||
|
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
enabled: root.visibilities.isDrawing && (!root.inLeftPanel(root.panels.drawing, hoverHandler.point.position.x, hoverHandler.point.position.y) || !root.panels.drawing.expanded)
|
enabled: root.screenState.isDrawing && (!root.inLeftPanel(root.panels.drawing, hoverHandler.point.position.x, hoverHandler.point.position.y) || !root.panels.drawing.expanded)
|
||||||
|
|
||||||
onActiveChanged: {
|
onActiveChanged: {
|
||||||
if (!active) {
|
if (!active) {
|
||||||
@@ -162,15 +176,28 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: unhideTimer
|
||||||
|
|
||||||
|
interval: Config.bar.revealDelay
|
||||||
|
repeat: false
|
||||||
|
running: false
|
||||||
|
|
||||||
|
onTriggered: {
|
||||||
|
if (hoverHandler.hovered)
|
||||||
|
root.bar.isHovered = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
id: hoverHandler
|
id: hoverHandler
|
||||||
|
|
||||||
cursorShape: root.visibilities.isDrawing && !root.inLeftPanel(root.panels.drawing, point.position.x, point.position.y) ? Qt.BlankCursor : undefined
|
cursorShape: root.screenState.isDrawing && !root.inLeftPanel(root.panels.drawing, point.position.x, point.position.y) ? Qt.BlankCursor : undefined
|
||||||
|
|
||||||
onHoveredChanged: {
|
onHoveredChanged: {
|
||||||
if (!hovered) {
|
if (!hovered) {
|
||||||
if (!root.osdShortcutActive) {
|
if (!root.osdShortcutActive) {
|
||||||
root.visibilities.osd = false;
|
root.screenState.osd = false;
|
||||||
root.panels.osd.hovered = false;
|
root.panels.osd.hovered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,15 +205,18 @@ Item {
|
|||||||
root.popouts.hasCurrent = false;
|
root.popouts.hasCurrent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.bar.autoHide)
|
if (Config.bar.autoHide || root.bar.fullscreen)
|
||||||
root.bar.isHovered = false;
|
root.bar.isHovered = false;
|
||||||
|
|
||||||
|
if (root.screenState.dashboard && Config.dashboard.showOnHover)
|
||||||
|
root.screenState.dashboard = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onPointChanged: {
|
onPointChanged: {
|
||||||
const x = point.position.x;
|
const x = point.position.x;
|
||||||
const y = point.position.y;
|
const y = point.position.y;
|
||||||
|
|
||||||
if (root.visibilities.isDrawing) {
|
if (root.screenState.isDrawing) {
|
||||||
if (root.inLeftPanel(root.panels.drawing, x, y) && !(drawingHandler.point.pressedButtons & Qt.LeftButton)) {
|
if (root.inLeftPanel(root.panels.drawing, x, y) && !(drawingHandler.point.pressedButtons & Qt.LeftButton)) {
|
||||||
root.panels.drawing.expand();
|
root.panels.drawing.expand();
|
||||||
root.drawing.content.hideHover();
|
root.drawing.content.hideHover();
|
||||||
@@ -197,9 +227,12 @@ Item {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!root.visibilities.bar && Config.bar.autoHide && root.geometry.barContains(x, y, true))
|
if (!root.screenState.bar && Config.bar.autoHide && root.geometry.barContains(x, y, true))
|
||||||
root.bar.isHovered = true;
|
root.bar.isHovered = true;
|
||||||
|
|
||||||
|
if (root.bar.fullscreen && !root.bar.isHovered)
|
||||||
|
unhideTimer.start();
|
||||||
|
|
||||||
if (root.panels.sidebar.offsetScale === 1) {
|
if (root.panels.sidebar.offsetScale === 1) {
|
||||||
const showOsd = root.inRightPanel(root.panels.osdWrapper, x, y);
|
const showOsd = root.inRightPanel(root.panels.osdWrapper, x, y);
|
||||||
|
|
||||||
@@ -212,7 +245,7 @@ Item {
|
|||||||
const showOsd = outOfSidebar && root.inRightPanel(root.panels.osdWrapper, x, y);
|
const showOsd = outOfSidebar && root.inRightPanel(root.panels.osdWrapper, x, y);
|
||||||
|
|
||||||
if (!root.osdShortcutActive) {
|
if (!root.osdShortcutActive) {
|
||||||
root.visibilities.osd = showOsd;
|
root.screenState.osd = showOsd;
|
||||||
root.panels.osd.hovered = showOsd;
|
root.panels.osd.hovered = showOsd;
|
||||||
} else if (showOsd) {
|
} else if (showOsd) {
|
||||||
root.osdShortcutActive = false;
|
root.osdShortcutActive = false;
|
||||||
@@ -220,8 +253,13 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.dock.enable && Config.dock.hoverToReveal && !root.visibilities.dock && !root.visibilities.launcher && root.inBottomPanel(root.panels.dock, x, y))
|
if (Config.dock.enable && Config.dock.hoverToReveal && !root.screenState.dock && !root.screenState.launcher && root.inBottomPanel(root.panels.dock, x, y))
|
||||||
root.visibilities.dock = true;
|
root.screenState.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))
|
if (root.geometry.barContains(x, y))
|
||||||
root.bar.checkPopout(root.geometry.axisPos(x, y));
|
root.bar.checkPopout(root.geometry.axisPos(x, y));
|
||||||
@@ -230,16 +268,17 @@ Item {
|
|||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
function onDashboardChanged() {
|
function onDashboardChanged() {
|
||||||
if (root.visibilities.dashboard) {
|
if (root.screenState.dashboard) {
|
||||||
const inDashboardArea = root.inTopPanel(root.panels.dashboard, root.mouseX, root.mouseY);
|
const inDashboardArea = root.inTopPanel(root.panels.dashboard, root.mouseX, root.mouseY);
|
||||||
if (!inDashboardArea) {
|
if (!inDashboardArea) {
|
||||||
root.dashboardShortcutActive = true;
|
root.dashboardShortcutActive = true;
|
||||||
}
|
}
|
||||||
if (root.panels.launcher.x + root.panels.launcher.width > root.panels.dashboardWrapper.x)
|
if (root.panels.launcher.x + root.panels.launcher.width > root.panels.dashboardWrapper.x)
|
||||||
root.visibilities.launcher = false;
|
root.screenState.launcher = false;
|
||||||
|
|
||||||
root.visibilities.settings = false;
|
root.screenState.settings = false;
|
||||||
root.visibilities.sidebar = false;
|
root.screenState.sidebar = false;
|
||||||
|
root.screenState.resources = false;
|
||||||
root.popouts.hasCurrent = false;
|
root.popouts.hasCurrent = false;
|
||||||
} else {
|
} else {
|
||||||
root.dashboardShortcutActive = false;
|
root.dashboardShortcutActive = false;
|
||||||
@@ -247,12 +286,12 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onIsDrawingChanged() {
|
function onIsDrawingChanged() {
|
||||||
if (!root.visibilities.isDrawing)
|
if (!root.screenState.isDrawing)
|
||||||
root.drawing.clear();
|
root.drawing.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLauncherChanged() {
|
function onLauncherChanged() {
|
||||||
if (!root.visibilities.launcher) {
|
if (!root.screenState.launcher) {
|
||||||
root.dashboardShortcutActive = false;
|
root.dashboardShortcutActive = false;
|
||||||
root.osdShortcutActive = false;
|
root.osdShortcutActive = false;
|
||||||
root.utilitiesShortcutActive = false;
|
root.utilitiesShortcutActive = false;
|
||||||
@@ -260,23 +299,23 @@ Item {
|
|||||||
const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY);
|
const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY);
|
||||||
|
|
||||||
if (!inOsdArea) {
|
if (!inOsdArea) {
|
||||||
root.visibilities.osd = false;
|
root.screenState.osd = false;
|
||||||
root.panels.osd.hovered = false;
|
root.panels.osd.hovered = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root.visibilities.launcher) {
|
if (root.screenState.launcher) {
|
||||||
if (root.panels.dashboardWrapper.x < root.panels.launcher.x + root.panels.launcher.width) {
|
if (root.panels.dashboardWrapper.x < root.panels.launcher.x + root.panels.launcher.width) {
|
||||||
root.visibilities.dashboard = false;
|
root.screenState.dashboard = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
root.visibilities.dock = false;
|
root.screenState.dock = false;
|
||||||
root.visibilities.settings = false;
|
root.screenState.settings = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onOsdChanged() {
|
function onOsdChanged() {
|
||||||
if (root.visibilities.osd) {
|
if (root.screenState.osd) {
|
||||||
const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY);
|
const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY);
|
||||||
if (!inOsdArea) {
|
if (!inOsdArea) {
|
||||||
root.osdShortcutActive = true;
|
root.osdShortcutActive = true;
|
||||||
@@ -287,32 +326,33 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onResourcesChanged() {
|
function onResourcesChanged() {
|
||||||
if (root.visibilities.resources && (root.popouts.currentName.startsWith("audio") || root.popouts.currentName.startsWith("updates"))) {
|
if (root.screenState.resources) {
|
||||||
root.popouts.hasCurrent = false;
|
if (root.popouts.currentName.startsWith("audio") || root.popouts.currentName.startsWith("updates"))
|
||||||
}
|
root.popouts.hasCurrent = false;
|
||||||
|
|
||||||
if (root.visibilities.resources)
|
root.screenState.settings = false;
|
||||||
root.visibilities.settings = false;
|
root.screenState.dashboard = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSettingsChanged() {
|
function onSettingsChanged() {
|
||||||
if (root.visibilities.settings) {
|
if (root.screenState.settings) {
|
||||||
root.visibilities.resources = false;
|
root.screenState.resources = false;
|
||||||
root.visibilities.dashboard = false;
|
root.screenState.dashboard = false;
|
||||||
root.visibilities.sidebar = false;
|
root.screenState.sidebar = false;
|
||||||
root.panels.popouts.hasCurrent = false;
|
root.panels.popouts.hasCurrent = false;
|
||||||
root.visibilities.launcher = false;
|
root.screenState.launcher = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSidebarChanged() {
|
function onSidebarChanged() {
|
||||||
if (root.visibilities.sidebar) {
|
if (root.screenState.sidebar) {
|
||||||
root.visibilities.dashboard = false;
|
root.screenState.dashboard = false;
|
||||||
root.visibilities.settings = false;
|
root.screenState.settings = false;
|
||||||
root.popouts.hasCurrent = false;
|
root.popouts.hasCurrent = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
target: root.visibilities
|
target: root.screenState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,315 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
-23
@@ -37,12 +37,12 @@ Item {
|
|||||||
readonly property alias resources: resources
|
readonly property alias resources: resources
|
||||||
readonly property alias resourcesWrapper: resourcesWrapper
|
readonly property alias resourcesWrapper: resourcesWrapper
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
|
required property ScreenState screenState
|
||||||
readonly property alias settings: settings
|
readonly property alias settings: settings
|
||||||
readonly property alias settingsWrapper: settingsWrapper
|
readonly property alias settingsWrapper: settingsWrapper
|
||||||
readonly property alias sidebar: sidebar
|
readonly property alias sidebar: sidebar
|
||||||
readonly property alias toasts: toasts
|
readonly property alias toasts: toasts
|
||||||
readonly property alias utilities: utilities
|
readonly property alias utilities: utilities
|
||||||
required property PersistentProperties visibilities
|
|
||||||
|
|
||||||
anchors.bottomMargin: geometry.insetBottom(borderThickness)
|
anchors.bottomMargin: geometry.insetBottom(borderThickness)
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -64,7 +64,7 @@ Item {
|
|||||||
id: resources
|
id: resources
|
||||||
|
|
||||||
position: root.geometry.position
|
position: root.geometry.position
|
||||||
visibilities: root.visibilities
|
screenState: root.screenState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,8 +84,8 @@ Item {
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
|
screenState: root.screenState
|
||||||
sidebarOrSessionVisible: sidebar.visible
|
sidebarOrSessionVisible: sidebar.visible
|
||||||
visibilities: root.visibilities
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ Item {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
drawing: root.drawingItem
|
drawing: root.drawingItem
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
visibilities: root.visibilities
|
screenState: root.screenState
|
||||||
}
|
}
|
||||||
|
|
||||||
Popouts.ClipWrapper {
|
Popouts.ClipWrapper {
|
||||||
@@ -111,7 +111,7 @@ Item {
|
|||||||
id: toasts
|
id: toasts
|
||||||
|
|
||||||
anchors.bottom: sidebar.visible ? parent.bottom : utilities.top
|
anchors.bottom: sidebar.visible ? parent.bottom : utilities.top
|
||||||
anchors.margins: Tokens.padding.normal
|
anchors.margins: Tokens.padding.small
|
||||||
anchors.right: sidebar.left
|
anchors.right: sidebar.left
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,8 +121,8 @@ Item {
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
panels: root
|
panels: root
|
||||||
|
screenState: root.screenState
|
||||||
sidebarPanel: sidebar
|
sidebarPanel: sidebar
|
||||||
visibilities: root.visibilities
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Launcher.Wrapper {
|
Launcher.Wrapper {
|
||||||
@@ -132,7 +132,7 @@ Item {
|
|||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
panels: root
|
panels: root
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
visibilities: root.visibilities
|
screenState: root.screenState
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.Wrapper {
|
Utils.Wrapper {
|
||||||
@@ -140,9 +140,8 @@ Item {
|
|||||||
|
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
popouts: popouts
|
screenState: root.screenState
|
||||||
sidebar: sidebar
|
sidebar: sidebar
|
||||||
visibilities: root.visibilities
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -150,18 +149,16 @@ Item {
|
|||||||
|
|
||||||
property real offsetScale: dashboard.shouldBeActive ? 0 : 1
|
property real offsetScale: dashboard.shouldBeActive ? 0 : 1
|
||||||
|
|
||||||
anchors.bottom: root.geometry.barOnLeft || root.geometry.barOnBottom ? parent.bottom : undefined
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.left: root.geometry.barOnLeft ? parent.left : undefined
|
anchors.top: parent.top
|
||||||
anchors.right: root.geometry.barOnLeft ? undefined : parent.right
|
clip: offsetScale > 0
|
||||||
anchors.top: root.geometry.barOnBottom || root.geometry.barOnLeft ? undefined : parent.top
|
implicitHeight: dashboard.implicitHeight * (1 - offsetScale)
|
||||||
clip: true
|
implicitWidth: dashboard.implicitWidth
|
||||||
implicitHeight: root.geometry.horizontal ? dashboard.implicitHeight * (1 - offsetScale) : dashboard.implicitHeight
|
|
||||||
implicitWidth: root.geometry.horizontal ? dashboard.implicitWidth : dashboard.implicitWidth * (1 - offsetScale)
|
|
||||||
|
|
||||||
Behavior on offsetScale {
|
Behavior on offsetScale {
|
||||||
Anim {
|
Anim {
|
||||||
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
||||||
easing.bezierCurve: Tokens.anim.curves.expressiveDefaultSpatial
|
easing: Tokens.anim.expressiveDefaultSpatial
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,8 +166,7 @@ Item {
|
|||||||
id: dashboard
|
id: dashboard
|
||||||
|
|
||||||
offsetScale: dashboardWrapper.offsetScale
|
offsetScale: dashboardWrapper.offsetScale
|
||||||
position: root.geometry.position
|
screenState: root.screenState
|
||||||
visibilities: root.visibilities
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +177,7 @@ Item {
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: notifications.bottom
|
anchors.top: notifications.bottom
|
||||||
panels: root
|
panels: root
|
||||||
visibilities: root.visibilities
|
screenState: root.screenState
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -197,7 +193,7 @@ Item {
|
|||||||
anchors.verticalCenterOffset: (-implicitHeight - 5 - ((root.height - implicitHeight) / 2)) * offsetScale
|
anchors.verticalCenterOffset: (-implicitHeight - 5 - ((root.height - implicitHeight) / 2)) * offsetScale
|
||||||
panels: root
|
panels: root
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
visibilities: root.visibilities
|
screenState: root.screenState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +204,7 @@ Item {
|
|||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
panels: root
|
panels: root
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
visibilities: root.visibilities
|
screenState: root.screenState
|
||||||
}
|
}
|
||||||
|
|
||||||
Clipboard.Wrapper {
|
Clipboard.Wrapper {
|
||||||
@@ -217,6 +213,6 @@ Item {
|
|||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
visibilities: root.visibilities
|
screenState: root.screenState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+110
-111
@@ -50,49 +50,47 @@ CustomWindow {
|
|||||||
readonly property alias menuRegion: regions.menuPopoutRegion
|
readonly property alias menuRegion: regions.menuPopoutRegion
|
||||||
readonly property HyprlandMonitor monitor: Hypr.monitorFor(screen)
|
readonly property HyprlandMonitor monitor: Hypr.monitorFor(screen)
|
||||||
property var root: Quickshell.shellDir
|
property var root: Quickshell.shellDir
|
||||||
|
readonly property ScreenState screenState: ShellState.forScreen(screen)
|
||||||
readonly property real sdfBorderOffset: 2 * fsTransitionProg
|
readonly property real sdfBorderOffset: 2 * fsTransitionProg
|
||||||
readonly property real shadowOpacity: 0.7 * (1 - fsTransitionProg)
|
readonly property real shadowOpacity: 0.5 * (1 - (bar.isHovered ? 0 : fsTransitionProg))
|
||||||
property color surfaceColor: Colors.tPalette.m3surface
|
property color surfaceColor: Colors.tPalette.m3surface
|
||||||
|
|
||||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||||
WlrLayershell.keyboardFocus: visibilities.launcher || visibilities.settings ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
WlrLayershell.keyboardFocus: screenState.screenshot ? WlrKeyboardFocus.Exclusive : screenState.launcher || screenState.settings || screenState.sidebar ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||||
WlrLayershell.layer: (fsTransitionProg > 0 && Config.general.showOverFullscreen) || (hasSpecialWorkspace && hasFullscreenOnNormalWs) ? WlrLayer.Overlay : WlrLayer.Top
|
WlrLayershell.layer: (fsTransitionProg > 0 && Config.general.showOverFullscreen) || (hasSpecialWorkspace && hasFullscreenOnNormalWs) ? WlrLayer.Overlay : WlrLayer.Top
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
contentItem.focus: true
|
mask: screenState.isDrawing || screenState.screenshot ? null : (hasFullscreen && !bar.isHovered ? emptyRegion : regions)
|
||||||
mask: visibilities.isDrawing ? null : (hasFullscreen ? emptyRegion : regions)
|
|
||||||
name: "Bar"
|
name: "Bar"
|
||||||
|
|
||||||
Behavior on fsTransitionProg {
|
Behavior on fsTransitionProg {
|
||||||
Anim {
|
Anim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Behavior on surfaceColor {
|
Behavior on surfaceColor {
|
||||||
CAnim {
|
CAnim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem.Keys.onEscapePressed: {
|
contentItem.Keys.onEscapePressed: {
|
||||||
if (Config.bar.autoHide)
|
if (Config.bar.autoHide)
|
||||||
visibilities.bar = false;
|
screenState.bar = false;
|
||||||
visibilities.launcher = false;
|
screenState.launcher = false;
|
||||||
visibilities.sidebar = false;
|
screenState.sidebar = false;
|
||||||
visibilities.dashboard = false;
|
screenState.dashboard = false;
|
||||||
visibilities.osd = false;
|
screenState.osd = false;
|
||||||
visibilities.settings = false;
|
screenState.settings = false;
|
||||||
visibilities.resources = false;
|
screenState.resources = false;
|
||||||
visibilities.dock = false;
|
screenState.dock = false;
|
||||||
visibilities.clipboard = false;
|
screenState.clipboard = false;
|
||||||
panels.popouts.hasCurrent = false;
|
panels.popouts.hasCurrent = false;
|
||||||
}
|
}
|
||||||
onHasFullscreenChanged: {
|
onHasFullscreenChanged: {
|
||||||
visibilities.launcher = false;
|
screenState.launcher = false;
|
||||||
visibilities.sidebar = false;
|
screenState.sidebar = false;
|
||||||
visibilities.dashboard = false;
|
screenState.dashboard = false;
|
||||||
visibilities.osd = false;
|
screenState.osd = false;
|
||||||
visibilities.settings = false;
|
screenState.settings = false;
|
||||||
visibilities.resources = false;
|
screenState.resources = false;
|
||||||
visibilities.clipboard = false;
|
screenState.clipboard = false;
|
||||||
visibilities.dock = false;
|
screenState.dock = false;
|
||||||
panels.popouts.hasCurrent = false;
|
panels.popouts.hasCurrent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,6 +116,12 @@ CustomWindow {
|
|||||||
x: root.width - width
|
x: root.width - width
|
||||||
y: panels.osdWrapper.y + bar.implicitHeight
|
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 {
|
Regions {
|
||||||
@@ -138,44 +142,41 @@ CustomWindow {
|
|||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
id: focusGrab
|
id: focusGrab
|
||||||
|
|
||||||
active: visibilities.dock || visibilities.resources || visibilities.launcher || visibilities.sidebar || visibilities.dashboard || visibilities.settings || visibilities.clipboard || (panels.popouts.hasCurrent && panels.popouts.currentName.startsWith("traymenu") && (!Config.bar.tray.showOnHover || (panels.popouts.current as StackView)?.depth > 1))
|
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))
|
||||||
|
return true;
|
||||||
|
if (s.dashboard && !c.dashboard.showOnHover && c.dashboard.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)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
windows: [root]
|
windows: [root]
|
||||||
|
|
||||||
onCleared: {
|
onCleared: {
|
||||||
visibilities.launcher = false;
|
root.screenState.launcher = false;
|
||||||
visibilities.sidebar = false;
|
root.screenState.sidebar = false;
|
||||||
visibilities.dashboard = false;
|
root.screenState.dashboard = false;
|
||||||
visibilities.osd = false;
|
root.screenState.osd = false;
|
||||||
visibilities.settings = false;
|
root.screenState.settings = false;
|
||||||
visibilities.resources = false;
|
root.screenState.resources = false;
|
||||||
visibilities.clipboard = false;
|
root.screenState.clipboard = false;
|
||||||
visibilities.dock = false;
|
root.screenState.dock = false;
|
||||||
panels.popouts.hasCurrent = 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 {
|
Binding {
|
||||||
property: "bar"
|
property: "bar"
|
||||||
target: visibilities
|
target: root.screenState
|
||||||
value: visibilities.sidebar || visibilities.dashboard || visibilities.osd || (!Config.bar.hideWhenNotif && visibilities.notif) || visibilities.resources || visibilities.settings || bar.isHovered
|
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
|
||||||
when: Config.bar.autoHide
|
when: Config.bar.autoHide
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,23 +184,19 @@ CustomWindow {
|
|||||||
id: surface
|
id: surface
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
layer.enabled: true
|
|
||||||
opacity: root.surfaceColor.a
|
opacity: root.surfaceColor.a
|
||||||
|
|
||||||
layer.effect: MultiEffect {
|
BlobGroup2 {
|
||||||
blurMax: 32
|
|
||||||
shadowColor: Qt.alpha(Colors.palette.m3shadow, Math.max(0, root.shadowOpacity))
|
|
||||||
shadowEnabled: true
|
|
||||||
}
|
|
||||||
|
|
||||||
BlobGroup {
|
|
||||||
id: blobGroup
|
id: blobGroup
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
color: root.surfaceColor
|
color: root.surfaceColor
|
||||||
|
shadowColor: Qt.alpha(Colors.palette.m3shadow, Math.max(0, root.shadowOpacity))
|
||||||
|
shadowRadius: 18
|
||||||
smoothing: Config.bar.smoothing
|
smoothing: Config.bar.smoothing
|
||||||
}
|
}
|
||||||
|
|
||||||
BlobInvertedRect {
|
BlobInvertedRect2 {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: -50
|
anchors.margins: -50
|
||||||
borderBottom: geometry.insetBottom(root.borderThickness) - anchors.margins - root.sdfBorderOffset
|
borderBottom: geometry.insetBottom(root.borderThickness) - anchors.margins - root.sdfBorderOffset
|
||||||
@@ -219,7 +216,7 @@ CustomWindow {
|
|||||||
implicitHeight: panels.dashboard.height * (geometry.horizontal ? 1 + extraExtent : 1)
|
implicitHeight: panels.dashboard.height * (geometry.horizontal ? 1 + extraExtent : 1)
|
||||||
implicitWidth: panels.dashboard.width * (geometry.horizontal ? 1 : 1 + extraExtent)
|
implicitWidth: panels.dashboard.width * (geometry.horizontal ? 1 : 1 + extraExtent)
|
||||||
panel: panels.dashboardWrapper
|
panel: panels.dashboardWrapper
|
||||||
radius: Tokens.rounding.normal
|
radius: Tokens.rounding.extraLarge
|
||||||
x: panels.dashboardWrapper.x + panels.dashboard.x + geometry.insetLeft(root.borderThickness) - (geometry.horizontal ? 0 : panels.dashboard.width * extraExtent)
|
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)
|
y: panels.dashboardWrapper.y + panels.dashboard.y + geometry.insetTop(root.borderThickness) - (geometry.horizontal && geometry.position !== "bottom" ? panels.dashboard.height * extraExtent : 0)
|
||||||
}
|
}
|
||||||
@@ -232,7 +229,7 @@ CustomWindow {
|
|||||||
deformAmount: 0.06
|
deformAmount: 0.06
|
||||||
implicitHeight: panels.launcher.height * (1 + extraHeight)
|
implicitHeight: panels.launcher.height * (1 + extraHeight)
|
||||||
panel: panels.launcher
|
panel: panels.launcher
|
||||||
radius: Tokens.rounding.smallest + 5
|
radius: Tokens.rounding.medium + (Tokens.padding.largeIncreased / 4)
|
||||||
y: panels.launcher.y + geometry.insetTop(root.borderThickness)
|
y: panels.launcher.y + geometry.insetTop(root.borderThickness)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,6 +246,7 @@ CustomWindow {
|
|||||||
PanelBg {
|
PanelBg {
|
||||||
id: osdBg
|
id: osdBg
|
||||||
|
|
||||||
|
atRestOverride: panels.osd.offsetScale < 0.99
|
||||||
deformAmount: 0.1
|
deformAmount: 0.1
|
||||||
implicitHeight: panels.osd.height
|
implicitHeight: panels.osd.height
|
||||||
implicitWidth: panels.osd.width
|
implicitWidth: panels.osd.width
|
||||||
@@ -260,8 +258,9 @@ CustomWindow {
|
|||||||
PanelBg {
|
PanelBg {
|
||||||
id: notifsBg
|
id: notifsBg
|
||||||
|
|
||||||
|
atRestOverride: panel.implicitHeight > 0
|
||||||
panel: panels.notifications
|
panel: panels.notifications
|
||||||
radius: Tokens.rounding.normal
|
radius: Tokens.rounding.large
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelBg {
|
PanelBg {
|
||||||
@@ -282,26 +281,28 @@ CustomWindow {
|
|||||||
implicitHeight: panels.popouts.height * (geometry.horizontal ? 1 + extraExtent : 1)
|
implicitHeight: panels.popouts.height * (geometry.horizontal ? 1 + extraExtent : 1)
|
||||||
implicitWidth: panels.popouts.width * (geometry.horizontal ? 1 : 1 + extraExtent)
|
implicitWidth: panels.popouts.width * (geometry.horizontal ? 1 : 1 + extraExtent)
|
||||||
panel: panels.popoutsWrapper
|
panel: panels.popoutsWrapper
|
||||||
radius: panels.popouts.current?.panelRadius ?? Tokens.rounding.normal
|
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)
|
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)
|
y: panels.popoutsWrapper.y + panels.popouts.y + geometry.insetTop(root.borderThickness) - (geometry.barOnTop ? panels.popouts.height * extraExtent : 0)
|
||||||
|
|
||||||
Behavior on extraExtent {
|
Behavior on extraExtent {
|
||||||
Anim {
|
Anim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelBg {
|
PanelBg {
|
||||||
id: resourcesBg
|
id: resourcesBg
|
||||||
|
|
||||||
|
property real extraExtent: 0.2
|
||||||
|
|
||||||
|
atRestOverride: panels.resources.offsetScale < 0.99
|
||||||
deformAmount: 0.05
|
deformAmount: 0.05
|
||||||
implicitHeight: panels.resources.height
|
implicitHeight: panels.resources.height * (1 + extraExtent)
|
||||||
implicitWidth: panels.resources.width
|
implicitWidth: panels.resources.width * (1 + extraExtent)
|
||||||
panel: panels.resourcesWrapper
|
panel: panels.resourcesWrapper
|
||||||
radius: Tokens.rounding.large
|
radius: Tokens.rounding.largeIncreased + Tokens.padding.small
|
||||||
x: panels.resourcesWrapper.x + panels.resources.x + geometry.insetLeft(root.borderThickness)
|
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)
|
y: panels.resourcesWrapper.y + panels.resources.y + geometry.insetTop(root.borderThickness) - panels.resources.height * extraExtent
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelBg {
|
PanelBg {
|
||||||
@@ -309,7 +310,7 @@ CustomWindow {
|
|||||||
|
|
||||||
deformAmount: 0.03
|
deformAmount: 0.03
|
||||||
panel: panels.settings
|
panel: panels.settings
|
||||||
radius: Tokens.rounding.large + Tokens.padding.normal
|
radius: Tokens.rounding.largeIncreased + Tokens.padding.small
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelBg {
|
PanelBg {
|
||||||
@@ -317,7 +318,7 @@ CustomWindow {
|
|||||||
|
|
||||||
deformAmount: 0.08
|
deformAmount: 0.08
|
||||||
panel: panels.dock
|
panel: panels.dock
|
||||||
radius: Tokens.rounding.normal
|
radius: Tokens.rounding.medium
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelBg {
|
PanelBg {
|
||||||
@@ -325,15 +326,21 @@ CustomWindow {
|
|||||||
|
|
||||||
deformAmount: 0.08
|
deformAmount: 0.08
|
||||||
panel: panels.drawing
|
panel: panels.drawing
|
||||||
radius: Tokens.rounding.normal
|
radius: Tokens.rounding.medium
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelBg {
|
PanelBg {
|
||||||
id: clipboardBg
|
id: clipboardBg
|
||||||
|
|
||||||
|
property real extraExtent: 0.2
|
||||||
|
|
||||||
deformAmount: 0.03
|
deformAmount: 0.03
|
||||||
|
implicitHeight: panels.clipboard.height * (1 + extraExtent)
|
||||||
|
implicitWidth: panels.clipboard.width * (1 + extraExtent)
|
||||||
panel: panels.clipboard
|
panel: panels.clipboard
|
||||||
radius: 29
|
radius: 29
|
||||||
|
x: panels.clipboard.x + geometry.insetLeft(root.borderThickness) - panels.clipboard.width * extraExtent
|
||||||
|
y: panels.clipboard.y + geometry.insetTop(root.borderThickness)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,37 +348,11 @@ CustomWindow {
|
|||||||
id: drawing
|
id: drawing
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
layer.enabled: true
|
screenState: root.screenState
|
||||||
visibilities: visibilities
|
|
||||||
z: 2
|
z: 2
|
||||||
|
|
||||||
layer.effect: MultiEffect {
|
|
||||||
maskEnabled: true
|
|
||||||
maskInverted: true
|
|
||||||
maskSource: maskSource
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Interactions2 {
|
||||||
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
|
id: interactions
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -383,7 +364,7 @@ CustomWindow {
|
|||||||
panels: panels
|
panels: panels
|
||||||
popouts: panels.popouts
|
popouts: panels.popouts
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
visibilities: visibilities
|
screenState: root.screenState
|
||||||
|
|
||||||
Panels {
|
Panels {
|
||||||
id: panels
|
id: panels
|
||||||
@@ -393,7 +374,7 @@ CustomWindow {
|
|||||||
drawingItem: drawing
|
drawingItem: drawing
|
||||||
geometry: geometry
|
geometry: geometry
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
visibilities: visibilities
|
screenState: root.screenState
|
||||||
|
|
||||||
clipboard.transform: Matrix4x4 {
|
clipboard.transform: Matrix4x4 {
|
||||||
matrix: clipboardBg.deformMatrix
|
matrix: clipboardBg.deformMatrix
|
||||||
@@ -436,27 +417,45 @@ CustomWindow {
|
|||||||
anchors.bottom: geometry.barOnBottom ? parent.bottom : undefined
|
anchors.bottom: geometry.barOnBottom ? parent.bottom : undefined
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.top: geometry.barOnBottom ? undefined : parent.top
|
anchors.top: geometry.barOnBottom ? undefined : parent.top
|
||||||
enabled: !visibilities.isDrawing
|
enabled: !screenState.isDrawing
|
||||||
fullscreen: root.hasFullscreen
|
fullscreen: root.hasFullscreen
|
||||||
height: geometry.horizontal ? implicitHeight : parent.height
|
height: geometry.horizontal ? implicitHeight : parent.height
|
||||||
popouts: panels.popouts
|
popouts: panels.popouts
|
||||||
popoutsWrapper: panels.popoutsWrapper
|
popoutsWrapper: panels.popoutsWrapper
|
||||||
position: geometry.position
|
position: geometry.position
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
visibilities: visibilities
|
screenState: root.screenState
|
||||||
width: geometry.horizontal ? parent.width : implicitWidth
|
width: geometry.horizontal ? parent.width : implicitWidth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component PanelBg: BlobRect {
|
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 {
|
||||||
property real deformAmount: 0.15
|
property real deformAmount: 0.15
|
||||||
required property Item panel
|
required property Item panel
|
||||||
|
|
||||||
|
atRestOverride: panel?.offsetScale < 0.99 ?? false
|
||||||
|
damping: 28.3
|
||||||
deformScale: (deformAmount * Config.appearance.deform.scale) / 10000
|
deformScale: (deformAmount * Config.appearance.deform.scale) / 10000
|
||||||
group: blobGroup
|
group: blobGroup
|
||||||
implicitHeight: panel.height
|
implicitHeight: panel.height
|
||||||
implicitWidth: panel.width
|
implicitWidth: panel.width
|
||||||
radius: Tokens.rounding.smallest
|
radius: Tokens.rounding.small
|
||||||
x: panel.x + geometry.insetLeft(root.borderThickness)
|
x: panel.x + geometry.insetLeft(root.borderThickness)
|
||||||
y: panel.y + geometry.insetTop(root.borderThickness)
|
y: panel.y + geometry.insetTop(root.borderThickness)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+8
-8
@@ -18,7 +18,7 @@ ColumnLayout {
|
|||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: false
|
Layout.fillWidth: false
|
||||||
Layout.preferredWidth: centerWidth
|
Layout.preferredWidth: centerWidth
|
||||||
spacing: Tokens.spacing.large * 2
|
spacing: Tokens.spacing.largeIncreased * 2
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
@@ -64,7 +64,7 @@ ColumnLayout {
|
|||||||
|
|
||||||
CustomClippingRect {
|
CustomClippingRect {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
Layout.topMargin: Tokens.spacing.large * 2
|
Layout.topMargin: Tokens.spacing.largeIncreased * 2
|
||||||
color: Colors.tPalette.m3surfaceContainer
|
color: Colors.tPalette.m3surfaceContainer
|
||||||
implicitHeight: root.centerWidth / 2
|
implicitHeight: root.centerWidth / 2
|
||||||
implicitWidth: root.centerWidth / 2
|
implicitWidth: root.centerWidth / 2
|
||||||
@@ -99,7 +99,7 @@ ColumnLayout {
|
|||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
color: Colors.tPalette.m3surfaceContainer
|
color: Colors.tPalette.m3surfaceContainer
|
||||||
focus: true
|
focus: true
|
||||||
implicitHeight: input.implicitHeight + Tokens.padding.small * 2
|
implicitHeight: input.implicitHeight + Tokens.padding.extraSmall * 2
|
||||||
implicitWidth: root.centerWidth * 0.8
|
implicitWidth: root.centerWidth * 0.8
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
@@ -130,11 +130,11 @@ ColumnLayout {
|
|||||||
id: input
|
id: input
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Tokens.padding.small
|
anchors.margins: Tokens.padding.extraSmall
|
||||||
spacing: Tokens.spacing.normal
|
spacing: Tokens.spacing.medium
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
implicitHeight: statusIcon.implicitHeight + Tokens.padding.small * 2
|
implicitHeight: statusIcon.implicitHeight + Tokens.padding.extraSmall * 2
|
||||||
implicitWidth: implicitHeight
|
implicitWidth: implicitHeight
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
@@ -174,7 +174,7 @@ ColumnLayout {
|
|||||||
|
|
||||||
CustomRect {
|
CustomRect {
|
||||||
color: root.greeter.buffer && !root.greeter.launching ? Colors.palette.m3primary : Colors.layer(Colors.palette.m3surfaceContainerHigh, 2)
|
color: root.greeter.buffer && !root.greeter.launching ? Colors.palette.m3primary : Colors.layer(Colors.palette.m3surfaceContainerHigh, 2)
|
||||||
implicitHeight: enterIcon.implicitHeight + Tokens.padding.small * 2
|
implicitHeight: enterIcon.implicitHeight + Tokens.padding.extraSmall * 2
|
||||||
implicitWidth: implicitHeight
|
implicitWidth: implicitHeight
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ ColumnLayout {
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: -Tokens.spacing.large
|
Layout.topMargin: -Tokens.spacing.largeIncreased
|
||||||
implicitHeight: Math.max(message.implicitHeight, stateMessage.implicitHeight)
|
implicitHeight: Math.max(message.implicitHeight, stateMessage.implicitHeight)
|
||||||
|
|
||||||
Behavior on implicitHeight {
|
Behavior on implicitHeight {
|
||||||
|
|||||||
+11
-11
@@ -30,11 +30,11 @@ NumberAnimation {
|
|||||||
if (type === Anim.DefaultSpatial)
|
if (type === Anim.DefaultSpatial)
|
||||||
return Tokens.anim.durations.expressiveDefaultSpatial;
|
return Tokens.anim.durations.expressiveDefaultSpatial;
|
||||||
if (type === Anim.SlowSpatial)
|
if (type === Anim.SlowSpatial)
|
||||||
return Tokens.anim.durations.large;
|
return Tokens.anim.durations.expressiveSlowSpatial;
|
||||||
if (type === Anim.FastEffects)
|
if (type === Anim.FastEffects)
|
||||||
return Tokens.anim.durations.expressiveFastEffects;
|
return Tokens.anim.durations.expressiveFastEffects;
|
||||||
if (type === Anim.DefaultEffects)
|
if (type === Anim.DefaultEffects)
|
||||||
return Tokens.anim.durations.expressiveEffects;
|
return Tokens.anim.durations.expressiveDefaultEffects;
|
||||||
if (type === Anim.SlowEffects)
|
if (type === Anim.SlowEffects)
|
||||||
return Tokens.anim.durations.expressiveSlowEffects;
|
return Tokens.anim.durations.expressiveSlowEffects;
|
||||||
|
|
||||||
@@ -42,22 +42,22 @@ NumberAnimation {
|
|||||||
const idx = type % 4; // 0-7 are the 4 standard types
|
const idx = type % 4; // 0-7 are the 4 standard types
|
||||||
return Tokens.anim.durations[types[idx]];
|
return Tokens.anim.durations[types[idx]];
|
||||||
}
|
}
|
||||||
easing.bezierCurve: {
|
easing: {
|
||||||
if (type === Anim.FastSpatial)
|
if (type === Anim.FastSpatial)
|
||||||
return Tokens.anim.curves.expressiveFastSpatial;
|
return Tokens.anim.expressiveFastSpatial;
|
||||||
if (type === Anim.DefaultSpatial)
|
if (type === Anim.DefaultSpatial)
|
||||||
return Tokens.anim.curves.expressiveDefaultSpatial;
|
return Tokens.anim.expressiveDefaultSpatial;
|
||||||
if (type === Anim.SlowSpatial)
|
if (type === Anim.SlowSpatial)
|
||||||
return Tokens.anim.curves.expressiveSlowSpatial;
|
return Tokens.anim.expressiveSlowSpatial;
|
||||||
if (type === Anim.FastEffects)
|
if (type === Anim.FastEffects)
|
||||||
return Tokens.anim.curves.expressiveFastEffects;
|
return Tokens.anim.expressiveFastEffects;
|
||||||
if (type === Anim.DefaultEffects)
|
if (type === Anim.DefaultEffects)
|
||||||
return Tokens.anim.curves.expressiveDefaultEffects;
|
return Tokens.anim.expressiveDefaultEffects;
|
||||||
if (type === Anim.SlowEffects)
|
if (type === Anim.SlowEffects)
|
||||||
return Tokens.anim.curves.expressiveSlowEffects;
|
return Tokens.anim.expressiveSlowEffects;
|
||||||
|
|
||||||
if (type >= Anim.EmphasizedSmall && type <= Anim.EmphasizedExtraLarge)
|
if (type >= Anim.EmphasizedSmall && type <= Anim.EmphasizedExtraLarge)
|
||||||
return Tokens.anim.curves.emphasized;
|
return Tokens.anim.emphasized;
|
||||||
return Tokens.anim.curves.standard;
|
return Tokens.anim.standard;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,62 +2,6 @@ import QtQuick
|
|||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
|
|
||||||
ColorAnimation {
|
ColorAnimation {
|
||||||
enum Type {
|
duration: Tokens.anim.durations.expressiveSlowEffects
|
||||||
StandardSmall = 0,
|
easing: Tokens.anim.expressiveSlowEffects
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ BusyIndicator {
|
|||||||
property real implicitSize: Tokens.font.size.normal * 3
|
property real implicitSize: Tokens.font.size.normal * 3
|
||||||
property real internalStrokeWidth: strokeWidth
|
property real internalStrokeWidth: strokeWidth
|
||||||
readonly property alias progress: manager.progress
|
readonly property alias progress: manager.progress
|
||||||
property real strokeWidth: Tokens.padding.small * 0.8
|
property real strokeWidth: Tokens.padding.extraSmall * 0.8
|
||||||
property alias type: manager.indeterminateAnimationType
|
property alias type: manager.indeterminateAnimationType
|
||||||
|
|
||||||
implicitHeight: implicitSize
|
implicitHeight: implicitSize
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ Item {
|
|||||||
readonly property real size: Math.min(width, height)
|
readonly property real size: Math.min(width, height)
|
||||||
property int spacing: Tokens.spacing.small
|
property int spacing: Tokens.spacing.small
|
||||||
property int startAngle: -90
|
property int startAngle: -90
|
||||||
property int strokeWidth: Tokens.padding.small
|
property int strokeWidth: Tokens.padding.extraSmall
|
||||||
property int sweepAngle: 360
|
property int sweepAngle: 360
|
||||||
readonly property real thickness: strokeWidth * (1 + waveAmplitude) * 2
|
readonly property real thickness: strokeWidth * (1 + waveAmplitude) * 2
|
||||||
property real value
|
property real value
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ TextField {
|
|||||||
|
|
||||||
color: Colors.palette.m3primary
|
color: Colors.palette.m3primary
|
||||||
implicitWidth: 2
|
implicitWidth: 2
|
||||||
radius: Tokens.rounding.normal
|
radius: Tokens.rounding.medium
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
Anim {
|
Anim {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
@@ -11,6 +10,6 @@ TextInput {
|
|||||||
font {
|
font {
|
||||||
family: Config.appearance?.font.family.sans ?? "sans-serif"
|
family: Config.appearance?.font.family.sans ?? "sans-serif"
|
||||||
hintingPreference: Font.PreferFullHinting
|
hintingPreference: Font.PreferFullHinting
|
||||||
pixelSize: Config.appearance?.font.size.normal ?? 15
|
pixelSize: Tokens?.font.size.normal ?? 15
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ MouseArea {
|
|||||||
|
|
||||||
alwaysRunToEnd: true
|
alwaysRunToEnd: true
|
||||||
duration: Tokens.anim.durations.expressiveSlowEffects * 2
|
duration: Tokens.anim.durations.expressiveSlowEffects * 2
|
||||||
easing.bezierCurve: Tokens.anim.curves.standard
|
easing: Tokens.anim.standard
|
||||||
property: "circleRadius"
|
property: "circleRadius"
|
||||||
target: root
|
target: root
|
||||||
to: root.endRadius
|
to: root.endRadius
|
||||||
|
|||||||
+7
-7
@@ -11,18 +11,18 @@ RowLayout {
|
|||||||
required property var greeter
|
required property var greeter
|
||||||
required property real screenHeight
|
required property real screenHeight
|
||||||
|
|
||||||
spacing: Tokens.spacing.large * 2
|
spacing: Tokens.spacing.largeIncreased * 2
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
spacing: Tokens.spacing.normal
|
spacing: Tokens.spacing.medium
|
||||||
|
|
||||||
CustomRect {
|
CustomRect {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
color: Colors.tPalette.m3surfaceContainer
|
color: Colors.tPalette.m3surfaceContainer
|
||||||
implicitHeight: weather.implicitHeight
|
implicitHeight: weather.implicitHeight
|
||||||
radius: Tokens.rounding.small
|
radius: Tokens.rounding.small
|
||||||
topLeftRadius: Tokens.rounding.large
|
topLeftRadius: Tokens.rounding.largeIncreased
|
||||||
|
|
||||||
WeatherInfo {
|
WeatherInfo {
|
||||||
id: weather
|
id: weather
|
||||||
@@ -34,7 +34,7 @@ RowLayout {
|
|||||||
CustomClippingRect {
|
CustomClippingRect {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
bottomLeftRadius: Tokens.rounding.large
|
bottomLeftRadius: Tokens.rounding.largeIncreased
|
||||||
color: Colors.tPalette.m3surfaceContainer
|
color: Colors.tPalette.m3surfaceContainer
|
||||||
radius: Tokens.rounding.small
|
radius: Tokens.rounding.small
|
||||||
|
|
||||||
@@ -51,15 +51,15 @@ RowLayout {
|
|||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
spacing: Tokens.spacing.normal
|
spacing: Tokens.spacing.medium
|
||||||
|
|
||||||
CustomRect {
|
CustomRect {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
bottomRightRadius: Tokens.rounding.large
|
bottomRightRadius: Tokens.rounding.largeIncreased
|
||||||
color: Colors.tPalette.m3surfaceContainer
|
color: Colors.tPalette.m3surfaceContainer
|
||||||
radius: Tokens.rounding.small
|
radius: Tokens.rounding.small
|
||||||
topRightRadius: Tokens.rounding.large
|
topRightRadius: Tokens.rounding.largeIncreased
|
||||||
|
|
||||||
SessionDock {
|
SessionDock {
|
||||||
greeter: root.greeter
|
greeter: root.greeter
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ Scope {
|
|||||||
ParallelAnimation {
|
ParallelAnimation {
|
||||||
Anim {
|
Anim {
|
||||||
duration: Tokens.anim.durations.expressiveFastSpatial
|
duration: Tokens.anim.durations.expressiveFastSpatial
|
||||||
easing.bezierCurve: Tokens.anim.curves.expressiveFastSpatial
|
easing: Tokens.anim.expressiveFastSpatial
|
||||||
property: "scale"
|
property: "scale"
|
||||||
target: lockContent
|
target: lockContent
|
||||||
to: 1
|
to: 1
|
||||||
@@ -65,7 +65,7 @@ Scope {
|
|||||||
|
|
||||||
Anim {
|
Anim {
|
||||||
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
||||||
easing.bezierCurve: Tokens.anim.curves.expressiveDefaultSpatial
|
easing: Tokens.anim.expressiveDefaultSpatial
|
||||||
property: "scale"
|
property: "scale"
|
||||||
target: content
|
target: content
|
||||||
to: 1
|
to: 1
|
||||||
@@ -74,12 +74,12 @@ Scope {
|
|||||||
Anim {
|
Anim {
|
||||||
property: "radius"
|
property: "radius"
|
||||||
target: lockBg
|
target: lockBg
|
||||||
to: Tokens.rounding.large * 1.5
|
to: Tokens.rounding.largeIncreased * 1.5
|
||||||
}
|
}
|
||||||
|
|
||||||
Anim {
|
Anim {
|
||||||
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
||||||
easing.bezierCurve: Tokens.anim.curves.expressiveDefaultSpatial
|
easing: Tokens.anim.expressiveDefaultSpatial
|
||||||
property: "implicitWidth"
|
property: "implicitWidth"
|
||||||
target: lockContent
|
target: lockContent
|
||||||
to: (win.screen?.height ?? 0) * Config.lock.sizes.heightMult * Config.lock.sizes.ratio
|
to: (win.screen?.height ?? 0) * Config.lock.sizes.heightMult * Config.lock.sizes.ratio
|
||||||
@@ -87,7 +87,7 @@ Scope {
|
|||||||
|
|
||||||
Anim {
|
Anim {
|
||||||
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
duration: Tokens.anim.durations.expressiveDefaultSpatial
|
||||||
easing.bezierCurve: Tokens.anim.curves.expressiveDefaultSpatial
|
easing: Tokens.anim.expressiveDefaultSpatial
|
||||||
property: "implicitHeight"
|
property: "implicitHeight"
|
||||||
target: lockContent
|
target: lockContent
|
||||||
to: (win.screen?.height ?? 0) * Config.lock.sizes.heightMult
|
to: (win.screen?.height ?? 0) * Config.lock.sizes.heightMult
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ Item {
|
|||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
Anim {
|
Anim {
|
||||||
duration: Tokens.anim.durations.expressiveFastSpatial
|
duration: Tokens.anim.durations.expressiveFastSpatial
|
||||||
easing.bezierCurve: Tokens.anim.curves.expressiveFastSpatial
|
easing: Tokens.anim.expressiveFastSpatial
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,21 +13,17 @@ import qs.Paths
|
|||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property M3Palette current: M3Palette {
|
readonly property M3Palette current: M3Palette {}
|
||||||
}
|
|
||||||
property bool currentLight
|
property bool currentLight
|
||||||
property string flavour
|
property string flavour
|
||||||
readonly property bool light: showPreview ? previewLight : currentLight
|
readonly property bool light: showPreview ? previewLight : currentLight
|
||||||
readonly property M3Palette palette: showPreview ? preview : current
|
readonly property M3Palette palette: showPreview ? preview : current
|
||||||
readonly property M3Palette preview: M3Palette {
|
readonly property M3Palette preview: M3Palette {}
|
||||||
}
|
|
||||||
property bool previewLight
|
property bool previewLight
|
||||||
property string scheme
|
property string scheme
|
||||||
property bool showPreview
|
property bool showPreview
|
||||||
readonly property M3TPalette tPalette: M3TPalette {
|
readonly property M3TPalette tPalette: M3TPalette {}
|
||||||
}
|
readonly property Transparency transparency: Transparency {}
|
||||||
readonly property Transparency transparency: Transparency {
|
|
||||||
}
|
|
||||||
readonly property alias wallLuminance: analyser.luminance
|
readonly property alias wallLuminance: analyser.luminance
|
||||||
|
|
||||||
function alterColor(c: color, a: real, layer: int): color {
|
function alterColor(c: color, a: real, layer: int): color {
|
||||||
@@ -112,8 +108,7 @@ Singleton {
|
|||||||
|
|
||||||
function setMode(mode: string): void {
|
function setMode(mode: string): void {
|
||||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--mode", mode]);
|
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--mode", mode]);
|
||||||
Config.general.color.mode = mode;
|
Config.colors.mode = mode;
|
||||||
Config.save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function swapRG(c: color): color {
|
function swapRG(c: color): color {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ ColumnLayout {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Tokens.padding.large
|
anchors.margins: Tokens.padding.large
|
||||||
spacing: Tokens.spacing.smaller
|
spacing: Tokens.spacing.small
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -41,7 +41,7 @@ ColumnLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sourceComponent: ColumnLayout {
|
sourceComponent: ColumnLayout {
|
||||||
spacing: Tokens.spacing.large
|
spacing: Tokens.spacing.largeIncreased
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
@@ -79,8 +79,8 @@ ColumnLayout {
|
|||||||
|
|
||||||
anchors.left: parent?.left
|
anchors.left: parent?.left
|
||||||
anchors.right: parent?.right
|
anchors.right: parent?.right
|
||||||
implicitHeight: row.implicitHeight + Tokens.padding.normal * 2
|
implicitHeight: row.implicitHeight + Tokens.padding.small * 2
|
||||||
radius: Tokens.rounding.normal - Tokens.padding.smaller
|
radius: Tokens.rounding.medium - Tokens.padding.small
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@@ -92,8 +92,8 @@ ColumnLayout {
|
|||||||
id: row
|
id: row
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Tokens.padding.normal
|
anchors.margins: Tokens.padding.small
|
||||||
spacing: Tokens.spacing.normal
|
spacing: Tokens.spacing.medium
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
color: session.index === sessions.currentIndex ? Colors.palette.m3onPrimary : Colors.palette.m3onSurfaceVariant
|
color: session.index === sessions.currentIndex ? Colors.palette.m3onPrimary : Colors.palette.m3onSurfaceVariant
|
||||||
@@ -129,13 +129,13 @@ ColumnLayout {
|
|||||||
color: Colors.palette.m3primary
|
color: Colors.palette.m3primary
|
||||||
implicitHeight: sessions.currentItem?.implicitHeight ?? 0
|
implicitHeight: sessions.currentItem?.implicitHeight ?? 0
|
||||||
implicitWidth: sessions.width
|
implicitWidth: sessions.width
|
||||||
radius: Tokens.rounding.normal - Tokens.padding.smaller
|
radius: Tokens.rounding.medium - Tokens.padding.small
|
||||||
y: sessions.currentItem?.y ?? 0
|
y: sessions.currentItem?.y ?? 0
|
||||||
|
|
||||||
Behavior on y {
|
Behavior on y {
|
||||||
Anim {
|
Anim {
|
||||||
duration: Tokens.anim.durations.small
|
duration: Tokens.anim.durations.small
|
||||||
easing.bezierCurve: Tokens.anim.curves.expressiveEffects
|
easing: Tokens.anim.expressiveDefaultEffects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ ColumnLayout {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Tokens.padding.large
|
anchors.margins: Tokens.padding.large
|
||||||
spacing: Tokens.spacing.smaller
|
spacing: Tokens.spacing.small
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -42,7 +42,7 @@ ColumnLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sourceComponent: ColumnLayout {
|
sourceComponent: ColumnLayout {
|
||||||
spacing: Tokens.spacing.large
|
spacing: Tokens.spacing.largeIncreased
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
@@ -81,8 +81,8 @@ ColumnLayout {
|
|||||||
|
|
||||||
anchors.left: parent?.left
|
anchors.left: parent?.left
|
||||||
anchors.right: parent?.right
|
anchors.right: parent?.right
|
||||||
implicitHeight: row.implicitHeight + Tokens.padding.normal * 2
|
implicitHeight: row.implicitHeight + Tokens.padding.small * 2
|
||||||
radius: Tokens.rounding.normal - Tokens.padding.smaller
|
radius: Tokens.rounding.medium - Tokens.padding.small
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@@ -94,8 +94,8 @@ ColumnLayout {
|
|||||||
id: row
|
id: row
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Tokens.padding.normal
|
anchors.margins: Tokens.padding.small
|
||||||
spacing: Tokens.spacing.normal
|
spacing: Tokens.spacing.medium
|
||||||
|
|
||||||
CustomClippingRect {
|
CustomClippingRect {
|
||||||
Layout.preferredHeight: 50
|
Layout.preferredHeight: 50
|
||||||
@@ -135,13 +135,13 @@ ColumnLayout {
|
|||||||
color: Colors.palette.m3primary
|
color: Colors.palette.m3primary
|
||||||
implicitHeight: users.currentItem?.implicitHeight ?? 0
|
implicitHeight: users.currentItem?.implicitHeight ?? 0
|
||||||
implicitWidth: users.width
|
implicitWidth: users.width
|
||||||
radius: Tokens.rounding.normal - Tokens.padding.smaller
|
radius: Tokens.rounding.medium - Tokens.padding.small
|
||||||
y: users.currentItem?.y ?? 0
|
y: users.currentItem?.y ?? 0
|
||||||
|
|
||||||
Behavior on y {
|
Behavior on y {
|
||||||
Anim {
|
Anim {
|
||||||
duration: Tokens.anim.durations.small
|
duration: Tokens.anim.durations.expressiveDefaultEffects
|
||||||
easing.bezierCurve: Tokens.anim.curves.expressiveEffects
|
easing: Tokens.anim.expressiveDefaultEffects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ ColumnLayout {
|
|||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
spacing: Tokens.spacing.large
|
spacing: Tokens.spacing.largeIncreased
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
animate: true
|
animate: true
|
||||||
@@ -67,7 +67,7 @@ ColumnLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
Layout.rightMargin: Tokens.padding.smaller
|
Layout.rightMargin: Tokens.padding.small
|
||||||
active: root.width > 400
|
active: root.width > 400
|
||||||
visible: active
|
visible: active
|
||||||
|
|
||||||
@@ -103,12 +103,12 @@ ColumnLayout {
|
|||||||
|
|
||||||
Layout.bottomMargin: Tokens.padding.large * 2
|
Layout.bottomMargin: Tokens.padding.large * 2
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: Tokens.spacing.smaller
|
Layout.topMargin: Tokens.spacing.small
|
||||||
active: root.rootHeight > 820
|
active: root.rootHeight > 820
|
||||||
visible: active
|
visible: active
|
||||||
|
|
||||||
sourceComponent: RowLayout {
|
sourceComponent: RowLayout {
|
||||||
spacing: Tokens.spacing.large
|
spacing: Tokens.spacing.largeIncreased
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: {
|
model: {
|
||||||
@@ -119,7 +119,8 @@ ColumnLayout {
|
|||||||
length: count
|
length: count
|
||||||
}, () => null);
|
}, () => null);
|
||||||
|
|
||||||
return forecast.slice(0, count);
|
const start = Math.max(0, Weather.currentHourIndex);
|
||||||
|
return forecast.slice(start, start + count);
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Wayland
|
|
||||||
import Quickshell.Io
|
|
||||||
import Quickshell.Hyprland
|
|
||||||
import ZShell
|
|
||||||
import qs.Components
|
|
||||||
|
|
||||||
Scope {
|
|
||||||
LazyLoader {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property bool closing
|
|
||||||
property bool freeze
|
|
||||||
|
|
||||||
Variants {
|
|
||||||
model: Quickshell.screens
|
|
||||||
|
|
||||||
PanelWindow {
|
|
||||||
id: win
|
|
||||||
|
|
||||||
required property ShellScreen modelData
|
|
||||||
|
|
||||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
|
||||||
WlrLayershell.keyboardFocus: root.closing ? WlrKeyboardFocus.None : WlrKeyboardFocus.Exclusive
|
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
|
||||||
WlrLayershell.namespace: "areapicker"
|
|
||||||
color: "transparent"
|
|
||||||
mask: root.closing ? empty : null
|
|
||||||
screen: modelData
|
|
||||||
|
|
||||||
anchors {
|
|
||||||
bottom: true
|
|
||||||
left: true
|
|
||||||
right: true
|
|
||||||
top: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Region {
|
|
||||||
id: empty
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Picker {
|
|
||||||
loader: root
|
|
||||||
screen: win.modelData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IpcHandler {
|
|
||||||
function open(): void {
|
|
||||||
root.freeze = false;
|
|
||||||
root.closing = false;
|
|
||||||
root.activeAsync = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function openFreeze(): void {
|
|
||||||
root.freeze = true;
|
|
||||||
root.closing = false;
|
|
||||||
root.activeAsync = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
target: "picker"
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomShortcut {
|
|
||||||
name: "screenshot"
|
|
||||||
|
|
||||||
onPressed: {
|
|
||||||
root.freeze = false;
|
|
||||||
root.closing = false;
|
|
||||||
root.activeAsync = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomShortcut {
|
|
||||||
name: "screenshotFreeze"
|
|
||||||
|
|
||||||
onPressed: {
|
|
||||||
root.freeze = true;
|
|
||||||
root.closing = false;
|
|
||||||
root.activeAsync = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+40
-12
@@ -1,35 +1,63 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
import Quickshell.Services.UPower
|
import Quickshell.Services.UPower
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
import qs.Paths
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property var colors: {
|
readonly property list<var> allPeripherals: [...logiDevices, ...upowerDevices.filter(d => !Battery.logiDevices.some(l => l.nativePath === d.nativePath))]
|
||||||
if (deviceState === UPowerDeviceState.Charging || deviceState === UPowerDeviceState.FullyCharged)
|
readonly property real currentPerc: UPower.displayDevice.percentage
|
||||||
|
readonly property var deviceState: UPower.displayDevice.state
|
||||||
|
readonly property string deviceStateString: UPowerDeviceState.toString(deviceState)
|
||||||
|
readonly property bool isLaptop: UPower.displayDevice.isLaptopBattery
|
||||||
|
readonly property alias logiDevices: adapter.devices
|
||||||
|
readonly property var lowestPeripheral: allPeripherals.reduce((lowest, current) => current.percentage < lowest.percentage ? current : lowest)
|
||||||
|
readonly property bool onBattery: UPower.onBattery
|
||||||
|
readonly property bool ready: UPower.displayDevice.ready
|
||||||
|
readonly property real timeToEmpty: UPower.displayDevice.timeToEmpty
|
||||||
|
readonly property real timeToFull: UPower.displayDevice.timeToFull
|
||||||
|
readonly property list<UPowerDevice> upowerDevices: UPower.devices.values.filter(d => d.state !== UPowerDeviceState.Unknown)
|
||||||
|
|
||||||
|
function getColors(percentage: real, state: string): var {
|
||||||
|
if (state === "charging" || state === "full" || state === "recharging")
|
||||||
return {
|
return {
|
||||||
fg: Colors.swapRG(Colors.palette.m3error),
|
fg: Colors.swapRG(Colors.palette.m3error),
|
||||||
bg: Colors.swapRG(Colors.palette.m3onError)
|
bg: Colors.swapRG(Colors.palette.m3onError)
|
||||||
};
|
};
|
||||||
else if (currentPerc <= 0.2)
|
else if (percentage <= 0.2)
|
||||||
return {
|
return {
|
||||||
fg: Colors.palette.m3error,
|
fg: Colors.palette.m3error,
|
||||||
bg: Colors.palette.m3onError
|
bg: Colors.palette.m3onError
|
||||||
};
|
};
|
||||||
else
|
else
|
||||||
return {
|
return {
|
||||||
fg: Colors.palette.m3onSurface,
|
fg: Colors.palette.m3tertiary,
|
||||||
bg: Colors.palette.m3surface
|
bg: Colors.palette.m3onTertiary
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
readonly property real currentPerc: UPower.displayDevice.percentage
|
|
||||||
readonly property var deviceState: UPower.displayDevice.state
|
function startDaemon(): void {
|
||||||
readonly property bool isLaptop: UPower.displayDevice.isLaptopBattery
|
Quickshell.execDetached(["zshell-cli", "battery", "daemon"]);
|
||||||
readonly property bool onBattery: UPower.onBattery
|
}
|
||||||
readonly property bool ready: UPower.displayDevice.ready
|
|
||||||
readonly property real timeToEmpty: UPower.displayDevice.timeToEmpty
|
FileView {
|
||||||
readonly property real timeToFull: UPower.displayDevice.timeToFull
|
id: fileView
|
||||||
|
|
||||||
|
path: `${Paths.cache}/battery.json`
|
||||||
|
watchChanges: true
|
||||||
|
|
||||||
|
onFileChanged: reload()
|
||||||
|
|
||||||
|
JsonAdapter {
|
||||||
|
id: adapter
|
||||||
|
|
||||||
|
property list<var> devices: []
|
||||||
|
property real updated: 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Wayland
|
|
||||||
import qs.Components
|
|
||||||
import ZShell.Config
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property list<var> apps: {
|
|
||||||
var map = new Map();
|
|
||||||
|
|
||||||
const pinnedApps = Config.dock?.pinnedApps ?? [];
|
|
||||||
for (const appId of pinnedApps) {
|
|
||||||
if (!map.has(appId.toLowerCase()))
|
|
||||||
map.set(appId.toLowerCase(), ({
|
|
||||||
pinned: true,
|
|
||||||
toplevels: []
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pinnedApps.length > 0) {
|
|
||||||
map.set("SEPARATOR", {
|
|
||||||
pinned: false,
|
|
||||||
toplevels: []
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var values = [];
|
|
||||||
|
|
||||||
for (const [key, value] of map) {
|
|
||||||
values.push(appEntryComp.createObject(null, {
|
|
||||||
appId: key,
|
|
||||||
toplevels: value.toplevels,
|
|
||||||
pinned: value.pinned
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isPinned(appId) {
|
|
||||||
return Config.dock.pinnedApps.indexOf(appId) !== -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function togglePin(appId) {
|
|
||||||
if (root.isPinned(appId)) {
|
|
||||||
Config.dock.pinnedApps = Config.dock.pinnedApps.filter(id => id !== appId);
|
|
||||||
} else {
|
|
||||||
Config.dock.pinnedApps = Config.dock.pinnedApps.concat([appId]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: appEntryComp
|
|
||||||
|
|
||||||
TaskbarAppEntry {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component TaskbarAppEntry: QtObject {
|
|
||||||
id: wrapper
|
|
||||||
|
|
||||||
required property string appId
|
|
||||||
required property bool pinned
|
|
||||||
required property list<var> toplevels
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
// FetchPresets.qml
|
|
||||||
pragma Singleton
|
|
||||||
|
|
||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property var parsedPresets: ({})
|
|
||||||
readonly property var presets: parsedPresets
|
|
||||||
property bool ready: false
|
|
||||||
|
|
||||||
function accents(presetName, variantName) {
|
|
||||||
const variant = parsedPresets[presetName]?.variants?.[variantName];
|
|
||||||
|
|
||||||
return variant?.accents ?? [];
|
|
||||||
}
|
|
||||||
|
|
||||||
function defaultAccent(presetName, variantName) {
|
|
||||||
const variant = parsedPresets[presetName]?.variants?.[variantName];
|
|
||||||
|
|
||||||
return variant?.default_accent ?? "";
|
|
||||||
}
|
|
||||||
|
|
||||||
function modes(presetName, variantName) {
|
|
||||||
const variant = parsedPresets[presetName]?.variants?.[variantName];
|
|
||||||
|
|
||||||
return variant?.modes ?? [];
|
|
||||||
}
|
|
||||||
|
|
||||||
function presetNames() {
|
|
||||||
return Object.keys(parsedPresets);
|
|
||||||
}
|
|
||||||
|
|
||||||
function variantNames(presetName) {
|
|
||||||
const preset = parsedPresets[presetName];
|
|
||||||
|
|
||||||
if (!preset || !preset.variants)
|
|
||||||
return [];
|
|
||||||
|
|
||||||
return Object.keys(preset.variants);
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
command: ["zshell-cli", "scheme", "list-presets", "--json"]
|
|
||||||
running: true
|
|
||||||
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
try {
|
|
||||||
const parsed = JSON.parse(text);
|
|
||||||
|
|
||||||
root.parsedPresets = parsed.presets ?? {};
|
|
||||||
root.ready = true;
|
|
||||||
} catch (e) {
|
|
||||||
console.error("Failed to parse presets JSON:", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -11,14 +11,14 @@ import qs.Services
|
|||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property int darkEnd: Config.general.color.scheduleDarkEnd
|
readonly property int darkEnd: Config.colors.scheduleDarkEnd
|
||||||
readonly property int darkStart: Config.general.color.scheduleDarkStart
|
readonly property int darkStart: Config.colors.scheduleDarkStart
|
||||||
readonly property bool enabled: Config.general.color.scheduleDark && Config.general.color.schemeGeneration
|
readonly property bool enabled: Config.colors.scheduleDark && Config.colors.schemeGen
|
||||||
|
|
||||||
function applyDarkMode() {
|
function applyDarkMode() {
|
||||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--mode", "dark"]);
|
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--mode", "dark"]);
|
||||||
|
|
||||||
Config.general.color.mode = "dark";
|
Config.colors.mode = "dark";
|
||||||
|
|
||||||
Quickshell.execDetached(["gsettings", "set", "org.gnome.desktop.interface", "color-scheme", "'prefer-dark'"]);
|
Quickshell.execDetached(["gsettings", "set", "org.gnome.desktop.interface", "color-scheme", "'prefer-dark'"]);
|
||||||
|
|
||||||
@@ -30,13 +30,13 @@ Singleton {
|
|||||||
function applyLightMode() {
|
function applyLightMode() {
|
||||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--mode", "light"]);
|
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--mode", "light"]);
|
||||||
|
|
||||||
Config.general.color.mode = "light";
|
Config.colors.mode = "light";
|
||||||
|
|
||||||
Quickshell.execDetached(["gsettings", "set", "org.gnome.desktop.interface", "color-scheme", "'prefer-light'"]);
|
Quickshell.execDetached(["gsettings", "set", "org.gnome.desktop.interface", "color-scheme", "'prefer-light'"]);
|
||||||
|
|
||||||
Quickshell.execDetached(["sh", "-c", `sed -i 's/color_scheme_path=\\(.*\\)Dark.colors/color_scheme_path=\\1Light.colors/' ${Paths.home}/.config/qt6ct/qt6ct.conf`]);
|
Quickshell.execDetached(["sh", "-c", `sed -i 's/color_scheme_path=\\(.*\\)Dark.colors/color_scheme_path=\\1Light.colors/' ${Paths.home}/.config/qt6ct/qt6ct.conf`]);
|
||||||
|
|
||||||
if (Config.general.color.neovimColors)
|
if (Config.colors.neovimColors)
|
||||||
Quickshell.execDetached(["sed", "-i", "'s/\\(vim.cmd.colorscheme \\).*/\\1\"onelight\"/'", "~/.config/nvim/lua/config/load-colorscheme.lua"]);
|
Quickshell.execDetached(["sed", "-i", "'s/\\(vim.cmd.colorscheme \\).*/\\1\"onelight\"/'", "~/.config/nvim/lua/config/load-colorscheme.lua"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,242 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import ZShell.Internal
|
|
||||||
import ZShell.Config
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property real _downloadSpeed: 0
|
|
||||||
property real _downloadTotal: 0
|
|
||||||
|
|
||||||
property real _initialRxBytes: 0
|
|
||||||
property real _initialTxBytes: 0
|
|
||||||
property bool _initialized: false
|
|
||||||
|
|
||||||
property real _prevRxBytes: 0
|
|
||||||
property real _prevTimestamp: 0
|
|
||||||
property real _prevTxBytes: 0
|
|
||||||
property real _uploadSpeed: 0
|
|
||||||
property real _uploadTotal: 0
|
|
||||||
|
|
||||||
readonly property CircularBuffer downloadBuffer: _downloadBuffer
|
|
||||||
|
|
||||||
readonly property real downloadSpeed: _downloadSpeed
|
|
||||||
|
|
||||||
readonly property real downloadTotal: _downloadTotal
|
|
||||||
readonly property int historyLength: Config.dashboard.performance.showVram ? 70 : 30
|
|
||||||
property int refCount: 0
|
|
||||||
readonly property CircularBuffer uploadBuffer: _uploadBuffer
|
|
||||||
readonly property real uploadSpeed: _uploadSpeed
|
|
||||||
readonly property real uploadTotal: _uploadTotal
|
|
||||||
|
|
||||||
function resetSampling(): void {
|
|
||||||
netDevFile.reload();
|
|
||||||
|
|
||||||
const content = netDevFile.text();
|
|
||||||
if (!content)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const data = root.parseNetDev(content);
|
|
||||||
const now = Date.now();
|
|
||||||
|
|
||||||
root._prevRxBytes = data.rx;
|
|
||||||
root._prevTxBytes = data.tx;
|
|
||||||
root._prevTimestamp = now;
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatBytes(bytes: real): var {
|
|
||||||
// Handle negative or invalid values
|
|
||||||
if (bytes < 0 || isNaN(bytes) || !isFinite(bytes)) {
|
|
||||||
return {
|
|
||||||
value: 0,
|
|
||||||
unit: "B/s"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bytes < 1024) {
|
|
||||||
return {
|
|
||||||
value: bytes,
|
|
||||||
unit: "B/s"
|
|
||||||
};
|
|
||||||
} else if (bytes < 1024 * 1024) {
|
|
||||||
return {
|
|
||||||
value: bytes / 1024,
|
|
||||||
unit: "KB/s"
|
|
||||||
};
|
|
||||||
} else if (bytes < 1024 * 1024 * 1024) {
|
|
||||||
return {
|
|
||||||
value: bytes / (1024 * 1024),
|
|
||||||
unit: "MB/s"
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
value: bytes / (1024 * 1024 * 1024),
|
|
||||||
unit: "GB/s"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatBytesTotal(bytes: real): var {
|
|
||||||
// Handle negative or invalid values
|
|
||||||
if (bytes < 0 || isNaN(bytes) || !isFinite(bytes)) {
|
|
||||||
return {
|
|
||||||
value: 0,
|
|
||||||
unit: "B"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bytes < 1024) {
|
|
||||||
return {
|
|
||||||
value: bytes,
|
|
||||||
unit: "B"
|
|
||||||
};
|
|
||||||
} else if (bytes < 1024 * 1024) {
|
|
||||||
return {
|
|
||||||
value: bytes / 1024,
|
|
||||||
unit: "KB"
|
|
||||||
};
|
|
||||||
} else if (bytes < 1024 * 1024 * 1024) {
|
|
||||||
return {
|
|
||||||
value: bytes / (1024 * 1024),
|
|
||||||
unit: "MB"
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
value: bytes / (1024 * 1024 * 1024),
|
|
||||||
unit: "GB"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseNetDev(content: string): var {
|
|
||||||
const lines = content.split("\n");
|
|
||||||
let totalRx = 0;
|
|
||||||
let totalTx = 0;
|
|
||||||
|
|
||||||
for (let i = 2; i < lines.length; i++) {
|
|
||||||
const line = lines[i].trim();
|
|
||||||
if (!line)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const parts = line.split(/\s+/);
|
|
||||||
if (parts.length < 10)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const iface = parts[0].replace(":", "");
|
|
||||||
// Skip loopback interface
|
|
||||||
if (iface === "lo")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const rxBytes = parseFloat(parts[1]) || 0;
|
|
||||||
const txBytes = parseFloat(parts[9]) || 0;
|
|
||||||
|
|
||||||
totalRx += rxBytes;
|
|
||||||
totalTx += txBytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
rx: totalRx,
|
|
||||||
tx: totalTx
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
CircularBuffer {
|
|
||||||
id: _downloadBuffer
|
|
||||||
|
|
||||||
capacity: root.historyLength + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
CircularBuffer {
|
|
||||||
id: _uploadBuffer
|
|
||||||
|
|
||||||
capacity: root.historyLength + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
FileView {
|
|
||||||
id: netDevFile
|
|
||||||
|
|
||||||
path: "/proc/net/dev"
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
interval: Config.dashboard.resourceUpdateInterval
|
|
||||||
repeat: true
|
|
||||||
running: true
|
|
||||||
triggeredOnStart: true
|
|
||||||
|
|
||||||
onTriggered: {
|
|
||||||
if (root.refCount <= 0) {
|
|
||||||
root.resetSampling();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
netDevFile.reload();
|
|
||||||
const content = netDevFile.text();
|
|
||||||
if (!content)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const data = root.parseNetDev(content);
|
|
||||||
const now = Date.now();
|
|
||||||
|
|
||||||
if (!root._initialized) {
|
|
||||||
root._initialRxBytes = data.rx;
|
|
||||||
root._initialTxBytes = data.tx;
|
|
||||||
root._prevRxBytes = data.rx;
|
|
||||||
root._prevTxBytes = data.tx;
|
|
||||||
root._prevTimestamp = now;
|
|
||||||
root._initialized = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const timeDelta = (now - root._prevTimestamp) / 1000; // seconds
|
|
||||||
if (timeDelta > 0) {
|
|
||||||
// Calculate byte deltas
|
|
||||||
let rxDelta = data.rx - root._prevRxBytes;
|
|
||||||
let txDelta = data.tx - root._prevTxBytes;
|
|
||||||
|
|
||||||
// Handle counter overflow (when counters wrap around from max to 0)
|
|
||||||
// This happens when counters exceed 32-bit or 64-bit limits
|
|
||||||
if (rxDelta < 0) {
|
|
||||||
// Counter wrapped around - assume 64-bit counter
|
|
||||||
rxDelta += Math.pow(2, 64);
|
|
||||||
}
|
|
||||||
if (txDelta < 0) {
|
|
||||||
txDelta += Math.pow(2, 64);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate speeds
|
|
||||||
root._downloadSpeed = rxDelta / timeDelta;
|
|
||||||
root._uploadSpeed = txDelta / timeDelta;
|
|
||||||
|
|
||||||
if (root._downloadSpeed >= 0 && isFinite(root._downloadSpeed))
|
|
||||||
_downloadBuffer.push(root._downloadSpeed);
|
|
||||||
|
|
||||||
if (root._uploadSpeed >= 0 && isFinite(root._uploadSpeed))
|
|
||||||
_uploadBuffer.push(root._uploadSpeed);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate totals with overflow handling
|
|
||||||
let downTotal = data.rx - root._initialRxBytes;
|
|
||||||
let upTotal = data.tx - root._initialTxBytes;
|
|
||||||
|
|
||||||
// Handle counter overflow for totals
|
|
||||||
if (downTotal < 0) {
|
|
||||||
downTotal += Math.pow(2, 64);
|
|
||||||
}
|
|
||||||
if (upTotal < 0) {
|
|
||||||
upTotal += Math.pow(2, 64);
|
|
||||||
}
|
|
||||||
|
|
||||||
root._downloadTotal = downTotal;
|
|
||||||
root._uploadTotal = upTotal;
|
|
||||||
|
|
||||||
root._prevRxBytes = data.rx;
|
|
||||||
root._prevTxBytes = data.tx;
|
|
||||||
root._prevTimestamp = now;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,13 +9,13 @@ Singleton {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property bool enabled: service.enabled
|
readonly property bool enabled: service.enabled
|
||||||
readonly property int end: Config.general.color.scheduleHyprsunsetEnd
|
readonly property int end: Config.display.nightlight.scheduleEnd
|
||||||
property bool manualToggle: false
|
property bool manualToggle: false
|
||||||
readonly property int start: Config.general.color.scheduleHyprsunsetStart
|
readonly property int start: Config.display.nightlight.scheduleStart
|
||||||
readonly property int temp: Config.general.color.hyprsunsetTemp
|
readonly property int temp: Config.display.nightlight.temp
|
||||||
|
|
||||||
function checkStartup(): void {
|
function checkStartup(): void {
|
||||||
if (!Config.general.color.scheduleHyprsunset)
|
if (!Config.display.nightlight.schedule)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
service.apply();
|
service.apply();
|
||||||
@@ -26,12 +26,14 @@ Singleton {
|
|||||||
service.toggle();
|
service.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
HyprsunsetManager {
|
NightlightManager {
|
||||||
id: service
|
id: service
|
||||||
|
|
||||||
activeAuto: Config.general.color.scheduleHyprsunset
|
activeAuto: Config.display.nightlight.schedule
|
||||||
endTime: root.end
|
endTime: root.end
|
||||||
startTime: root.start
|
startTime: root.start
|
||||||
temp: root.temp
|
temp: root.temp
|
||||||
|
fadeDuration: Config.display.nightlight.fadeDuration / 1000
|
||||||
|
useNativeNightlight: Config.display.nightlight.useNative
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+101
-61
@@ -41,8 +41,9 @@ Item {
|
|||||||
property real rsy: Math.min(sy, ey)
|
property real rsy: Math.min(sy, ey)
|
||||||
readonly property real scaleRatio: Hypr.monitorFor(screen).scale
|
readonly property real scaleRatio: Hypr.monitorFor(screen).scale
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
|
required property ScreenState screenState
|
||||||
property real sh: Math.abs(sy - ey)
|
property real sh: Math.abs(sy - ey)
|
||||||
readonly property color shadowColor: Hypr.options.decoration.shadow.color
|
readonly property color shadowColor: Hypr.options.decoration.shadow?.color ?? "black"
|
||||||
readonly property bool shadowEnabled: Hypr.options.decoration.shadow.enabled
|
readonly property bool shadowEnabled: Hypr.options.decoration.shadow.enabled
|
||||||
readonly property var shadowOffset: Hypr.options.decoration.shadow.offset
|
readonly property var shadowOffset: Hypr.options.decoration.shadow.offset
|
||||||
readonly property int shadowRange: Hypr.options.decoration.shadow.range
|
readonly property int shadowRange: Hypr.options.decoration.shadow.range
|
||||||
@@ -97,10 +98,6 @@ Item {
|
|||||||
const args = Config.screenshot.mode === "auto" ? ["--rounding", `${rounding}`, "--radius", root.cornerRadius, "--shadow", root.shadowEnabled, "--shadow-blur", `${shadow_blur}`, "--shadow-color", `${r},${g},${b},${a}`, "--shadow-offset-x", root.shadowOffset[0], "--shadow-offset-y", root.shadowOffset[1]] : [];
|
const args = Config.screenshot.mode === "auto" ? ["--rounding", `${rounding}`, "--radius", root.cornerRadius, "--shadow", root.shadowEnabled, "--shadow-blur", `${shadow_blur}`, "--shadow-color", `${r},${g},${b},${a}`, "--shadow-offset-x", root.shadowOffset[0], "--shadow-offset-y", root.shadowOffset[1]] : [];
|
||||||
const postCmd = Config.screenshot.enable_pp ? ["zshell-img-tools", "--scale", root.scaleRatio, ...args, "--image"] : null;
|
const postCmd = Config.screenshot.enable_pp ? ["zshell-img-tools", "--scale", root.scaleRatio, ...args, "--image"] : null;
|
||||||
|
|
||||||
overlay.visible = border.visible = false;
|
|
||||||
handles.visible = false;
|
|
||||||
toolbar.visible = false;
|
|
||||||
|
|
||||||
ZShellIo.saveItem(captureLayer, tmpfile, Qt.rect(Math.ceil(rsx), Math.ceil(rsy), Math.floor(sw), Math.floor(sh)), path => {
|
ZShellIo.saveItem(captureLayer, tmpfile, Qt.rect(Math.ceil(rsx), Math.ceil(rsy), Math.floor(sw), Math.floor(sh)), path => {
|
||||||
const finalize = finalPath => {
|
const finalize = finalPath => {
|
||||||
if (copyToClipboard) {
|
if (copyToClipboard) {
|
||||||
@@ -126,39 +123,35 @@ Item {
|
|||||||
focus: true
|
focus: true
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
|
||||||
|
Behavior on rsx {
|
||||||
|
enabled: !selectArea.pressed && root.mode === "select"
|
||||||
|
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
Behavior on rsy {
|
||||||
|
enabled: !selectArea.pressed && root.mode === "select"
|
||||||
|
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
Behavior on sh {
|
||||||
|
enabled: !selectArea.pressed && root.mode === "select"
|
||||||
|
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
Behavior on sw {
|
||||||
|
enabled: !selectArea.pressed && root.mode === "select"
|
||||||
|
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
Anim {
|
Anim {
|
||||||
duration: 300
|
duration: 300
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on rsx {
|
|
||||||
enabled: !selectArea.pressed && root.mode === "select"
|
|
||||||
|
|
||||||
ExAnim {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Behavior on rsy {
|
|
||||||
enabled: !selectArea.pressed && root.mode === "select"
|
|
||||||
|
|
||||||
ExAnim {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Behavior on sh {
|
|
||||||
enabled: !selectArea.pressed && root.mode === "select"
|
|
||||||
|
|
||||||
ExAnim {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Behavior on sw {
|
|
||||||
enabled: !selectArea.pressed && root.mode === "select"
|
|
||||||
|
|
||||||
ExAnim {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
Hypr.extras.refreshOptions();
|
Hypr.extras.refreshOptions();
|
||||||
screencopy.active = true;
|
root.forceActiveFocus();
|
||||||
|
|
||||||
opacity = 1;
|
opacity = 1;
|
||||||
|
|
||||||
@@ -223,13 +216,63 @@ Item {
|
|||||||
onReleased: root.enterEditMode()
|
onReleased: root.enterEditMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
function onClosingChanged(): void {
|
||||||
|
if (root.loader.closing)
|
||||||
|
closeAnim.start();
|
||||||
|
else {
|
||||||
|
closeAnim.stop();
|
||||||
|
returnAnim.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
target: root.loader
|
||||||
|
}
|
||||||
|
|
||||||
|
ParallelAnimation {
|
||||||
|
id: returnAnim
|
||||||
|
|
||||||
|
Anim {
|
||||||
|
duration: 300
|
||||||
|
property: "opacity"
|
||||||
|
target: root
|
||||||
|
to: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Anim {
|
||||||
|
property: "rsx"
|
||||||
|
target: root
|
||||||
|
to: Math.min(root.sx, root.ex)
|
||||||
|
}
|
||||||
|
|
||||||
|
Anim {
|
||||||
|
property: "rsy"
|
||||||
|
target: root
|
||||||
|
to: Math.min(root.sy, root.ey)
|
||||||
|
}
|
||||||
|
|
||||||
|
Anim {
|
||||||
|
property: "sw"
|
||||||
|
target: root
|
||||||
|
to: Math.abs(root.sx - root.ex)
|
||||||
|
}
|
||||||
|
|
||||||
|
Anim {
|
||||||
|
property: "sh"
|
||||||
|
target: root
|
||||||
|
to: Math.abs(root.sy - root.ey)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SequentialAnimation {
|
SequentialAnimation {
|
||||||
id: closeAnim
|
id: closeAnim
|
||||||
|
|
||||||
PropertyAction {
|
ScriptAction {
|
||||||
property: "closing"
|
script: {
|
||||||
target: root.loader
|
const states = ShellState.allStates();
|
||||||
value: true
|
for (const s of states)
|
||||||
|
s.screenshot = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ParallelAnimation {
|
ParallelAnimation {
|
||||||
@@ -240,19 +283,19 @@ Item {
|
|||||||
to: 0
|
to: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
ExAnim {
|
Anim {
|
||||||
properties: "rsx,rsy"
|
properties: "rsx,rsy"
|
||||||
target: root
|
target: root
|
||||||
to: 0
|
to: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
ExAnim {
|
Anim {
|
||||||
property: "sw"
|
property: "sw"
|
||||||
target: root
|
target: root
|
||||||
to: root.screen.width
|
to: root.screen.width
|
||||||
}
|
}
|
||||||
|
|
||||||
ExAnim {
|
Anim {
|
||||||
property: "sh"
|
property: "sh"
|
||||||
target: root
|
target: root
|
||||||
to: root.screen.height
|
to: root.screen.height
|
||||||
@@ -271,17 +314,12 @@ Item {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
Loader {
|
ScreencopyView {
|
||||||
id: screencopy
|
id: screencopy
|
||||||
|
|
||||||
active: false
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
asynchronous: true
|
captureSource: root.screen
|
||||||
|
paintCursor: false
|
||||||
sourceComponent: ScreencopyView {
|
|
||||||
captureSource: root.screen
|
|
||||||
paintCursor: false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AnnotationCanvas {
|
AnnotationCanvas {
|
||||||
@@ -290,6 +328,7 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
inkColor: root.inkColor
|
inkColor: root.inkColor
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
|
selection: selectionRect
|
||||||
tool: root.mode === "edit" && root.tool !== "move" ? root.tool : "none"
|
tool: root.mode === "edit" && root.tool !== "move" ? root.tool : "none"
|
||||||
|
|
||||||
layer.effect: MultiEffect {
|
layer.effect: MultiEffect {
|
||||||
@@ -301,15 +340,14 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
CustomRect {
|
||||||
id: overlay
|
id: overlay
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: "white"
|
color: "white"
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
opacity: 0.3
|
opacity: 0.3
|
||||||
radius: root.realRounding
|
visible: screencopy.hasContent
|
||||||
visible: screencopy.item?.hasContent ?? false
|
|
||||||
|
|
||||||
layer.effect: MultiEffect {
|
layer.effect: MultiEffect {
|
||||||
maskEnabled: true
|
maskEnabled: true
|
||||||
@@ -338,39 +376,44 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
CustomRect {
|
||||||
id: border
|
id: border
|
||||||
|
|
||||||
border.color: Colors.palette.m3primary
|
border.color: Colors.palette.m3primary
|
||||||
border.width: root.realBorderWidth
|
border.width: root.realBorderWidth
|
||||||
color: "transparent"
|
|
||||||
implicitHeight: selectionRect.implicitHeight + root.realBorderWidth * 2
|
implicitHeight: selectionRect.implicitHeight + root.realBorderWidth * 2
|
||||||
implicitWidth: selectionRect.implicitWidth + root.realBorderWidth * 2
|
implicitWidth: selectionRect.implicitWidth + root.realBorderWidth * 2
|
||||||
radius: root.realRounding > 0 ? root.realRounding + root.realBorderWidth : 0
|
radius: root.realRounding > 0 ? root.realRounding + root.realBorderWidth : 0
|
||||||
visible: screencopy.item?.hasContent ?? false
|
visible: screencopy.hasContent
|
||||||
x: selectionRect.x - root.realBorderWidth
|
x: selectionRect.x - root.realBorderWidth
|
||||||
y: selectionRect.y - root.realBorderWidth
|
y: selectionRect.y - root.realBorderWidth
|
||||||
|
|
||||||
Behavior on border.color {
|
Behavior on border.color {
|
||||||
Anim {
|
Anim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionHandles {
|
SelectionHandles {
|
||||||
id: handles
|
id: handles
|
||||||
|
|
||||||
|
border: root.realBorderWidth
|
||||||
selH: root.sh
|
selH: root.sh
|
||||||
selW: root.sw
|
selW: root.sw
|
||||||
selX: root.rsx
|
selX: root.rsx
|
||||||
selY: root.rsy
|
selY: root.rsy
|
||||||
|
selection: selectionRect
|
||||||
|
tool: root.tool
|
||||||
visible: root.mode === "edit" && root.tool === "move"
|
visible: root.mode === "edit" && root.tool === "move"
|
||||||
|
|
||||||
onBoundsChanged: (x, y, w, h) => {
|
onBoundsChanged: (x, y, w, h) => {
|
||||||
root.sx = x;
|
let nx = Math.max(0, x);
|
||||||
root.sy = y;
|
let ny = Math.max(0, y);
|
||||||
root.ex = x + w;
|
let nw = Math.min(w, root.screen.width - nx);
|
||||||
root.ey = y + h;
|
let nh = Math.min(h, root.screen.height - ny);
|
||||||
|
root.sx = nx;
|
||||||
|
root.sy = ny;
|
||||||
|
root.ex = nx + nw;
|
||||||
|
root.ey = ny + nh;
|
||||||
}
|
}
|
||||||
onMoveBy: (dx, dy) => {
|
onMoveBy: (dx, dy) => {
|
||||||
const w = root.sw, h = root.sh;
|
const w = root.sw, h = root.sh;
|
||||||
@@ -391,7 +434,7 @@ Item {
|
|||||||
tool: root.tool
|
tool: root.tool
|
||||||
visible: root.mode === "edit"
|
visible: root.mode === "edit"
|
||||||
x: Math.max(8, Math.min(root.rsx + root.sw / 2 - width / 2, root.screen.width - width - 8))
|
x: Math.max(8, Math.min(root.rsx + root.sw / 2 - width / 2, root.screen.width - width - 8))
|
||||||
y: (root.rsy + root.sh + height + Tokens.padding.normal <= root.screen.height) ? root.rsy + root.sh + Tokens.padding.normal : (root.rsy - height - Tokens.padding.normal <= 0) ? root.rsy + root.sh - height - Tokens.padding.normal : root.rsy - height - Tokens.padding.normal
|
y: (root.rsy + root.sh + height + Tokens.padding.small <= root.screen.height) ? root.rsy + root.sh + Tokens.padding.small : (root.rsy - height - Tokens.padding.small <= 0) ? root.rsy + root.sh - height - Tokens.padding.small : root.rsy - height - Tokens.padding.small
|
||||||
|
|
||||||
onCancelRequested: root.cancel()
|
onCancelRequested: root.cancel()
|
||||||
onClearRequested: annotations.clearAll()
|
onClearRequested: annotations.clearAll()
|
||||||
@@ -401,7 +444,4 @@ Item {
|
|||||||
onToolSelected: t => root.tool = t
|
onToolSelected: t => root.tool = t
|
||||||
onUndoRequested: annotations.undo()
|
onUndoRequested: annotations.undo()
|
||||||
}
|
}
|
||||||
|
|
||||||
component ExAnim: Anim {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ Item {
|
|||||||
|
|
||||||
property color inkColor: "#ff3b30"
|
property color inkColor: "#ff3b30"
|
||||||
property real inkWidth: 4
|
property real inkWidth: 4
|
||||||
|
required property Rectangle selection
|
||||||
property string tool: "none"
|
property string tool: "none"
|
||||||
|
|
||||||
signal changed
|
signal changed
|
||||||
|
|
||||||
function clearAll() {
|
function clearAll() {
|
||||||
committedCanvas.clear();
|
canvas.clear();
|
||||||
previewCanvas.clear();
|
|
||||||
changed();
|
changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,90 +54,85 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function undo() {
|
function undo() {
|
||||||
committedCanvas.undoLastGroup();
|
canvas.undoLastGroup();
|
||||||
changed();
|
changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
enabled: tool !== "none"
|
||||||
|
|
||||||
StrokeCanvas {
|
StrokeCanvas {
|
||||||
id: committedCanvas
|
id: canvas
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
penColor: root.inkColor
|
penColor: root.inkColor
|
||||||
penWidth: root.inkWidth
|
penWidth: root.inkWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
StrokeCanvas {
|
MouseArea {
|
||||||
id: previewCanvas
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
penColor: root.inkColor
|
|
||||||
penWidth: root.inkWidth
|
|
||||||
}
|
|
||||||
|
|
||||||
PointHandler {
|
|
||||||
id: drawHandler
|
id: drawHandler
|
||||||
|
|
||||||
property real startX
|
property real startX
|
||||||
property real startY
|
property real startY
|
||||||
property bool started: false
|
|
||||||
|
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
enabled: root.tool !== "none"
|
anchors.fill: parent
|
||||||
|
cursorShape: undefined
|
||||||
|
enabled: root.enabled
|
||||||
|
|
||||||
onActiveChanged: {
|
onPositionChanged: e => {
|
||||||
if (active)
|
const x = e.x;
|
||||||
|
const y = e.y;
|
||||||
|
|
||||||
|
if (!pressed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (root.tool === "pen") {
|
if (root.tool === "pen") {
|
||||||
committedCanvas.endStroke();
|
canvas.appendPoint(x, y);
|
||||||
} else if (started) {
|
|
||||||
const pts = root.sampleShape(root.tool, startX, startY, point.position.x, point.position.y);
|
|
||||||
if (pts.length > 0) {
|
|
||||||
committedCanvas.beginStroke(pts[0][0], pts[0][1], true);
|
|
||||||
for (let i = 1; i < pts.length; i++)
|
|
||||||
committedCanvas.appendPoint(pts[i][0], pts[i][1]);
|
|
||||||
committedCanvas.endStroke();
|
|
||||||
}
|
|
||||||
previewCanvas.clear();
|
|
||||||
}
|
|
||||||
started = false;
|
|
||||||
root.changed();
|
|
||||||
}
|
|
||||||
onPointChanged: {
|
|
||||||
if (!active)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (point.pressedButtons & Qt.RightButton) {
|
const pts = root.sampleShape(root.tool, startX, startY, x, y);
|
||||||
root.clearAll();
|
if (pts.length > 0) {
|
||||||
return;
|
canvas.beginStroke(pts[0][0], pts[0][1], true);
|
||||||
|
for (let i = 1; i < pts.length; i++)
|
||||||
|
canvas.appendPoint(pts[i][0], pts[i][1]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
onPressed: e => {
|
||||||
|
if (e.button & Qt.LeftButton) {
|
||||||
|
startX = e.x;
|
||||||
|
startY = e.y;
|
||||||
|
canvas.beginStroke(e.x, e.y);
|
||||||
|
} else if (e.button & Qt.RightButton) {
|
||||||
|
root.clearAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onPressedChanged: if (!pressed)
|
||||||
|
canvas.endStroke()
|
||||||
|
}
|
||||||
|
|
||||||
|
HoverHandler {
|
||||||
|
cursorShape: {
|
||||||
|
if (root.tool === "none")
|
||||||
|
return undefined;
|
||||||
|
|
||||||
const x = point.position.x;
|
const x = point.position.x;
|
||||||
const y = point.position.y;
|
const y = point.position.y;
|
||||||
|
const withinXWidth = x > root.selection.x && x < root.selection.x + root.selection.implicitWidth;
|
||||||
|
const withinYHeight = y > root.selection.y && y < root.selection.y + root.selection.implicitHeight;
|
||||||
|
|
||||||
if (root.tool === "pen") {
|
if (withinXWidth && withinYHeight) {
|
||||||
if (!started) {
|
if (!drawHandler.pressed)
|
||||||
started = true;
|
canvas.showHover(x, y);
|
||||||
committedCanvas.beginStroke(x, y);
|
else
|
||||||
return;
|
canvas.showHover(drawHandler.mouseX, drawHandler.mouseY);
|
||||||
}
|
return Qt.BlankCursor;
|
||||||
committedCanvas.appendPoint(x, y);
|
} else {
|
||||||
return;
|
canvas.hideHover();
|
||||||
}
|
return undefined;
|
||||||
|
|
||||||
if (!started) {
|
|
||||||
started = true;
|
|
||||||
startX = point.pressPosition.x;
|
|
||||||
startY = point.pressPosition.y;
|
|
||||||
}
|
|
||||||
const pts = root.sampleShape(root.tool, startX, startY, x, y);
|
|
||||||
if (pts.length > 0) {
|
|
||||||
previewCanvas.beginStroke(pts[0][0], pts[0][1], true);
|
|
||||||
for (let i = 1; i < pts.length; i++)
|
|
||||||
previewCanvas.appendPoint(pts[i][0], pts[i][1]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
enabled: root.enabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ CustomRect {
|
|||||||
signal undoRequested
|
signal undoRequested
|
||||||
|
|
||||||
color: Colors.palette.m3surface
|
color: Colors.palette.m3surface
|
||||||
height: row.implicitHeight + Tokens.padding.normal * 2
|
height: row.implicitHeight + Tokens.padding.small * 2
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
width: row.implicitWidth + Tokens.padding.normal * 2
|
width: row.implicitWidth + Tokens.padding.small * 2
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: row
|
id: row
|
||||||
@@ -73,6 +73,7 @@ CustomRect {
|
|||||||
required property var modelData
|
required property var modelData
|
||||||
|
|
||||||
color: root.tool === modelData.id ? "#3584e4" : "transparent"
|
color: root.tool === modelData.id ? "#3584e4" : "transparent"
|
||||||
|
font: Tokens.font.icon.medium
|
||||||
icon: tool.modelData.glyph
|
icon: tool.modelData.glyph
|
||||||
inactiveColor: root.tool === modelData.id ? Colors.palette.m3primary : "transparent"
|
inactiveColor: root.tool === modelData.id ? Colors.palette.m3primary : "transparent"
|
||||||
inactiveOnColor: root.tool === modelData.id ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
inactiveOnColor: root.tool === modelData.id ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||||
@@ -98,11 +99,11 @@ CustomRect {
|
|||||||
model: root.colorPalette
|
model: root.colorPalette
|
||||||
|
|
||||||
delegate: IconButton {
|
delegate: IconButton {
|
||||||
readonly property real buttonSize: toolRow.implicitHeight - Tokens.padding.normal
|
readonly property real buttonSize: toolRow.implicitHeight - Tokens.padding.small
|
||||||
required property color modelData
|
required property color modelData
|
||||||
|
|
||||||
fillWidth: false
|
fillWidth: false
|
||||||
font.pointSize: 0
|
font: Tokens.font.icon.medium
|
||||||
icon: ""
|
icon: ""
|
||||||
implicitHeight: buttonSize
|
implicitHeight: buttonSize
|
||||||
implicitWidth: buttonSize
|
implicitWidth: buttonSize
|
||||||
@@ -127,6 +128,7 @@ CustomRect {
|
|||||||
spacing: Tokens.spacing.extraSmall
|
spacing: Tokens.spacing.extraSmall
|
||||||
|
|
||||||
IconButton {
|
IconButton {
|
||||||
|
font: Tokens.font.icon.medium
|
||||||
icon: "undo"
|
icon: "undo"
|
||||||
inactiveColor: "transparent"
|
inactiveColor: "transparent"
|
||||||
inactiveOnColor: Colors.palette.m3onSurface
|
inactiveOnColor: Colors.palette.m3onSurface
|
||||||
@@ -138,6 +140,7 @@ CustomRect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IconButton {
|
IconButton {
|
||||||
|
font: Tokens.font.icon.medium
|
||||||
icon: "delete_history"
|
icon: "delete_history"
|
||||||
inactiveColor: "transparent"
|
inactiveColor: "transparent"
|
||||||
inactiveOnColor: Colors.palette.m3onSurface
|
inactiveOnColor: Colors.palette.m3onSurface
|
||||||
@@ -149,6 +152,7 @@ CustomRect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IconButton {
|
IconButton {
|
||||||
|
font: Tokens.font.icon.medium
|
||||||
icon: "content_copy"
|
icon: "content_copy"
|
||||||
inactiveColor: "transparent"
|
inactiveColor: "transparent"
|
||||||
inactiveOnColor: Colors.palette.m3onSurface
|
inactiveOnColor: Colors.palette.m3onSurface
|
||||||
@@ -160,6 +164,7 @@ CustomRect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IconButton {
|
IconButton {
|
||||||
|
font: Tokens.font.icon.medium
|
||||||
icon: "delete_forever"
|
icon: "delete_forever"
|
||||||
inactiveColor: "transparent"
|
inactiveColor: "transparent"
|
||||||
inactiveOnColor: Colors.palette.m3onSurface
|
inactiveOnColor: Colors.palette.m3onSurface
|
||||||
@@ -171,6 +176,7 @@ CustomRect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IconButton {
|
IconButton {
|
||||||
|
font: Tokens.font.icon.medium
|
||||||
icon: "check"
|
icon: "check"
|
||||||
inactiveColor: "transparent"
|
inactiveColor: "transparent"
|
||||||
inactiveOnColor: Colors.palette.m3onSurface
|
inactiveOnColor: Colors.palette.m3onSurface
|
||||||
|
|||||||
@@ -1,18 +1,23 @@
|
|||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import ZShell.Internal
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property color handleBorder: "#3584e4"
|
required property int border
|
||||||
property color handleFill: "white"
|
property color handleBorder: Colors.palette.m3primary
|
||||||
|
property color handleFill: Colors.palette.m3onPrimary
|
||||||
property real hs: 12
|
property real hs: 12
|
||||||
property real minSize: 24
|
property real minSize: 24
|
||||||
required property real selH
|
required property real selH
|
||||||
required property real selW
|
required property real selW
|
||||||
required property real selX
|
required property real selX
|
||||||
required property real selY
|
required property real selY
|
||||||
|
required property Rectangle selection
|
||||||
|
required property string tool
|
||||||
|
|
||||||
signal boundsChanged(x: real, y: real, w: real, h: real)
|
signal boundsChanged(x: real, y: real, w: real, h: real)
|
||||||
signal dragFinished
|
signal dragFinished
|
||||||
@@ -23,12 +28,16 @@ Item {
|
|||||||
x: selX
|
x: selX
|
||||||
y: selY
|
y: selY
|
||||||
|
|
||||||
|
Component.onDestruction: Cursor.clearOverride()
|
||||||
|
|
||||||
DragHandler {
|
DragHandler {
|
||||||
id: moveHandler
|
id: moveHandler
|
||||||
|
|
||||||
property real accumX: 0
|
property real accumX: 0
|
||||||
property real accumY: 0
|
property real accumY: 0
|
||||||
|
|
||||||
|
cursorShape: undefined
|
||||||
|
dragThreshold: 0
|
||||||
target: null
|
target: null
|
||||||
|
|
||||||
onActiveChanged: {
|
onActiveChanged: {
|
||||||
@@ -45,51 +54,63 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HoverHandler {
|
||||||
|
cursorShape: {
|
||||||
|
if (root.tool !== "move")
|
||||||
|
return undefined;
|
||||||
|
|
||||||
|
if ((moveHandler.centroid.pressedButtons & Qt.LeftButton) && moveHandler.active)
|
||||||
|
return Qt.ClosedHandCursor;
|
||||||
|
else
|
||||||
|
return Qt.OpenHandCursor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "tl"
|
edge: "tl"
|
||||||
x: -root.hs / 2
|
x: -(root.hs + root.border) / 2
|
||||||
y: -root.hs / 2
|
y: -(root.hs + root.border) / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "t"
|
edge: "t"
|
||||||
x: root.width / 2 - root.hs / 2
|
x: root.width / 2 - root.hs / 2
|
||||||
y: -root.hs / 2
|
y: -(root.hs + root.border) / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "tr"
|
edge: "tr"
|
||||||
x: root.width - root.hs / 2
|
x: root.width - root.hs / 2 + root.border / 2
|
||||||
y: -root.hs / 2
|
y: -(root.hs + root.border) / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "r"
|
edge: "r"
|
||||||
x: root.width - root.hs / 2
|
x: root.width - root.hs / 2 + root.border / 2
|
||||||
y: root.height / 2 - root.hs / 2
|
y: root.height / 2 - root.hs / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "br"
|
edge: "br"
|
||||||
x: root.width - root.hs / 2
|
x: root.width - root.hs / 2 + root.border / 2
|
||||||
y: root.height - root.hs / 2
|
y: root.height - root.hs / 2 + root.border / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "b"
|
edge: "b"
|
||||||
x: root.width / 2 - root.hs / 2
|
x: root.width / 2 - root.hs / 2
|
||||||
y: root.height - root.hs / 2
|
y: root.height - root.hs / 2 + root.border / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "bl"
|
edge: "bl"
|
||||||
x: -root.hs / 2
|
x: -(root.hs + root.border) / 2
|
||||||
y: root.height - root.hs / 2
|
y: root.height - root.hs / 2 + root.border / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle {
|
Handle {
|
||||||
edge: "l"
|
edge: "l"
|
||||||
x: -root.hs / 2
|
x: -(root.hs + root.border) / 2
|
||||||
y: root.height / 2 - root.hs / 2
|
y: root.height / 2 - root.hs / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,6 +128,8 @@ Item {
|
|||||||
z: 10
|
z: 10
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
|
id: hover
|
||||||
|
|
||||||
cursorShape: {
|
cursorShape: {
|
||||||
switch (handle.edge) {
|
switch (handle.edge) {
|
||||||
case "tl":
|
case "tl":
|
||||||
@@ -132,6 +155,7 @@ Item {
|
|||||||
property real startX
|
property real startX
|
||||||
property real startY
|
property real startY
|
||||||
|
|
||||||
|
dragThreshold: 0
|
||||||
grabPermissions: PointerHandler.CanTakeOverFromAnything | PointerHandler.TakeOverForbidden
|
grabPermissions: PointerHandler.CanTakeOverFromAnything | PointerHandler.TakeOverForbidden
|
||||||
target: null
|
target: null
|
||||||
|
|
||||||
@@ -141,8 +165,10 @@ Item {
|
|||||||
startY = root.y;
|
startY = root.y;
|
||||||
startW = root.width;
|
startW = root.width;
|
||||||
startH = root.height;
|
startH = root.height;
|
||||||
|
Cursor.setOverride(hover.cursorShape);
|
||||||
} else {
|
} else {
|
||||||
root.dragFinished();
|
root.dragFinished();
|
||||||
|
Cursor.clearOverride();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onTranslationChanged: {
|
onTranslationChanged: {
|
||||||
|
|||||||
@@ -5,6 +5,15 @@ import Quickshell
|
|||||||
Singleton {
|
Singleton {
|
||||||
property var _regexCache: ({})
|
property var _regexCache: ({})
|
||||||
|
|
||||||
|
function percent(value: int): string {
|
||||||
|
// TRANSLATORS: %1 = a number
|
||||||
|
return qsTr("%1%").arg(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function percentOne(value: real): string {
|
||||||
|
return percent(Math.round(value * 100));
|
||||||
|
}
|
||||||
|
|
||||||
function testRegexList(filterList: list<string>, target: string): bool {
|
function testRegexList(filterList: list<string>, target: string): bool {
|
||||||
const regexChecker = /^\^.*\$$/;
|
const regexChecker = /^\^.*\$$/;
|
||||||
for (const filter of filterList) {
|
for (const filter of filterList) {
|
||||||
|
|||||||
+8
-41
@@ -11,8 +11,8 @@ Singleton {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property int availableUpdates: 0
|
property int availableUpdates: 0
|
||||||
property string cmd: ""
|
|
||||||
property bool commandReady
|
property bool commandReady
|
||||||
|
property bool hasHelper
|
||||||
property bool loaded
|
property bool loaded
|
||||||
property double now: Date.now()
|
property double now: Date.now()
|
||||||
property var updates: ({})
|
property var updates: ({})
|
||||||
@@ -38,18 +38,12 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function performPackageUpdate(pkg: string): void {
|
function performPackageUpdate(pkg: string): void {
|
||||||
if (root.cmd === "pacman")
|
pkgUpdateProc.command = ["pkexec", "pacman", "--noconfirm", "-Sy", pkg];
|
||||||
pkgUpdateProc.command = ["pkexec", root.cmd, "--noconfirm", "-Sy", pkg];
|
|
||||||
else
|
|
||||||
pkgUpdateProc.command = [root.cmd, "--noconfirm", "--sudo", "pkexec", "-Sy", pkg];
|
|
||||||
pkgUpdateProc.running = true;
|
pkgUpdateProc.running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function performSystemUpdate(): void {
|
function performSystemUpdate(): void {
|
||||||
if (root.cmd === "pacman")
|
sysUpdateProc.command = ["pkexec", "pacman", "--noconfirm", "-Syu"];
|
||||||
sysUpdateProc.command = ["pkexec", root.cmd, "--noconfirm", "-Syu"];
|
|
||||||
else
|
|
||||||
sysUpdateProc.command = [root.cmd, "--noconfirm", "--sudo", "pkexec", "-Syu"];
|
|
||||||
sysUpdateProc.running = true;
|
sysUpdateProc.running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +81,7 @@ Singleton {
|
|||||||
Process {
|
Process {
|
||||||
id: cmdDetect
|
id: cmdDetect
|
||||||
|
|
||||||
command: ["sh", "-c", "command -v checkupdates || command -v yay || command -v paru"]
|
command: ["sh", "-c", "command -v checkupdates"]
|
||||||
running: true
|
running: true
|
||||||
|
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
@@ -96,47 +90,20 @@ Singleton {
|
|||||||
let helper;
|
let helper;
|
||||||
|
|
||||||
if (cmd.length > 0) {
|
if (cmd.length > 0) {
|
||||||
helper = cmd.split("/").pop();
|
helper = true;
|
||||||
} else {
|
} else {
|
||||||
helper = "pacman";
|
helper = false;
|
||||||
}
|
|
||||||
|
|
||||||
if (helper === "checkupdates") {
|
|
||||||
updatesProc.command = [helper];
|
|
||||||
} else {
|
|
||||||
updatesProc.command = [helper, "-Qu"];
|
|
||||||
}
|
}
|
||||||
|
root.hasHelper = helper;
|
||||||
root.commandReady = true;
|
root.commandReady = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
|
||||||
id: updateCmdDetect
|
|
||||||
|
|
||||||
command: ["sh", "-c", "command -v yay || command -v paru"]
|
|
||||||
running: true
|
|
||||||
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
const cmd = this.text.trim();
|
|
||||||
let helper;
|
|
||||||
|
|
||||||
if (cmd.length > 0) {
|
|
||||||
helper = cmd.split("/").pop();
|
|
||||||
} else {
|
|
||||||
helper = "pacman";
|
|
||||||
}
|
|
||||||
|
|
||||||
root.cmd = helper;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: updatesProc
|
id: updatesProc
|
||||||
|
|
||||||
command: []
|
command: root.hasHelper ? ["checkupdates"] : []
|
||||||
running: false
|
running: false
|
||||||
|
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
import Quickshell
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
property var bars: new Map()
|
|
||||||
property var screens: new Map()
|
|
||||||
|
|
||||||
function getForActive(): PersistentProperties {
|
|
||||||
return screens.get(Hypr.focusedMonitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
function load(screen: ShellScreen, visibilities: var): void {
|
|
||||||
screens.set(Hypr.monitorFor(screen), visibilities);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,7 +17,10 @@ Singleton {
|
|||||||
watchChanges: true
|
watchChanges: true
|
||||||
|
|
||||||
onAdapterUpdated: writeAdapter()
|
onAdapterUpdated: writeAdapter()
|
||||||
onFileChanged: reload()
|
onFileChanged: {
|
||||||
|
reload();
|
||||||
|
Wallpapers.previewColorLock = false;
|
||||||
|
}
|
||||||
|
|
||||||
JsonAdapter {
|
JsonAdapter {
|
||||||
id: adapter
|
id: adapter
|
||||||
|
|||||||
+68
-8
@@ -5,8 +5,10 @@ import Quickshell
|
|||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import ZShell.Models
|
import ZShell.Models
|
||||||
|
import ZShell.Internal
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Modules
|
import qs.Components
|
||||||
|
import qs.Services
|
||||||
import qs.Helpers
|
import qs.Helpers
|
||||||
import qs.Paths
|
import qs.Paths
|
||||||
|
|
||||||
@@ -17,6 +19,8 @@ Searcher {
|
|||||||
property alias crops: adapter.monitorCrops
|
property alias crops: adapter.monitorCrops
|
||||||
readonly property string current: showPreview ? previewPath : actualCurrent
|
readonly property string current: showPreview ? previewPath : actualCurrent
|
||||||
property alias monitorCrops: monitorCrops
|
property alias monitorCrops: monitorCrops
|
||||||
|
property bool pendingPreviewClear
|
||||||
|
property bool previewColorLock
|
||||||
property string previewPath
|
property string previewPath
|
||||||
property bool recentlyChanged
|
property bool recentlyChanged
|
||||||
property bool showPreview: false
|
property bool showPreview: false
|
||||||
@@ -34,9 +38,10 @@ Searcher {
|
|||||||
|
|
||||||
function preview(path: string): void {
|
function preview(path: string): void {
|
||||||
previewPath = path;
|
previewPath = path;
|
||||||
if (Config.general.color.schemeGeneration)
|
|
||||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--image-path", `${previewPath}`, "--scheme", `${Config.colors.schemeType}`, "--mode", `${Config.general.color.mode}`]);
|
|
||||||
showPreview = true;
|
showPreview = true;
|
||||||
|
|
||||||
|
if (Config.colors.schemeGen)
|
||||||
|
previewColorsProc.running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCrop(screen: string, rect: rect, zoom: real): void {
|
function setCrop(screen: string, rect: rect, zoom: real): void {
|
||||||
@@ -52,7 +57,6 @@ Searcher {
|
|||||||
height: rect.height,
|
height: rect.height,
|
||||||
zoom: zoom
|
zoom: zoom
|
||||||
};
|
};
|
||||||
// root.crops = updated;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWallpaper(path: string): void {
|
function setWallpaper(path: string): void {
|
||||||
@@ -60,14 +64,16 @@ Searcher {
|
|||||||
WallpaperPath.currentWallpaperPath = path;
|
WallpaperPath.currentWallpaperPath = path;
|
||||||
Quickshell.screens.forEach(n => setCrop(n.name, Qt.rect(0, 0, 1, 1), 1.0));
|
Quickshell.screens.forEach(n => setCrop(n.name, Qt.rect(0, 0, 1, 1), 1.0));
|
||||||
Quickshell.execDetached(["zshell-cli", "wallpaper", "lockscreen", "--input-image", `${root.actualCurrent}`, "--output-path", `${Paths.state}/lockscreen_bg.png`, "--blur-amount", `${Config.lock.blurAmount}`]);
|
Quickshell.execDetached(["zshell-cli", "wallpaper", "lockscreen", "--input-image", `${root.actualCurrent}`, "--output-path", `${Paths.state}/lockscreen_bg.png`, "--blur-amount", `${Config.lock.blurAmount}`]);
|
||||||
if (Config.general.color.schemeGeneration)
|
if (Config.colors.schemeGen)
|
||||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--image-path", `${root.actualCurrent}`, "--scheme", `${Config.colors.schemeType}`, "--mode", `${Config.general.color.mode}`]);
|
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--image-path", `${root.actualCurrent}`, "--scheme", `${Config.colors.schemeType}`, "--mode", `${Config.colors.mode}`]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopPreview(): void {
|
function stopPreview(): void {
|
||||||
showPreview = false;
|
showPreview = false;
|
||||||
if (Config.general.color.schemeGeneration)
|
if (previewColorLock)
|
||||||
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--image-path", `${root.actualCurrent}`, "--scheme", `${Config.colors.schemeType}`, "--mode", `${Config.general.color.mode}`]);
|
pendingPreviewClear = true;
|
||||||
|
else
|
||||||
|
Colors.showPreview = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
extraOpts: useFuzzy ? ({}) : ({
|
extraOpts: useFuzzy ? ({}) : ({
|
||||||
@@ -77,6 +83,11 @@ Searcher {
|
|||||||
list: wallpapers.entries
|
list: wallpapers.entries
|
||||||
useFuzzy: true
|
useFuzzy: true
|
||||||
|
|
||||||
|
onPreviewColorLockChanged: {
|
||||||
|
if (!previewColorLock && pendingPreviewClear)
|
||||||
|
Colors.showPreview = false;
|
||||||
|
}
|
||||||
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
function set(path: string): void {
|
function set(path: string): void {
|
||||||
root.setWallpaper(path);
|
root.setWallpaper(path);
|
||||||
@@ -118,4 +129,53 @@ Searcher {
|
|||||||
path: Config.general.wallpaperPath
|
path: Config.general.wallpaperPath
|
||||||
recursive: true
|
recursive: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: previewColorsProc
|
||||||
|
|
||||||
|
command: ["zshell-cli", "scheme", "generate", "-p", "-i", root.previewPath]
|
||||||
|
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
Colors.load(text, true);
|
||||||
|
Colors.showPreview = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WallpaperService {
|
||||||
|
id: wallpaper
|
||||||
|
|
||||||
|
path: root.current
|
||||||
|
}
|
||||||
|
|
||||||
|
Variants {
|
||||||
|
model: Quickshell.screens
|
||||||
|
|
||||||
|
WallpaperObject {
|
||||||
|
readonly property var crops: root.getCrop(modelData.name)
|
||||||
|
required property var modelData
|
||||||
|
|
||||||
|
cropHeight: crops?.height ?? 1.0
|
||||||
|
cropWidth: crops?.width ?? 1.0
|
||||||
|
cropX: crops?.x ?? 0.0
|
||||||
|
cropY: crops?.y ?? 0.0
|
||||||
|
screen: modelData.name
|
||||||
|
service: wallpaper
|
||||||
|
zoom: crops?.zoom ?? 1.0
|
||||||
|
|
||||||
|
Behavior on cropHeight {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
Behavior on cropWidth {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
Behavior on cropX {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
Behavior on cropY {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-7
@@ -3,25 +3,36 @@ pragma Singleton
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import ZShell
|
import ZShell
|
||||||
|
import ZShell.Internal
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property var cachedCities: new Map()
|
readonly property var cachedCities: new Map()
|
||||||
property var cc
|
|
||||||
property string city
|
|
||||||
readonly property string description: cc?.weatherDesc ?? qsTr("No weather")
|
readonly property string description: cc?.weatherDesc ?? qsTr("No weather")
|
||||||
readonly property string feelsLike: formatTemp(cc?.feelsLikeC)
|
readonly property string feelsLike: formatTemp(cc?.feelsLikeC)
|
||||||
property list<var> forecast
|
|
||||||
property list<var> hourlyForecast
|
|
||||||
readonly property int humidity: cc?.humidity ?? 0
|
readonly property int humidity: cc?.humidity ?? 0
|
||||||
readonly property string icon: cc ? Icons.getWeatherIcon(cc.weatherCode) : "cloud_alert"
|
readonly property string icon: cc ? Icons.getWeatherIcon(cc.weatherCode) : "cloud_alert"
|
||||||
property string loc
|
|
||||||
readonly property string sunrise: cc ? Qt.formatDateTime(new Date(cc.sunrise), Config.services.useTwelveHourClock ? "h:mm A" : "h:mm") : "--:--"
|
readonly property string sunrise: cc ? Qt.formatDateTime(new Date(cc.sunrise), Config.services.useTwelveHourClock ? "h:mm A" : "h:mm") : "--:--"
|
||||||
readonly property string sunset: cc ? Qt.formatDateTime(new Date(cc.sunset), Config.services.useTwelveHourClock ? "h:mm A" : "h:mm") : "--:--"
|
readonly property string sunset: cc ? Qt.formatDateTime(new Date(cc.sunset), Config.services.useTwelveHourClock ? "h:mm A" : "h:mm") : "--:--"
|
||||||
readonly property string temp: formatTemp(cc?.tempC)
|
readonly property string temp: formatTemp(cc?.tempC)
|
||||||
readonly property real windSpeed: cc?.windSpeed ?? 0
|
readonly property real windSpeed: cc?.windSpeed ?? 0
|
||||||
|
readonly property CircularBuffer precipitationForecast: precipitationBuffer
|
||||||
|
|
||||||
|
property var cc
|
||||||
|
property string city
|
||||||
|
property list<var> forecast
|
||||||
|
property list<var> hourlyForecast
|
||||||
|
readonly property int currentHourIndex: {
|
||||||
|
const now = new Date();
|
||||||
|
for (let i = 0; i < hourlyForecast.length; i++) {
|
||||||
|
if (new Date(hourlyForecast[i].timestamp.replace("T", " ")) >= now)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
property string loc
|
||||||
|
|
||||||
function fetchCityFromCoords(coords: string): void {
|
function fetchCityFromCoords(coords: string): void {
|
||||||
if (cachedCities.has(coords)) {
|
if (cachedCities.has(coords)) {
|
||||||
@@ -112,11 +123,12 @@ Singleton {
|
|||||||
forecast = forecastList;
|
forecast = forecastList;
|
||||||
|
|
||||||
const hourlyList = [];
|
const hourlyList = [];
|
||||||
const now = new Date();
|
const startOfToday = new Date();
|
||||||
|
startOfToday.setHours(0, 0, 0, 0);
|
||||||
for (let i = 0; i < json.hourly.time.length; i++) {
|
for (let i = 0; i < json.hourly.time.length; i++) {
|
||||||
const time = new Date(json.hourly.time[i].replace("T", " "));
|
const time = new Date(json.hourly.time[i].replace("T", " "));
|
||||||
|
|
||||||
if (time < now)
|
if (time < startOfToday)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
hourlyList.push({
|
hourlyList.push({
|
||||||
@@ -129,6 +141,10 @@ Singleton {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
hourlyForecast = hourlyList;
|
hourlyForecast = hourlyList;
|
||||||
|
precipitationBuffer.clear();
|
||||||
|
|
||||||
|
for (const hour of hourlyList)
|
||||||
|
precipitationBuffer.push(hour.precipChance);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,6 +274,11 @@ Singleton {
|
|||||||
|
|
||||||
onLocChanged: fetchWeatherData()
|
onLocChanged: fetchWeatherData()
|
||||||
|
|
||||||
|
CircularBuffer {
|
||||||
|
id: precipitationBuffer
|
||||||
|
capacity: 24
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
function onWeatherLocationChanged(): void {
|
function onWeatherLocationChanged(): void {
|
||||||
root.reload();
|
root.reload();
|
||||||
|
|||||||
+20
-17
@@ -4,6 +4,7 @@ import Quickshell
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
|
import qs.Components
|
||||||
import qs.Modules.Bar.Components
|
import qs.Modules.Bar.Components
|
||||||
import qs.Modules.Bar.Popouts
|
import qs.Modules.Bar.Popouts
|
||||||
|
|
||||||
@@ -12,15 +13,16 @@ GridLayout {
|
|||||||
|
|
||||||
required property bool fullscreen
|
required property bool fullscreen
|
||||||
required property bool horizontal
|
required property bool horizontal
|
||||||
|
required property bool isHovered
|
||||||
required property Wrapper popouts
|
required property Wrapper popouts
|
||||||
required property ClipWrapper popoutsWrapper
|
required property ClipWrapper popoutsWrapper
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
|
required property ScreenState screenState
|
||||||
readonly property int vPadding: 6
|
readonly property int vPadding: 6
|
||||||
required property PersistentProperties visibilities
|
|
||||||
|
|
||||||
function axisCenterOf(item: Item): real {
|
function axisCenterOf(item: Item): real {
|
||||||
const c = item.mapToItem(root, item.implicitWidth / 2, item.implicitHeight / 2);
|
const c = item.mapToItem(root, item.implicitWidth / 2, item.implicitHeight / 2);
|
||||||
return horizontal ? c.x : c.y;
|
return horizontal ? Math.floor(c.x) : Math.floor(c.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkPopout(pos: real): void {
|
function checkPopout(pos: real): void {
|
||||||
@@ -33,7 +35,7 @@ GridLayout {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (visibilities.sidebar || visibilities.dashboard || visibilities.resources || visibilities.settings)
|
if (screenState.sidebar || screenState.dashboard || screenState.resources || screenState.settings)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (id === "statusIcons" && Config.bar.popouts.statusIcons) {
|
if (id === "statusIcons" && Config.bar.popouts.statusIcons) {
|
||||||
@@ -87,12 +89,12 @@ GridLayout {
|
|||||||
role: "id"
|
role: "id"
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: "hyprsunset"
|
roleValue: "nightlight"
|
||||||
|
|
||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
HyprsunsetWidget {
|
NightlightWidget {
|
||||||
horizontal: root.horizontal
|
horizontal: root.horizontal
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen || root.isHovered
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,7 +115,7 @@ GridLayout {
|
|||||||
Workspaces {
|
Workspaces {
|
||||||
horizontal: root.horizontal
|
horizontal: root.horizontal
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen || root.isHovered
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,7 +128,7 @@ GridLayout {
|
|||||||
horizontal: root.horizontal
|
horizontal: root.horizontal
|
||||||
loader: root
|
loader: root
|
||||||
popouts: root.popouts
|
popouts: root.popouts
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen || root.isHovered
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,6 +139,7 @@ GridLayout {
|
|||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
StatusIcons {
|
StatusIcons {
|
||||||
horizontal: root.horizontal
|
horizontal: root.horizontal
|
||||||
|
visible: !root.fullscreen || root.isHovered
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,8 +150,8 @@ GridLayout {
|
|||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
Resources {
|
Resources {
|
||||||
horizontal: root.horizontal
|
horizontal: root.horizontal
|
||||||
visibilities: root.visibilities
|
screenState: root.screenState
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen || root.isHovered
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,7 +162,7 @@ GridLayout {
|
|||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
UpdatesWidget {
|
UpdatesWidget {
|
||||||
horizontal: root.horizontal
|
horizontal: root.horizontal
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen || root.isHovered
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,8 +174,8 @@ GridLayout {
|
|||||||
NotifBell {
|
NotifBell {
|
||||||
horizontal: root.horizontal
|
horizontal: root.horizontal
|
||||||
popouts: root.popouts
|
popouts: root.popouts
|
||||||
visibilities: root.visibilities
|
screenState: root.screenState
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen || root.isHovered
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,8 +188,8 @@ GridLayout {
|
|||||||
horizontal: root.horizontal
|
horizontal: root.horizontal
|
||||||
loader: root
|
loader: root
|
||||||
popouts: root.popouts
|
popouts: root.popouts
|
||||||
visibilities: root.visibilities
|
screenState: root.screenState
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen || root.isHovered
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,7 +201,7 @@ GridLayout {
|
|||||||
WindowTitle {
|
WindowTitle {
|
||||||
bar: root
|
bar: root
|
||||||
horizontal: root.horizontal
|
horizontal: root.horizontal
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen || root.isHovered
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -218,7 +221,7 @@ GridLayout {
|
|||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
MediaWidget {
|
MediaWidget {
|
||||||
horizontal: root.horizontal
|
horizontal: root.horizontal
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen || root.isHovered
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,20 +10,20 @@ Item {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property int clampedExtent: Math.max(Config.bar.border, extent)
|
readonly property int clampedExtent: Math.max(Config.bar.border, extent)
|
||||||
readonly property int contentThickness: Math.floor(Math.max(Config.bar.height, Tokens.bar.innerSize * (horizontal ? 1 : 1.5))) + padding * 2
|
readonly property int contentThickness: Math.floor(Math.max(Config.bar.height, Tokens.sizes.bar.innerSize * (horizontal ? 1 : 1.5))) + padding * 2
|
||||||
readonly property int exclusiveZone: Config.bar.autoHide ? Config.bar.border : contentThickness
|
readonly property int exclusiveZone: Config.bar.autoHide ? Config.bar.border : contentThickness
|
||||||
property real extent: fullscreen ? 0 : Config.bar.border
|
property real extent: fullscreen ? 0 : Config.bar.border
|
||||||
required property bool fullscreen
|
required property bool fullscreen
|
||||||
readonly property bool horizontal: position !== "left"
|
readonly property bool horizontal: position !== "left"
|
||||||
property bool isHovered
|
property bool isHovered
|
||||||
readonly property int padding: Math.max(Tokens.padding.smaller, Config.bar.border)
|
readonly property int padding: Math.max(Tokens.padding.small, Config.bar.border)
|
||||||
required property Wrapper popouts
|
required property Wrapper popouts
|
||||||
required property ClipWrapper popoutsWrapper
|
required property ClipWrapper popoutsWrapper
|
||||||
required property string position
|
required property string position
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
readonly property bool shouldBeVisible: !fullscreen && (!Config.bar.autoHide || visibilities.bar || isHovered)
|
readonly property bool shouldBeVisible: (!fullscreen && (!Config.bar.autoHide || screenState.bar)) || isHovered
|
||||||
readonly property int vPadding: 6
|
readonly property int vPadding: 6
|
||||||
required property PersistentProperties visibilities
|
required property ScreenState screenState
|
||||||
|
|
||||||
function checkPopout(pos: real): void {
|
function checkPopout(pos: real): void {
|
||||||
(content.item as Bar)?.checkPopout(pos);
|
(content.item as Bar)?.checkPopout(pos);
|
||||||
@@ -79,11 +79,13 @@ Item {
|
|||||||
|
|
||||||
sourceComponent: Bar {
|
sourceComponent: Bar {
|
||||||
fullscreen: root.fullscreen
|
fullscreen: root.fullscreen
|
||||||
|
height: root.contentThickness
|
||||||
horizontal: root.horizontal
|
horizontal: root.horizontal
|
||||||
|
isHovered: root.isHovered
|
||||||
popouts: root.popouts
|
popouts: root.popouts
|
||||||
popoutsWrapper: root.popoutsWrapper
|
popoutsWrapper: root.popoutsWrapper
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
visibilities: root.visibilities
|
screenState: root.screenState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ Item {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property Item bar
|
required property Item bar
|
||||||
required property PersistentProperties visibilities
|
required property ScreenState screenState
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import qs.Services
|
|||||||
WidgetBase {
|
WidgetBase {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property color contentColor: visibilities.dashboard ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
readonly property font font: Tokens.font.clock.family(Config.appearance.font.family.clock).build()
|
||||||
|
readonly property color contentColor: Colors.palette.m3onSurface
|
||||||
readonly property string effectiveFormat: {
|
readonly property string effectiveFormat: {
|
||||||
let fmt = Config.general.dateFormat;
|
let fmt = Config.general.dateFormat;
|
||||||
if (!root.horizontal)
|
if (!root.horizontal)
|
||||||
@@ -44,10 +45,9 @@ WidgetBase {
|
|||||||
}
|
}
|
||||||
required property GridLayout loader
|
required property GridLayout loader
|
||||||
required property Wrapper popouts
|
required property Wrapper popouts
|
||||||
readonly property real size: horizontal ? timeText.contentWidth + Tokens.padding.normal * 2 : verticalColumn.implicitHeight + Tokens.padding.larger * 2
|
readonly property real size: horizontal ? timeText.contentWidth + Tokens.padding.medium * 2 : verticalColumn.implicitHeight + Tokens.padding.medium * 2
|
||||||
required property PersistentProperties visibilities
|
required property ScreenState screenState
|
||||||
|
|
||||||
color: visibilities.dashboard ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
|
||||||
implicitHeight: horizontal ? baseSize : size
|
implicitHeight: horizontal ? baseSize : size
|
||||||
implicitWidth: horizontal ? size : baseSize
|
implicitWidth: horizontal ? size : baseSize
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
@@ -57,14 +57,13 @@ WidgetBase {
|
|||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: root.contentColor
|
color: root.contentColor
|
||||||
font: Config.appearance.font.family.mono // qmllint disable incompatible-type
|
font: root.font
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
text: Time.dateStr
|
text: Time.dateStr
|
||||||
visible: root.horizontal
|
visible: root.horizontal
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
CAnim {
|
CAnim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +71,7 @@ WidgetBase {
|
|||||||
id: verticalColumn
|
id: verticalColumn
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: Tokens.padding.small ?? 2
|
spacing: Tokens.padding.extraSmall ?? 2
|
||||||
visible: !root.horizontal
|
visible: !root.horizontal
|
||||||
width: root.baseSize
|
width: root.baseSize
|
||||||
|
|
||||||
@@ -84,20 +83,19 @@ WidgetBase {
|
|||||||
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
color: root.contentColor
|
color: root.contentColor
|
||||||
font: Config.appearance.font.family.mono // qmllint disable incompatible-type
|
font: root.font
|
||||||
text: Qt.formatDateTime(Time.date, modelData)
|
text: Qt.formatDateTime(Time.date, modelData)
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
CAnim {
|
CAnim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
Layout.bottomMargin: Tokens.padding.small ?? 2
|
Layout.bottomMargin: Tokens.padding.extraSmall ?? 2
|
||||||
Layout.topMargin: Tokens.padding.small ?? 2
|
Layout.topMargin: Tokens.padding.extraSmall ?? 2
|
||||||
color: root.contentColor
|
color: root.contentColor
|
||||||
height: 1
|
height: 1
|
||||||
implicitWidth: root.baseSize * 0.5
|
implicitWidth: root.baseSize * 0.5
|
||||||
@@ -114,7 +112,7 @@ WidgetBase {
|
|||||||
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
color: root.contentColor
|
color: root.contentColor
|
||||||
font: Config.appearance.font.family.mono // qmllint disable incompatible-type
|
font: root.font
|
||||||
text: {
|
text: {
|
||||||
if (modelData.includes("h"))
|
if (modelData.includes("h"))
|
||||||
return Time.hourStr;
|
return Time.hourStr;
|
||||||
@@ -126,8 +124,7 @@ WidgetBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
CAnim {
|
CAnim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,23 +132,13 @@ WidgetBase {
|
|||||||
CustomText {
|
CustomText {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
color: root.contentColor
|
color: root.contentColor
|
||||||
font: Config.appearance.font.family.mono // qmllint disable incompatible-type
|
font: root.font
|
||||||
text: Qt.formatDateTime(Time.date, "AP")
|
text: Qt.formatDateTime(Time.date, "AP")
|
||||||
visible: Config.services.useTwelveHourClock && root.formatParts.timeTokens.length > 0
|
visible: Config.services.useTwelveHourClock && root.formatParts.timeTokens.length > 0
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
CAnim {
|
CAnim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StateLayer {
|
|
||||||
acceptedButtons: Qt.LeftButton
|
|
||||||
color: root.contentColor
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
root.visibilities.dashboard = !root.visibilities.dashboard;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
import QtQuick
|
||||||
|
import ZShell.Config
|
||||||
|
import qs.Services
|
||||||
|
import qs.Components
|
||||||
|
import qs.Helpers
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property real batHeight: Tokens.padding.small * 2
|
||||||
|
property real batWidth: Tokens.padding.medium * 2
|
||||||
|
required property string devState
|
||||||
|
property real nubHeight: Tokens.padding.extraSmall
|
||||||
|
property real nubWidth: 2
|
||||||
|
required property real percentage
|
||||||
|
property real radius: Tokens.rounding.small / 2
|
||||||
|
|
||||||
|
spacing: 1
|
||||||
|
|
||||||
|
CustomRect {
|
||||||
|
id: track
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
color: Battery.getColors(root.percentage, root.devState).bg
|
||||||
|
height: root.batHeight
|
||||||
|
radius: root.radius
|
||||||
|
width: root.batWidth
|
||||||
|
|
||||||
|
CustomText {
|
||||||
|
color: Battery.getColors(root.percentage, root.devState).fg
|
||||||
|
font: Tokens.font.body.builders.small.size(11).weight(Font.Bold).build()
|
||||||
|
height: track.height
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: Math.round(root.percentage * 100)
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
width: track.width
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
clip: true
|
||||||
|
width: parent.width * root.percentage
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: parent.left
|
||||||
|
top: parent.top
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomRect {
|
||||||
|
id: fill
|
||||||
|
|
||||||
|
color: Battery.getColors(root.percentage, root.devState).fg
|
||||||
|
height: track.height
|
||||||
|
radius: track.radius
|
||||||
|
width: track.width
|
||||||
|
|
||||||
|
CustomText {
|
||||||
|
id: batteryLabel
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
color: Battery.getColors(root.percentage, root.devState).bg
|
||||||
|
font: Tokens.font.body.builders.small.size(11).weight(Font.Bold).build()
|
||||||
|
height: track.height
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: Math.round(root.percentage * 100)
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
width: track.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomRect {
|
||||||
|
id: nub
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
bottomRightRadius: 20
|
||||||
|
color: root.percentage < 0.99 ? track.color : fill.color
|
||||||
|
height: root.nubHeight
|
||||||
|
topRightRadius: 20
|
||||||
|
width: root.nubWidth
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ import qs.Services
|
|||||||
CustomRect {
|
CustomRect {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property int baseSize: horizontal ? Math.max(Config.bar.height, Tokens.bar.innerSize) : Math.max(Config.bar.height, Math.floor(Tokens.bar.innerSize * 1.5))
|
readonly property int baseSize: horizontal ? Math.max(Config.bar.height, Tokens.sizes.bar.innerSize) : Math.max(Config.bar.height, Math.floor(Tokens.sizes.bar.innerSize * 1.5))
|
||||||
required property bool horizontal
|
required property bool horizontal
|
||||||
|
|
||||||
color: Colors.tPalette.m3surfaceContainer
|
color: Colors.tPalette.m3surfaceContainer
|
||||||
|
|||||||
@@ -12,21 +12,19 @@ WidgetBase {
|
|||||||
readonly property string currentMedia: (Players.active?.trackTitle ?? qsTr("No media")) || qsTr("Unknown title")
|
readonly property string currentMedia: (Players.active?.trackTitle ?? qsTr("No media")) || qsTr("Unknown title")
|
||||||
readonly property int textWidth: Math.min(metrics.width, 200)
|
readonly property int textWidth: Math.min(metrics.width, 200)
|
||||||
|
|
||||||
implicitHeight: horizontal ? baseSize : layout.implicitHeight + Tokens.padding.normal * 2
|
implicitHeight: horizontal ? baseSize : layout.implicitHeight + Tokens.padding.small * 2
|
||||||
implicitWidth: horizontal ? layout.implicitWidth + Tokens.padding.normal * 2 : baseSize
|
implicitWidth: horizontal ? layout.implicitWidth + Tokens.padding.small * 2 : baseSize
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
Behavior on implicitHeight {
|
Behavior on implicitHeight {
|
||||||
enabled: !root.horizontal
|
enabled: !root.horizontal
|
||||||
|
|
||||||
Anim {
|
Anim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Behavior on implicitWidth {
|
Behavior on implicitWidth {
|
||||||
enabled: root.horizontal
|
enabled: root.horizontal
|
||||||
|
|
||||||
Anim {
|
Anim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextMetrics {
|
TextMetrics {
|
||||||
@@ -39,23 +37,22 @@ WidgetBase {
|
|||||||
GridLayout {
|
GridLayout {
|
||||||
id: layout
|
id: layout
|
||||||
|
|
||||||
anchors.bottomMargin: root.horizontal ? 0 : Tokens.padding.normal
|
anchors.bottomMargin: root.horizontal ? 0 : Tokens.padding.small
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: root.horizontal ? Tokens.padding.normal : 0
|
anchors.leftMargin: root.horizontal ? Tokens.padding.small : 0
|
||||||
anchors.rightMargin: root.horizontal ? Tokens.padding.normal : 0
|
anchors.rightMargin: root.horizontal ? Tokens.padding.small : 0
|
||||||
anchors.topMargin: root.horizontal ? 0 : Tokens.padding.normal
|
anchors.topMargin: root.horizontal ? 0 : Tokens.padding.small
|
||||||
columns: root.horizontal ? -1 : 1
|
columns: root.horizontal ? -1 : 1
|
||||||
|
|
||||||
Behavior on implicitWidth {
|
Behavior on implicitWidth {
|
||||||
Anim {
|
Anim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
||||||
animate: true
|
animate: true
|
||||||
color: Players.active?.isPlaying ? Colors.palette.m3primary : Colors.palette.m3onSurface
|
color: Players.active?.isPlaying ? Colors.palette.m3primary : Colors.palette.m3onSurface
|
||||||
font.pointSize: Tokens.font.size.larger
|
fontStyle: Tokens.font.icon.small
|
||||||
text: Players.active?.isPlaying ? "music_note" : "music_off"
|
text: Players.active?.isPlaying ? "music_note" : "music_off"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +62,6 @@ WidgetBase {
|
|||||||
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
||||||
animate: true
|
animate: true
|
||||||
color: Players.active?.isPlaying ? Colors.palette.m3primary : Colors.palette.m3onSurface
|
color: Players.active?.isPlaying ? Colors.palette.m3primary : Colors.palette.m3onSurface
|
||||||
font.pointSize: Tokens.font.size.normal
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
implicitHeight: root.horizontal ? root.implicitHeight : root.textWidth
|
implicitHeight: root.horizontal ? root.implicitHeight : root.textWidth
|
||||||
implicitWidth: root.horizontal ? root.textWidth : root.implicitWidth
|
implicitWidth: root.horizontal ? root.textWidth : root.implicitWidth
|
||||||
|
|||||||
+5
-6
@@ -8,15 +8,15 @@ import qs.Services
|
|||||||
WidgetBase {
|
WidgetBase {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool tempEnabled: Hyprsunset.enabled
|
property bool tempEnabled: Nightlight.enabled
|
||||||
|
|
||||||
color: root.tempEnabled ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
color: root.tempEnabled ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Hyprsunset.toggleNightLight();
|
Nightlight.toggleNightLight();
|
||||||
Hyprsunset.manualToggle = true;
|
Nightlight.manualToggle = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,12 +25,11 @@ WidgetBase {
|
|||||||
animate: true
|
animate: true
|
||||||
color: root.tempEnabled ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
color: root.tempEnabled ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||||
fill: root.tempEnabled ? 1 : 0
|
fill: root.tempEnabled ? 1 : 0
|
||||||
font.pointSize: Tokens.font.size.larger
|
fontStyle: Tokens.font.icon.small
|
||||||
text: root.tempEnabled ? "lightbulb" : "light_off"
|
text: root.tempEnabled ? "lightbulb" : "light_off"
|
||||||
|
|
||||||
Behavior on fill {
|
Behavior on fill {
|
||||||
Anim {
|
Anim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,35 +11,33 @@ WidgetBase {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property Wrapper popouts
|
required property Wrapper popouts
|
||||||
required property PersistentProperties visibilities
|
required property ScreenState screenState
|
||||||
|
|
||||||
color: visibilities.sidebar ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
color: screenState.sidebar ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
id: notificationCenterIcon
|
id: notificationCenterIcon
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: root.visibilities.sidebar ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
color: root.screenState.sidebar ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||||
fill: root.visibilities.sidebar ? 1 : 0
|
fill: root.screenState.sidebar ? 1 : 0
|
||||||
font.pointSize: Tokens.font.size.larger
|
fontStyle: Tokens.font.icon.size(16).build()
|
||||||
text: NotifServer.list.length ? "\uf4fe" : "\ue7f4"
|
text: NotifServer.list.length ? "\uf4fe" : "\ue7f4"
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
CAnim {
|
CAnim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Behavior on fill {
|
Behavior on fill {
|
||||||
Anim {
|
Anim {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
color: root.visibilities.sidebar ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
color: root.screenState.sidebar ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.visibilities.sidebar = !root.visibilities.sidebar;
|
root.screenState.sidebar = !root.screenState.sidebar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Shapes
|
import Quickshell
|
||||||
import qs.Components
|
import qs.Components
|
||||||
import ZShell.Config
|
import ZShell.Config
|
||||||
import qs.Services
|
import qs.Services
|
||||||
@@ -12,6 +12,7 @@ GridLayout {
|
|||||||
property real animatedPercentage: 0
|
property real animatedPercentage: 0
|
||||||
readonly property real arcStartAngle: 0.75 * Math.PI
|
readonly property real arcStartAngle: 0.75 * Math.PI
|
||||||
readonly property real arcSweep: 1.5 * Math.PI
|
readonly property real arcSweep: 1.5 * Math.PI
|
||||||
|
readonly property real dpr: (QsWindow.window as QsWindow)?.devicePixelRatio ?? 1
|
||||||
required property bool horizontal
|
required property bool horizontal
|
||||||
property string icon
|
property string icon
|
||||||
required property color iconColor
|
required property color iconColor
|
||||||
@@ -22,7 +23,11 @@ GridLayout {
|
|||||||
property bool warning: percentage * 100 >= warningThreshold
|
property bool warning: percentage * 100 >= warningThreshold
|
||||||
property int warningThreshold: 80
|
property int warningThreshold: 80
|
||||||
|
|
||||||
columnSpacing: Tokens.spacing.smaller
|
function snap(v) {
|
||||||
|
return Math.round(v * dpr) / dpr;
|
||||||
|
}
|
||||||
|
|
||||||
|
columnSpacing: Tokens.spacing.medium
|
||||||
columns: horizontal ? -1 : 1
|
columns: horizontal ? -1 : 1
|
||||||
percentage: 0
|
percentage: 0
|
||||||
|
|
||||||
@@ -44,31 +49,39 @@ GridLayout {
|
|||||||
|
|
||||||
Layout.preferredWidth: 16
|
Layout.preferredWidth: 16
|
||||||
color: root.iconColor
|
color: root.iconColor
|
||||||
font.pointSize: Tokens.font.size.larger
|
fontStyle: Tokens.font.icon.small
|
||||||
text: root.icon
|
text: root.icon
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomClippingRect {
|
CustomRect {
|
||||||
Layout.preferredHeight: root.horizontal ? icon.implicitHeight - Tokens.padding.small : 4
|
id: track
|
||||||
|
|
||||||
|
Layout.preferredHeight: root.horizontal ? icon.implicitHeight - Tokens.padding.extraSmall : 4
|
||||||
Layout.preferredWidth: root.horizontal ? 4 : icon.implicitWidth
|
Layout.preferredWidth: root.horizontal ? 4 : icon.implicitWidth
|
||||||
color: Colors.layer(Colors.palette.m3surfaceContainerHigh, 2)
|
color: Colors.layer(Colors.palette.m3surfaceContainerHigh, 2)
|
||||||
radius: Tokens.rounding.full
|
radius: Math.min(width, height) / 2
|
||||||
|
|
||||||
CustomRect {
|
Item {
|
||||||
id: fill
|
id: clipper
|
||||||
|
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: root.horizontal ? parent.bottom : undefined
|
||||||
anchors.left: parent.left
|
anchors.horizontalCenter: root.horizontal ? parent.horizontalCenter : undefined
|
||||||
anchors.right: root.horizontal ? parent.right : undefined
|
anchors.left: root.horizontal ? undefined : parent.left
|
||||||
anchors.top: root.horizontal ? undefined : parent.top
|
anchors.verticalCenter: root.horizontal ? undefined : parent.verticalCenter
|
||||||
color: root.mainColor
|
clip: true
|
||||||
implicitHeight: root.horizontal ? Math.ceil(root.percentage * parent.height) : 0
|
height: root.horizontal ? root.snap(root.percentage * track.height) : track.height * 2
|
||||||
implicitWidth: root.horizontal ? 0 : Math.ceil(root.percentage * parent.width)
|
width: root.horizontal ? track.width * 2 : root.snap(root.percentage * track.width)
|
||||||
|
|
||||||
// Behavior on implicitHeight {
|
CustomRect {
|
||||||
// Anim {
|
anchors.bottom: root.horizontal ? parent.bottom : undefined
|
||||||
// }
|
anchors.horizontalCenter: root.horizontal ? parent.horizontalCenter : undefined
|
||||||
// }
|
anchors.left: root.horizontal ? undefined : parent.left
|
||||||
|
anchors.verticalCenter: root.horizontal ? undefined : parent.verticalCenter
|
||||||
|
color: root.mainColor
|
||||||
|
height: track.height
|
||||||
|
radius: track.radius
|
||||||
|
width: track.width
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,18 +12,18 @@ import qs.Components
|
|||||||
WidgetBase {
|
WidgetBase {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property PersistentProperties visibilities
|
required property ScreenState screenState
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
color: visibilities.resources ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
color: screenState.resources ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
||||||
implicitHeight: horizontal ? baseSize : gridLayout.implicitHeight + Tokens.padding.normal * 2
|
implicitHeight: horizontal ? baseSize : gridLayout.implicitHeight + Tokens.padding.medium * 2
|
||||||
implicitWidth: horizontal ? gridLayout.implicitWidth + Tokens.padding.larger * 2 : baseSize
|
implicitWidth: horizontal ? gridLayout.implicitWidth + Tokens.padding.medium * 2 : baseSize
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
color: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
color: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||||
|
|
||||||
onClicked: root.visibilities.resources = !root.visibilities.resources
|
onClicked: root.screenState.resources = !root.screenState.resources
|
||||||
}
|
}
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
@@ -32,7 +32,7 @@ WidgetBase {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
anchors.horizontalCenterOffset: root.horizontal ? 0 : 1
|
anchors.horizontalCenterOffset: root.horizontal ? 0 : 1
|
||||||
anchors.verticalCenterOffset: root.horizontal ? 0 : -3
|
anchors.verticalCenterOffset: root.horizontal ? 0 : -3
|
||||||
columnSpacing: Tokens.spacing.smaller
|
columnSpacing: Tokens.spacing.small
|
||||||
columns: root.horizontal ? -1 : 1
|
columns: root.horizontal ? -1 : 1
|
||||||
|
|
||||||
ServiceRef {
|
ServiceRef {
|
||||||
@@ -53,8 +53,8 @@ WidgetBase {
|
|||||||
Layout.fillWidth: !root.horizontal
|
Layout.fillWidth: !root.horizontal
|
||||||
horizontal: root.horizontal
|
horizontal: root.horizontal
|
||||||
icon: "memory"
|
icon: "memory"
|
||||||
iconColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
iconColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||||
mainColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3primary
|
mainColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3primary
|
||||||
percentage: Cpu.percentage
|
percentage: Cpu.percentage
|
||||||
warningThreshold: 95
|
warningThreshold: 95
|
||||||
}
|
}
|
||||||
@@ -64,8 +64,8 @@ WidgetBase {
|
|||||||
Layout.fillWidth: !root.horizontal
|
Layout.fillWidth: !root.horizontal
|
||||||
horizontal: root.horizontal
|
horizontal: root.horizontal
|
||||||
icon: "memory_alt"
|
icon: "memory_alt"
|
||||||
iconColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
iconColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||||
mainColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3secondary
|
mainColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3secondary
|
||||||
percentage: Memory.percentage
|
percentage: Memory.percentage
|
||||||
warningThreshold: 80
|
warningThreshold: 80
|
||||||
}
|
}
|
||||||
@@ -75,8 +75,8 @@ WidgetBase {
|
|||||||
Layout.fillWidth: !root.horizontal
|
Layout.fillWidth: !root.horizontal
|
||||||
horizontal: root.horizontal
|
horizontal: root.horizontal
|
||||||
icon: "gamepad"
|
icon: "gamepad"
|
||||||
iconColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
iconColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||||
mainColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3tertiary
|
mainColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3tertiary
|
||||||
percentage: Gpu.percentage
|
percentage: Gpu.percentage
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,8 +85,8 @@ WidgetBase {
|
|||||||
Layout.fillWidth: !root.horizontal
|
Layout.fillWidth: !root.horizontal
|
||||||
horizontal: root.horizontal
|
horizontal: root.horizontal
|
||||||
icon: "developer_board"
|
icon: "developer_board"
|
||||||
iconColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
iconColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||||
mainColor: root.visibilities.resources ? Colors.palette.m3onPrimary : Colors.palette.m3primary
|
mainColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3primary
|
||||||
percentage: Gpu.memoryUsed / Gpu.memoryTotal
|
percentage: Gpu.memoryUsed / Gpu.memoryTotal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ WidgetBase {
|
|||||||
return i;
|
return i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
readonly property real size: horizontal ? grid.implicitWidth + Tokens.padding.small * 2 : grid.implicitHeight + Tokens.padding.small * 2
|
readonly property real size: horizontal ? grid.implicitWidth + grid.anchors.leftMargin + grid.anchors.rightMargin : grid.implicitHeight + grid.anchors.bottomMargin + grid.anchors.topMargin
|
||||||
readonly property int spacing: Tokens.spacing.normal / 2
|
readonly property int spacing: Tokens.spacing.medium / 2
|
||||||
|
|
||||||
// Entries that can shrink to nothing, spacing included
|
// Entries that can shrink to nothing, spacing included
|
||||||
function collapsed(entry: var): bool {
|
function collapsed(entry: var): bool {
|
||||||
@@ -40,13 +40,13 @@ WidgetBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bottomLeftRadius: horizontal ? Tokens.rounding.smallest / 2 : Tokens.rounding.full
|
bottomLeftRadius: horizontal ? Tokens.rounding.small / 2 : Tokens.rounding.full
|
||||||
color: Colors.tPalette.m3surfaceContainer
|
color: Colors.tPalette.m3surfaceContainer
|
||||||
implicitHeight: horizontal ? baseSize : size
|
implicitHeight: horizontal ? baseSize : size
|
||||||
implicitWidth: horizontal ? size : baseSize
|
implicitWidth: horizontal ? size : baseSize
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
topLeftRadius: Tokens.rounding.smallest / 2
|
topLeftRadius: Tokens.rounding.small / 2
|
||||||
topRightRadius: horizontal ? Tokens.rounding.full : Tokens.rounding.smallest / 2
|
topRightRadius: horizontal ? Tokens.rounding.full : Tokens.rounding.small / 2
|
||||||
|
|
||||||
Behavior on implicitHeight {
|
Behavior on implicitHeight {
|
||||||
enabled: !root.horizontal
|
enabled: !root.horizontal
|
||||||
@@ -64,11 +64,11 @@ WidgetBase {
|
|||||||
GridLayout {
|
GridLayout {
|
||||||
id: grid
|
id: grid
|
||||||
|
|
||||||
anchors.bottomMargin: root.horizontal ? 0 : Tokens.padding.small
|
anchors.bottomMargin: root.horizontal ? 0 : Tokens.padding.medium
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: root.horizontal ? Tokens.padding.small : 0
|
anchors.leftMargin: root.horizontal ? Tokens.padding.extraSmall : 0
|
||||||
anchors.rightMargin: root.horizontal ? Tokens.padding.small : 0
|
anchors.rightMargin: root.horizontal ? Tokens.padding.extraSmall : 0
|
||||||
anchors.topMargin: root.horizontal ? 0 : Tokens.padding.small
|
anchors.topMargin: root.horizontal ? 0 : Tokens.padding.extraSmall
|
||||||
columns: root.horizontal ? -1 : 1
|
columns: root.horizontal ? -1 : 1
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
@@ -112,7 +112,6 @@ WidgetBase {
|
|||||||
name: "upower"
|
name: "upower"
|
||||||
|
|
||||||
UPowerWidget {
|
UPowerWidget {
|
||||||
horizontal: root.horizontal
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user