mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-25 05:52:50 -05:00
Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ad2a9d704 | ||
|
|
e0ab20dbda | ||
|
|
aadc3111a2 | ||
|
|
741d492084 | ||
|
|
604d55015c | ||
|
|
a4ce39caa5 | ||
|
|
0a82c9877d | ||
|
|
56f5c5eccb | ||
|
|
d20b5adbfa | ||
|
|
10dc86a5dc | ||
|
|
5463aed213 | ||
|
|
f435f0d413 | ||
|
|
521d804763 | ||
|
|
e203ec960a | ||
|
|
830ca10b45 | ||
|
|
4ffa06945a | ||
|
|
b1406fc49a | ||
|
|
f8179167a8 | ||
|
|
32998a5219 | ||
|
|
7fb358bada | ||
|
|
73cf3130e1 | ||
|
|
119b5df6df | ||
|
|
8ede810d32 | ||
|
|
830dd93af5 | ||
|
|
75f28c5ea7 | ||
|
|
6c9b8c590e | ||
|
|
24d9b77307 | ||
|
|
d4be68912c | ||
|
|
a443721000 | ||
|
|
786b097187 | ||
|
|
8ca60c7d2a |
500
.github/workflows/release.yml
vendored
500
.github/workflows/release.yml
vendored
@@ -1,16 +1,19 @@
|
|||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_dispatch:
|
||||||
tags:
|
inputs:
|
||||||
- "v*"
|
tag:
|
||||||
|
description: "Tag to release (e.g., v1.0.1)"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
actions: write
|
actions: write
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: release-${{ github.ref_name }}
|
group: release-${{ inputs.tag }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -24,10 +27,14 @@ jobs:
|
|||||||
run:
|
run:
|
||||||
working-directory: core
|
working-directory: core
|
||||||
|
|
||||||
|
env:
|
||||||
|
TAG: ${{ inputs.tag }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
ref: ${{ inputs.tag }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
@@ -54,7 +61,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -eux
|
set -eux
|
||||||
cd cmd/dankinstall
|
cd cmd/dankinstall
|
||||||
go build -trimpath -ldflags "-s -w -X main.Version=${GITHUB_REF#refs/tags/}" \
|
go build -trimpath -ldflags "-s -w -X main.Version=${TAG}" \
|
||||||
-o ../../dankinstall-${{ matrix.arch }}
|
-o ../../dankinstall-${{ matrix.arch }}
|
||||||
cd ../..
|
cd ../..
|
||||||
gzip -9 -k dankinstall-${{ matrix.arch }}
|
gzip -9 -k dankinstall-${{ matrix.arch }}
|
||||||
@@ -68,7 +75,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -eux
|
set -eux
|
||||||
cd cmd/dms
|
cd cmd/dms
|
||||||
go build -trimpath -ldflags "-s -w -X main.Version=${GITHUB_REF#refs/tags/}" \
|
go build -trimpath -ldflags "-s -w -X main.Version=${TAG}" \
|
||||||
-o ../../dms-${{ matrix.arch }}
|
-o ../../dms-${{ matrix.arch }}
|
||||||
cd ../..
|
cd ../..
|
||||||
gzip -9 -k dms-${{ matrix.arch }}
|
gzip -9 -k dms-${{ matrix.arch }}
|
||||||
@@ -91,7 +98,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -eux
|
set -eux
|
||||||
cd cmd/dms
|
cd cmd/dms
|
||||||
go build -trimpath -tags distro_binary -ldflags "-s -w -X main.Version=${GITHUB_REF#refs/tags/}" \
|
go build -trimpath -tags distro_binary -ldflags "-s -w -X main.Version=${TAG}" \
|
||||||
-o ../../dms-distropkg-${{ matrix.arch }}
|
-o ../../dms-distropkg-${{ matrix.arch }}
|
||||||
cd ../..
|
cd ../..
|
||||||
gzip -9 -k dms-distropkg-${{ matrix.arch }}
|
gzip -9 -k dms-distropkg-${{ matrix.arch }}
|
||||||
@@ -171,17 +178,18 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
needs: [build-core] #, update-versions]
|
needs: [build-core] #, update-versions]
|
||||||
env:
|
env:
|
||||||
TAG: ${{ github.ref_name }}
|
TAG: ${{ inputs.tag }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
ref: ${{ inputs.tag }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Fetch updated tag after version bump
|
- name: Fetch updated tag after version bump
|
||||||
run: |
|
run: |
|
||||||
git fetch origin --force tag ${{ github.ref_name }}
|
git fetch origin --force tag ${TAG}
|
||||||
git checkout ${{ github.ref_name }}
|
git checkout ${TAG}
|
||||||
|
|
||||||
- name: Download core artifacts
|
- name: Download core artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@@ -388,288 +396,296 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
trigger-obs-update:
|
# trigger-obs-update:
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
needs: release
|
# needs: release
|
||||||
steps:
|
# env:
|
||||||
- name: Checkout
|
# TAG: ${{ inputs.tag }}
|
||||||
uses: actions/checkout@v4
|
# steps:
|
||||||
|
# - name: Checkout
|
||||||
|
# uses: actions/checkout@v4
|
||||||
|
# with:
|
||||||
|
# ref: ${{ inputs.tag }}
|
||||||
|
|
||||||
- name: Install OSC
|
# - name: Install OSC
|
||||||
run: |
|
# run: |
|
||||||
sudo apt-get update
|
# sudo apt-get update
|
||||||
sudo apt-get install -y osc
|
# sudo apt-get install -y osc
|
||||||
|
|
||||||
mkdir -p ~/.config/osc
|
# mkdir -p ~/.config/osc
|
||||||
cat > ~/.config/osc/oscrc << EOF
|
# cat > ~/.config/osc/oscrc << EOF
|
||||||
[general]
|
# [general]
|
||||||
apiurl = https://api.opensuse.org
|
# apiurl = https://api.opensuse.org
|
||||||
|
|
||||||
[https://api.opensuse.org]
|
# [https://api.opensuse.org]
|
||||||
user = ${{ secrets.OBS_USERNAME }}
|
# user = ${{ secrets.OBS_USERNAME }}
|
||||||
pass = ${{ secrets.OBS_PASSWORD }}
|
# pass = ${{ secrets.OBS_PASSWORD }}
|
||||||
EOF
|
# EOF
|
||||||
chmod 600 ~/.config/osc/oscrc
|
# chmod 600 ~/.config/osc/oscrc
|
||||||
|
|
||||||
- name: Update OBS packages
|
# - name: Update OBS packages
|
||||||
run: |
|
# run: |
|
||||||
VERSION="${{ github.ref_name }}"
|
# cd distro
|
||||||
cd distro
|
# bash scripts/obs-upload.sh dms "Update to ${TAG}"
|
||||||
bash scripts/obs-upload.sh dms "Update to $VERSION"
|
|
||||||
|
|
||||||
trigger-ppa-update:
|
# trigger-ppa-update:
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
needs: release
|
# needs: release
|
||||||
steps:
|
# env:
|
||||||
- name: Checkout
|
# TAG: ${{ inputs.tag }}
|
||||||
uses: actions/checkout@v4
|
# steps:
|
||||||
|
# - name: Checkout
|
||||||
|
# uses: actions/checkout@v4
|
||||||
|
# with:
|
||||||
|
# ref: ${{ inputs.tag }}
|
||||||
|
|
||||||
- name: Install build dependencies
|
# - name: Install build dependencies
|
||||||
run: |
|
# run: |
|
||||||
sudo apt-get update
|
# sudo apt-get update
|
||||||
sudo apt-get install -y \
|
# sudo apt-get install -y \
|
||||||
debhelper \
|
# debhelper \
|
||||||
devscripts \
|
# devscripts \
|
||||||
dput \
|
# dput \
|
||||||
lftp \
|
# lftp \
|
||||||
build-essential \
|
# build-essential \
|
||||||
fakeroot \
|
# fakeroot \
|
||||||
dpkg-dev
|
# dpkg-dev
|
||||||
|
|
||||||
- name: Configure GPG
|
# - name: Configure GPG
|
||||||
env:
|
# env:
|
||||||
GPG_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
# GPG_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
run: |
|
# run: |
|
||||||
echo "$GPG_KEY" | gpg --import
|
# echo "$GPG_KEY" | gpg --import
|
||||||
GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep sec | awk '{print $2}' | cut -d'/' -f2)
|
# GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep sec | awk '{print $2}' | cut -d'/' -f2)
|
||||||
echo "DEBSIGN_KEYID=$GPG_KEY_ID" >> $GITHUB_ENV
|
# echo "DEBSIGN_KEYID=$GPG_KEY_ID" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Upload to PPA
|
# - name: Upload to PPA
|
||||||
run: |
|
# run: |
|
||||||
VERSION="${{ github.ref_name }}"
|
# cd distro/ubuntu/ppa
|
||||||
cd distro/ubuntu/ppa
|
# bash create-and-upload.sh ../dms dms questing
|
||||||
bash create-and-upload.sh ../dms dms questing
|
|
||||||
|
|
||||||
copr-build:
|
# copr-build:
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
needs: release
|
# needs: release
|
||||||
env:
|
# env:
|
||||||
TAG: ${{ github.ref_name }}
|
# TAG: ${{ inputs.tag }}
|
||||||
|
|
||||||
steps:
|
# steps:
|
||||||
- name: Checkout repository
|
# - name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
# uses: actions/checkout@v4
|
||||||
|
# with:
|
||||||
|
# ref: ${{ inputs.tag }}
|
||||||
|
|
||||||
- name: Determine version
|
# - name: Determine version
|
||||||
id: version
|
# id: version
|
||||||
run: |
|
# run: |
|
||||||
VERSION="${TAG#v}"
|
# VERSION="${TAG#v}"
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
# echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
echo "Building DMS stable version: $VERSION"
|
# echo "Building DMS stable version: $VERSION"
|
||||||
|
|
||||||
- name: Setup build environment
|
# - name: Setup build environment
|
||||||
run: |
|
# run: |
|
||||||
sudo apt-get update
|
# sudo apt-get update
|
||||||
sudo apt-get install -y rpm wget curl jq gzip
|
# sudo apt-get install -y rpm wget curl jq gzip
|
||||||
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
|
# mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
|
||||||
|
|
||||||
- name: Download release assets
|
# - name: Download release assets
|
||||||
run: |
|
# run: |
|
||||||
VERSION="${{ steps.version.outputs.version }}"
|
# VERSION="${{ steps.version.outputs.version }}"
|
||||||
cd ~/rpmbuild/SOURCES
|
# cd ~/rpmbuild/SOURCES
|
||||||
|
|
||||||
wget "https://github.com/AvengeMedia/DankMaterialShell/releases/download/v${VERSION}/dms-qml.tar.gz" || {
|
# wget "https://github.com/AvengeMedia/DankMaterialShell/releases/download/v${VERSION}/dms-qml.tar.gz" || {
|
||||||
echo "Failed to download dms-qml.tar.gz for v${VERSION}"
|
# echo "Failed to download dms-qml.tar.gz for v${VERSION}"
|
||||||
exit 1
|
# exit 1
|
||||||
}
|
# }
|
||||||
|
|
||||||
- name: Generate stable spec file
|
# - name: Generate stable spec file
|
||||||
run: |
|
# run: |
|
||||||
VERSION="${{ steps.version.outputs.version }}"
|
# VERSION="${{ steps.version.outputs.version }}"
|
||||||
CHANGELOG_DATE="$(date '+%a %b %d %Y')"
|
# CHANGELOG_DATE="$(date '+%a %b %d %Y')"
|
||||||
|
|
||||||
cat > ~/rpmbuild/SPECS/dms.spec <<'SPECEOF'
|
# cat > ~/rpmbuild/SPECS/dms.spec <<'SPECEOF'
|
||||||
# Spec for DMS stable releases - Generated by GitHub Actions
|
# # Spec for DMS stable releases - Generated by GitHub Actions
|
||||||
|
|
||||||
%global debug_package %{nil}
|
# %global debug_package %{nil}
|
||||||
%global version VERSION_PLACEHOLDER
|
# %global version VERSION_PLACEHOLDER
|
||||||
%global pkg_summary DankMaterialShell - Material 3 inspired shell for Wayland compositors
|
# %global pkg_summary DankMaterialShell - Material 3 inspired shell for Wayland compositors
|
||||||
|
|
||||||
Name: dms
|
# Name: dms
|
||||||
Version: %{version}
|
# Version: %{version}
|
||||||
Release: 1%{?dist}
|
# Release: 1%{?dist}
|
||||||
Summary: %{pkg_summary}
|
# Summary: %{pkg_summary}
|
||||||
|
|
||||||
License: MIT
|
# License: MIT
|
||||||
URL: https://github.com/AvengeMedia/DankMaterialShell
|
# URL: https://github.com/AvengeMedia/DankMaterialShell
|
||||||
|
|
||||||
Source0: dms-qml.tar.gz
|
# Source0: dms-qml.tar.gz
|
||||||
|
|
||||||
BuildRequires: gzip
|
# BuildRequires: gzip
|
||||||
BuildRequires: wget
|
# BuildRequires: wget
|
||||||
BuildRequires: systemd-rpm-macros
|
# BuildRequires: systemd-rpm-macros
|
||||||
|
|
||||||
Requires: (quickshell or quickshell-git)
|
# Requires: (quickshell or quickshell-git)
|
||||||
Requires: accountsservice
|
# Requires: accountsservice
|
||||||
Requires: dms-cli = %{version}-%{release}
|
# Requires: dms-cli = %{version}-%{release}
|
||||||
Requires: dgop
|
# Requires: dgop
|
||||||
|
|
||||||
Recommends: cava
|
# Recommends: cava
|
||||||
Recommends: cliphist
|
# Recommends: cliphist
|
||||||
Recommends: danksearch
|
# Recommends: danksearch
|
||||||
Recommends: matugen
|
# Recommends: matugen
|
||||||
Recommends: wl-clipboard
|
# Recommends: wl-clipboard
|
||||||
Recommends: NetworkManager
|
# Recommends: NetworkManager
|
||||||
Recommends: qt6-qtmultimedia
|
# Recommends: qt6-qtmultimedia
|
||||||
Suggests: qt6ct
|
# Suggests: qt6ct
|
||||||
|
|
||||||
%description
|
# %description
|
||||||
DankMaterialShell (DMS) is a modern Wayland desktop shell built with Quickshell
|
# DankMaterialShell (DMS) is a modern Wayland desktop shell built with Quickshell
|
||||||
and optimized for the niri and hyprland compositors. Features notifications,
|
# and optimized for the niri and hyprland compositors. Features notifications,
|
||||||
app launcher, wallpaper customization, and fully customizable with plugins.
|
# app launcher, wallpaper customization, and fully customizable with plugins.
|
||||||
|
|
||||||
Includes auto-theming for GTK/Qt apps with matugen, 20+ customizable widgets,
|
# Includes auto-theming for GTK/Qt apps with matugen, 20+ customizable widgets,
|
||||||
process monitoring, notification center, clipboard history, dock, control center,
|
# process monitoring, notification center, clipboard history, dock, control center,
|
||||||
lock screen, and comprehensive plugin system.
|
# lock screen, and comprehensive plugin system.
|
||||||
|
|
||||||
%package -n dms-cli
|
# %package -n dms-cli
|
||||||
Summary: DankMaterialShell CLI tool
|
# Summary: DankMaterialShell CLI tool
|
||||||
License: MIT
|
# License: MIT
|
||||||
URL: https://github.com/AvengeMedia/DankMaterialShell
|
# URL: https://github.com/AvengeMedia/DankMaterialShell
|
||||||
|
|
||||||
%description -n dms-cli
|
# %description -n dms-cli
|
||||||
Command-line interface for DankMaterialShell configuration and management.
|
# Command-line interface for DankMaterialShell configuration and management.
|
||||||
Provides native DBus bindings, NetworkManager integration, and system utilities.
|
# Provides native DBus bindings, NetworkManager integration, and system utilities.
|
||||||
|
|
||||||
%prep
|
# %prep
|
||||||
%setup -q -c -n dms-qml
|
# %setup -q -c -n dms-qml
|
||||||
|
|
||||||
# Download architecture-specific binaries during build
|
# # Download architecture-specific binaries during build
|
||||||
case "%{_arch}" in
|
# case "%{_arch}" in
|
||||||
x86_64)
|
# x86_64)
|
||||||
ARCH_SUFFIX="amd64"
|
# ARCH_SUFFIX="amd64"
|
||||||
;;
|
# ;;
|
||||||
aarch64)
|
# aarch64)
|
||||||
ARCH_SUFFIX="arm64"
|
# ARCH_SUFFIX="arm64"
|
||||||
;;
|
# ;;
|
||||||
*)
|
# *)
|
||||||
echo "Unsupported architecture: %{_arch}"
|
# echo "Unsupported architecture: %{_arch}"
|
||||||
exit 1
|
# exit 1
|
||||||
;;
|
# ;;
|
||||||
esac
|
# esac
|
||||||
|
|
||||||
wget -O %{_builddir}/dms-cli.gz "https://github.com/AvengeMedia/DankMaterialShell/releases/latest/download/dms-distropkg-${ARCH_SUFFIX}.gz" || {
|
# wget -O %{_builddir}/dms-cli.gz "https://github.com/AvengeMedia/DankMaterialShell/releases/latest/download/dms-distropkg-${ARCH_SUFFIX}.gz" || {
|
||||||
echo "Failed to download dms-cli for architecture %{_arch}"
|
# echo "Failed to download dms-cli for architecture %{_arch}"
|
||||||
exit 1
|
# exit 1
|
||||||
}
|
# }
|
||||||
gunzip -c %{_builddir}/dms-cli.gz > %{_builddir}/dms-cli
|
# gunzip -c %{_builddir}/dms-cli.gz > %{_builddir}/dms-cli
|
||||||
chmod +x %{_builddir}/dms-cli
|
# chmod +x %{_builddir}/dms-cli
|
||||||
|
|
||||||
%build
|
# %build
|
||||||
|
|
||||||
%install
|
# %install
|
||||||
install -Dm755 %{_builddir}/dms-cli %{buildroot}%{_bindir}/dms
|
# install -Dm755 %{_builddir}/dms-cli %{buildroot}%{_bindir}/dms
|
||||||
|
|
||||||
install -d %{buildroot}%{_datadir}/bash-completion/completions
|
# install -d %{buildroot}%{_datadir}/bash-completion/completions
|
||||||
install -d %{buildroot}%{_datadir}/zsh/site-functions
|
# install -d %{buildroot}%{_datadir}/zsh/site-functions
|
||||||
install -d %{buildroot}%{_datadir}/fish/vendor_completions.d
|
# install -d %{buildroot}%{_datadir}/fish/vendor_completions.d
|
||||||
%{_builddir}/dms-cli completion bash > %{buildroot}%{_datadir}/bash-completion/completions/dms || :
|
# %{_builddir}/dms-cli completion bash > %{buildroot}%{_datadir}/bash-completion/completions/dms || :
|
||||||
%{_builddir}/dms-cli completion zsh > %{buildroot}%{_datadir}/zsh/site-functions/_dms || :
|
# %{_builddir}/dms-cli completion zsh > %{buildroot}%{_datadir}/zsh/site-functions/_dms || :
|
||||||
%{_builddir}/dms-cli completion fish > %{buildroot}%{_datadir}/fish/vendor_completions.d/dms.fish || :
|
# %{_builddir}/dms-cli completion fish > %{buildroot}%{_datadir}/fish/vendor_completions.d/dms.fish || :
|
||||||
|
|
||||||
install -Dm644 assets/systemd/dms.service %{buildroot}%{_userunitdir}/dms.service
|
# install -Dm644 assets/systemd/dms.service %{buildroot}%{_userunitdir}/dms.service
|
||||||
|
|
||||||
install -Dm644 assets/dms-open.desktop %{buildroot}%{_datadir}/applications/dms-open.desktop
|
# install -Dm644 assets/dms-open.desktop %{buildroot}%{_datadir}/applications/dms-open.desktop
|
||||||
install -Dm644 assets/danklogo.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/danklogo.svg
|
# install -Dm644 assets/danklogo.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/danklogo.svg
|
||||||
|
|
||||||
install -dm755 %{buildroot}%{_datadir}/quickshell/dms
|
# install -dm755 %{buildroot}%{_datadir}/quickshell/dms
|
||||||
cp -r %{_builddir}/dms-qml/* %{buildroot}%{_datadir}/quickshell/dms/
|
# cp -r %{_builddir}/dms-qml/* %{buildroot}%{_datadir}/quickshell/dms/
|
||||||
|
|
||||||
rm -rf %{buildroot}%{_datadir}/quickshell/dms/.git*
|
# rm -rf %{buildroot}%{_datadir}/quickshell/dms/.git*
|
||||||
rm -f %{buildroot}%{_datadir}/quickshell/dms/.gitignore
|
# rm -f %{buildroot}%{_datadir}/quickshell/dms/.gitignore
|
||||||
rm -rf %{buildroot}%{_datadir}/quickshell/dms/.github
|
# rm -rf %{buildroot}%{_datadir}/quickshell/dms/.github
|
||||||
rm -rf %{buildroot}%{_datadir}/quickshell/dms/distro
|
# rm -rf %{buildroot}%{_datadir}/quickshell/dms/distro
|
||||||
|
|
||||||
echo "%{version}" > %{buildroot}%{_datadir}/quickshell/dms/VERSION
|
# echo "%{version}" > %{buildroot}%{_datadir}/quickshell/dms/VERSION
|
||||||
|
|
||||||
%posttrans
|
# %posttrans
|
||||||
if [ -d "%{_sysconfdir}/xdg/quickshell/dms" ]; then
|
# if [ -d "%{_sysconfdir}/xdg/quickshell/dms" ]; then
|
||||||
rmdir "%{_sysconfdir}/xdg/quickshell/dms" 2>/dev/null || true
|
# rmdir "%{_sysconfdir}/xdg/quickshell/dms" 2>/dev/null || true
|
||||||
rmdir "%{_sysconfdir}/xdg/quickshell" 2>/dev/null || true
|
# rmdir "%{_sysconfdir}/xdg/quickshell" 2>/dev/null || true
|
||||||
rmdir "%{_sysconfdir}/xdg" 2>/dev/null || true
|
# rmdir "%{_sysconfdir}/xdg" 2>/dev/null || true
|
||||||
fi
|
# fi
|
||||||
# Signal running DMS instances to reload
|
# # Signal running DMS instances to reload
|
||||||
pkill -USR1 -x dms >/dev/null 2>&1 || :
|
# pkill -USR1 -x dms >/dev/null 2>&1 || :
|
||||||
|
|
||||||
%files
|
# %files
|
||||||
%license LICENSE
|
# %license LICENSE
|
||||||
%doc README.md CONTRIBUTING.md
|
# %doc README.md CONTRIBUTING.md
|
||||||
%{_datadir}/quickshell/dms/
|
# %{_datadir}/quickshell/dms/
|
||||||
%{_userunitdir}/dms.service
|
# %{_userunitdir}/dms.service
|
||||||
%{_datadir}/applications/dms-open.desktop
|
# %{_datadir}/applications/dms-open.desktop
|
||||||
%{_datadir}/icons/hicolor/scalable/apps/danklogo.svg
|
# %{_datadir}/icons/hicolor/scalable/apps/danklogo.svg
|
||||||
|
|
||||||
%files -n dms-cli
|
# %files -n dms-cli
|
||||||
%{_bindir}/dms
|
# %{_bindir}/dms
|
||||||
%{_datadir}/bash-completion/completions/dms
|
# %{_datadir}/bash-completion/completions/dms
|
||||||
%{_datadir}/zsh/site-functions/_dms
|
# %{_datadir}/zsh/site-functions/_dms
|
||||||
%{_datadir}/fish/vendor_completions.d/dms.fish
|
# %{_datadir}/fish/vendor_completions.d/dms.fish
|
||||||
|
|
||||||
%changelog
|
# %changelog
|
||||||
* CHANGELOG_DATE_PLACEHOLDER AvengeMedia <contact@avengemedia.com> - VERSION_PLACEHOLDER-1
|
# * CHANGELOG_DATE_PLACEHOLDER AvengeMedia <contact@avengemedia.com> - VERSION_PLACEHOLDER-1
|
||||||
- Stable release VERSION_PLACEHOLDER
|
# - Stable release VERSION_PLACEHOLDER
|
||||||
- Built from GitHub release
|
# - Built from GitHub release
|
||||||
SPECEOF
|
# SPECEOF
|
||||||
|
|
||||||
sed -i "s/VERSION_PLACEHOLDER/${VERSION}/g" ~/rpmbuild/SPECS/dms.spec
|
# sed -i "s/VERSION_PLACEHOLDER/${VERSION}/g" ~/rpmbuild/SPECS/dms.spec
|
||||||
sed -i "s/CHANGELOG_DATE_PLACEHOLDER/${CHANGELOG_DATE}/g" ~/rpmbuild/SPECS/dms.spec
|
# sed -i "s/CHANGELOG_DATE_PLACEHOLDER/${CHANGELOG_DATE}/g" ~/rpmbuild/SPECS/dms.spec
|
||||||
|
|
||||||
- name: Build SRPM
|
# - name: Build SRPM
|
||||||
id: build
|
# id: build
|
||||||
run: |
|
# run: |
|
||||||
cd ~/rpmbuild/SPECS
|
# cd ~/rpmbuild/SPECS
|
||||||
rpmbuild -bs dms.spec
|
# rpmbuild -bs dms.spec
|
||||||
|
|
||||||
SRPM=$(ls ~/rpmbuild/SRPMS/*.src.rpm | tail -n 1)
|
# SRPM=$(ls ~/rpmbuild/SRPMS/*.src.rpm | tail -n 1)
|
||||||
SRPM_NAME=$(basename "$SRPM")
|
# SRPM_NAME=$(basename "$SRPM")
|
||||||
|
|
||||||
echo "srpm_path=$SRPM" >> $GITHUB_OUTPUT
|
# echo "srpm_path=$SRPM" >> $GITHUB_OUTPUT
|
||||||
echo "srpm_name=$SRPM_NAME" >> $GITHUB_OUTPUT
|
# echo "srpm_name=$SRPM_NAME" >> $GITHUB_OUTPUT
|
||||||
echo "SRPM built: $SRPM_NAME"
|
# echo "SRPM built: $SRPM_NAME"
|
||||||
|
|
||||||
- name: Upload SRPM artifact
|
# - name: Upload SRPM artifact
|
||||||
uses: actions/upload-artifact@v4
|
# uses: actions/upload-artifact@v4
|
||||||
with:
|
# with:
|
||||||
name: dms-stable-srpm-${{ steps.version.outputs.version }}
|
# name: dms-stable-srpm-${{ steps.version.outputs.version }}
|
||||||
path: ${{ steps.build.outputs.srpm_path }}
|
# path: ${{ steps.build.outputs.srpm_path }}
|
||||||
retention-days: 90
|
# retention-days: 90
|
||||||
|
|
||||||
- name: Install Copr CLI
|
# - name: Install Copr CLI
|
||||||
run: |
|
# run: |
|
||||||
sudo apt-get install -y python3-pip
|
# sudo apt-get install -y python3-pip
|
||||||
pip3 install copr-cli
|
# pip3 install copr-cli
|
||||||
|
|
||||||
mkdir -p ~/.config
|
# mkdir -p ~/.config
|
||||||
cat > ~/.config/copr << EOF
|
# cat > ~/.config/copr << EOF
|
||||||
[copr-cli]
|
# [copr-cli]
|
||||||
login = ${{ secrets.COPR_LOGIN }}
|
# login = ${{ secrets.COPR_LOGIN }}
|
||||||
username = avengemedia
|
# username = avengemedia
|
||||||
token = ${{ secrets.COPR_TOKEN }}
|
# token = ${{ secrets.COPR_TOKEN }}
|
||||||
copr_url = https://copr.fedorainfracloud.org
|
# copr_url = https://copr.fedorainfracloud.org
|
||||||
EOF
|
# EOF
|
||||||
chmod 600 ~/.config/copr
|
# chmod 600 ~/.config/copr
|
||||||
|
|
||||||
- name: Upload to Copr
|
# - name: Upload to Copr
|
||||||
run: |
|
# run: |
|
||||||
SRPM="${{ steps.build.outputs.srpm_path }}"
|
# SRPM="${{ steps.build.outputs.srpm_path }}"
|
||||||
VERSION="${{ steps.version.outputs.version }}"
|
# VERSION="${{ steps.version.outputs.version }}"
|
||||||
|
|
||||||
echo "Uploading SRPM to avengemedia/dms..."
|
# echo "Uploading SRPM to avengemedia/dms..."
|
||||||
BUILD_OUTPUT=$(copr-cli build avengemedia/dms "$SRPM" --nowait 2>&1)
|
# BUILD_OUTPUT=$(copr-cli build avengemedia/dms "$SRPM" --nowait 2>&1)
|
||||||
echo "$BUILD_OUTPUT"
|
# echo "$BUILD_OUTPUT"
|
||||||
|
|
||||||
BUILD_ID=$(echo "$BUILD_OUTPUT" | grep -oP 'Build was added to.*\K[0-9]+' || echo "unknown")
|
# BUILD_ID=$(echo "$BUILD_OUTPUT" | grep -oP 'Build was added to.*\K[0-9]+' || echo "unknown")
|
||||||
|
|
||||||
if [ "$BUILD_ID" != "unknown" ]; then
|
# if [ "$BUILD_ID" != "unknown" ]; then
|
||||||
echo "Build submitted: https://copr.fedorainfracloud.org/coprs/avengemedia/dms/build/$BUILD_ID/"
|
# echo "Build submitted: https://copr.fedorainfracloud.org/coprs/avengemedia/dms/build/$BUILD_ID/"
|
||||||
fi
|
# fi
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ func runShellInteractive(session bool) {
|
|||||||
errChan <- fmt.Errorf("server panic: %v", r)
|
errChan <- fmt.Errorf("server panic: %v", r)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
server.CLIVersion = Version
|
||||||
if err := server.Start(false); err != nil {
|
if err := server.Start(false); err != nil {
|
||||||
errChan <- fmt.Errorf("server error: %w", err)
|
errChan <- fmt.Errorf("server error: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
314
core/internal/colorpicker/state_test.go
Normal file
314
core/internal/colorpicker/state_test.go
Normal file
@@ -0,0 +1,314 @@
|
|||||||
|
package colorpicker
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestSurfaceState_ConcurrentPointerMotion(t *testing.T) {
|
||||||
|
s := NewSurfaceState(FormatHex, false)
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 50
|
||||||
|
const iterations = 100
|
||||||
|
|
||||||
|
for i := 0; i < goroutines; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(id int) {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
s.OnPointerMotion(float64(id*10+j), float64(id*10+j))
|
||||||
|
}
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSurfaceState_ConcurrentScaleAccess(t *testing.T) {
|
||||||
|
s := NewSurfaceState(FormatHex, false)
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 30
|
||||||
|
const iterations = 100
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(id int) {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
s.SetScale(int32(id%3 + 1))
|
||||||
|
}
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
scale := s.Scale()
|
||||||
|
assert.GreaterOrEqual(t, scale, int32(1))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSurfaceState_ConcurrentLogicalSize(t *testing.T) {
|
||||||
|
s := NewSurfaceState(FormatHex, false)
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 20
|
||||||
|
const iterations = 100
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(id int) {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
_ = s.OnLayerConfigure(1920+id, 1080+j)
|
||||||
|
}
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
w, h := s.LogicalSize()
|
||||||
|
_ = w
|
||||||
|
_ = h
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSurfaceState_ConcurrentIsDone(t *testing.T) {
|
||||||
|
s := NewSurfaceState(FormatHex, false)
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 30
|
||||||
|
const iterations = 100
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/3; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
s.OnPointerButton(0x110, 1)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/3; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
s.OnKey(1, 1)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/3; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
picked, cancelled := s.IsDone()
|
||||||
|
_ = picked
|
||||||
|
_ = cancelled
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSurfaceState_ConcurrentIsReady(t *testing.T) {
|
||||||
|
s := NewSurfaceState(FormatHex, false)
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 20
|
||||||
|
const iterations = 100
|
||||||
|
|
||||||
|
for i := 0; i < goroutines; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
_ = s.IsReady()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSurfaceState_ConcurrentSwapBuffers(t *testing.T) {
|
||||||
|
s := NewSurfaceState(FormatHex, false)
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 20
|
||||||
|
const iterations = 100
|
||||||
|
|
||||||
|
for i := 0; i < goroutines; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
s.SwapBuffers()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSurfaceState_ZeroScale(t *testing.T) {
|
||||||
|
s := NewSurfaceState(FormatHex, false)
|
||||||
|
s.SetScale(0)
|
||||||
|
assert.Equal(t, int32(1), s.Scale())
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSurfaceState_NegativeScale(t *testing.T) {
|
||||||
|
s := NewSurfaceState(FormatHex, false)
|
||||||
|
s.SetScale(-5)
|
||||||
|
assert.Equal(t, int32(1), s.Scale())
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSurfaceState_ZeroDimensionConfigure(t *testing.T) {
|
||||||
|
s := NewSurfaceState(FormatHex, false)
|
||||||
|
|
||||||
|
err := s.OnLayerConfigure(0, 100)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
err = s.OnLayerConfigure(100, 0)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
err = s.OnLayerConfigure(-1, 100)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
w, h := s.LogicalSize()
|
||||||
|
assert.Equal(t, 0, w)
|
||||||
|
assert.Equal(t, 0, h)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSurfaceState_PickColorNilBuffer(t *testing.T) {
|
||||||
|
s := NewSurfaceState(FormatHex, false)
|
||||||
|
color, ok := s.PickColor()
|
||||||
|
assert.False(t, ok)
|
||||||
|
assert.Equal(t, Color{}, color)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSurfaceState_RedrawNilBuffer(t *testing.T) {
|
||||||
|
s := NewSurfaceState(FormatHex, false)
|
||||||
|
buf := s.Redraw()
|
||||||
|
assert.Nil(t, buf)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSurfaceState_RedrawScreenOnlyNilBuffer(t *testing.T) {
|
||||||
|
s := NewSurfaceState(FormatHex, false)
|
||||||
|
buf := s.RedrawScreenOnly()
|
||||||
|
assert.Nil(t, buf)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSurfaceState_FrontRenderBufferNil(t *testing.T) {
|
||||||
|
s := NewSurfaceState(FormatHex, false)
|
||||||
|
buf := s.FrontRenderBuffer()
|
||||||
|
assert.Nil(t, buf)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSurfaceState_ScreenBufferNil(t *testing.T) {
|
||||||
|
s := NewSurfaceState(FormatHex, false)
|
||||||
|
buf := s.ScreenBuffer()
|
||||||
|
assert.Nil(t, buf)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSurfaceState_DestroyMultipleTimes(t *testing.T) {
|
||||||
|
s := NewSurfaceState(FormatHex, false)
|
||||||
|
s.Destroy()
|
||||||
|
s.Destroy()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestClamp(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
v, lo, hi, expected int
|
||||||
|
}{
|
||||||
|
{5, 0, 10, 5},
|
||||||
|
{-5, 0, 10, 0},
|
||||||
|
{15, 0, 10, 10},
|
||||||
|
{0, 0, 10, 0},
|
||||||
|
{10, 0, 10, 10},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
result := clamp(tt.v, tt.lo, tt.hi)
|
||||||
|
assert.Equal(t, tt.expected, result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestClampF(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
v, lo, hi, expected float64
|
||||||
|
}{
|
||||||
|
{5.0, 0.0, 10.0, 5.0},
|
||||||
|
{-5.0, 0.0, 10.0, 0.0},
|
||||||
|
{15.0, 0.0, 10.0, 10.0},
|
||||||
|
{0.0, 0.0, 10.0, 0.0},
|
||||||
|
{10.0, 0.0, 10.0, 10.0},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
result := clampF(tt.v, tt.lo, tt.hi)
|
||||||
|
assert.InDelta(t, tt.expected, result, 0.001)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestAbs(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
v, expected int
|
||||||
|
}{
|
||||||
|
{5, 5},
|
||||||
|
{-5, 5},
|
||||||
|
{0, 0},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
result := abs(tt.v)
|
||||||
|
assert.Equal(t, tt.expected, result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestBlendColors(t *testing.T) {
|
||||||
|
bg := Color{R: 0, G: 0, B: 0, A: 255}
|
||||||
|
fg := Color{R: 255, G: 255, B: 255, A: 255}
|
||||||
|
|
||||||
|
result := blendColors(bg, fg, 0.0)
|
||||||
|
assert.Equal(t, bg.R, result.R)
|
||||||
|
assert.Equal(t, bg.G, result.G)
|
||||||
|
assert.Equal(t, bg.B, result.B)
|
||||||
|
|
||||||
|
result = blendColors(bg, fg, 1.0)
|
||||||
|
assert.Equal(t, fg.R, result.R)
|
||||||
|
assert.Equal(t, fg.G, result.G)
|
||||||
|
assert.Equal(t, fg.B, result.B)
|
||||||
|
|
||||||
|
result = blendColors(bg, fg, 0.5)
|
||||||
|
assert.InDelta(t, 127, int(result.R), 1)
|
||||||
|
assert.InDelta(t, 127, int(result.G), 1)
|
||||||
|
assert.InDelta(t, 127, int(result.B), 1)
|
||||||
|
|
||||||
|
result = blendColors(bg, fg, -1.0)
|
||||||
|
assert.Equal(t, bg.R, result.R)
|
||||||
|
|
||||||
|
result = blendColors(bg, fg, 2.0)
|
||||||
|
assert.Equal(t, fg.R, result.R)
|
||||||
|
}
|
||||||
@@ -277,4 +277,4 @@ bind = CTRL, Print, exec, dms screenshot full
|
|||||||
bind = ALT, Print, exec, dms screenshot window
|
bind = ALT, Print, exec, dms screenshot window
|
||||||
|
|
||||||
# === System Controls ===
|
# === System Controls ===
|
||||||
bind = $mod SHIFT, P, dpms, off
|
bind = $mod SHIFT, P, dpms, toggle
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ func (a *ArchDistribution) InstallPackages(ctx context.Context, dependencies []d
|
|||||||
a.log(fmt.Sprintf("Warning: failed to write window manager config: %v", err))
|
a.log(fmt.Sprintf("Warning: failed to write window manager config: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := a.EnableDMSService(ctx); err != nil {
|
if err := a.EnableDMSService(ctx, wm); err != nil {
|
||||||
a.log(fmt.Sprintf("Warning: failed to enable dms service: %v", err))
|
a.log(fmt.Sprintf("Warning: failed to enable dms service: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -597,12 +597,24 @@ TERMINAL=%s
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BaseDistribution) EnableDMSService(ctx context.Context) error {
|
func (b *BaseDistribution) EnableDMSService(ctx context.Context, wm deps.WindowManager) error {
|
||||||
cmd := exec.CommandContext(ctx, "systemctl", "--user", "enable", "--now", "dms")
|
cmd := exec.CommandContext(ctx, "systemctl", "--user", "enable", "--now", "dms")
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
return fmt.Errorf("failed to enable dms service: %w", err)
|
return fmt.Errorf("failed to enable dms service: %w", err)
|
||||||
}
|
}
|
||||||
b.log("Enabled dms systemd user service")
|
b.log("Enabled dms systemd user service")
|
||||||
|
|
||||||
|
switch wm {
|
||||||
|
case deps.WindowManagerNiri:
|
||||||
|
if err := exec.CommandContext(ctx, "systemctl", "--user", "add-wants", "niri.service", "dms").Run(); err != nil {
|
||||||
|
b.log("Warning: failed to add dms as a want for niri.service")
|
||||||
|
}
|
||||||
|
case deps.WindowManagerHyprland:
|
||||||
|
if err := exec.CommandContext(ctx, "systemctl", "--user", "add-wants", "hyprland-session.target", "dms").Run(); err != nil {
|
||||||
|
b.log("Warning: failed to add dms as a want for hyprland-session.target")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ func (d *DebianDistribution) InstallPackages(ctx context.Context, dependencies [
|
|||||||
d.log(fmt.Sprintf("Warning: failed to write window manager config: %v", err))
|
d.log(fmt.Sprintf("Warning: failed to write window manager config: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := d.EnableDMSService(ctx); err != nil {
|
if err := d.EnableDMSService(ctx, wm); err != nil {
|
||||||
d.log(fmt.Sprintf("Warning: failed to enable dms service: %v", err))
|
d.log(fmt.Sprintf("Warning: failed to enable dms service: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ func (f *FedoraDistribution) InstallPackages(ctx context.Context, dependencies [
|
|||||||
f.log(fmt.Sprintf("Warning: failed to write window manager config: %v", err))
|
f.log(fmt.Sprintf("Warning: failed to write window manager config: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := f.EnableDMSService(ctx); err != nil {
|
if err := f.EnableDMSService(ctx, wm); err != nil {
|
||||||
f.log(fmt.Sprintf("Warning: failed to enable dms service: %v", err))
|
f.log(fmt.Sprintf("Warning: failed to enable dms service: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ func (g *GentooDistribution) InstallPackages(ctx context.Context, dependencies [
|
|||||||
g.log(fmt.Sprintf("Warning: failed to write window manager config: %v", err))
|
g.log(fmt.Sprintf("Warning: failed to write window manager config: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := g.EnableDMSService(ctx); err != nil {
|
if err := g.EnableDMSService(ctx, wm); err != nil {
|
||||||
g.log(fmt.Sprintf("Warning: failed to enable dms service: %v", err))
|
g.log(fmt.Sprintf("Warning: failed to enable dms service: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ func (o *OpenSUSEDistribution) InstallPackages(ctx context.Context, dependencies
|
|||||||
o.log(fmt.Sprintf("Warning: failed to write window manager config: %v", err))
|
o.log(fmt.Sprintf("Warning: failed to write window manager config: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := o.EnableDMSService(ctx); err != nil {
|
if err := o.EnableDMSService(ctx, wm); err != nil {
|
||||||
o.log(fmt.Sprintf("Warning: failed to enable dms service: %v", err))
|
o.log(fmt.Sprintf("Warning: failed to enable dms service: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ func (u *UbuntuDistribution) InstallPackages(ctx context.Context, dependencies [
|
|||||||
u.log(fmt.Sprintf("Warning: failed to write window manager config: %v", err))
|
u.log(fmt.Sprintf("Warning: failed to write window manager config: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := u.EnableDMSService(ctx); err != nil {
|
if err := u.EnableDMSService(ctx, wm); err != nil {
|
||||||
u.log(fmt.Sprintf("Warning: failed to enable dms service: %v", err))
|
u.log(fmt.Sprintf("Warning: failed to enable dms service: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/AvengeMedia/DankMaterialShell/core/internal/keybinds"
|
"github.com/AvengeMedia/DankMaterialShell/core/internal/keybinds"
|
||||||
@@ -153,6 +154,7 @@ func (n *NiriProvider) convertKeybind(kb *NiriKeyBinding, subcategory string, co
|
|||||||
Subcategory: subcategory,
|
Subcategory: subcategory,
|
||||||
Source: source,
|
Source: source,
|
||||||
HideOnOverlay: kb.HideOnOverlay,
|
HideOnOverlay: kb.HideOnOverlay,
|
||||||
|
CooldownMs: kb.CooldownMs,
|
||||||
}
|
}
|
||||||
|
|
||||||
if source == "dms" && conflicts != nil {
|
if source == "dms" && conflicts != nil {
|
||||||
@@ -310,7 +312,9 @@ func (n *NiriProvider) extractOptions(node *document.Node) map[string]any {
|
|||||||
opts["repeat"] = val.String() == "true"
|
opts["repeat"] = val.String() == "true"
|
||||||
}
|
}
|
||||||
if val, ok := node.Properties.Get("cooldown-ms"); ok {
|
if val, ok := node.Properties.Get("cooldown-ms"); ok {
|
||||||
opts["cooldown-ms"] = val.String()
|
if ms, err := strconv.Atoi(val.String()); err == nil {
|
||||||
|
opts["cooldown-ms"] = ms
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if val, ok := node.Properties.Get("allow-when-locked"); ok {
|
if val, ok := node.Properties.Get("allow-when-locked"); ok {
|
||||||
opts["allow-when-locked"] = val.String() == "true"
|
opts["allow-when-locked"] = val.String() == "true"
|
||||||
@@ -336,7 +340,14 @@ func (n *NiriProvider) buildBindNode(bind *overrideBind) *document.Node {
|
|||||||
node.AddProperty("repeat", false, "")
|
node.AddProperty("repeat", false, "")
|
||||||
}
|
}
|
||||||
if v, ok := bind.Options["cooldown-ms"]; ok {
|
if v, ok := bind.Options["cooldown-ms"]; ok {
|
||||||
node.AddProperty("cooldown-ms", v, "")
|
switch val := v.(type) {
|
||||||
|
case int:
|
||||||
|
node.AddProperty("cooldown-ms", val, "")
|
||||||
|
case string:
|
||||||
|
if ms, err := strconv.Atoi(val); err == nil {
|
||||||
|
node.AddProperty("cooldown-ms", ms, "")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if v, ok := bind.Options["allow-when-locked"]; ok && v == true {
|
if v, ok := bind.Options["allow-when-locked"]; ok && v == true {
|
||||||
node.AddProperty("allow-when-locked", true, "")
|
node.AddProperty("allow-when-locked", true, "")
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/sblinch/kdl-go"
|
"github.com/sblinch/kdl-go"
|
||||||
@@ -17,6 +18,7 @@ type NiriKeyBinding struct {
|
|||||||
Args []string
|
Args []string
|
||||||
Description string
|
Description string
|
||||||
HideOnOverlay bool
|
HideOnOverlay bool
|
||||||
|
CooldownMs int
|
||||||
Source string
|
Source string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,6 +277,7 @@ func (p *NiriParser) parseKeybindNode(node *document.Node, _ string) *NiriKeyBin
|
|||||||
|
|
||||||
var description string
|
var description string
|
||||||
var hideOnOverlay bool
|
var hideOnOverlay bool
|
||||||
|
var cooldownMs int
|
||||||
if node.Properties != nil {
|
if node.Properties != nil {
|
||||||
if val, ok := node.Properties.Get("hotkey-overlay-title"); ok {
|
if val, ok := node.Properties.Get("hotkey-overlay-title"); ok {
|
||||||
switch val.ValueString() {
|
switch val.ValueString() {
|
||||||
@@ -284,6 +287,9 @@ func (p *NiriParser) parseKeybindNode(node *document.Node, _ string) *NiriKeyBin
|
|||||||
description = val.ValueString()
|
description = val.ValueString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if val, ok := node.Properties.Get("cooldown-ms"); ok {
|
||||||
|
cooldownMs, _ = strconv.Atoi(val.String())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &NiriKeyBinding{
|
return &NiriKeyBinding{
|
||||||
@@ -293,6 +299,7 @@ func (p *NiriParser) parseKeybindNode(node *document.Node, _ string) *NiriKeyBin
|
|||||||
Args: args,
|
Args: args,
|
||||||
Description: description,
|
Description: description,
|
||||||
HideOnOverlay: hideOnOverlay,
|
HideOnOverlay: hideOnOverlay,
|
||||||
|
CooldownMs: cooldownMs,
|
||||||
Source: p.currentSource,
|
Source: p.currentSource,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ type Keybind struct {
|
|||||||
Subcategory string `json:"subcat,omitempty"`
|
Subcategory string `json:"subcat,omitempty"`
|
||||||
Source string `json:"source,omitempty"`
|
Source string `json:"source,omitempty"`
|
||||||
HideOnOverlay bool `json:"hideOnOverlay,omitempty"`
|
HideOnOverlay bool `json:"hideOnOverlay,omitempty"`
|
||||||
|
CooldownMs int `json:"cooldownMs,omitempty"`
|
||||||
Conflict *Keybind `json:"conflict,omitempty"`
|
Conflict *Keybind `json:"conflict,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
352
core/internal/server/dwl/manager_test.go
Normal file
352
core/internal/server/dwl/manager_test.go
Normal file
@@ -0,0 +1,352 @@
|
|||||||
|
package dwl
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestStateChanged_BothNil(t *testing.T) {
|
||||||
|
assert.True(t, stateChanged(nil, nil))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_OneNil(t *testing.T) {
|
||||||
|
s := &State{TagCount: 9}
|
||||||
|
assert.True(t, stateChanged(s, nil))
|
||||||
|
assert.True(t, stateChanged(nil, s))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_TagCountDiffers(t *testing.T) {
|
||||||
|
a := &State{TagCount: 9, Outputs: make(map[string]*OutputState), Layouts: []string{}}
|
||||||
|
b := &State{TagCount: 10, Outputs: make(map[string]*OutputState), Layouts: []string{}}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_LayoutLengthDiffers(t *testing.T) {
|
||||||
|
a := &State{TagCount: 9, Layouts: []string{"tile"}, Outputs: make(map[string]*OutputState)}
|
||||||
|
b := &State{TagCount: 9, Layouts: []string{"tile", "monocle"}, Outputs: make(map[string]*OutputState)}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_ActiveOutputDiffers(t *testing.T) {
|
||||||
|
a := &State{TagCount: 9, ActiveOutput: "eDP-1", Outputs: make(map[string]*OutputState), Layouts: []string{}}
|
||||||
|
b := &State{TagCount: 9, ActiveOutput: "HDMI-A-1", Outputs: make(map[string]*OutputState), Layouts: []string{}}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_OutputCountDiffers(t *testing.T) {
|
||||||
|
a := &State{
|
||||||
|
TagCount: 9,
|
||||||
|
Outputs: map[string]*OutputState{"eDP-1": {}},
|
||||||
|
Layouts: []string{},
|
||||||
|
}
|
||||||
|
b := &State{
|
||||||
|
TagCount: 9,
|
||||||
|
Outputs: map[string]*OutputState{},
|
||||||
|
Layouts: []string{},
|
||||||
|
}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_OutputFieldsDiffer(t *testing.T) {
|
||||||
|
a := &State{
|
||||||
|
TagCount: 9,
|
||||||
|
Layouts: []string{},
|
||||||
|
Outputs: map[string]*OutputState{
|
||||||
|
"eDP-1": {Active: 1, Layout: 0, Title: "Firefox"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
b := &State{
|
||||||
|
TagCount: 9,
|
||||||
|
Layouts: []string{},
|
||||||
|
Outputs: map[string]*OutputState{
|
||||||
|
"eDP-1": {Active: 0, Layout: 0, Title: "Firefox"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
|
||||||
|
b.Outputs["eDP-1"].Active = 1
|
||||||
|
b.Outputs["eDP-1"].Layout = 1
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
|
||||||
|
b.Outputs["eDP-1"].Layout = 0
|
||||||
|
b.Outputs["eDP-1"].Title = "Code"
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_TagsDiffer(t *testing.T) {
|
||||||
|
a := &State{
|
||||||
|
TagCount: 9,
|
||||||
|
Layouts: []string{},
|
||||||
|
Outputs: map[string]*OutputState{
|
||||||
|
"eDP-1": {Tags: []TagState{{Tag: 1, State: 1, Clients: 2, Focused: 1}}},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
b := &State{
|
||||||
|
TagCount: 9,
|
||||||
|
Layouts: []string{},
|
||||||
|
Outputs: map[string]*OutputState{
|
||||||
|
"eDP-1": {Tags: []TagState{{Tag: 1, State: 2, Clients: 2, Focused: 1}}},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
|
||||||
|
b.Outputs["eDP-1"].Tags[0].State = 1
|
||||||
|
b.Outputs["eDP-1"].Tags[0].Clients = 3
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_Equal(t *testing.T) {
|
||||||
|
a := &State{
|
||||||
|
TagCount: 9,
|
||||||
|
ActiveOutput: "eDP-1",
|
||||||
|
Layouts: []string{"tile", "monocle"},
|
||||||
|
Outputs: map[string]*OutputState{
|
||||||
|
"eDP-1": {
|
||||||
|
Name: "eDP-1",
|
||||||
|
Active: 1,
|
||||||
|
Layout: 0,
|
||||||
|
LayoutSymbol: "[]=",
|
||||||
|
Title: "Firefox",
|
||||||
|
AppID: "firefox",
|
||||||
|
KbLayout: "us",
|
||||||
|
Keymode: "",
|
||||||
|
Tags: []TagState{{Tag: 1, State: 1, Clients: 2, Focused: 1}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
b := &State{
|
||||||
|
TagCount: 9,
|
||||||
|
ActiveOutput: "eDP-1",
|
||||||
|
Layouts: []string{"tile", "monocle"},
|
||||||
|
Outputs: map[string]*OutputState{
|
||||||
|
"eDP-1": {
|
||||||
|
Name: "eDP-1",
|
||||||
|
Active: 1,
|
||||||
|
Layout: 0,
|
||||||
|
LayoutSymbol: "[]=",
|
||||||
|
Title: "Firefox",
|
||||||
|
AppID: "firefox",
|
||||||
|
KbLayout: "us",
|
||||||
|
Keymode: "",
|
||||||
|
Tags: []TagState{{Tag: 1, State: 1, Clients: 2, Focused: 1}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
assert.False(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_ConcurrentGetState(t *testing.T) {
|
||||||
|
m := &Manager{
|
||||||
|
state: &State{
|
||||||
|
TagCount: 9,
|
||||||
|
Layouts: []string{"tile"},
|
||||||
|
Outputs: map[string]*OutputState{"eDP-1": {Name: "eDP-1"}},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 50
|
||||||
|
const iterations = 100
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
s := m.GetState()
|
||||||
|
_ = s.TagCount
|
||||||
|
_ = s.Outputs
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(i int) {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
m.stateMutex.Lock()
|
||||||
|
m.state = &State{
|
||||||
|
TagCount: uint32(j % 10),
|
||||||
|
Layouts: []string{"tile", "monocle"},
|
||||||
|
Outputs: map[string]*OutputState{"eDP-1": {Active: uint32(j % 2)}},
|
||||||
|
}
|
||||||
|
m.stateMutex.Unlock()
|
||||||
|
}
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_ConcurrentSubscriberAccess(t *testing.T) {
|
||||||
|
m := &Manager{
|
||||||
|
stopChan: make(chan struct{}),
|
||||||
|
dirty: make(chan struct{}, 1),
|
||||||
|
}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 20
|
||||||
|
|
||||||
|
for i := 0; i < goroutines; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(id int) {
|
||||||
|
defer wg.Done()
|
||||||
|
subID := string(rune('a' + id))
|
||||||
|
ch := m.Subscribe(subID)
|
||||||
|
assert.NotNil(t, ch)
|
||||||
|
time.Sleep(time.Millisecond)
|
||||||
|
m.Unsubscribe(subID)
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_SyncmapOutputsConcurrentAccess(t *testing.T) {
|
||||||
|
m := &Manager{}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 30
|
||||||
|
const iterations = 50
|
||||||
|
|
||||||
|
for i := 0; i < goroutines; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(id int) {
|
||||||
|
defer wg.Done()
|
||||||
|
key := uint32(id)
|
||||||
|
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
state := &outputState{
|
||||||
|
id: key,
|
||||||
|
name: "test-output",
|
||||||
|
active: uint32(j % 2),
|
||||||
|
tags: []TagState{{Tag: uint32(j), State: 1}},
|
||||||
|
}
|
||||||
|
m.outputs.Store(key, state)
|
||||||
|
|
||||||
|
if loaded, ok := m.outputs.Load(key); ok {
|
||||||
|
assert.Equal(t, key, loaded.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
m.outputs.Range(func(k uint32, v *outputState) bool {
|
||||||
|
_ = v.name
|
||||||
|
_ = v.active
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
m.outputs.Delete(key)
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_NotifySubscribersNonBlocking(t *testing.T) {
|
||||||
|
m := &Manager{
|
||||||
|
dirty: make(chan struct{}, 1),
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
m.notifySubscribers()
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Len(t, m.dirty, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_PostQueueFull(t *testing.T) {
|
||||||
|
m := &Manager{
|
||||||
|
cmdq: make(chan cmd, 2),
|
||||||
|
stopChan: make(chan struct{}),
|
||||||
|
}
|
||||||
|
|
||||||
|
m.post(func() {})
|
||||||
|
m.post(func() {})
|
||||||
|
m.post(func() {})
|
||||||
|
m.post(func() {})
|
||||||
|
|
||||||
|
assert.Len(t, m.cmdq, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_GetStateNilState(t *testing.T) {
|
||||||
|
m := &Manager{}
|
||||||
|
|
||||||
|
s := m.GetState()
|
||||||
|
assert.NotNil(t, s.Outputs)
|
||||||
|
assert.NotNil(t, s.Layouts)
|
||||||
|
assert.Equal(t, uint32(0), s.TagCount)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestTagState_Fields(t *testing.T) {
|
||||||
|
tag := TagState{
|
||||||
|
Tag: 1,
|
||||||
|
State: 2,
|
||||||
|
Clients: 3,
|
||||||
|
Focused: 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Equal(t, uint32(1), tag.Tag)
|
||||||
|
assert.Equal(t, uint32(2), tag.State)
|
||||||
|
assert.Equal(t, uint32(3), tag.Clients)
|
||||||
|
assert.Equal(t, uint32(1), tag.Focused)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestOutputState_Fields(t *testing.T) {
|
||||||
|
out := OutputState{
|
||||||
|
Name: "eDP-1",
|
||||||
|
Active: 1,
|
||||||
|
Tags: []TagState{{Tag: 1}},
|
||||||
|
Layout: 0,
|
||||||
|
LayoutSymbol: "[]=",
|
||||||
|
Title: "Firefox",
|
||||||
|
AppID: "firefox",
|
||||||
|
KbLayout: "us",
|
||||||
|
Keymode: "",
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Equal(t, "eDP-1", out.Name)
|
||||||
|
assert.Equal(t, uint32(1), out.Active)
|
||||||
|
assert.Len(t, out.Tags, 1)
|
||||||
|
assert.Equal(t, "[]=", out.LayoutSymbol)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_NewOutputAppears(t *testing.T) {
|
||||||
|
a := &State{
|
||||||
|
TagCount: 9,
|
||||||
|
Layouts: []string{},
|
||||||
|
Outputs: map[string]*OutputState{
|
||||||
|
"eDP-1": {Name: "eDP-1"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
b := &State{
|
||||||
|
TagCount: 9,
|
||||||
|
Layouts: []string{},
|
||||||
|
Outputs: map[string]*OutputState{
|
||||||
|
"eDP-1": {Name: "eDP-1"},
|
||||||
|
"HDMI-A-1": {Name: "HDMI-A-1"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_TagsLengthDiffers(t *testing.T) {
|
||||||
|
a := &State{
|
||||||
|
TagCount: 9,
|
||||||
|
Layouts: []string{},
|
||||||
|
Outputs: map[string]*OutputState{
|
||||||
|
"eDP-1": {Tags: []TagState{{Tag: 1}}},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
b := &State{
|
||||||
|
TagCount: 9,
|
||||||
|
Layouts: []string{},
|
||||||
|
Outputs: map[string]*OutputState{
|
||||||
|
"eDP-1": {Tags: []TagState{{Tag: 1}, {Tag: 2}}},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
@@ -880,29 +880,24 @@ func (b *NetworkManagerBackend) ImportVPN(filePath string, name string) (*VPNImp
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *NetworkManagerBackend) importVPNWithNmcli(filePath string, name string) (*VPNImportResult, error) {
|
func (b *NetworkManagerBackend) importVPNWithNmcli(filePath string, name string) (*VPNImportResult, error) {
|
||||||
args := []string{"connection", "import", "type", "openvpn", "file", filePath}
|
vpnTypes := []string{"openvpn", "wireguard", "vpnc", "pptp", "l2tp", "openconnect", "strongswan"}
|
||||||
cmd := exec.Command("nmcli", args...)
|
|
||||||
output, err := cmd.CombinedOutput()
|
var output []byte
|
||||||
|
var err error
|
||||||
|
for _, vpnType := range vpnTypes {
|
||||||
|
args := []string{"connection", "import", "type", vpnType, "file", filePath}
|
||||||
|
cmd := exec.Command("nmcli", args...)
|
||||||
|
output, err = cmd.CombinedOutput()
|
||||||
|
if err == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
outputStr := string(output)
|
return &VPNImportResult{
|
||||||
if strings.Contains(outputStr, "vpnc") || strings.Contains(outputStr, "unknown connection type") {
|
Success: false,
|
||||||
for _, vpnType := range []string{"vpnc", "pptp", "l2tp", "openconnect", "strongswan", "wireguard"} {
|
Error: fmt.Sprintf("import failed: %s", strings.TrimSpace(string(output))),
|
||||||
args = []string{"connection", "import", "type", vpnType, "file", filePath}
|
}, nil
|
||||||
cmd = exec.Command("nmcli", args...)
|
|
||||||
output, err = cmd.CombinedOutput()
|
|
||||||
if err == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return &VPNImportResult{
|
|
||||||
Success: false,
|
|
||||||
Error: fmt.Sprintf("import failed: %s", strings.TrimSpace(string(output))),
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
outputStr := string(output)
|
outputStr := string(output)
|
||||||
|
|||||||
@@ -103,18 +103,16 @@ func (m *Manager) waylandActor() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) allOutputsReady() bool {
|
func (m *Manager) anyOutputReady() bool {
|
||||||
hasOutputs := false
|
anyReady := false
|
||||||
allReady := true
|
|
||||||
m.outputs.Range(func(_ uint32, out *outputState) bool {
|
m.outputs.Range(func(_ uint32, out *outputState) bool {
|
||||||
hasOutputs = true
|
if out.rampSize > 0 && !out.failed {
|
||||||
if out.rampSize == 0 || out.failed {
|
anyReady = true
|
||||||
allReady = false
|
return false // stop iteration
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
return hasOutputs && allReady
|
return anyReady
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) setupDBusMonitor() error {
|
func (m *Manager) setupDBusMonitor() error {
|
||||||
@@ -268,31 +266,37 @@ func (m *Manager) setupOutputControls(outputs []*wlclient.Output, manager *wlr_g
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) setupControlHandlers(state *outputState, control *wlr_gamma_control.ZwlrGammaControlV1) {
|
func (m *Manager) setupControlHandlers(state *outputState, control *wlr_gamma_control.ZwlrGammaControlV1) {
|
||||||
|
outputID := state.id
|
||||||
|
|
||||||
control.SetGammaSizeHandler(func(e wlr_gamma_control.ZwlrGammaControlV1GammaSizeEvent) {
|
control.SetGammaSizeHandler(func(e wlr_gamma_control.ZwlrGammaControlV1GammaSizeEvent) {
|
||||||
if out, ok := m.outputs.Load(state.id); ok {
|
size := e.Size
|
||||||
out.rampSize = e.Size
|
|
||||||
out.failed = false
|
|
||||||
out.retryCount = 0
|
|
||||||
}
|
|
||||||
m.post(func() {
|
m.post(func() {
|
||||||
m.applyCurrentTemp()
|
if out, ok := m.outputs.Load(outputID); ok {
|
||||||
|
out.rampSize = size
|
||||||
|
out.failed = false
|
||||||
|
out.retryCount = 0
|
||||||
|
}
|
||||||
|
m.lastAppliedTemp = 0
|
||||||
|
m.applyCurrentTemp("gamma_size")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
control.SetFailedHandler(func(_ wlr_gamma_control.ZwlrGammaControlV1FailedEvent) {
|
control.SetFailedHandler(func(_ wlr_gamma_control.ZwlrGammaControlV1FailedEvent) {
|
||||||
out, ok := m.outputs.Load(state.id)
|
m.post(func() {
|
||||||
if !ok {
|
out, ok := m.outputs.Load(outputID)
|
||||||
return
|
if !ok {
|
||||||
}
|
return
|
||||||
out.failed = true
|
}
|
||||||
out.rampSize = 0
|
out.failed = true
|
||||||
out.retryCount++
|
out.rampSize = 0
|
||||||
out.lastFailTime = time.Now()
|
out.retryCount++
|
||||||
|
out.lastFailTime = time.Now()
|
||||||
|
|
||||||
backoff := time.Duration(300<<uint(min(out.retryCount-1, 4))) * time.Millisecond
|
backoff := time.Duration(300<<uint(min(out.retryCount-1, 4))) * time.Millisecond
|
||||||
time.AfterFunc(backoff, func() {
|
time.AfterFunc(backoff, func() {
|
||||||
m.post(func() {
|
m.post(func() {
|
||||||
m.recreateOutputControl(out)
|
m.recreateOutputControl(out)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -523,8 +527,9 @@ func (m *Manager) getNextDeadline(now time.Time) time.Time {
|
|||||||
return m.tomorrow(now)
|
return m.tomorrow(now)
|
||||||
case StateNormal:
|
case StateNormal:
|
||||||
return m.getDeadlineNormal(now, sched)
|
return m.getDeadlineNormal(now, sched)
|
||||||
|
default:
|
||||||
|
return m.tomorrow(now)
|
||||||
}
|
}
|
||||||
return m.tomorrow(now)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) getDeadlineNormal(now time.Time, sched sunSchedule) time.Time {
|
func (m *Manager) getDeadlineNormal(now time.Time, sched sunSchedule) time.Time {
|
||||||
@@ -583,7 +588,7 @@ func (m *Manager) schedulerLoop() {
|
|||||||
m.configMutex.RUnlock()
|
m.configMutex.RUnlock()
|
||||||
|
|
||||||
if enabled {
|
if enabled {
|
||||||
m.applyCurrentTemp()
|
m.post(func() { m.applyCurrentTemp("startup") })
|
||||||
}
|
}
|
||||||
|
|
||||||
var timer *time.Timer
|
var timer *time.Timer
|
||||||
@@ -625,21 +630,34 @@ func (m *Manager) schedulerLoop() {
|
|||||||
enabled := m.config.Enabled
|
enabled := m.config.Enabled
|
||||||
m.configMutex.RUnlock()
|
m.configMutex.RUnlock()
|
||||||
if enabled {
|
if enabled {
|
||||||
m.applyCurrentTemp()
|
m.post(func() { m.applyCurrentTemp("updateTrigger") })
|
||||||
}
|
}
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
m.configMutex.RLock()
|
m.configMutex.RLock()
|
||||||
enabled := m.config.Enabled
|
enabled := m.config.Enabled
|
||||||
m.configMutex.RUnlock()
|
m.configMutex.RUnlock()
|
||||||
if enabled {
|
if enabled {
|
||||||
m.applyCurrentTemp()
|
m.post(func() { m.applyCurrentTemp("timer") })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) applyCurrentTemp() {
|
func (m *Manager) applyCurrentTemp(_ string) {
|
||||||
if !m.controlsInitialized || !m.allOutputsReady() {
|
if !m.controlsInitialized || !m.anyOutputReady() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure schedule is up-to-date (handles display wake after overnight sleep)
|
||||||
|
m.recalcSchedule(time.Now())
|
||||||
|
|
||||||
|
m.configMutex.RLock()
|
||||||
|
low, high := m.config.LowTemp, m.config.HighTemp
|
||||||
|
m.configMutex.RUnlock()
|
||||||
|
|
||||||
|
if low == high {
|
||||||
|
m.applyGamma(low)
|
||||||
|
m.updateStateFromSchedule()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -665,6 +683,10 @@ func (m *Manager) applyGamma(temp int) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if m.lastAppliedTemp == temp && m.lastAppliedGamma == gamma {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var outs []*outputState
|
var outs []*outputState
|
||||||
m.outputs.Range(func(_ uint32, out *outputState) bool {
|
m.outputs.Range(func(_ uint32, out *outputState) bool {
|
||||||
outs = append(outs, out)
|
outs = append(outs, out)
|
||||||
@@ -700,6 +722,7 @@ func (m *Manager) applyGamma(temp int) {
|
|||||||
|
|
||||||
for _, j := range jobs {
|
for _, j := range jobs {
|
||||||
if err := m.setGammaBytes(j.out, j.data); err != nil {
|
if err := m.setGammaBytes(j.out, j.data); err != nil {
|
||||||
|
log.Warnf("gamma: failed to set output %d: %v", j.out.id, err)
|
||||||
j.out.failed = true
|
j.out.failed = true
|
||||||
j.out.rampSize = 0
|
j.out.rampSize = 0
|
||||||
outID := j.out.id
|
outID := j.out.id
|
||||||
@@ -712,6 +735,9 @@ func (m *Manager) applyGamma(temp int) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m.lastAppliedTemp = temp
|
||||||
|
m.lastAppliedGamma = gamma
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) setGammaBytes(out *outputState, data []byte) error {
|
func (m *Manager) setGammaBytes(out *outputState, data []byte) error {
|
||||||
@@ -886,6 +912,10 @@ func (m *Manager) SetConfig(config Config) error {
|
|||||||
|
|
||||||
func (m *Manager) SetTemperature(low, high int) error {
|
func (m *Manager) SetTemperature(low, high int) error {
|
||||||
m.configMutex.Lock()
|
m.configMutex.Lock()
|
||||||
|
if m.config.LowTemp == low && m.config.HighTemp == high {
|
||||||
|
m.configMutex.Unlock()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
m.config.LowTemp = low
|
m.config.LowTemp = low
|
||||||
m.config.HighTemp = high
|
m.config.HighTemp = high
|
||||||
err := m.config.Validate()
|
err := m.config.Validate()
|
||||||
@@ -899,6 +929,11 @@ func (m *Manager) SetTemperature(low, high int) error {
|
|||||||
|
|
||||||
func (m *Manager) SetLocation(lat, lon float64) error {
|
func (m *Manager) SetLocation(lat, lon float64) error {
|
||||||
m.configMutex.Lock()
|
m.configMutex.Lock()
|
||||||
|
if m.config.Latitude != nil && m.config.Longitude != nil &&
|
||||||
|
*m.config.Latitude == lat && *m.config.Longitude == lon && !m.config.UseIPLocation {
|
||||||
|
m.configMutex.Unlock()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
m.config.Latitude = &lat
|
m.config.Latitude = &lat
|
||||||
m.config.Longitude = &lon
|
m.config.Longitude = &lon
|
||||||
m.config.UseIPLocation = false
|
m.config.UseIPLocation = false
|
||||||
@@ -913,6 +948,10 @@ func (m *Manager) SetLocation(lat, lon float64) error {
|
|||||||
|
|
||||||
func (m *Manager) SetUseIPLocation(use bool) {
|
func (m *Manager) SetUseIPLocation(use bool) {
|
||||||
m.configMutex.Lock()
|
m.configMutex.Lock()
|
||||||
|
if m.config.UseIPLocation == use {
|
||||||
|
m.configMutex.Unlock()
|
||||||
|
return
|
||||||
|
}
|
||||||
m.config.UseIPLocation = use
|
m.config.UseIPLocation = use
|
||||||
if use {
|
if use {
|
||||||
m.config.Latitude = nil
|
m.config.Latitude = nil
|
||||||
@@ -931,6 +970,12 @@ func (m *Manager) SetUseIPLocation(use bool) {
|
|||||||
|
|
||||||
func (m *Manager) SetManualTimes(sunrise, sunset time.Time) error {
|
func (m *Manager) SetManualTimes(sunrise, sunset time.Time) error {
|
||||||
m.configMutex.Lock()
|
m.configMutex.Lock()
|
||||||
|
if m.config.ManualSunrise != nil && m.config.ManualSunset != nil &&
|
||||||
|
m.config.ManualSunrise.Hour() == sunrise.Hour() && m.config.ManualSunrise.Minute() == sunrise.Minute() &&
|
||||||
|
m.config.ManualSunset.Hour() == sunset.Hour() && m.config.ManualSunset.Minute() == sunset.Minute() {
|
||||||
|
m.configMutex.Unlock()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
m.config.ManualSunrise = &sunrise
|
m.config.ManualSunrise = &sunrise
|
||||||
m.config.ManualSunset = &sunset
|
m.config.ManualSunset = &sunset
|
||||||
err := m.config.Validate()
|
err := m.config.Validate()
|
||||||
@@ -944,6 +989,10 @@ func (m *Manager) SetManualTimes(sunrise, sunset time.Time) error {
|
|||||||
|
|
||||||
func (m *Manager) ClearManualTimes() {
|
func (m *Manager) ClearManualTimes() {
|
||||||
m.configMutex.Lock()
|
m.configMutex.Lock()
|
||||||
|
if m.config.ManualSunrise == nil && m.config.ManualSunset == nil {
|
||||||
|
m.configMutex.Unlock()
|
||||||
|
return
|
||||||
|
}
|
||||||
m.config.ManualSunrise = nil
|
m.config.ManualSunrise = nil
|
||||||
m.config.ManualSunset = nil
|
m.config.ManualSunset = nil
|
||||||
m.configMutex.Unlock()
|
m.configMutex.Unlock()
|
||||||
@@ -952,6 +1001,10 @@ func (m *Manager) ClearManualTimes() {
|
|||||||
|
|
||||||
func (m *Manager) SetGamma(gamma float64) error {
|
func (m *Manager) SetGamma(gamma float64) error {
|
||||||
m.configMutex.Lock()
|
m.configMutex.Lock()
|
||||||
|
if m.config.Gamma == gamma {
|
||||||
|
m.configMutex.Unlock()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
m.config.Gamma = gamma
|
m.config.Gamma = gamma
|
||||||
err := m.config.Validate()
|
err := m.config.Validate()
|
||||||
m.configMutex.Unlock()
|
m.configMutex.Unlock()
|
||||||
@@ -965,6 +1018,10 @@ func (m *Manager) SetGamma(gamma float64) error {
|
|||||||
func (m *Manager) SetEnabled(enabled bool) {
|
func (m *Manager) SetEnabled(enabled bool) {
|
||||||
m.configMutex.Lock()
|
m.configMutex.Lock()
|
||||||
wasEnabled := m.config.Enabled
|
wasEnabled := m.config.Enabled
|
||||||
|
if wasEnabled == enabled {
|
||||||
|
m.configMutex.Unlock()
|
||||||
|
return
|
||||||
|
}
|
||||||
m.config.Enabled = enabled
|
m.config.Enabled = enabled
|
||||||
highTemp := m.config.HighTemp
|
highTemp := m.config.HighTemp
|
||||||
m.configMutex.Unlock()
|
m.configMutex.Unlock()
|
||||||
@@ -974,7 +1031,7 @@ func (m *Manager) SetEnabled(enabled bool) {
|
|||||||
m.post(func() {
|
m.post(func() {
|
||||||
gammaMgr := m.gammaControl.(*wlr_gamma_control.ZwlrGammaControlManagerV1)
|
gammaMgr := m.gammaControl.(*wlr_gamma_control.ZwlrGammaControlManagerV1)
|
||||||
if err := m.setupOutputControls(m.availableOutputs, gammaMgr); err != nil {
|
if err := m.setupOutputControls(m.availableOutputs, gammaMgr); err != nil {
|
||||||
log.Errorf("Failed to create gamma controls: %v", err)
|
log.Errorf("gamma: failed to create controls: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
m.controlsInitialized = true
|
m.controlsInitialized = true
|
||||||
|
|||||||
386
core/internal/server/wayland/manager_test.go
Normal file
386
core/internal/server/wayland/manager_test.go
Normal file
@@ -0,0 +1,386 @@
|
|||||||
|
package wayland
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestManager_ActorSerializesOutputStateAccess(t *testing.T) {
|
||||||
|
m := &Manager{
|
||||||
|
cmdq: make(chan cmd, 128),
|
||||||
|
stopChan: make(chan struct{}),
|
||||||
|
}
|
||||||
|
|
||||||
|
m.wg.Add(1)
|
||||||
|
go m.waylandActor()
|
||||||
|
|
||||||
|
state := &outputState{
|
||||||
|
id: 1,
|
||||||
|
registryName: 100,
|
||||||
|
rampSize: 256,
|
||||||
|
}
|
||||||
|
m.outputs.Store(state.id, state)
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 50
|
||||||
|
const iterations = 100
|
||||||
|
|
||||||
|
for i := 0; i < goroutines; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(id int) {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
m.post(func() {
|
||||||
|
if out, ok := m.outputs.Load(state.id); ok {
|
||||||
|
out.rampSize = uint32(j)
|
||||||
|
out.failed = j%2 == 0
|
||||||
|
out.retryCount = j
|
||||||
|
out.lastFailTime = time.Now()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
done := make(chan struct{})
|
||||||
|
m.post(func() { close(done) })
|
||||||
|
<-done
|
||||||
|
|
||||||
|
close(m.stopChan)
|
||||||
|
m.wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_ConcurrentSubscriberAccess(t *testing.T) {
|
||||||
|
m := &Manager{
|
||||||
|
stopChan: make(chan struct{}),
|
||||||
|
dirty: make(chan struct{}, 1),
|
||||||
|
updateTrigger: make(chan struct{}, 1),
|
||||||
|
}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 20
|
||||||
|
|
||||||
|
for i := 0; i < goroutines; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(id int) {
|
||||||
|
defer wg.Done()
|
||||||
|
subID := string(rune('a' + id))
|
||||||
|
ch := m.Subscribe(subID)
|
||||||
|
assert.NotNil(t, ch)
|
||||||
|
time.Sleep(time.Millisecond)
|
||||||
|
m.Unsubscribe(subID)
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_ConcurrentGetState(t *testing.T) {
|
||||||
|
m := &Manager{
|
||||||
|
state: &State{
|
||||||
|
CurrentTemp: 5000,
|
||||||
|
IsDay: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 50
|
||||||
|
const iterations = 100
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
s := m.GetState()
|
||||||
|
assert.GreaterOrEqual(t, s.CurrentTemp, 0)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(i int) {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
m.stateMutex.Lock()
|
||||||
|
m.state = &State{
|
||||||
|
CurrentTemp: 4000 + i*100,
|
||||||
|
IsDay: j%2 == 0,
|
||||||
|
}
|
||||||
|
m.stateMutex.Unlock()
|
||||||
|
}
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_ConcurrentConfigAccess(t *testing.T) {
|
||||||
|
m := &Manager{
|
||||||
|
config: DefaultConfig(),
|
||||||
|
}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 30
|
||||||
|
const iterations = 100
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
m.configMutex.RLock()
|
||||||
|
_ = m.config.LowTemp
|
||||||
|
_ = m.config.HighTemp
|
||||||
|
_ = m.config.Enabled
|
||||||
|
m.configMutex.RUnlock()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(i int) {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
m.configMutex.Lock()
|
||||||
|
m.config.LowTemp = 3000 + j
|
||||||
|
m.config.HighTemp = 7000 - j
|
||||||
|
m.config.Enabled = j%2 == 0
|
||||||
|
m.configMutex.Unlock()
|
||||||
|
}
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_SyncmapOutputsConcurrentAccess(t *testing.T) {
|
||||||
|
m := &Manager{}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 30
|
||||||
|
const iterations = 50
|
||||||
|
|
||||||
|
for i := 0; i < goroutines; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(id int) {
|
||||||
|
defer wg.Done()
|
||||||
|
key := uint32(id)
|
||||||
|
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
state := &outputState{
|
||||||
|
id: key,
|
||||||
|
rampSize: uint32(j),
|
||||||
|
failed: j%2 == 0,
|
||||||
|
}
|
||||||
|
m.outputs.Store(key, state)
|
||||||
|
|
||||||
|
if loaded, ok := m.outputs.Load(key); ok {
|
||||||
|
assert.Equal(t, key, loaded.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
m.outputs.Range(func(k uint32, v *outputState) bool {
|
||||||
|
_ = v.rampSize
|
||||||
|
_ = v.failed
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
m.outputs.Delete(key)
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_LocationCacheConcurrentAccess(t *testing.T) {
|
||||||
|
m := &Manager{}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 20
|
||||||
|
const iterations = 100
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
m.locationMutex.RLock()
|
||||||
|
_ = m.cachedIPLat
|
||||||
|
_ = m.cachedIPLon
|
||||||
|
m.locationMutex.RUnlock()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(i int) {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
lat := float64(40 + i)
|
||||||
|
lon := float64(-74 + j)
|
||||||
|
m.locationMutex.Lock()
|
||||||
|
m.cachedIPLat = &lat
|
||||||
|
m.cachedIPLon = &lon
|
||||||
|
m.locationMutex.Unlock()
|
||||||
|
}
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_ScheduleConcurrentAccess(t *testing.T) {
|
||||||
|
now := time.Now()
|
||||||
|
m := &Manager{
|
||||||
|
schedule: sunSchedule{
|
||||||
|
times: SunTimes{
|
||||||
|
Dawn: now,
|
||||||
|
Sunrise: now.Add(time.Hour),
|
||||||
|
Sunset: now.Add(12 * time.Hour),
|
||||||
|
Night: now.Add(13 * time.Hour),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 20
|
||||||
|
const iterations = 100
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
m.scheduleMutex.RLock()
|
||||||
|
_ = m.schedule.times.Dawn
|
||||||
|
_ = m.schedule.times.Sunrise
|
||||||
|
_ = m.schedule.times.Sunset
|
||||||
|
_ = m.schedule.condition
|
||||||
|
m.scheduleMutex.RUnlock()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
m.scheduleMutex.Lock()
|
||||||
|
m.schedule.times.Dawn = time.Now()
|
||||||
|
m.schedule.times.Sunrise = time.Now().Add(time.Hour)
|
||||||
|
m.schedule.condition = SunNormal
|
||||||
|
m.scheduleMutex.Unlock()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestInterpolate_EdgeCases(t *testing.T) {
|
||||||
|
now := time.Now()
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
now time.Time
|
||||||
|
start time.Time
|
||||||
|
stop time.Time
|
||||||
|
expected float64
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "same start and stop",
|
||||||
|
now: now,
|
||||||
|
start: now,
|
||||||
|
stop: now,
|
||||||
|
expected: 1.0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "now before start",
|
||||||
|
now: now,
|
||||||
|
start: now.Add(time.Hour),
|
||||||
|
stop: now.Add(2 * time.Hour),
|
||||||
|
expected: 0.0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "now after stop",
|
||||||
|
now: now.Add(3 * time.Hour),
|
||||||
|
start: now,
|
||||||
|
stop: now.Add(time.Hour),
|
||||||
|
expected: 1.0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "now at midpoint",
|
||||||
|
now: now.Add(30 * time.Minute),
|
||||||
|
start: now,
|
||||||
|
stop: now.Add(time.Hour),
|
||||||
|
expected: 0.5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "now equals start",
|
||||||
|
now: now,
|
||||||
|
start: now,
|
||||||
|
stop: now.Add(time.Hour),
|
||||||
|
expected: 0.0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "now equals stop",
|
||||||
|
now: now.Add(time.Hour),
|
||||||
|
start: now,
|
||||||
|
stop: now.Add(time.Hour),
|
||||||
|
expected: 1.0,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
result := interpolate(tt.now, tt.start, tt.stop)
|
||||||
|
assert.InDelta(t, tt.expected, result, 0.01)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGenerateGammaRamp_ZeroSize(t *testing.T) {
|
||||||
|
ramp := GenerateGammaRamp(0, 5000, 1.0)
|
||||||
|
assert.Empty(t, ramp.Red)
|
||||||
|
assert.Empty(t, ramp.Green)
|
||||||
|
assert.Empty(t, ramp.Blue)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGenerateGammaRamp_ValidSizes(t *testing.T) {
|
||||||
|
sizes := []uint32{1, 256, 1024}
|
||||||
|
temps := []int{1000, 4000, 6500, 10000}
|
||||||
|
gammas := []float64{0.5, 1.0, 2.0}
|
||||||
|
|
||||||
|
for _, size := range sizes {
|
||||||
|
for _, temp := range temps {
|
||||||
|
for _, gamma := range gammas {
|
||||||
|
ramp := GenerateGammaRamp(size, temp, gamma)
|
||||||
|
assert.Len(t, ramp.Red, int(size))
|
||||||
|
assert.Len(t, ramp.Green, int(size))
|
||||||
|
assert.Len(t, ramp.Blue, int(size))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestNotifySubscribers_NonBlocking(t *testing.T) {
|
||||||
|
m := &Manager{
|
||||||
|
dirty: make(chan struct{}, 1),
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
m.notifySubscribers()
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Len(t, m.dirty, 1)
|
||||||
|
}
|
||||||
@@ -96,6 +96,9 @@ type Manager struct {
|
|||||||
|
|
||||||
dbusConn *dbus.Conn
|
dbusConn *dbus.Conn
|
||||||
dbusSignal chan *dbus.Signal
|
dbusSignal chan *dbus.Signal
|
||||||
|
|
||||||
|
lastAppliedTemp int
|
||||||
|
lastAppliedGamma float64
|
||||||
}
|
}
|
||||||
|
|
||||||
type outputState struct {
|
type outputState struct {
|
||||||
|
|||||||
400
core/internal/server/wlroutput/manager_test.go
Normal file
400
core/internal/server/wlroutput/manager_test.go
Normal file
@@ -0,0 +1,400 @@
|
|||||||
|
package wlroutput
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestStateChanged_BothNil(t *testing.T) {
|
||||||
|
assert.True(t, stateChanged(nil, nil))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_OneNil(t *testing.T) {
|
||||||
|
s := &State{Serial: 1}
|
||||||
|
assert.True(t, stateChanged(s, nil))
|
||||||
|
assert.True(t, stateChanged(nil, s))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_SerialDiffers(t *testing.T) {
|
||||||
|
a := &State{Serial: 1, Outputs: []Output{}}
|
||||||
|
b := &State{Serial: 2, Outputs: []Output{}}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_OutputCountDiffers(t *testing.T) {
|
||||||
|
a := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1"}}}
|
||||||
|
b := &State{Serial: 1, Outputs: []Output{}}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_OutputNameDiffers(t *testing.T) {
|
||||||
|
a := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", Enabled: true}}}
|
||||||
|
b := &State{Serial: 1, Outputs: []Output{{Name: "HDMI-A-1", Enabled: true}}}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_OutputEnabledDiffers(t *testing.T) {
|
||||||
|
a := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", Enabled: true}}}
|
||||||
|
b := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", Enabled: false}}}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_OutputPositionDiffers(t *testing.T) {
|
||||||
|
a := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", X: 0, Y: 0}}}
|
||||||
|
b := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", X: 1920, Y: 0}}}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_OutputTransformDiffers(t *testing.T) {
|
||||||
|
a := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", Transform: 0}}}
|
||||||
|
b := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", Transform: 1}}}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_OutputScaleDiffers(t *testing.T) {
|
||||||
|
a := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", Scale: 1.0}}}
|
||||||
|
b := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", Scale: 2.0}}}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_OutputAdaptiveSyncDiffers(t *testing.T) {
|
||||||
|
a := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", AdaptiveSync: 0}}}
|
||||||
|
b := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", AdaptiveSync: 1}}}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_CurrentModeNilVsNonNil(t *testing.T) {
|
||||||
|
a := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", CurrentMode: nil}}}
|
||||||
|
b := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", CurrentMode: &OutputMode{Width: 1920}}}}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_CurrentModeDiffers(t *testing.T) {
|
||||||
|
a := &State{Serial: 1, Outputs: []Output{{
|
||||||
|
Name: "eDP-1",
|
||||||
|
CurrentMode: &OutputMode{Width: 1920, Height: 1080, Refresh: 60000},
|
||||||
|
}}}
|
||||||
|
b := &State{Serial: 1, Outputs: []Output{{
|
||||||
|
Name: "eDP-1",
|
||||||
|
CurrentMode: &OutputMode{Width: 2560, Height: 1440, Refresh: 60000},
|
||||||
|
}}}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
|
||||||
|
b.Outputs[0].CurrentMode.Width = 1920
|
||||||
|
b.Outputs[0].CurrentMode.Height = 1080
|
||||||
|
b.Outputs[0].CurrentMode.Refresh = 144000
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_ModesLengthDiffers(t *testing.T) {
|
||||||
|
a := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", Modes: []OutputMode{{Width: 1920}}}}}
|
||||||
|
b := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", Modes: []OutputMode{{Width: 1920}, {Width: 1280}}}}}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_Equal(t *testing.T) {
|
||||||
|
mode := OutputMode{Width: 1920, Height: 1080, Refresh: 60000, Preferred: true}
|
||||||
|
a := &State{
|
||||||
|
Serial: 5,
|
||||||
|
Outputs: []Output{{
|
||||||
|
Name: "eDP-1",
|
||||||
|
Description: "Built-in display",
|
||||||
|
Make: "BOE",
|
||||||
|
Model: "0x0ABC",
|
||||||
|
SerialNumber: "12345",
|
||||||
|
PhysicalWidth: 309,
|
||||||
|
PhysicalHeight: 174,
|
||||||
|
Enabled: true,
|
||||||
|
X: 0,
|
||||||
|
Y: 0,
|
||||||
|
Transform: 0,
|
||||||
|
Scale: 1.0,
|
||||||
|
CurrentMode: &mode,
|
||||||
|
Modes: []OutputMode{mode},
|
||||||
|
AdaptiveSync: 0,
|
||||||
|
}},
|
||||||
|
}
|
||||||
|
b := &State{
|
||||||
|
Serial: 5,
|
||||||
|
Outputs: []Output{{
|
||||||
|
Name: "eDP-1",
|
||||||
|
Description: "Built-in display",
|
||||||
|
Make: "BOE",
|
||||||
|
Model: "0x0ABC",
|
||||||
|
SerialNumber: "12345",
|
||||||
|
PhysicalWidth: 309,
|
||||||
|
PhysicalHeight: 174,
|
||||||
|
Enabled: true,
|
||||||
|
X: 0,
|
||||||
|
Y: 0,
|
||||||
|
Transform: 0,
|
||||||
|
Scale: 1.0,
|
||||||
|
CurrentMode: &mode,
|
||||||
|
Modes: []OutputMode{mode},
|
||||||
|
AdaptiveSync: 0,
|
||||||
|
}},
|
||||||
|
}
|
||||||
|
assert.False(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_ConcurrentGetState(t *testing.T) {
|
||||||
|
m := &Manager{
|
||||||
|
state: &State{
|
||||||
|
Serial: 1,
|
||||||
|
Outputs: []Output{{Name: "eDP-1", Enabled: true}},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 50
|
||||||
|
const iterations = 100
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
s := m.GetState()
|
||||||
|
_ = s.Serial
|
||||||
|
_ = s.Outputs
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < goroutines/2; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(i int) {
|
||||||
|
defer wg.Done()
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
m.stateMutex.Lock()
|
||||||
|
m.state = &State{
|
||||||
|
Serial: uint32(j),
|
||||||
|
Outputs: []Output{{Name: "eDP-1", Scale: float64(j % 3)}},
|
||||||
|
}
|
||||||
|
m.stateMutex.Unlock()
|
||||||
|
}
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_ConcurrentSubscriberAccess(t *testing.T) {
|
||||||
|
m := &Manager{
|
||||||
|
stopChan: make(chan struct{}),
|
||||||
|
dirty: make(chan struct{}, 1),
|
||||||
|
}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 20
|
||||||
|
|
||||||
|
for i := 0; i < goroutines; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(id int) {
|
||||||
|
defer wg.Done()
|
||||||
|
subID := string(rune('a' + id))
|
||||||
|
ch := m.Subscribe(subID)
|
||||||
|
assert.NotNil(t, ch)
|
||||||
|
time.Sleep(time.Millisecond)
|
||||||
|
m.Unsubscribe(subID)
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_SyncmapHeadsConcurrentAccess(t *testing.T) {
|
||||||
|
m := &Manager{}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 30
|
||||||
|
const iterations = 50
|
||||||
|
|
||||||
|
for i := 0; i < goroutines; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(id int) {
|
||||||
|
defer wg.Done()
|
||||||
|
key := uint32(id)
|
||||||
|
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
state := &headState{
|
||||||
|
id: key,
|
||||||
|
name: "test-head",
|
||||||
|
enabled: j%2 == 0,
|
||||||
|
scale: float64(j % 3),
|
||||||
|
modeIDs: []uint32{uint32(j)},
|
||||||
|
}
|
||||||
|
m.heads.Store(key, state)
|
||||||
|
|
||||||
|
if loaded, ok := m.heads.Load(key); ok {
|
||||||
|
assert.Equal(t, key, loaded.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
m.heads.Range(func(k uint32, v *headState) bool {
|
||||||
|
_ = v.name
|
||||||
|
_ = v.enabled
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
m.heads.Delete(key)
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_SyncmapModesConcurrentAccess(t *testing.T) {
|
||||||
|
m := &Manager{}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
const goroutines = 30
|
||||||
|
const iterations = 50
|
||||||
|
|
||||||
|
for i := 0; i < goroutines; i++ {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(id int) {
|
||||||
|
defer wg.Done()
|
||||||
|
key := uint32(id)
|
||||||
|
|
||||||
|
for j := 0; j < iterations; j++ {
|
||||||
|
state := &modeState{
|
||||||
|
id: key,
|
||||||
|
width: int32(1920 + j),
|
||||||
|
height: int32(1080 + j),
|
||||||
|
refresh: 60000,
|
||||||
|
preferred: j == 0,
|
||||||
|
}
|
||||||
|
m.modes.Store(key, state)
|
||||||
|
|
||||||
|
if loaded, ok := m.modes.Load(key); ok {
|
||||||
|
assert.Equal(t, key, loaded.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
m.modes.Range(func(k uint32, v *modeState) bool {
|
||||||
|
_ = v.width
|
||||||
|
_ = v.height
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
m.modes.Delete(key)
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_NotifySubscribersNonBlocking(t *testing.T) {
|
||||||
|
m := &Manager{
|
||||||
|
dirty: make(chan struct{}, 1),
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
m.notifySubscribers()
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Len(t, m.dirty, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_PostQueueFull(t *testing.T) {
|
||||||
|
m := &Manager{
|
||||||
|
cmdq: make(chan cmd, 2),
|
||||||
|
stopChan: make(chan struct{}),
|
||||||
|
}
|
||||||
|
|
||||||
|
m.post(func() {})
|
||||||
|
m.post(func() {})
|
||||||
|
m.post(func() {})
|
||||||
|
m.post(func() {})
|
||||||
|
|
||||||
|
assert.Len(t, m.cmdq, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_GetStateNilState(t *testing.T) {
|
||||||
|
m := &Manager{}
|
||||||
|
|
||||||
|
s := m.GetState()
|
||||||
|
assert.NotNil(t, s.Outputs)
|
||||||
|
assert.Equal(t, uint32(0), s.Serial)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_FatalErrorChannel(t *testing.T) {
|
||||||
|
m := &Manager{
|
||||||
|
fatalError: make(chan error, 1),
|
||||||
|
}
|
||||||
|
|
||||||
|
ch := m.FatalError()
|
||||||
|
assert.NotNil(t, ch)
|
||||||
|
|
||||||
|
m.fatalError <- assert.AnError
|
||||||
|
err := <-ch
|
||||||
|
assert.Error(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestOutputMode_Fields(t *testing.T) {
|
||||||
|
mode := OutputMode{
|
||||||
|
Width: 1920,
|
||||||
|
Height: 1080,
|
||||||
|
Refresh: 60000,
|
||||||
|
Preferred: true,
|
||||||
|
ID: 42,
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Equal(t, int32(1920), mode.Width)
|
||||||
|
assert.Equal(t, int32(1080), mode.Height)
|
||||||
|
assert.Equal(t, int32(60000), mode.Refresh)
|
||||||
|
assert.True(t, mode.Preferred)
|
||||||
|
assert.Equal(t, uint32(42), mode.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestOutput_Fields(t *testing.T) {
|
||||||
|
out := Output{
|
||||||
|
Name: "eDP-1",
|
||||||
|
Description: "Built-in display",
|
||||||
|
Make: "BOE",
|
||||||
|
Model: "0x0ABC",
|
||||||
|
SerialNumber: "12345",
|
||||||
|
PhysicalWidth: 309,
|
||||||
|
PhysicalHeight: 174,
|
||||||
|
Enabled: true,
|
||||||
|
X: 0,
|
||||||
|
Y: 0,
|
||||||
|
Transform: 0,
|
||||||
|
Scale: 1.5,
|
||||||
|
AdaptiveSync: 1,
|
||||||
|
ID: 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Equal(t, "eDP-1", out.Name)
|
||||||
|
assert.Equal(t, "Built-in display", out.Description)
|
||||||
|
assert.True(t, out.Enabled)
|
||||||
|
assert.Equal(t, float64(1.5), out.Scale)
|
||||||
|
assert.Equal(t, uint32(1), out.AdaptiveSync)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestHeadState_ModeIDsSlice(t *testing.T) {
|
||||||
|
head := &headState{
|
||||||
|
id: 1,
|
||||||
|
modeIDs: make([]uint32, 0),
|
||||||
|
}
|
||||||
|
|
||||||
|
head.modeIDs = append(head.modeIDs, 1, 2, 3)
|
||||||
|
assert.Len(t, head.modeIDs, 3)
|
||||||
|
assert.Equal(t, uint32(1), head.modeIDs[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_BothCurrentModeNil(t *testing.T) {
|
||||||
|
a := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", CurrentMode: nil}}}
|
||||||
|
b := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1", CurrentMode: nil}}}
|
||||||
|
assert.False(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStateChanged_IndexOutOfBounds(t *testing.T) {
|
||||||
|
a := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1"}}}
|
||||||
|
b := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1"}, {Name: "HDMI-A-1"}}}
|
||||||
|
assert.True(t, stateChanged(a, b))
|
||||||
|
}
|
||||||
@@ -139,10 +139,32 @@ in
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
if [ -f session.json ]; then
|
if [ -f session.json ]; then
|
||||||
if cp "$(${jq} -r '.wallpaperPath' session.json)" wallpaper.jpg; then
|
copy_wallpaper() {
|
||||||
mv session.json session.orig.json
|
local path=$(${jq} -r ".$1 // empty" session.json)
|
||||||
${jq} '.wallpaperPath = "${cacheDir}/wallpaper.jpg"' session.orig.json > session.json
|
if [ -f "$path" ]; then
|
||||||
fi
|
cp "$path" "$2"
|
||||||
|
${jq} ".$1 = \"${cacheDir}/$2\"" session.json > session.tmp
|
||||||
|
mv session.tmp session.json
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
copy_monitor_wallpapers() {
|
||||||
|
${jq} -r ".$1 // {} | to_entries[] | .key + \":\" + .value" session.json 2>/dev/null | while IFS=: read monitor path; do
|
||||||
|
local dest="$2-$(echo "$monitor" | tr -c '[:alnum:]' '-')"
|
||||||
|
if [ -f "$path" ]; then
|
||||||
|
cp "$path" "$dest"
|
||||||
|
${jq} --arg m "$monitor" --arg p "${cacheDir}/$dest" ".$1[\$m] = \$p" session.json > session.tmp
|
||||||
|
mv session.tmp session.json
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
copy_wallpaper "wallpaperPath" "wallpaper"
|
||||||
|
copy_wallpaper "wallpaperPathLight" "wallpaper-light"
|
||||||
|
copy_wallpaper "wallpaperPathDark" "wallpaper-dark"
|
||||||
|
copy_monitor_wallpapers "monitorWallpapers" "wallpaper-monitor"
|
||||||
|
copy_monitor_wallpapers "monitorWallpapersLight" "wallpaper-monitor-light"
|
||||||
|
copy_monitor_wallpapers "monitorWallpapersDark" "wallpaper-monitor-dark"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f settings.json ]; then
|
if [ -f settings.json ]; then
|
||||||
|
|||||||
@@ -203,10 +203,6 @@ Singleton {
|
|||||||
"value": "scheme-vibrant",
|
"value": "scheme-vibrant",
|
||||||
"label": "Vibrant",
|
"label": "Vibrant",
|
||||||
"description": I18n.tr("Lively palette with saturated accents.")
|
"description": I18n.tr("Lively palette with saturated accents.")
|
||||||
}), ({
|
|
||||||
"value": "scheme-dynamic-contrast",
|
|
||||||
"label": "Dynamic Contrast",
|
|
||||||
"description": I18n.tr("High-contrast palette for strong visual distinction.")
|
|
||||||
}), ({
|
}), ({
|
||||||
"value": "scheme-content",
|
"value": "scheme-content",
|
||||||
"label": "Content",
|
"label": "Content",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ DankModal {
|
|||||||
layerNamespace: "dms:clipboard"
|
layerNamespace: "dms:clipboard"
|
||||||
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
windows: [clipboardHistoryModal.contentWindow]
|
windows: [clipboardHistoryModal.contentWindow, clipboardHistoryModal.backgroundWindow]
|
||||||
active: clipboardHistoryModal.useHyprlandFocusGrab && clipboardHistoryModal.shouldHaveFocus
|
active: clipboardHistoryModal.useHyprlandFocusGrab && clipboardHistoryModal.shouldHaveFocus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,12 +49,14 @@ Item {
|
|||||||
readonly property alias backgroundWindow: backgroundWindow
|
readonly property alias backgroundWindow: backgroundWindow
|
||||||
readonly property bool useHyprlandFocusGrab: CompositorService.useHyprlandFocusGrab
|
readonly property bool useHyprlandFocusGrab: CompositorService.useHyprlandFocusGrab
|
||||||
|
|
||||||
|
readonly property bool useSingleWindow: root.useHyprlandFocusGrab
|
||||||
|
|
||||||
signal opened
|
signal opened
|
||||||
signal dialogClosed
|
signal dialogClosed
|
||||||
signal backgroundClicked
|
signal backgroundClicked
|
||||||
|
|
||||||
property bool animationsEnabled: true
|
property bool animationsEnabled: true
|
||||||
readonly property bool useBackgroundWindow: true
|
readonly property bool useBackgroundWindow: !useSingleWindow
|
||||||
|
|
||||||
function open() {
|
function open() {
|
||||||
ModalManager.openModal(root);
|
ModalManager.openModal(root);
|
||||||
@@ -205,7 +207,7 @@ Item {
|
|||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
enabled: root.closeOnBackgroundClick && root.shouldBeVisible
|
enabled: root.useBackgroundWindow && root.closeOnBackgroundClick && root.shouldBeVisible
|
||||||
onClicked: mouse => {
|
onClicked: mouse => {
|
||||||
const clickX = mouse.x;
|
const clickX = mouse.x;
|
||||||
const clickY = mouse.y;
|
const clickY = mouse.y;
|
||||||
@@ -222,7 +224,7 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: "black"
|
color: "black"
|
||||||
opacity: root.showBackground && SettingsData.modalDarkenBackground ? (root.shouldBeVisible ? root.backgroundOpacity : 0) : 0
|
opacity: root.showBackground && SettingsData.modalDarkenBackground ? (root.shouldBeVisible ? root.backgroundOpacity : 0) : 0
|
||||||
visible: root.showBackground && SettingsData.modalDarkenBackground
|
visible: root.useBackgroundWindow && root.showBackground && SettingsData.modalDarkenBackground
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
enabled: root.animationsEnabled
|
enabled: root.animationsEnabled
|
||||||
@@ -271,15 +273,19 @@ Item {
|
|||||||
anchors {
|
anchors {
|
||||||
left: true
|
left: true
|
||||||
top: true
|
top: true
|
||||||
|
right: root.useSingleWindow
|
||||||
|
bottom: root.useSingleWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
WlrLayershell.margins {
|
WlrLayershell.margins {
|
||||||
left: Math.max(0, Theme.snap(root.alignedX - shadowBuffer, dpr))
|
left: root.useSingleWindow ? 0 : Math.max(0, Theme.snap(root.alignedX - shadowBuffer, dpr))
|
||||||
top: Math.max(0, Theme.snap(root.alignedY - shadowBuffer, dpr))
|
top: root.useSingleWindow ? 0 : Math.max(0, Theme.snap(root.alignedY - shadowBuffer, dpr))
|
||||||
|
right: 0
|
||||||
|
bottom: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
implicitWidth: root.alignedWidth + (shadowBuffer * 2)
|
implicitWidth: root.useSingleWindow ? undefined : root.alignedWidth + (shadowBuffer * 2)
|
||||||
implicitHeight: root.alignedHeight + (shadowBuffer * 2)
|
implicitHeight: root.useSingleWindow ? undefined : root.alignedHeight + (shadowBuffer * 2)
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
@@ -292,13 +298,48 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
enabled: root.useSingleWindow && root.closeOnBackgroundClick && root.shouldBeVisible
|
||||||
|
z: -2
|
||||||
|
onClicked: root.backgroundClicked()
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
z: -1
|
||||||
|
color: "black"
|
||||||
|
opacity: root.showBackground && SettingsData.modalDarkenBackground ? (root.shouldBeVisible ? root.backgroundOpacity : 0) : 0
|
||||||
|
visible: root.useSingleWindow && root.showBackground && SettingsData.modalDarkenBackground
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
enabled: root.animationsEnabled
|
||||||
|
NumberAnimation {
|
||||||
|
duration: root.animationDuration
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: root.shouldBeVisible ? root.animationEnterCurve : root.animationExitCurve
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: modalContainer
|
id: modalContainer
|
||||||
x: shadowBuffer
|
x: root.useSingleWindow ? root.alignedX : shadowBuffer
|
||||||
y: shadowBuffer
|
y: root.useSingleWindow ? root.alignedY : shadowBuffer
|
||||||
|
|
||||||
width: root.alignedWidth
|
width: root.alignedWidth
|
||||||
height: root.alignedHeight
|
height: root.alignedHeight
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
enabled: root.useSingleWindow
|
||||||
|
hoverEnabled: false
|
||||||
|
acceptedButtons: Qt.AllButtons
|
||||||
|
onPressed: mouse.accepted = true
|
||||||
|
onClicked: mouse.accepted = true
|
||||||
|
z: -1
|
||||||
|
}
|
||||||
|
|
||||||
readonly property bool slide: root.animationType === "slide"
|
readonly property bool slide: root.animationType === "slide"
|
||||||
readonly property real offsetX: slide ? 15 : 0
|
readonly property real offsetX: slide ? 15 : 0
|
||||||
readonly property real offsetY: slide ? -30 : root.animationOffset
|
readonly property real offsetY: slide ? -30 : root.animationOffset
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ DankModal {
|
|||||||
keepPopoutsOpen: true
|
keepPopoutsOpen: true
|
||||||
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
windows: [root.contentWindow]
|
windows: [root.contentWindow, root.backgroundWindow]
|
||||||
active: root.useHyprlandFocusGrab && root.shouldHaveFocus
|
active: root.useHyprlandFocusGrab && root.shouldHaveFocus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ FloatingWindow {
|
|||||||
title: I18n.tr("Settings", "settings window title")
|
title: I18n.tr("Settings", "settings window title")
|
||||||
minimumSize: Qt.size(500, 400)
|
minimumSize: Qt.size(500, 400)
|
||||||
implicitWidth: 800
|
implicitWidth: 800
|
||||||
implicitHeight: 940
|
implicitHeight: screen ? Math.min(940, screen.height - 100) : 940
|
||||||
color: Theme.surfaceContainer
|
color: Theme.surfaceContainer
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ DankModal {
|
|||||||
layerNamespace: "dms:spotlight"
|
layerNamespace: "dms:spotlight"
|
||||||
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
windows: [spotlightModal.contentWindow]
|
windows: [spotlightModal.contentWindow, spotlightModal.backgroundWindow]
|
||||||
active: spotlightModal.useHyprlandFocusGrab && spotlightModal.shouldHaveFocus
|
active: spotlightModal.useHyprlandFocusGrab && spotlightModal.shouldHaveFocus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,10 +79,12 @@ Variants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (source) {
|
if (!source) {
|
||||||
const formattedSource = source.startsWith("file://") ? source : "file://" + source;
|
isInitialized = true;
|
||||||
setWallpaperImmediate(formattedSource);
|
return;
|
||||||
}
|
}
|
||||||
|
const formattedSource = source.startsWith("file://") ? source : "file://" + source;
|
||||||
|
setWallpaperImmediate(formattedSource);
|
||||||
isInitialized = true;
|
isInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,22 +95,23 @@ Variants {
|
|||||||
property bool useNextForEffect: false
|
property bool useNextForEffect: false
|
||||||
|
|
||||||
onSourceChanged: {
|
onSourceChanged: {
|
||||||
const isColor = source.startsWith("#");
|
if (!source || source.startsWith("#")) {
|
||||||
|
|
||||||
if (!source) {
|
|
||||||
setWallpaperImmediate("");
|
setWallpaperImmediate("");
|
||||||
} else if (isColor) {
|
return;
|
||||||
setWallpaperImmediate("");
|
|
||||||
} else {
|
|
||||||
if (!isInitialized || !currentWallpaper.source) {
|
|
||||||
setWallpaperImmediate(source.startsWith("file://") ? source : "file://" + source);
|
|
||||||
isInitialized = true;
|
|
||||||
} else if (CompositorService.isNiri && SessionData.isSwitchingMode) {
|
|
||||||
setWallpaperImmediate(source.startsWith("file://") ? source : "file://" + source);
|
|
||||||
} else {
|
|
||||||
changeWallpaper(source.startsWith("file://") ? source : "file://" + source);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const formattedSource = source.startsWith("file://") ? source : "file://" + source;
|
||||||
|
|
||||||
|
if (!isInitialized || !currentWallpaper.source) {
|
||||||
|
setWallpaperImmediate(formattedSource);
|
||||||
|
isInitialized = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (CompositorService.isNiri && SessionData.isSwitchingMode) {
|
||||||
|
setWallpaperImmediate(formattedSource);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
changeWallpaper(formattedSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWallpaperImmediate(newSource) {
|
function setWallpaperImmediate(newSource) {
|
||||||
@@ -120,15 +123,18 @@ Variants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function startTransition() {
|
function startTransition() {
|
||||||
currentWallpaper.cache = true;
|
|
||||||
nextWallpaper.cache = true;
|
|
||||||
root.useNextForEffect = true;
|
root.useNextForEffect = true;
|
||||||
root.effectActive = true;
|
root.effectActive = true;
|
||||||
if (srcNext.scheduleUpdate)
|
if (srcNext.scheduleUpdate)
|
||||||
srcNext.scheduleUpdate();
|
srcNext.scheduleUpdate();
|
||||||
Qt.callLater(() => {
|
transitionDelayTimer.start();
|
||||||
transitionAnimation.start();
|
}
|
||||||
});
|
|
||||||
|
Timer {
|
||||||
|
id: transitionDelayTimer
|
||||||
|
interval: 16
|
||||||
|
repeat: false
|
||||||
|
onTriggered: transitionAnimation.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeWallpaper(newPath) {
|
function changeWallpaper(newPath) {
|
||||||
@@ -143,7 +149,6 @@ Variants {
|
|||||||
currentWallpaper.source = nextWallpaper.source;
|
currentWallpaper.source = nextWallpaper.source;
|
||||||
nextWallpaper.source = "";
|
nextWallpaper.source = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!currentWallpaper.source) {
|
if (!currentWallpaper.source) {
|
||||||
setWallpaperImmediate(newPath);
|
setWallpaperImmediate(newPath);
|
||||||
return;
|
return;
|
||||||
@@ -151,9 +156,8 @@ Variants {
|
|||||||
|
|
||||||
nextWallpaper.source = newPath;
|
nextWallpaper.source = newPath;
|
||||||
|
|
||||||
if (nextWallpaper.status === Image.Ready) {
|
if (nextWallpaper.status === Image.Ready)
|
||||||
root.startTransition();
|
root.startTransition();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
@@ -166,9 +170,9 @@ Variants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property real screenScale: CompositorService.getScreenScale(modelData)
|
readonly property int maxTextureSize: 8192
|
||||||
property int physicalWidth: Math.round(modelData.width * screenScale)
|
property int textureWidth: Math.min(modelData.width, maxTextureSize)
|
||||||
property int physicalHeight: Math.round(modelData.height * screenScale)
|
property int textureHeight: Math.min(modelData.height, maxTextureSize)
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: currentWallpaper
|
id: currentWallpaper
|
||||||
@@ -178,7 +182,7 @@ Variants {
|
|||||||
asynchronous: true
|
asynchronous: true
|
||||||
smooth: true
|
smooth: true
|
||||||
cache: true
|
cache: true
|
||||||
sourceSize: Qt.size(root.physicalWidth, root.physicalHeight)
|
sourceSize: Qt.size(root.textureWidth, root.textureHeight)
|
||||||
fillMode: root.getFillMode(SessionData.isGreeterMode ? GreetdSettings.wallpaperFillMode : SettingsData.wallpaperFillMode)
|
fillMode: root.getFillMode(SessionData.isGreeterMode ? GreetdSettings.wallpaperFillMode : SettingsData.wallpaperFillMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,8 +193,8 @@ Variants {
|
|||||||
opacity: 0
|
opacity: 0
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
smooth: true
|
smooth: true
|
||||||
cache: false
|
cache: true
|
||||||
sourceSize: Qt.size(root.physicalWidth, root.physicalHeight)
|
sourceSize: Qt.size(root.textureWidth, root.textureHeight)
|
||||||
fillMode: root.getFillMode(SessionData.isGreeterMode ? GreetdSettings.wallpaperFillMode : SettingsData.wallpaperFillMode)
|
fillMode: root.getFillMode(SessionData.isGreeterMode ? GreetdSettings.wallpaperFillMode : SettingsData.wallpaperFillMode)
|
||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
@@ -209,7 +213,7 @@ Variants {
|
|||||||
live: root.effectActive
|
live: root.effectActive
|
||||||
mipmap: false
|
mipmap: false
|
||||||
recursive: false
|
recursive: false
|
||||||
textureSize: root.effectActive ? Qt.size(root.physicalWidth, root.physicalHeight) : Qt.size(1, 1)
|
textureSize: Qt.size(root.textureWidth, root.textureHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -265,19 +269,12 @@ Variants {
|
|||||||
duration: 1000
|
duration: 1000
|
||||||
easing.type: Easing.InOutCubic
|
easing.type: Easing.InOutCubic
|
||||||
onFinished: {
|
onFinished: {
|
||||||
if (nextWallpaper.source && nextWallpaper.status === Image.Ready) {
|
if (nextWallpaper.source && nextWallpaper.status === Image.Ready)
|
||||||
currentWallpaper.source = nextWallpaper.source;
|
currentWallpaper.source = nextWallpaper.source;
|
||||||
}
|
|
||||||
root.useNextForEffect = false;
|
root.useNextForEffect = false;
|
||||||
Qt.callLater(() => {
|
nextWallpaper.source = "";
|
||||||
nextWallpaper.source = "";
|
root.transitionProgress = 0.0;
|
||||||
Qt.callLater(() => {
|
root.effectActive = false;
|
||||||
root.effectActive = false;
|
|
||||||
currentWallpaper.cache = true;
|
|
||||||
nextWallpaper.cache = false;
|
|
||||||
root.transitionProgress = 0.0;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ PluginComponent {
|
|||||||
|
|
||||||
ccDetailContent: Component {
|
ccDetailContent: Component {
|
||||||
VpnDetailContent {
|
VpnDetailContent {
|
||||||
listHeight: 180
|
listHeight: 260
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,13 +18,16 @@ Item {
|
|||||||
|
|
||||||
function getDetailHeight(section) {
|
function getDetailHeight(section) {
|
||||||
const maxAvailable = parent ? parent.height - Theme.spacingS : 9999;
|
const maxAvailable = parent ? parent.height - Theme.spacingS : 9999;
|
||||||
if (section === "wifi")
|
switch (true) {
|
||||||
|
case section === "wifi":
|
||||||
|
case section === "bluetooth":
|
||||||
|
case section === "builtin_vpn":
|
||||||
return Math.min(350, maxAvailable);
|
return Math.min(350, maxAvailable);
|
||||||
if (section === "bluetooth")
|
case section.startsWith("brightnessSlider_"):
|
||||||
return Math.min(350, maxAvailable);
|
|
||||||
if (section.startsWith("brightnessSlider_"))
|
|
||||||
return Math.min(400, maxAvailable);
|
return Math.min(400, maxAvailable);
|
||||||
return Math.min(250, maxAvailable);
|
default:
|
||||||
|
return Math.min(250, maxAvailable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
|||||||
@@ -1088,6 +1088,7 @@ Item {
|
|||||||
id: layoutComponent
|
id: layoutComponent
|
||||||
|
|
||||||
DWLLayout {
|
DWLLayout {
|
||||||
|
id: layoutWidget
|
||||||
layoutPopupVisible: layoutPopoutLoader.item ? layoutPopoutLoader.item.shouldBeVisible : false
|
layoutPopupVisible: layoutPopoutLoader.item ? layoutPopoutLoader.item.shouldBeVisible : false
|
||||||
widgetThickness: barWindow.widgetThickness
|
widgetThickness: barWindow.widgetThickness
|
||||||
barThickness: barWindow.effectiveBarThickness
|
barThickness: barWindow.effectiveBarThickness
|
||||||
@@ -1100,14 +1101,19 @@ Item {
|
|||||||
parentScreen: barWindow.screen
|
parentScreen: barWindow.screen
|
||||||
onToggleLayoutPopup: {
|
onToggleLayoutPopup: {
|
||||||
layoutPopoutLoader.active = true;
|
layoutPopoutLoader.active = true;
|
||||||
|
if (!layoutPopoutLoader.item)
|
||||||
|
return;
|
||||||
const effectiveBarConfig = topBarContent.barConfig;
|
const effectiveBarConfig = topBarContent.barConfig;
|
||||||
const barPosition = barWindow.axis?.edge === "left" ? 2 : (barWindow.axis?.edge === "right" ? 3 : (barWindow.axis?.edge === "top" ? 0 : 1));
|
const barPosition = barWindow.axis?.edge === "left" ? 2 : (barWindow.axis?.edge === "right" ? 3 : (barWindow.axis?.edge === "top" ? 0 : 1));
|
||||||
if (layoutPopoutLoader.item && layoutPopoutLoader.item.setBarContext) {
|
|
||||||
layoutPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
|
if (layoutPopoutLoader.item.setTriggerPosition) {
|
||||||
}
|
const globalPos = layoutWidget.mapToGlobal(0, 0);
|
||||||
if (layoutPopoutLoader.item) {
|
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, layoutWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
|
||||||
PopoutManager.requestPopout(layoutPopoutLoader.item, undefined, "layout");
|
const widgetSection = topBarContent.getWidgetSection(parent) || "center";
|
||||||
|
layoutPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PopoutManager.requestPopout(layoutPopoutLoader.item, undefined, "layout");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -552,22 +552,31 @@ DankPopout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DankButtonGroup {
|
Item {
|
||||||
property var profileModel: (typeof PowerProfiles !== "undefined") ? [PowerProfile.PowerSaver, PowerProfile.Balanced].concat(PowerProfiles.hasPerformanceProfile ? [PowerProfile.Performance] : []) : [PowerProfile.PowerSaver, PowerProfile.Balanced, PowerProfile.Performance]
|
width: parent.width
|
||||||
property int currentProfileIndex: {
|
height: profileButtonGroup.height * profileButtonGroup.scale
|
||||||
if (typeof PowerProfiles === "undefined")
|
|
||||||
return 1;
|
|
||||||
return profileModel.findIndex(profile => root.isActiveProfile(profile));
|
|
||||||
}
|
|
||||||
|
|
||||||
model: profileModel.map(profile => Theme.getPowerProfileLabel(profile))
|
DankButtonGroup {
|
||||||
currentIndex: currentProfileIndex
|
id: profileButtonGroup
|
||||||
selectionMode: "single"
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
property var profileModel: (typeof PowerProfiles !== "undefined") ? [PowerProfile.PowerSaver, PowerProfile.Balanced].concat(PowerProfiles.hasPerformanceProfile ? [PowerProfile.Performance] : []) : [PowerProfile.PowerSaver, PowerProfile.Balanced, PowerProfile.Performance]
|
||||||
onSelectionChanged: (index, selected) => {
|
property int currentProfileIndex: {
|
||||||
if (!selected)
|
if (typeof PowerProfiles === "undefined")
|
||||||
return;
|
return 1;
|
||||||
root.setProfile(profileModel[index]);
|
return profileModel.findIndex(profile => root.isActiveProfile(profile));
|
||||||
|
}
|
||||||
|
|
||||||
|
scale: Math.min(1, parent.width / implicitWidth)
|
||||||
|
transformOrigin: Item.Center
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
model: profileModel.map(profile => Theme.getPowerProfileLabel(profile))
|
||||||
|
currentIndex: currentProfileIndex
|
||||||
|
selectionMode: "single"
|
||||||
|
onSelectionChanged: (index, selected) => {
|
||||||
|
if (!selected)
|
||||||
|
return;
|
||||||
|
root.setProfile(profileModel[index]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ DankPopout {
|
|||||||
triggerY = y;
|
triggerY = y;
|
||||||
triggerWidth = width;
|
triggerWidth = width;
|
||||||
triggerSection = section;
|
triggerSection = section;
|
||||||
|
triggerScreen = screen;
|
||||||
root.screen = screen;
|
root.screen = screen;
|
||||||
|
|
||||||
storedBarThickness = barThickness !== undefined ? barThickness : (Theme.barHeight - 4);
|
storedBarThickness = barThickness !== undefined ? barThickness : (Theme.barHeight - 4);
|
||||||
@@ -102,6 +103,8 @@ DankPopout {
|
|||||||
screen: triggerScreen
|
screen: triggerScreen
|
||||||
shouldBeVisible: false
|
shouldBeVisible: false
|
||||||
|
|
||||||
|
onBackgroundClicked: close()
|
||||||
|
|
||||||
content: Component {
|
content: Component {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: layoutContent
|
id: layoutContent
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Effects
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
import Quickshell.Hyprland
|
import Quickshell.Hyprland
|
||||||
@@ -245,11 +246,14 @@ Item {
|
|||||||
if (!byApp[key]) {
|
if (!byApp[key]) {
|
||||||
const moddedId = Paths.moddedAppId(keyBase);
|
const moddedId = Paths.moddedAppId(keyBase);
|
||||||
const isSteamApp = moddedId.toLowerCase().includes("steam_app");
|
const isSteamApp = moddedId.toLowerCase().includes("steam_app");
|
||||||
const icon = isSteamApp ? "" : DesktopService.resolveIconPath(moddedId);
|
const isQuickshell = keyBase === "org.quickshell";
|
||||||
|
const desktopEntry = DesktopEntries.heuristicLookup(keyBase);
|
||||||
|
const icon = isSteamApp ? "" : Paths.getAppIcon(keyBase, desktopEntry);
|
||||||
byApp[key] = {
|
byApp[key] = {
|
||||||
"type": "icon",
|
"type": "icon",
|
||||||
"icon": icon,
|
"icon": icon,
|
||||||
"isSteamApp": isSteamApp,
|
"isSteamApp": isSteamApp,
|
||||||
|
"isQuickshell": isQuickshell,
|
||||||
"active": !!((w.activated || w.is_focused) || (CompositorService.isNiri && w.is_focused)),
|
"active": !!((w.activated || w.is_focused) || (CompositorService.isNiri && w.is_focused)),
|
||||||
"count": 1,
|
"count": 1,
|
||||||
"windowId": w.address || w.id,
|
"windowId": w.address || w.id,
|
||||||
@@ -446,6 +450,7 @@ Item {
|
|||||||
readonly property real padding: Math.max(Theme.spacingXS, Theme.spacingS * (widgetHeight / 30))
|
readonly property real padding: Math.max(Theme.spacingXS, Theme.spacingS * (widgetHeight / 30))
|
||||||
readonly property real visualWidth: isVertical ? widgetHeight : (workspaceRow.implicitWidth + padding * 2)
|
readonly property real visualWidth: isVertical ? widgetHeight : (workspaceRow.implicitWidth + padding * 2)
|
||||||
readonly property real visualHeight: isVertical ? (workspaceRow.implicitHeight + padding * 2) : widgetHeight
|
readonly property real visualHeight: isVertical ? (workspaceRow.implicitHeight + padding * 2) : widgetHeight
|
||||||
|
readonly property real appIconSize: Theme.barIconSize(barThickness, -6)
|
||||||
|
|
||||||
function getRealWorkspaces() {
|
function getRealWorkspaces() {
|
||||||
return root.workspaceList.filter(ws => {
|
return root.workspaceList.filter(ws => {
|
||||||
@@ -719,14 +724,14 @@ Item {
|
|||||||
readonly property real iconsExtraWidth: {
|
readonly property real iconsExtraWidth: {
|
||||||
if (!root.isVertical && SettingsData.showWorkspaceApps && loadedIcons.length > 0) {
|
if (!root.isVertical && SettingsData.showWorkspaceApps && loadedIcons.length > 0) {
|
||||||
const numIcons = Math.min(loadedIcons.length, SettingsData.maxWorkspaceIcons);
|
const numIcons = Math.min(loadedIcons.length, SettingsData.maxWorkspaceIcons);
|
||||||
return numIcons * 18 + (numIcons > 0 ? (numIcons - 1) * Theme.spacingXS : 0) + (isActive ? Theme.spacingXS : 0);
|
return numIcons * root.appIconSize + (numIcons > 0 ? (numIcons - 1) * Theme.spacingXS : 0) + (isActive ? Theme.spacingXS : 0);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
readonly property real iconsExtraHeight: {
|
readonly property real iconsExtraHeight: {
|
||||||
if (root.isVertical && SettingsData.showWorkspaceApps && loadedIcons.length > 0) {
|
if (root.isVertical && SettingsData.showWorkspaceApps && loadedIcons.length > 0) {
|
||||||
const numIcons = Math.min(loadedIcons.length, SettingsData.maxWorkspaceIcons);
|
const numIcons = Math.min(loadedIcons.length, SettingsData.maxWorkspaceIcons);
|
||||||
return numIcons * 18 + (numIcons > 0 ? (numIcons - 1) * Theme.spacingXS : 0) + (isActive ? Theme.spacingXS : 0);
|
return numIcons * root.appIconSize + (numIcons > 0 ? (numIcons - 1) * Theme.spacingXS : 0) + (isActive ? Theme.spacingXS : 0);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -897,7 +902,7 @@ Item {
|
|||||||
Item {
|
Item {
|
||||||
visible: loadedHasIcon && loadedIconData?.type === "icon"
|
visible: loadedHasIcon && loadedIconData?.type === "icon"
|
||||||
width: wsIcon.width + (isActive && loadedIcons.length > 0 ? 4 : 0)
|
width: wsIcon.width + (isActive && loadedIcons.length > 0 ? 4 : 0)
|
||||||
height: 18
|
height: root.appIconSize
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
id: wsIcon
|
id: wsIcon
|
||||||
@@ -912,7 +917,7 @@ Item {
|
|||||||
Item {
|
Item {
|
||||||
visible: loadedHasIcon && loadedIconData?.type === "text"
|
visible: loadedHasIcon && loadedIconData?.type === "text"
|
||||||
width: wsText.implicitWidth + (isActive && loadedIcons.length > 0 ? 4 : 0)
|
width: wsText.implicitWidth + (isActive && loadedIcons.length > 0 ? 4 : 0)
|
||||||
height: 18
|
height: root.appIconSize
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
id: wsText
|
id: wsText
|
||||||
@@ -927,7 +932,7 @@ Item {
|
|||||||
Item {
|
Item {
|
||||||
visible: SettingsData.showWorkspaceIndex && !loadedHasIcon
|
visible: SettingsData.showWorkspaceIndex && !loadedHasIcon
|
||||||
width: wsIndexText.implicitWidth + (isActive && loadedIcons.length > 0 ? 4 : 0)
|
width: wsIndexText.implicitWidth + (isActive && loadedIcons.length > 0 ? 4 : 0)
|
||||||
height: 18
|
height: root.appIconSize
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
id: wsIndexText
|
id: wsIndexText
|
||||||
@@ -944,48 +949,61 @@ Item {
|
|||||||
values: loadedIcons.slice(0, SettingsData.maxWorkspaceIcons)
|
values: loadedIcons.slice(0, SettingsData.maxWorkspaceIcons)
|
||||||
}
|
}
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
width: 18
|
width: root.appIconSize
|
||||||
height: 18
|
height: root.appIconSize
|
||||||
|
|
||||||
IconImage {
|
IconImage {
|
||||||
id: appIcon
|
id: rowAppIcon
|
||||||
property var windowId: modelData.windowId
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: modelData.icon
|
source: modelData.icon
|
||||||
opacity: modelData.active ? 1.0 : appMouseArea.containsMouse ? 0.8 : 0.6
|
opacity: modelData.active ? 1.0 : rowAppMouseArea.containsMouse ? 0.8 : 0.6
|
||||||
visible: !modelData.isSteamApp
|
visible: !modelData.isSteamApp && !modelData.isQuickshell
|
||||||
|
}
|
||||||
|
|
||||||
|
IconImage {
|
||||||
|
anchors.fill: parent
|
||||||
|
source: modelData.icon
|
||||||
|
opacity: modelData.active ? 1.0 : rowAppMouseArea.containsMouse ? 0.8 : 0.6
|
||||||
|
visible: modelData.isQuickshell
|
||||||
|
layer.enabled: true
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
saturation: 0
|
||||||
|
colorization: 1
|
||||||
|
colorizationColor: isActive ? Theme.primaryContainer : Theme.primary
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
size: 18
|
size: root.appIconSize
|
||||||
name: "sports_esports"
|
name: "sports_esports"
|
||||||
color: Theme.widgetTextColor
|
color: Theme.widgetTextColor
|
||||||
opacity: modelData.active ? 1.0 : appMouseArea.containsMouse ? 0.8 : 0.6
|
opacity: modelData.active ? 1.0 : rowAppMouseArea.containsMouse ? 0.8 : 0.6
|
||||||
visible: modelData.isSteamApp
|
visible: modelData.isSteamApp
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: appMouseArea
|
id: rowAppMouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
enabled: isActive
|
enabled: isActive
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (!appIcon.windowId)
|
const winId = modelData.windowId;
|
||||||
|
if (!winId)
|
||||||
return;
|
return;
|
||||||
if (CompositorService.isHyprland) {
|
if (CompositorService.isHyprland) {
|
||||||
Hyprland.dispatch(`focuswindow address:${appIcon.windowId}`);
|
Hyprland.dispatch(`focuswindow address:${winId}`);
|
||||||
} else if (CompositorService.isNiri) {
|
} else if (CompositorService.isNiri) {
|
||||||
NiriService.focusWindow(appIcon.windowId);
|
NiriService.focusWindow(winId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
visible: modelData.count > 1 && !isActive
|
visible: modelData.count > 1 && !isActive
|
||||||
width: 12
|
width: root.appIconSize * 0.67
|
||||||
height: 12
|
height: root.appIconSize * 0.67
|
||||||
radius: 6
|
radius: root.appIconSize * 0.33
|
||||||
color: "black"
|
color: "black"
|
||||||
border.color: "white"
|
border.color: "white"
|
||||||
border.width: 1
|
border.width: 1
|
||||||
@@ -996,7 +1014,7 @@ Item {
|
|||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: modelData.count
|
text: modelData.count
|
||||||
font.pixelSize: 8
|
font.pixelSize: root.appIconSize * 0.44
|
||||||
color: "white"
|
color: "white"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1034,48 +1052,61 @@ Item {
|
|||||||
values: loadedIcons.slice(0, SettingsData.maxWorkspaceIcons)
|
values: loadedIcons.slice(0, SettingsData.maxWorkspaceIcons)
|
||||||
}
|
}
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
width: 18
|
width: root.appIconSize
|
||||||
height: 18
|
height: root.appIconSize
|
||||||
|
|
||||||
IconImage {
|
IconImage {
|
||||||
id: appIcon
|
id: colAppIcon
|
||||||
property var windowId: modelData.windowId
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: modelData.icon
|
source: modelData.icon
|
||||||
opacity: modelData.active ? 1.0 : appMouseArea.containsMouse ? 0.8 : 0.6
|
opacity: modelData.active ? 1.0 : colAppMouseArea.containsMouse ? 0.8 : 0.6
|
||||||
visible: !modelData.isSteamApp
|
visible: !modelData.isSteamApp && !modelData.isQuickshell
|
||||||
|
}
|
||||||
|
|
||||||
|
IconImage {
|
||||||
|
anchors.fill: parent
|
||||||
|
source: modelData.icon
|
||||||
|
opacity: modelData.active ? 1.0 : colAppMouseArea.containsMouse ? 0.8 : 0.6
|
||||||
|
visible: modelData.isQuickshell
|
||||||
|
layer.enabled: true
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
saturation: 0
|
||||||
|
colorization: 1
|
||||||
|
colorizationColor: isActive ? Theme.primaryContainer : Theme.primary
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
size: 18
|
size: root.appIconSize
|
||||||
name: "sports_esports"
|
name: "sports_esports"
|
||||||
color: Theme.widgetTextColor
|
color: Theme.widgetTextColor
|
||||||
opacity: modelData.active ? 1.0 : appMouseArea.containsMouse ? 0.8 : 0.6
|
opacity: modelData.active ? 1.0 : colAppMouseArea.containsMouse ? 0.8 : 0.6
|
||||||
visible: modelData.isSteamApp
|
visible: modelData.isSteamApp
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: appMouseArea
|
id: colAppMouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
enabled: isActive
|
enabled: isActive
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (!appIcon.windowId)
|
const winId = modelData.windowId;
|
||||||
|
if (!winId)
|
||||||
return;
|
return;
|
||||||
if (CompositorService.isHyprland) {
|
if (CompositorService.isHyprland) {
|
||||||
Hyprland.dispatch(`focuswindow address:${appIcon.windowId}`);
|
Hyprland.dispatch(`focuswindow address:${winId}`);
|
||||||
} else if (CompositorService.isNiri) {
|
} else if (CompositorService.isNiri) {
|
||||||
NiriService.focusWindow(appIcon.windowId);
|
NiriService.focusWindow(winId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
visible: modelData.count > 1 && !isActive
|
visible: modelData.count > 1 && !isActive
|
||||||
width: 12
|
width: root.appIconSize * 0.67
|
||||||
height: 12
|
height: root.appIconSize * 0.67
|
||||||
radius: 6
|
radius: root.appIconSize * 0.33
|
||||||
color: "black"
|
color: "black"
|
||||||
border.color: "white"
|
border.color: "white"
|
||||||
border.width: 1
|
border.width: 1
|
||||||
@@ -1086,7 +1117,7 @@ Item {
|
|||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: modelData.count
|
text: modelData.count
|
||||||
font.pixelSize: 8
|
font.pixelSize: root.appIconSize * 0.44
|
||||||
color: "white"
|
color: "white"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ Item {
|
|||||||
DankTextField {
|
DankTextField {
|
||||||
id: searchField
|
id: searchField
|
||||||
width: parent.width - addButton.width - Theme.spacingM
|
width: parent.width - addButton.width - Theme.spacingM
|
||||||
height: 44
|
height: Math.round(Theme.fontSizeMedium * 3)
|
||||||
placeholderText: I18n.tr("Search keybinds...")
|
placeholderText: I18n.tr("Search keybinds...")
|
||||||
leftIconName: "search"
|
leftIconName: "search"
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
@@ -240,8 +240,8 @@ Item {
|
|||||||
|
|
||||||
DankActionButton {
|
DankActionButton {
|
||||||
id: addButton
|
id: addButton
|
||||||
width: 44
|
width: searchField.height
|
||||||
height: 44
|
height: searchField.height
|
||||||
circular: false
|
circular: false
|
||||||
iconName: "add"
|
iconName: "add"
|
||||||
iconSize: Theme.iconSize
|
iconSize: Theme.iconSize
|
||||||
@@ -331,7 +331,7 @@ Item {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
id: fixButton
|
id: fixButton
|
||||||
width: fixButtonText.implicitWidth + Theme.spacingL * 2
|
width: fixButtonText.implicitWidth + Theme.spacingL * 2
|
||||||
height: 36
|
height: Math.round(Theme.fontSizeMedium * 2.5)
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
visible: warningBox.showError || warningBox.showSetup
|
visible: warningBox.showError || warningBox.showSetup
|
||||||
color: KeybindsService.fixing ? Theme.withAlpha(Theme.error, 0.6) : Theme.error
|
color: KeybindsService.fixing ? Theme.withAlpha(Theme.error, 0.6) : Theme.error
|
||||||
@@ -382,9 +382,10 @@ Item {
|
|||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
readonly property real chipHeight: allChip.implicitHeight + Theme.spacingM
|
||||||
width: allChip.implicitWidth + Theme.spacingL
|
width: allChip.implicitWidth + Theme.spacingL
|
||||||
height: 32
|
height: chipHeight
|
||||||
radius: 16
|
radius: chipHeight / 2
|
||||||
color: !keybindsTab.selectedCategory ? Theme.primary : Theme.surfaceContainerHighest
|
color: !keybindsTab.selectedCategory ? Theme.primary : Theme.surfaceContainerHighest
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
@@ -412,9 +413,10 @@ Item {
|
|||||||
required property string modelData
|
required property string modelData
|
||||||
required property int index
|
required property int index
|
||||||
|
|
||||||
|
readonly property real chipHeight: catText.implicitHeight + Theme.spacingM
|
||||||
width: catText.implicitWidth + Theme.spacingL
|
width: catText.implicitWidth + Theme.spacingL
|
||||||
height: 32
|
height: chipHeight
|
||||||
radius: 16
|
radius: chipHeight / 2
|
||||||
color: keybindsTab.selectedCategory === modelData ? Theme.primary : (modelData === "__overrides__" ? Theme.withAlpha(Theme.primary, 0.15) : Theme.surfaceContainerHighest)
|
color: keybindsTab.selectedCategory === modelData ? Theme.primary : (modelData === "__overrides__" ? Theme.withAlpha(Theme.primary, 0.15) : Theme.surfaceContainerHighest)
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ StyledRect {
|
|||||||
property string pluginSettingsPath: pluginData ? (pluginData.settingsPath || "") : ""
|
property string pluginSettingsPath: pluginData ? (pluginData.settingsPath || "") : ""
|
||||||
property var pluginPermissions: pluginData ? (pluginData.permissions || []) : []
|
property var pluginPermissions: pluginData ? (pluginData.permissions || []) : []
|
||||||
property bool hasSettings: pluginData && pluginData.settings !== undefined && pluginData.settings !== ""
|
property bool hasSettings: pluginData && pluginData.settings !== undefined && pluginData.settings !== ""
|
||||||
|
property bool isSystemPlugin: pluginData ? (pluginData.source === "system") : false
|
||||||
property bool isExpanded: expandedPluginId === pluginId
|
property bool isExpanded: expandedPluginId === pluginId
|
||||||
property bool isLoaded: {
|
property bool isLoaded: {
|
||||||
PluginService.loadedPlugins;
|
PluginService.loadedPlugins;
|
||||||
@@ -116,7 +117,7 @@ StyledRect {
|
|||||||
height: 28
|
height: 28
|
||||||
radius: 14
|
radius: 14
|
||||||
color: updateArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHighest, Theme.popupTransparency) : "transparent"
|
color: updateArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHighest, Theme.popupTransparency) : "transparent"
|
||||||
visible: DMSService.dmsAvailable && root.isLoaded && root.hasUpdate
|
visible: DMSService.dmsAvailable && root.isLoaded && root.hasUpdate && !root.isSystemPlugin
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
@@ -160,7 +161,7 @@ StyledRect {
|
|||||||
height: 28
|
height: 28
|
||||||
radius: 14
|
radius: 14
|
||||||
color: uninstallArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHighest, Theme.popupTransparency) : "transparent"
|
color: uninstallArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHighest, Theme.popupTransparency) : "transparent"
|
||||||
visible: DMSService.dmsAvailable
|
visible: DMSService.dmsAvailable && !root.isSystemPlugin
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|||||||
@@ -57,15 +57,11 @@ Variants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
onTransitionTypeChanged: {
|
onTransitionTypeChanged: {
|
||||||
if (transitionType === "random") {
|
if (transitionType !== "random") {
|
||||||
if (SessionData.includedTransitions.length === 0) {
|
|
||||||
actualTransitionType = "none";
|
|
||||||
} else {
|
|
||||||
actualTransitionType = SessionData.includedTransitions[Math.floor(Math.random() * SessionData.includedTransitions.length)];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
actualTransitionType = transitionType;
|
actualTransitionType = transitionType;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
actualTransitionType = SessionData.includedTransitions.length === 0 ? "none" : SessionData.includedTransitions[Math.floor(Math.random() * SessionData.includedTransitions.length)];
|
||||||
}
|
}
|
||||||
|
|
||||||
property real transitionProgress: 0
|
property real transitionProgress: 0
|
||||||
@@ -108,30 +104,33 @@ Variants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (source) {
|
if (!source) {
|
||||||
const formattedSource = source.startsWith("file://") ? source : "file://" + source;
|
isInitialized = true;
|
||||||
setWallpaperImmediate(formattedSource);
|
return;
|
||||||
}
|
}
|
||||||
|
const formattedSource = source.startsWith("file://") ? source : "file://" + source;
|
||||||
|
setWallpaperImmediate(formattedSource);
|
||||||
isInitialized = true;
|
isInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
onSourceChanged: {
|
onSourceChanged: {
|
||||||
const isColor = source.startsWith("#");
|
if (!source || source.startsWith("#")) {
|
||||||
|
|
||||||
if (!source) {
|
|
||||||
setWallpaperImmediate("");
|
setWallpaperImmediate("");
|
||||||
} else if (isColor) {
|
return;
|
||||||
setWallpaperImmediate("");
|
|
||||||
} else {
|
|
||||||
if (!isInitialized || !currentWallpaper.source) {
|
|
||||||
setWallpaperImmediate(source.startsWith("file://") ? source : "file://" + source);
|
|
||||||
isInitialized = true;
|
|
||||||
} else if (CompositorService.isNiri && SessionData.isSwitchingMode) {
|
|
||||||
setWallpaperImmediate(source.startsWith("file://") ? source : "file://" + source);
|
|
||||||
} else {
|
|
||||||
changeWallpaper(source.startsWith("file://") ? source : "file://" + source);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const formattedSource = source.startsWith("file://") ? source : "file://" + source;
|
||||||
|
|
||||||
|
if (!isInitialized || !currentWallpaper.source) {
|
||||||
|
setWallpaperImmediate(formattedSource);
|
||||||
|
isInitialized = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (CompositorService.isNiri && SessionData.isSwitchingMode) {
|
||||||
|
setWallpaperImmediate(formattedSource);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
changeWallpaper(formattedSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWallpaperImmediate(newSource) {
|
function setWallpaperImmediate(newSource) {
|
||||||
@@ -143,8 +142,6 @@ Variants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function startTransition() {
|
function startTransition() {
|
||||||
currentWallpaper.cache = true;
|
|
||||||
nextWallpaper.cache = true;
|
|
||||||
currentWallpaper.layer.enabled = true;
|
currentWallpaper.layer.enabled = true;
|
||||||
nextWallpaper.layer.enabled = true;
|
nextWallpaper.layer.enabled = true;
|
||||||
root.useNextForEffect = true;
|
root.useNextForEffect = true;
|
||||||
@@ -153,9 +150,14 @@ Variants {
|
|||||||
srcCurrent.scheduleUpdate();
|
srcCurrent.scheduleUpdate();
|
||||||
if (srcNext.scheduleUpdate)
|
if (srcNext.scheduleUpdate)
|
||||||
srcNext.scheduleUpdate();
|
srcNext.scheduleUpdate();
|
||||||
Qt.callLater(() => {
|
transitionDelayTimer.start();
|
||||||
transitionAnimation.start();
|
}
|
||||||
});
|
|
||||||
|
Timer {
|
||||||
|
id: transitionDelayTimer
|
||||||
|
interval: 16
|
||||||
|
repeat: false
|
||||||
|
onTriggered: transitionAnimation.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeWallpaper(newPath, force) {
|
function changeWallpaper(newPath, force) {
|
||||||
@@ -163,23 +165,17 @@ Variants {
|
|||||||
return;
|
return;
|
||||||
if (!newPath || newPath.startsWith("#"))
|
if (!newPath || newPath.startsWith("#"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (root.transitioning || root.effectActive) {
|
if (root.transitioning || root.effectActive) {
|
||||||
root.pendingWallpaper = newPath;
|
root.pendingWallpaper = newPath;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!currentWallpaper.source) {
|
if (!currentWallpaper.source) {
|
||||||
setWallpaperImmediate(newPath);
|
setWallpaperImmediate(newPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root.transitionType === "random") {
|
if (root.transitionType === "random") {
|
||||||
if (SessionData.includedTransitions.length === 0) {
|
root.actualTransitionType = SessionData.includedTransitions.length === 0 ? "none" : SessionData.includedTransitions[Math.floor(Math.random() * SessionData.includedTransitions.length)];
|
||||||
root.actualTransitionType = "none";
|
|
||||||
} else {
|
|
||||||
root.actualTransitionType = SessionData.includedTransitions[Math.floor(Math.random() * SessionData.includedTransitions.length)];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root.actualTransitionType === "none") {
|
if (root.actualTransitionType === "none") {
|
||||||
@@ -187,21 +183,26 @@ Variants {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root.actualTransitionType === "wipe") {
|
switch (root.actualTransitionType) {
|
||||||
|
case "wipe":
|
||||||
root.wipeDirection = Math.random() * 4;
|
root.wipeDirection = Math.random() * 4;
|
||||||
} else if (root.actualTransitionType === "disc" || root.actualTransitionType === "pixelate" || root.actualTransitionType === "portal") {
|
break;
|
||||||
|
case "disc":
|
||||||
|
case "pixelate":
|
||||||
|
case "portal":
|
||||||
root.discCenterX = Math.random();
|
root.discCenterX = Math.random();
|
||||||
root.discCenterY = Math.random();
|
root.discCenterY = Math.random();
|
||||||
} else if (root.actualTransitionType === "stripes") {
|
break;
|
||||||
|
case "stripes":
|
||||||
root.stripesCount = Math.round(Math.random() * 20 + 4);
|
root.stripesCount = Math.round(Math.random() * 20 + 4);
|
||||||
root.stripesAngle = Math.random() * 360;
|
root.stripesAngle = Math.random() * 360;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
nextWallpaper.source = newPath;
|
nextWallpaper.source = newPath;
|
||||||
|
|
||||||
if (nextWallpaper.status === Image.Ready) {
|
if (nextWallpaper.status === Image.Ready)
|
||||||
root.startTransition();
|
root.startTransition();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
@@ -214,9 +215,10 @@ Variants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readonly property int maxTextureSize: 8192
|
||||||
property real screenScale: CompositorService.getScreenScale(modelData)
|
property real screenScale: CompositorService.getScreenScale(modelData)
|
||||||
property int physicalWidth: Math.round(modelData.width * screenScale)
|
property int textureWidth: Math.min(Math.round(modelData.width * screenScale), maxTextureSize)
|
||||||
property int physicalHeight: Math.round(modelData.height * screenScale)
|
property int textureHeight: Math.min(Math.round(modelData.height * screenScale), maxTextureSize)
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: currentWallpaper
|
id: currentWallpaper
|
||||||
@@ -227,7 +229,7 @@ Variants {
|
|||||||
asynchronous: true
|
asynchronous: true
|
||||||
smooth: true
|
smooth: true
|
||||||
cache: true
|
cache: true
|
||||||
sourceSize: Qt.size(root.physicalWidth, root.physicalHeight)
|
sourceSize: Qt.size(root.textureWidth, root.textureHeight)
|
||||||
fillMode: root.getFillMode(SettingsData.wallpaperFillMode)
|
fillMode: root.getFillMode(SettingsData.wallpaperFillMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,8 +241,8 @@ Variants {
|
|||||||
layer.enabled: false
|
layer.enabled: false
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
smooth: true
|
smooth: true
|
||||||
cache: false
|
cache: true
|
||||||
sourceSize: Qt.size(root.physicalWidth, root.physicalHeight)
|
sourceSize: Qt.size(root.textureWidth, root.textureHeight)
|
||||||
fillMode: root.getFillMode(SettingsData.wallpaperFillMode)
|
fillMode: root.getFillMode(SettingsData.wallpaperFillMode)
|
||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
@@ -263,7 +265,7 @@ Variants {
|
|||||||
live: root.effectActive
|
live: root.effectActive
|
||||||
mipmap: false
|
mipmap: false
|
||||||
recursive: false
|
recursive: false
|
||||||
textureSize: root.effectActive ? Qt.size(root.physicalWidth, root.physicalHeight) : Qt.size(1, 1)
|
textureSize: Qt.size(root.textureWidth, root.textureHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderEffectSource {
|
ShaderEffectSource {
|
||||||
@@ -273,7 +275,7 @@ Variants {
|
|||||||
live: root.effectActive
|
live: root.effectActive
|
||||||
mipmap: false
|
mipmap: false
|
||||||
recursive: false
|
recursive: false
|
||||||
textureSize: root.effectActive ? Qt.size(root.physicalWidth, root.physicalHeight) : Qt.size(1, 1)
|
textureSize: Qt.size(root.textureWidth, root.textureHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -297,8 +299,9 @@ Variants {
|
|||||||
id: effectLoader
|
id: effectLoader
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
active: root.effectActive
|
active: root.effectActive
|
||||||
sourceComponent: {
|
|
||||||
switch (root.actualTransitionType) {
|
function getTransitionComponent(type) {
|
||||||
|
switch (type) {
|
||||||
case "fade":
|
case "fade":
|
||||||
return fadeComp;
|
return fadeComp;
|
||||||
case "wipe":
|
case "wipe":
|
||||||
@@ -317,6 +320,8 @@ Variants {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceComponent: getTransitionComponent(root.actualTransitionType)
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
@@ -491,17 +496,13 @@ Variants {
|
|||||||
root.transitionProgress = 0.0;
|
root.transitionProgress = 0.0;
|
||||||
currentWallpaper.layer.enabled = false;
|
currentWallpaper.layer.enabled = false;
|
||||||
nextWallpaper.layer.enabled = false;
|
nextWallpaper.layer.enabled = false;
|
||||||
currentWallpaper.cache = true;
|
|
||||||
nextWallpaper.cache = false;
|
|
||||||
root.effectActive = false;
|
root.effectActive = false;
|
||||||
|
|
||||||
if (root.pendingWallpaper) {
|
if (!root.pendingWallpaper)
|
||||||
var pending = root.pendingWallpaper;
|
return;
|
||||||
root.pendingWallpaper = "";
|
var pending = root.pendingWallpaper;
|
||||||
Qt.callLater(() => {
|
root.pendingWallpaper = "";
|
||||||
root.changeWallpaper(pending, true);
|
Qt.callLater(() => root.changeWallpaper(pending, true));
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ Singleton {
|
|||||||
id: cavaProcess
|
id: cavaProcess
|
||||||
|
|
||||||
running: root.cavaAvailable && root.refCount > 0
|
running: root.cavaAvailable && root.refCount > 0
|
||||||
command: ["sh", "-c", "printf '[general]\\nframerate=25\\nbars=6\\nautosens=0\\nsensitivity=30\\nlower_cutoff_freq=50\\nhigher_cutoff_freq=12000\\n[input]\\nmethod=pipewire\\nsource=auto\\nsample_rate=48000\\n[output]\\nmethod=raw\\nraw_target=/dev/stdout\\ndata_format=ascii\\nchannels=mono\\nmono_option=average\\n[smoothing]\\nnoise_reduction=35\\nintegral=90\\ngravity=95\\nignore=2\\nmonstercat=1.5' | cava -p /dev/stdin"]
|
command: ["sh", "-c", "printf '[general]\\nframerate=25\\nbars=6\\nautosens=0\\nsensitivity=30\\nlower_cutoff_freq=50\\nhigher_cutoff_freq=12000\\n[input]\\nsample_rate=48000\\n[output]\\nmethod=raw\\nraw_target=/dev/stdout\\ndata_format=ascii\\nchannels=mono\\nmono_option=average\\n[smoothing]\\nnoise_reduction=35\\nintegral=90\\ngravity=95\\nignore=2\\nmonstercat=1.5' | cava -p /dev/stdin"]
|
||||||
|
|
||||||
onRunningChanged: {
|
onRunningChanged: {
|
||||||
if (!running) {
|
if (!running) {
|
||||||
|
|||||||
@@ -314,7 +314,8 @@ Singleton {
|
|||||||
const keyData = {
|
const keyData = {
|
||||||
key: bind.key || "",
|
key: bind.key || "",
|
||||||
source: bind.source || "config",
|
source: bind.source || "config",
|
||||||
isOverride: bind.source === "dms"
|
isOverride: bind.source === "dms",
|
||||||
|
cooldownMs: bind.cooldownMs || 0
|
||||||
};
|
};
|
||||||
if (actionMap[action]) {
|
if (actionMap[action]) {
|
||||||
actionMap[action].keys.push(keyData);
|
actionMap[action].keys.push(keyData);
|
||||||
@@ -378,6 +379,8 @@ Singleton {
|
|||||||
const cmd = ["dms", "keybinds", "set", currentProvider, bindData.key, bindData.action, "--desc", bindData.desc || ""];
|
const cmd = ["dms", "keybinds", "set", currentProvider, bindData.key, bindData.action, "--desc", bindData.desc || ""];
|
||||||
if (originalKey && originalKey !== bindData.key)
|
if (originalKey && originalKey !== bindData.key)
|
||||||
cmd.push("--replace-key", originalKey);
|
cmd.push("--replace-key", originalKey);
|
||||||
|
if (bindData.cooldownMs > 0)
|
||||||
|
cmd.push("--cooldown-ms", String(bindData.cooldownMs));
|
||||||
saveProcess.command = cmd;
|
saveProcess.command = cmd;
|
||||||
saveProcess.running = true;
|
saveProcess.running = true;
|
||||||
bindSaved(bindData.key);
|
bindSaved(bindData.key);
|
||||||
|
|||||||
@@ -66,6 +66,19 @@ Singleton {
|
|||||||
onTriggered: root.doGenerateNiriLayoutConfig()
|
onTriggered: root.doGenerateNiriLayoutConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property int _lastGapValue: -1
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: SettingsData
|
||||||
|
function onBarConfigsChanged() {
|
||||||
|
const newGaps = Math.max(4, (SettingsData.barConfigs[0]?.spacing ?? 4));
|
||||||
|
if (newGaps === root._lastGapValue)
|
||||||
|
return;
|
||||||
|
root._lastGapValue = newGaps;
|
||||||
|
generateNiriLayoutConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: validateProcess
|
id: validateProcess
|
||||||
command: ["niri", "validate"]
|
command: ["niri", "validate"]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v1.0.0
|
v1.0.3
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|
||||||
@@ -13,7 +12,7 @@ StyledRect {
|
|||||||
|
|
||||||
onActiveFocusChanged: {
|
onActiveFocusChanged: {
|
||||||
if (activeFocus) {
|
if (activeFocus) {
|
||||||
textInput.forceActiveFocus()
|
textInput.forceActiveFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,26 +52,26 @@ StyledRect {
|
|||||||
signal focusStateChanged(bool hasFocus)
|
signal focusStateChanged(bool hasFocus)
|
||||||
|
|
||||||
function getActiveFocus() {
|
function getActiveFocus() {
|
||||||
return textInput.activeFocus
|
return textInput.activeFocus;
|
||||||
}
|
}
|
||||||
function setFocus(value) {
|
function setFocus(value) {
|
||||||
textInput.focus = value
|
textInput.focus = value;
|
||||||
}
|
}
|
||||||
function forceActiveFocus() {
|
function forceActiveFocus() {
|
||||||
textInput.forceActiveFocus()
|
textInput.forceActiveFocus();
|
||||||
}
|
}
|
||||||
function selectAll() {
|
function selectAll() {
|
||||||
textInput.selectAll()
|
textInput.selectAll();
|
||||||
}
|
}
|
||||||
function clear() {
|
function clear() {
|
||||||
textInput.clear()
|
textInput.clear();
|
||||||
}
|
}
|
||||||
function insertText(str) {
|
function insertText(str) {
|
||||||
textInput.insert(textInput.cursorPosition, str)
|
textInput.insert(textInput.cursorPosition, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
width: 200
|
width: 200
|
||||||
height: 48
|
height: Math.round(Theme.fontSizeMedium * 3.4)
|
||||||
radius: cornerRadius
|
radius: cornerRadius
|
||||||
color: backgroundColor
|
color: backgroundColor
|
||||||
border.color: textInput.activeFocus ? focusedBorderColor : normalBorderColor
|
border.color: textInput.activeFocus ? focusedBorderColor : normalBorderColor
|
||||||
@@ -112,30 +111,30 @@ StyledRect {
|
|||||||
onActiveFocusChanged: root.focusStateChanged(activeFocus)
|
onActiveFocusChanged: root.focusStateChanged(activeFocus)
|
||||||
Keys.forwardTo: root.keyForwardTargets
|
Keys.forwardTo: root.keyForwardTargets
|
||||||
Keys.onLeftPressed: event => {
|
Keys.onLeftPressed: event => {
|
||||||
if (root.ignoreLeftRightKeys) {
|
if (root.ignoreLeftRightKeys) {
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else {
|
} else {
|
||||||
// Allow normal TextInput cursor movement
|
// Allow normal TextInput cursor movement
|
||||||
event.accepted = false
|
event.accepted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Keys.onRightPressed: event => {
|
Keys.onRightPressed: event => {
|
||||||
if (root.ignoreLeftRightKeys) {
|
if (root.ignoreLeftRightKeys) {
|
||||||
event.accepted = true
|
event.accepted = true;
|
||||||
} else {
|
} else {
|
||||||
event.accepted = false
|
event.accepted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Keys.onPressed: event => {
|
Keys.onPressed: event => {
|
||||||
if (root.ignoreTabKeys && (event.key === Qt.Key_Tab || event.key === Qt.Key_Backtab)) {
|
if (root.ignoreTabKeys && (event.key === Qt.Key_Tab || event.key === Qt.Key_Backtab)) {
|
||||||
event.accepted = false
|
event.accepted = false;
|
||||||
for (var i = 0; i < root.keyForwardTargets.length; i++) {
|
for (var i = 0; i < root.keyForwardTargets.length; i++) {
|
||||||
if (root.keyForwardTargets[i]) {
|
if (root.keyForwardTargets[i]) {
|
||||||
root.keyForwardTargets[i].Keys.pressed(event)
|
root.keyForwardTargets[i].Keys.pressed(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -171,7 +170,7 @@ StyledRect {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
textInput.text = ""
|
textInput.text = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ Item {
|
|||||||
property string editKey: ""
|
property string editKey: ""
|
||||||
property string editAction: ""
|
property string editAction: ""
|
||||||
property string editDesc: ""
|
property string editDesc: ""
|
||||||
|
property int editCooldownMs: 0
|
||||||
|
property int _savedCooldownMs: -1
|
||||||
property bool hasChanges: false
|
property bool hasChanges: false
|
||||||
property string _actionType: ""
|
property string _actionType: ""
|
||||||
property bool addingNewKey: false
|
property bool addingNewKey: false
|
||||||
@@ -52,6 +54,12 @@ Item {
|
|||||||
readonly property var _conflicts: editKey ? KeyUtils.getConflictingBinds(editKey, bindData.action, KeybindsService.getFlatBinds()) : []
|
readonly property var _conflicts: editKey ? KeyUtils.getConflictingBinds(editKey, bindData.action, KeybindsService.getFlatBinds()) : []
|
||||||
readonly property bool hasConflict: _conflicts.length > 0
|
readonly property bool hasConflict: _conflicts.length > 0
|
||||||
|
|
||||||
|
readonly property real _inputHeight: Math.round(Theme.fontSizeMedium * 3)
|
||||||
|
readonly property real _chipHeight: Math.round(Theme.fontSizeSmall * 2.3)
|
||||||
|
readonly property real _buttonHeight: Math.round(Theme.fontSizeMedium * 2.3)
|
||||||
|
readonly property real _keysColumnWidth: Math.round(Theme.fontSizeSmall * 12)
|
||||||
|
readonly property real _labelWidth: Math.round(Theme.fontSizeSmall * 5)
|
||||||
|
|
||||||
signal toggleExpand
|
signal toggleExpand
|
||||||
signal saveBind(string originalKey, var newData)
|
signal saveBind(string originalKey, var newData)
|
||||||
signal removeBind(string key)
|
signal removeBind(string key)
|
||||||
@@ -90,6 +98,12 @@ Item {
|
|||||||
editKey = keyToFind;
|
editKey = keyToFind;
|
||||||
editAction = bindData.action || "";
|
editAction = bindData.action || "";
|
||||||
editDesc = bindData.desc || "";
|
editDesc = bindData.desc || "";
|
||||||
|
if (_savedCooldownMs >= 0) {
|
||||||
|
editCooldownMs = _savedCooldownMs;
|
||||||
|
_savedCooldownMs = -1;
|
||||||
|
} else {
|
||||||
|
editCooldownMs = keys[i].cooldownMs || 0;
|
||||||
|
}
|
||||||
hasChanges = false;
|
hasChanges = false;
|
||||||
_actionType = Actions.getActionType(editAction);
|
_actionType = Actions.getActionType(editAction);
|
||||||
useCustomCompositor = _actionType === "compositor" && editAction && !Actions.isKnownCompositorAction(editAction);
|
useCustomCompositor = _actionType === "compositor" && editAction && !Actions.isKnownCompositorAction(editAction);
|
||||||
@@ -109,6 +123,7 @@ Item {
|
|||||||
editKey = editingKeyIndex >= 0 ? keys[editingKeyIndex].key : "";
|
editKey = editingKeyIndex >= 0 ? keys[editingKeyIndex].key : "";
|
||||||
editAction = bindData.action || "";
|
editAction = bindData.action || "";
|
||||||
editDesc = bindData.desc || "";
|
editDesc = bindData.desc || "";
|
||||||
|
editCooldownMs = editingKeyIndex >= 0 ? (keys[editingKeyIndex].cooldownMs || 0) : 0;
|
||||||
hasChanges = false;
|
hasChanges = false;
|
||||||
_actionType = Actions.getActionType(editAction);
|
_actionType = Actions.getActionType(editAction);
|
||||||
useCustomCompositor = _actionType === "compositor" && editAction && !Actions.isKnownCompositorAction(editAction);
|
useCustomCompositor = _actionType === "compositor" && editAction && !Actions.isKnownCompositorAction(editAction);
|
||||||
@@ -127,6 +142,7 @@ Item {
|
|||||||
addingNewKey = false;
|
addingNewKey = false;
|
||||||
editingKeyIndex = index;
|
editingKeyIndex = index;
|
||||||
editKey = keys[index].key;
|
editKey = keys[index].key;
|
||||||
|
editCooldownMs = keys[index].cooldownMs || 0;
|
||||||
hasChanges = false;
|
hasChanges = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,8 +153,11 @@ Item {
|
|||||||
editAction = changes.action;
|
editAction = changes.action;
|
||||||
if (changes.desc !== undefined)
|
if (changes.desc !== undefined)
|
||||||
editDesc = changes.desc;
|
editDesc = changes.desc;
|
||||||
|
if (changes.cooldownMs !== undefined)
|
||||||
|
editCooldownMs = changes.cooldownMs;
|
||||||
const origKey = editingKeyIndex >= 0 && editingKeyIndex < keys.length ? keys[editingKeyIndex].key : "";
|
const origKey = editingKeyIndex >= 0 && editingKeyIndex < keys.length ? keys[editingKeyIndex].key : "";
|
||||||
hasChanges = editKey !== origKey || editAction !== (bindData.action || "") || editDesc !== (bindData.desc || "");
|
const origCooldown = editingKeyIndex >= 0 && editingKeyIndex < keys.length ? (keys[editingKeyIndex].cooldownMs || 0) : 0;
|
||||||
|
hasChanges = editKey !== origKey || editAction !== (bindData.action || "") || editDesc !== (bindData.desc || "") || editCooldownMs !== origCooldown;
|
||||||
}
|
}
|
||||||
|
|
||||||
function canSave() {
|
function canSave() {
|
||||||
@@ -156,10 +175,12 @@ Item {
|
|||||||
let desc = editDesc;
|
let desc = editDesc;
|
||||||
if (expandedLoader.item?.currentTitle !== undefined)
|
if (expandedLoader.item?.currentTitle !== undefined)
|
||||||
desc = expandedLoader.item.currentTitle;
|
desc = expandedLoader.item.currentTitle;
|
||||||
|
_savedCooldownMs = editCooldownMs;
|
||||||
saveBind(origKey, {
|
saveBind(origKey, {
|
||||||
key: editKey,
|
key: editKey,
|
||||||
action: editAction,
|
action: editAction,
|
||||||
desc: desc
|
desc: desc,
|
||||||
|
cooldownMs: editCooldownMs
|
||||||
});
|
});
|
||||||
hasChanges = false;
|
hasChanges = false;
|
||||||
addingNewKey = false;
|
addingNewKey = false;
|
||||||
@@ -208,7 +229,7 @@ Item {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
id: collapsedRect
|
id: collapsedRect
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: Math.max(52, keysColumn.implicitHeight + Theme.spacingM * 2)
|
height: Math.max(root._inputHeight + Theme.spacingM, keysColumn.implicitHeight + Theme.spacingM * 2)
|
||||||
radius: root.isExpanded ? 0 : Theme.cornerRadius
|
radius: root.isExpanded ? 0 : Theme.cornerRadius
|
||||||
topLeftRadius: Theme.cornerRadius
|
topLeftRadius: Theme.cornerRadius
|
||||||
topRightRadius: Theme.cornerRadius
|
topRightRadius: Theme.cornerRadius
|
||||||
@@ -225,7 +246,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: keysColumn
|
id: keysColumn
|
||||||
Layout.preferredWidth: 140
|
Layout.preferredWidth: root._keysColumnWidth
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
spacing: Theme.spacingXS
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
@@ -238,9 +259,9 @@ Item {
|
|||||||
|
|
||||||
property bool isSelected: root.isExpanded && root.editingKeyIndex === index && !root.addingNewKey
|
property bool isSelected: root.isExpanded && root.editingKeyIndex === index && !root.addingNewKey
|
||||||
|
|
||||||
width: 140
|
width: root._keysColumnWidth
|
||||||
height: 28
|
height: root._chipHeight
|
||||||
radius: 6
|
radius: root._chipHeight / 4
|
||||||
color: isSelected ? Theme.primary : Theme.surfaceVariant
|
color: isSelected ? Theme.primary : Theme.surfaceVariant
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -317,7 +338,7 @@ Item {
|
|||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: "warning"
|
name: "warning"
|
||||||
size: 14
|
size: Theme.iconSizeSmall
|
||||||
color: Theme.primary
|
color: Theme.primary
|
||||||
visible: root.hasConfigConflict
|
visible: root.hasConfigConflict
|
||||||
}
|
}
|
||||||
@@ -337,7 +358,7 @@ Item {
|
|||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: root.isExpanded ? "expand_less" : "expand_more"
|
name: root.isExpanded ? "expand_less" : "expand_more"
|
||||||
size: 20
|
size: Theme.iconSize - 4
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
@@ -345,7 +366,7 @@ Item {
|
|||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: 140 + Theme.spacingM * 2
|
anchors.leftMargin: root._keysColumnWidth + Theme.spacingM * 2
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: root.toggleExpand()
|
onClicked: root.toggleExpand()
|
||||||
}
|
}
|
||||||
@@ -405,7 +426,7 @@ Item {
|
|||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: "warning"
|
name: "warning"
|
||||||
size: 16
|
size: Theme.iconSizeSmall
|
||||||
color: Theme.primary
|
color: Theme.primary
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,7 +467,7 @@ Item {
|
|||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
Layout.preferredWidth: 60
|
Layout.preferredWidth: root._labelWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
Flow {
|
Flow {
|
||||||
@@ -463,8 +484,8 @@ Item {
|
|||||||
property bool isSelected: root.editingKeyIndex === index && !root.addingNewKey
|
property bool isSelected: root.editingKeyIndex === index && !root.addingNewKey
|
||||||
|
|
||||||
width: editKeyChipText.implicitWidth + Theme.spacingM
|
width: editKeyChipText.implicitWidth + Theme.spacingM
|
||||||
height: 28
|
height: root._chipHeight
|
||||||
radius: 6
|
radius: root._chipHeight / 4
|
||||||
color: isSelected ? Theme.primary : Theme.surfaceVariant
|
color: isSelected ? Theme.primary : Theme.surfaceVariant
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -494,9 +515,9 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 28
|
width: root._chipHeight
|
||||||
height: 28
|
height: root._chipHeight
|
||||||
radius: 6
|
radius: root._chipHeight / 4
|
||||||
color: root.addingNewKey ? Theme.primary : Theme.surfaceVariant
|
color: root.addingNewKey ? Theme.primary : Theme.surfaceVariant
|
||||||
visible: !root.isNew
|
visible: !root.isNew
|
||||||
|
|
||||||
@@ -508,7 +529,7 @@ Item {
|
|||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: "add"
|
name: "add"
|
||||||
size: 16
|
size: Theme.iconSizeSmall
|
||||||
color: root.addingNewKey ? Theme.primaryText : Theme.surfaceVariantText
|
color: root.addingNewKey ? Theme.primaryText : Theme.surfaceVariantText
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
@@ -533,13 +554,13 @@ Item {
|
|||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
Layout.preferredWidth: 60
|
Layout.preferredWidth: root._labelWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
FocusScope {
|
FocusScope {
|
||||||
id: captureScope
|
id: captureScope
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: root._inputHeight
|
||||||
focus: root.recording
|
focus: root.recording
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
@@ -581,12 +602,12 @@ Item {
|
|||||||
|
|
||||||
DankActionButton {
|
DankActionButton {
|
||||||
id: recordBtn
|
id: recordBtn
|
||||||
width: 28
|
width: root._chipHeight
|
||||||
height: 28
|
height: root._chipHeight
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
circular: false
|
circular: false
|
||||||
iconName: root.recording ? "close" : "radio_button_checked"
|
iconName: root.recording ? "close" : "radio_button_checked"
|
||||||
iconSize: 16
|
iconSize: Theme.iconSizeSmall
|
||||||
iconColor: root.recording ? Theme.error : Theme.primary
|
iconColor: root.recording ? Theme.error : Theme.primary
|
||||||
onClicked: root.recording ? root.stopRecording() : root.startRecording()
|
onClicked: root.recording ? root.stopRecording() : root.startRecording()
|
||||||
}
|
}
|
||||||
@@ -688,8 +709,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.preferredWidth: 40
|
Layout.preferredWidth: root._inputHeight
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: root._inputHeight
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: root.addingNewKey ? Theme.primary : Theme.surfaceVariant
|
color: root.addingNewKey ? Theme.primary : Theme.surfaceVariant
|
||||||
visible: root.keys.length === 1 && !root.isNew
|
visible: root.keys.length === 1 && !root.isNew
|
||||||
@@ -702,7 +723,7 @@ Item {
|
|||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: "add"
|
name: "add"
|
||||||
size: 18
|
size: Theme.iconSizeSmall + 2
|
||||||
color: root.addingNewKey ? Theme.primaryText : Theme.surfaceVariantText
|
color: root.addingNewKey ? Theme.primaryText : Theme.surfaceVariantText
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
@@ -721,11 +742,11 @@ Item {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
visible: root.hasConflict
|
visible: root.hasConflict
|
||||||
Layout.leftMargin: 60 + Theme.spacingM
|
Layout.leftMargin: root._labelWidth + Theme.spacingM
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: "warning"
|
name: "warning"
|
||||||
size: 16
|
size: Theme.iconSizeSmall
|
||||||
color: Theme.primary
|
color: Theme.primary
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -747,7 +768,7 @@ Item {
|
|||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
Layout.preferredWidth: 60
|
Layout.preferredWidth: root._labelWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
@@ -770,7 +791,7 @@ Item {
|
|||||||
})
|
})
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 36
|
Layout.preferredHeight: root._buttonHeight
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: root._actionType === modelData.id ? Theme.surfaceContainerHighest : Theme.surfaceContainer
|
color: root._actionType === modelData.id ? Theme.surfaceContainerHighest : Theme.surfaceContainer
|
||||||
border.color: root._actionType === modelData.id ? Theme.outline : (typeArea.containsMouse ? Theme.outlineVariant : "transparent")
|
border.color: root._actionType === modelData.id ? Theme.outline : (typeArea.containsMouse ? Theme.outlineVariant : "transparent")
|
||||||
@@ -782,7 +803,7 @@ Item {
|
|||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: typeDelegate.modelData.icon
|
name: typeDelegate.modelData.icon
|
||||||
size: 16
|
size: Theme.iconSizeSmall
|
||||||
color: root._actionType === typeDelegate.modelData.id ? Theme.surfaceText : Theme.surfaceVariantText
|
color: root._actionType === typeDelegate.modelData.id ? Theme.surfaceText : Theme.surfaceVariantText
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -854,7 +875,7 @@ Item {
|
|||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
Layout.preferredWidth: 60
|
Layout.preferredWidth: root._labelWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
DankDropdown {
|
DankDropdown {
|
||||||
@@ -898,14 +919,14 @@ Item {
|
|||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
Layout.preferredWidth: 60
|
Layout.preferredWidth: root._labelWidth
|
||||||
visible: dmsArgsRow.hasAmountArg
|
visible: dmsArgsRow.hasAmountArg
|
||||||
}
|
}
|
||||||
|
|
||||||
DankTextField {
|
DankTextField {
|
||||||
id: dmsAmountField
|
id: dmsAmountField
|
||||||
Layout.preferredWidth: 80
|
Layout.preferredWidth: Math.round(Theme.fontSizeMedium * 5.5)
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: root._inputHeight
|
||||||
placeholderText: "5"
|
placeholderText: "5"
|
||||||
visible: dmsArgsRow.hasAmountArg
|
visible: dmsArgsRow.hasAmountArg
|
||||||
|
|
||||||
@@ -946,14 +967,14 @@ Item {
|
|||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
Layout.leftMargin: dmsArgsRow.hasAmountArg ? Theme.spacingM : 0
|
Layout.leftMargin: dmsArgsRow.hasAmountArg ? Theme.spacingM : 0
|
||||||
Layout.preferredWidth: dmsArgsRow.hasAmountArg ? -1 : 60
|
Layout.preferredWidth: dmsArgsRow.hasAmountArg ? -1 : root._labelWidth
|
||||||
visible: dmsArgsRow.hasDeviceArg
|
visible: dmsArgsRow.hasDeviceArg
|
||||||
}
|
}
|
||||||
|
|
||||||
DankTextField {
|
DankTextField {
|
||||||
id: dmsDeviceField
|
id: dmsDeviceField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: root._inputHeight
|
||||||
placeholderText: I18n.tr("leave empty for default")
|
placeholderText: I18n.tr("leave empty for default")
|
||||||
visible: dmsArgsRow.hasDeviceArg
|
visible: dmsArgsRow.hasDeviceArg
|
||||||
|
|
||||||
@@ -991,7 +1012,7 @@ Item {
|
|||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
Layout.preferredWidth: 60
|
Layout.preferredWidth: root._labelWidth
|
||||||
visible: dmsArgsRow.hasTabArg
|
visible: dmsArgsRow.hasTabArg
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1049,12 +1070,12 @@ Item {
|
|||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
Layout.preferredWidth: 60
|
Layout.preferredWidth: root._labelWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
DankDropdown {
|
DankDropdown {
|
||||||
id: compositorCatDropdown
|
id: compositorCatDropdown
|
||||||
Layout.preferredWidth: 120
|
Layout.preferredWidth: Math.round(Theme.fontSizeMedium * 8.5)
|
||||||
compactMode: true
|
compactMode: true
|
||||||
currentValue: {
|
currentValue: {
|
||||||
const base = root.editAction.split(" ")[0];
|
const base = root.editAction.split(" ")[0];
|
||||||
@@ -1093,8 +1114,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.preferredWidth: 40
|
Layout.preferredWidth: root._inputHeight
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: root._inputHeight
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: Theme.surfaceVariant
|
color: Theme.surfaceVariant
|
||||||
|
|
||||||
@@ -1106,7 +1127,7 @@ Item {
|
|||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: "edit"
|
name: "edit"
|
||||||
size: 18
|
size: Theme.iconSizeSmall + 2
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
@@ -1135,7 +1156,7 @@ Item {
|
|||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
Layout.preferredWidth: 60
|
Layout.preferredWidth: root._labelWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
@@ -1145,7 +1166,7 @@ Item {
|
|||||||
DankTextField {
|
DankTextField {
|
||||||
id: argValueField
|
id: argValueField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: root._inputHeight
|
||||||
visible: {
|
visible: {
|
||||||
const cfg = optionsRow.argConfig;
|
const cfg = optionsRow.argConfig;
|
||||||
if (!cfg?.config?.args)
|
if (!cfg?.config?.args)
|
||||||
@@ -1293,13 +1314,13 @@ Item {
|
|||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
Layout.preferredWidth: 60
|
Layout.preferredWidth: root._labelWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
DankTextField {
|
DankTextField {
|
||||||
id: customCompositorField
|
id: customCompositorField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: root._inputHeight
|
||||||
placeholderText: I18n.tr("e.g., focus-workspace 3, resize-column -10")
|
placeholderText: I18n.tr("e.g., focus-workspace 3, resize-column -10")
|
||||||
text: root._actionType === "compositor" ? root.editAction : ""
|
text: root._actionType === "compositor" ? root.editAction : ""
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
@@ -1312,8 +1333,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.preferredWidth: 40
|
Layout.preferredWidth: root._inputHeight
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: root._inputHeight
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: Theme.surfaceVariant
|
color: Theme.surfaceVariant
|
||||||
|
|
||||||
@@ -1325,7 +1346,7 @@ Item {
|
|||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: "list"
|
name: "list"
|
||||||
size: 18
|
size: Theme.iconSizeSmall + 2
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
@@ -1356,13 +1377,13 @@ Item {
|
|||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
Layout.preferredWidth: 60
|
Layout.preferredWidth: root._labelWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
DankTextField {
|
DankTextField {
|
||||||
id: spawnTextField
|
id: spawnTextField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: root._inputHeight
|
||||||
placeholderText: I18n.tr("e.g., firefox, kitty --title foo")
|
placeholderText: I18n.tr("e.g., firefox, kitty --title foo")
|
||||||
readonly property var _parsed: root._actionType === "spawn" ? Actions.parseSpawnCommand(root.editAction) : null
|
readonly property var _parsed: root._actionType === "spawn" ? Actions.parseSpawnCommand(root.editAction) : null
|
||||||
text: _parsed ? (_parsed.command + " " + _parsed.args.join(" ")).trim() : ""
|
text: _parsed ? (_parsed.command + " " + _parsed.args.join(" ")).trim() : ""
|
||||||
@@ -1388,13 +1409,13 @@ Item {
|
|||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
Layout.preferredWidth: 60
|
Layout.preferredWidth: root._labelWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
DankTextField {
|
DankTextField {
|
||||||
id: shellTextField
|
id: shellTextField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: root._inputHeight
|
||||||
placeholderText: I18n.tr("e.g., notify-send 'Hello' && sleep 1")
|
placeholderText: I18n.tr("e.g., notify-send 'Hello' && sleep 1")
|
||||||
text: root._actionType === "shell" ? Actions.parseShellCommand(root.editAction) : ""
|
text: root._actionType === "shell" ? Actions.parseShellCommand(root.editAction) : ""
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
@@ -1416,13 +1437,13 @@ Item {
|
|||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
Layout.preferredWidth: 60
|
Layout.preferredWidth: root._labelWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
DankTextField {
|
DankTextField {
|
||||||
id: titleField
|
id: titleField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: root._inputHeight
|
||||||
placeholderText: I18n.tr("Hotkey overlay title (optional)")
|
placeholderText: I18n.tr("Hotkey overlay title (optional)")
|
||||||
text: root.editDesc
|
text: root.editDesc
|
||||||
onTextChanged: root.updateEdit({
|
onTextChanged: root.updateEdit({
|
||||||
@@ -1431,6 +1452,57 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Cooldown")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
Layout.preferredWidth: root._labelWidth
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: cooldownField
|
||||||
|
Layout.preferredWidth: Math.round(Theme.fontSizeMedium * 7)
|
||||||
|
Layout.preferredHeight: root._inputHeight
|
||||||
|
placeholderText: "0"
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: root
|
||||||
|
function onEditCooldownMsChanged() {
|
||||||
|
const newText = root.editCooldownMs > 0 ? String(root.editCooldownMs) : "";
|
||||||
|
if (cooldownField.text !== newText)
|
||||||
|
cooldownField.text = newText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
text = root.editCooldownMs > 0 ? String(root.editCooldownMs) : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
onTextChanged: {
|
||||||
|
const val = parseInt(text) || 0;
|
||||||
|
if (val !== root.editCooldownMs)
|
||||||
|
root.updateEdit({
|
||||||
|
cooldownMs: val
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("ms")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 1
|
Layout.preferredHeight: 1
|
||||||
@@ -1442,8 +1514,8 @@ Item {
|
|||||||
spacing: Theme.spacingM
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
DankActionButton {
|
DankActionButton {
|
||||||
Layout.preferredWidth: 32
|
Layout.preferredWidth: root._buttonHeight
|
||||||
Layout.preferredHeight: 32
|
Layout.preferredHeight: root._buttonHeight
|
||||||
circular: false
|
circular: false
|
||||||
iconName: "delete"
|
iconName: "delete"
|
||||||
iconSize: Theme.iconSize - 4
|
iconSize: Theme.iconSize - 4
|
||||||
@@ -1465,7 +1537,7 @@ Item {
|
|||||||
|
|
||||||
DankButton {
|
DankButton {
|
||||||
text: I18n.tr("Cancel")
|
text: I18n.tr("Cancel")
|
||||||
buttonHeight: 32
|
buttonHeight: root._buttonHeight
|
||||||
backgroundColor: Theme.surfaceContainer
|
backgroundColor: Theme.surfaceContainer
|
||||||
textColor: Theme.surfaceText
|
textColor: Theme.surfaceText
|
||||||
visible: root.hasChanges || root.isNew
|
visible: root.hasChanges || root.isNew
|
||||||
@@ -1481,7 +1553,7 @@ Item {
|
|||||||
|
|
||||||
DankButton {
|
DankButton {
|
||||||
text: root.isNew ? I18n.tr("Add") : I18n.tr("Save")
|
text: root.isNew ? I18n.tr("Add") : I18n.tr("Save")
|
||||||
buttonHeight: 32
|
buttonHeight: root._buttonHeight
|
||||||
enabled: root.canSave()
|
enabled: root.canSave()
|
||||||
visible: root.hasChanges || root.isNew
|
visible: root.hasChanges || root.isNew
|
||||||
onClicked: root.doSave()
|
onClicked: root.doSave()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
import Quickshell
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Modals.Common
|
import qs.Modals.Common
|
||||||
import qs.Modals.FileBrowser
|
import qs.Modals.FileBrowser
|
||||||
@@ -13,7 +14,7 @@ Rectangle {
|
|||||||
property string expandedUuid: ""
|
property string expandedUuid: ""
|
||||||
property int listHeight: 180
|
property int listHeight: 180
|
||||||
|
|
||||||
implicitHeight: contentColumn.implicitHeight + Theme.spacingM * 2
|
implicitHeight: 32 + 1 + listHeight + Theme.spacingS * 4 + Theme.spacingM * 2
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||||
|
|
||||||
@@ -153,328 +154,71 @@ Rectangle {
|
|||||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
||||||
}
|
}
|
||||||
|
|
||||||
DankFlickable {
|
Item {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: root.listHeight
|
height: root.listHeight
|
||||||
contentHeight: listCol.height
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: listCol
|
anchors.centerIn: parent
|
||||||
width: parent.width
|
spacing: Theme.spacingS
|
||||||
spacing: 4
|
visible: DMSNetworkService.profiles.length === 0
|
||||||
|
|
||||||
Item {
|
DankIcon {
|
||||||
width: parent.width
|
name: "vpn_key_off"
|
||||||
height: DMSNetworkService.profiles.length === 0 ? 100 : 0
|
size: 36
|
||||||
visible: height > 0
|
color: Theme.surfaceVariantText
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
Column {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: Theme.spacingS
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
name: "vpn_key_off"
|
|
||||||
size: 36
|
|
||||||
color: Theme.surfaceVariantText
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: I18n.tr("No VPN profiles")
|
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
|
||||||
color: Theme.surfaceVariantText
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: I18n.tr("Click Import to add a .ovpn or .conf")
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.surfaceVariantText
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeater {
|
StyledText {
|
||||||
model: DMSNetworkService.profiles
|
text: I18n.tr("No VPN profiles")
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
delegate: Rectangle {
|
StyledText {
|
||||||
id: profileRow
|
text: I18n.tr("Click Import to add a .ovpn or .conf")
|
||||||
required property var modelData
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
required property int index
|
color: Theme.surfaceVariantText
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
readonly property bool isActive: DMSNetworkService.isActiveUuid(modelData.uuid)
|
DankListView {
|
||||||
readonly property bool isExpanded: root.expandedUuid === modelData.uuid
|
id: vpnListView
|
||||||
readonly property bool isHovered: rowArea.containsMouse || expandBtn.containsMouse || deleteBtn.containsMouse
|
anchors.fill: parent
|
||||||
readonly property var configData: isExpanded ? VPNService.editConfig : null
|
visible: DMSNetworkService.profiles.length > 0
|
||||||
|
spacing: 4
|
||||||
|
cacheBuffer: 200
|
||||||
|
clip: true
|
||||||
|
|
||||||
width: listCol.width
|
model: ScriptModel {
|
||||||
height: isExpanded ? 46 + expandedContent.height : 46
|
values: DMSNetworkService.profiles
|
||||||
radius: Theme.cornerRadius
|
objectProp: "uuid"
|
||||||
color: isHovered ? Theme.primaryHoverLight : (isActive ? Theme.primaryPressed : Theme.surfaceLight)
|
}
|
||||||
border.width: isActive ? 2 : 1
|
|
||||||
border.color: isActive ? Theme.primary : Theme.outlineLight
|
|
||||||
opacity: DMSNetworkService.isBusy ? 0.5 : 1.0
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
Behavior on height {
|
delegate: VpnProfileDelegate {
|
||||||
NumberAnimation {
|
required property var modelData
|
||||||
duration: 150
|
width: vpnListView.width
|
||||||
easing.type: Easing.OutQuad
|
profile: modelData
|
||||||
}
|
isExpanded: root.expandedUuid === modelData.uuid
|
||||||
}
|
onToggleExpand: {
|
||||||
|
if (root.expandedUuid === modelData.uuid) {
|
||||||
MouseArea {
|
root.expandedUuid = "";
|
||||||
id: rowArea
|
return;
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: DMSNetworkService.isBusy ? Qt.BusyCursor : Qt.PointingHandCursor
|
|
||||||
enabled: !DMSNetworkService.isBusy
|
|
||||||
onClicked: DMSNetworkService.toggle(modelData.uuid)
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Theme.spacingS
|
|
||||||
spacing: Theme.spacingS
|
|
||||||
|
|
||||||
Row {
|
|
||||||
width: parent.width
|
|
||||||
height: 46 - Theme.spacingS * 2
|
|
||||||
spacing: Theme.spacingS
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
name: isActive ? "vpn_lock" : "vpn_key_off"
|
|
||||||
size: 20
|
|
||||||
color: isActive ? Theme.primary : Theme.surfaceText
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
spacing: 1
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: parent.width - 20 - 28 - 28 - Theme.spacingS * 4
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: modelData.name
|
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
|
||||||
color: isActive ? Theme.primary : Theme.surfaceText
|
|
||||||
elide: Text.ElideRight
|
|
||||||
wrapMode: Text.NoWrap
|
|
||||||
width: parent.width
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: VPNService.getVpnTypeFromProfile(modelData)
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.surfaceTextMedium
|
|
||||||
wrapMode: Text.NoWrap
|
|
||||||
width: parent.width
|
|
||||||
elide: Text.ElideRight
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
width: Theme.spacingXS
|
|
||||||
height: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: expandBtnRect
|
|
||||||
width: 28
|
|
||||||
height: 28
|
|
||||||
radius: 14
|
|
||||||
color: expandBtn.containsMouse ? Theme.surfacePressed : "transparent"
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
name: isExpanded ? "expand_less" : "expand_more"
|
|
||||||
size: 18
|
|
||||||
color: Theme.surfaceText
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: expandBtn
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: {
|
|
||||||
if (isExpanded) {
|
|
||||||
root.expandedUuid = "";
|
|
||||||
} else {
|
|
||||||
root.expandedUuid = modelData.uuid;
|
|
||||||
VPNService.getConfig(modelData.uuid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: deleteBtnRect
|
|
||||||
width: 28
|
|
||||||
height: 28
|
|
||||||
radius: 14
|
|
||||||
color: deleteBtn.containsMouse ? Theme.errorHover : "transparent"
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
name: "delete"
|
|
||||||
size: 18
|
|
||||||
color: deleteBtn.containsMouse ? Theme.error : Theme.surfaceVariantText
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: deleteBtn
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: {
|
|
||||||
deleteConfirm.showWithOptions({
|
|
||||||
title: I18n.tr("Delete VPN"),
|
|
||||||
message: I18n.tr("Delete \"") + modelData.name + "\"?",
|
|
||||||
confirmText: I18n.tr("Delete"),
|
|
||||||
confirmColor: Theme.error,
|
|
||||||
onConfirm: () => VPNService.deleteVpn(modelData.uuid)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: expandedContent
|
|
||||||
width: parent.width
|
|
||||||
spacing: Theme.spacingXS
|
|
||||||
visible: isExpanded
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: parent.width
|
|
||||||
height: 1
|
|
||||||
color: Theme.outlineLight
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
width: parent.width
|
|
||||||
height: VPNService.configLoading ? 40 : 0
|
|
||||||
visible: VPNService.configLoading
|
|
||||||
|
|
||||||
Row {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: Theme.spacingS
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
name: "sync"
|
|
||||||
size: 16
|
|
||||||
color: Theme.surfaceVariantText
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: I18n.tr("Loading...")
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.surfaceVariantText
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Flow {
|
|
||||||
width: parent.width
|
|
||||||
spacing: Theme.spacingXS
|
|
||||||
visible: !VPNService.configLoading && configData
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: {
|
|
||||||
if (!configData)
|
|
||||||
return [];
|
|
||||||
const fields = [];
|
|
||||||
const data = configData.data || {};
|
|
||||||
|
|
||||||
if (data.remote)
|
|
||||||
fields.push({
|
|
||||||
label: I18n.tr("Server"),
|
|
||||||
value: data.remote
|
|
||||||
});
|
|
||||||
if (configData.username || data.username)
|
|
||||||
fields.push({
|
|
||||||
label: I18n.tr("Username"),
|
|
||||||
value: configData.username || data.username
|
|
||||||
});
|
|
||||||
if (data.cipher)
|
|
||||||
fields.push({
|
|
||||||
label: I18n.tr("Cipher"),
|
|
||||||
value: data.cipher
|
|
||||||
});
|
|
||||||
if (data.auth)
|
|
||||||
fields.push({
|
|
||||||
label: I18n.tr("Auth"),
|
|
||||||
value: data.auth
|
|
||||||
});
|
|
||||||
if (data["proto-tcp"] === "yes" || data["proto-tcp"] === "no")
|
|
||||||
fields.push({
|
|
||||||
label: I18n.tr("Protocol"),
|
|
||||||
value: data["proto-tcp"] === "yes" ? "TCP" : "UDP"
|
|
||||||
});
|
|
||||||
if (data["tunnel-mtu"])
|
|
||||||
fields.push({
|
|
||||||
label: I18n.tr("MTU"),
|
|
||||||
value: data["tunnel-mtu"]
|
|
||||||
});
|
|
||||||
if (data["connection-type"])
|
|
||||||
fields.push({
|
|
||||||
label: I18n.tr("Auth Type"),
|
|
||||||
value: data["connection-type"]
|
|
||||||
});
|
|
||||||
fields.push({
|
|
||||||
label: I18n.tr("Autoconnect"),
|
|
||||||
value: configData.autoconnect ? I18n.tr("Yes") : I18n.tr("No")
|
|
||||||
});
|
|
||||||
|
|
||||||
return fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
delegate: Rectangle {
|
|
||||||
required property var modelData
|
|
||||||
required property int index
|
|
||||||
|
|
||||||
width: fieldContent.width + Theme.spacingM * 2
|
|
||||||
height: 32
|
|
||||||
radius: Theme.cornerRadius - 2
|
|
||||||
color: Theme.surfaceContainerHigh
|
|
||||||
border.width: 1
|
|
||||||
border.color: Theme.outlineLight
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: fieldContent
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: Theme.spacingXS
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: modelData.label + ":"
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.surfaceVariantText
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: modelData.value
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.surfaceText
|
|
||||||
font.weight: Font.Medium
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
width: 1
|
|
||||||
height: Theme.spacingXS
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
root.expandedUuid = modelData.uuid;
|
||||||
|
VPNService.getConfig(modelData.uuid);
|
||||||
|
}
|
||||||
|
onDeleteRequested: {
|
||||||
|
deleteConfirm.showWithOptions({
|
||||||
|
"title": I18n.tr("Delete VPN"),
|
||||||
|
"message": I18n.tr("Delete \"") + modelData.name + "\"?",
|
||||||
|
"confirmText": I18n.tr("Delete"),
|
||||||
|
"confirmColor": Theme.error,
|
||||||
|
"onConfirm": () => VPNService.deleteVpn(modelData.uuid)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
275
quickshell/Widgets/VpnProfileDelegate.qml
Normal file
275
quickshell/Widgets/VpnProfileDelegate.qml
Normal file
@@ -0,0 +1,275 @@
|
|||||||
|
import QtQuick
|
||||||
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
import qs.Widgets
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property var profile
|
||||||
|
property bool isExpanded: false
|
||||||
|
|
||||||
|
signal toggleExpand
|
||||||
|
signal deleteRequested
|
||||||
|
|
||||||
|
readonly property bool isActive: DMSNetworkService.activeUuids?.includes(profile?.uuid) ?? false
|
||||||
|
readonly property bool isHovered: rowArea.containsMouse || expandBtn.containsMouse || deleteBtn.containsMouse
|
||||||
|
readonly property var configData: isExpanded ? VPNService.editConfig : null
|
||||||
|
readonly property var configFields: buildConfigFields()
|
||||||
|
|
||||||
|
height: isExpanded ? 46 + expandedContent.height : 46
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: isHovered ? Theme.primaryHoverLight : (isActive ? Theme.primaryPressed : Theme.surfaceLight)
|
||||||
|
border.width: isActive ? 2 : 1
|
||||||
|
border.color: isActive ? Theme.primary : Theme.outlineLight
|
||||||
|
opacity: DMSNetworkService.isBusy ? 0.5 : 1.0
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
function buildConfigFields() {
|
||||||
|
if (!configData)
|
||||||
|
return [];
|
||||||
|
const fields = [];
|
||||||
|
const data = configData.data || {};
|
||||||
|
if (data.remote)
|
||||||
|
fields.push({
|
||||||
|
"key": "server",
|
||||||
|
"label": I18n.tr("Server"),
|
||||||
|
"value": data.remote
|
||||||
|
});
|
||||||
|
if (configData.username || data.username)
|
||||||
|
fields.push({
|
||||||
|
"key": "user",
|
||||||
|
"label": I18n.tr("Username"),
|
||||||
|
"value": configData.username || data.username
|
||||||
|
});
|
||||||
|
if (data.cipher)
|
||||||
|
fields.push({
|
||||||
|
"key": "cipher",
|
||||||
|
"label": I18n.tr("Cipher"),
|
||||||
|
"value": data.cipher
|
||||||
|
});
|
||||||
|
if (data.auth)
|
||||||
|
fields.push({
|
||||||
|
"key": "auth",
|
||||||
|
"label": I18n.tr("Auth"),
|
||||||
|
"value": data.auth
|
||||||
|
});
|
||||||
|
if (data["proto-tcp"] === "yes" || data["proto-tcp"] === "no")
|
||||||
|
fields.push({
|
||||||
|
"key": "proto",
|
||||||
|
"label": I18n.tr("Protocol"),
|
||||||
|
"value": data["proto-tcp"] === "yes" ? "TCP" : "UDP"
|
||||||
|
});
|
||||||
|
if (data["tunnel-mtu"])
|
||||||
|
fields.push({
|
||||||
|
"key": "mtu",
|
||||||
|
"label": I18n.tr("MTU"),
|
||||||
|
"value": data["tunnel-mtu"]
|
||||||
|
});
|
||||||
|
if (data["connection-type"])
|
||||||
|
fields.push({
|
||||||
|
"key": "conntype",
|
||||||
|
"label": I18n.tr("Auth Type"),
|
||||||
|
"value": data["connection-type"]
|
||||||
|
});
|
||||||
|
fields.push({
|
||||||
|
"key": "auto",
|
||||||
|
"label": I18n.tr("Autoconnect"),
|
||||||
|
"value": configData.autoconnect ? I18n.tr("Yes") : I18n.tr("No")
|
||||||
|
});
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on height {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: 150
|
||||||
|
easing.type: Easing.OutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: rowArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: DMSNetworkService.isBusy ? Qt.BusyCursor : Qt.PointingHandCursor
|
||||||
|
enabled: !DMSNetworkService.isBusy
|
||||||
|
onClicked: DMSNetworkService.toggle(profile.uuid)
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingS
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
height: 46 - Theme.spacingS * 2
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: isActive ? "vpn_lock" : "vpn_key_off"
|
||||||
|
size: 20
|
||||||
|
color: isActive ? Theme.primary : Theme.surfaceText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
spacing: 1
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: parent.width - 20 - 28 - 28 - Theme.spacingS * 4
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: profile?.name ?? ""
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: isActive ? Theme.primary : Theme.surfaceText
|
||||||
|
elide: Text.ElideRight
|
||||||
|
wrapMode: Text.NoWrap
|
||||||
|
width: parent.width
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: VPNService.getVpnTypeFromProfile(profile)
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceTextMedium
|
||||||
|
wrapMode: Text.NoWrap
|
||||||
|
width: parent.width
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: Theme.spacingXS
|
||||||
|
height: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 28
|
||||||
|
height: 28
|
||||||
|
radius: 14
|
||||||
|
color: expandBtn.containsMouse ? Theme.surfacePressed : "transparent"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
name: isExpanded ? "expand_less" : "expand_more"
|
||||||
|
size: 18
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: expandBtn
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: root.toggleExpand()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 28
|
||||||
|
height: 28
|
||||||
|
radius: 14
|
||||||
|
color: deleteBtn.containsMouse ? Theme.errorHover : "transparent"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
name: "delete"
|
||||||
|
size: 18
|
||||||
|
color: deleteBtn.containsMouse ? Theme.error : Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: deleteBtn
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: root.deleteRequested()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: expandedContent
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingXS
|
||||||
|
visible: isExpanded
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 1
|
||||||
|
color: Theme.outlineLight
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: parent.width
|
||||||
|
height: VPNService.configLoading ? 40 : 0
|
||||||
|
visible: VPNService.configLoading
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: "sync"
|
||||||
|
size: 16
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Loading...")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Flow {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingXS
|
||||||
|
visible: !VPNService.configLoading && configData
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: configFields
|
||||||
|
|
||||||
|
delegate: Rectangle {
|
||||||
|
required property var modelData
|
||||||
|
|
||||||
|
width: fieldContent.width + Theme.spacingM * 2
|
||||||
|
height: 32
|
||||||
|
radius: Theme.cornerRadius - 2
|
||||||
|
color: Theme.surfaceContainerHigh
|
||||||
|
border.width: 1
|
||||||
|
border.color: Theme.outlineLight
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: fieldContent
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: modelData.label + ":"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: modelData.value
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: 1
|
||||||
|
height: Theme.spacingXS
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user