From 36cf913830b49f01ede572c8461ace44aa2da283 Mon Sep 17 00:00:00 2001 From: Zacharias-Brohn Date: Tue, 18 Nov 2025 22:57:54 +0100 Subject: [PATCH] added 'warningAlt' accent color config --- Config/AccentColor.qml | 3 +- Helpers/SearchWallpapers.qml | 9 ----- Modules/NotificationCenter.qml | 8 +++++ Modules/Resource.qml | 62 +++++++++++++++++++++------------ Modules/Resources.qml | 33 ++++++++---------- Modules/TrackedNotification.qml | 18 ++-------- 6 files changed, 65 insertions(+), 68 deletions(-) diff --git a/Config/AccentColor.qml b/Config/AccentColor.qml index e7720af..2964332 100644 --- a/Config/AccentColor.qml +++ b/Config/AccentColor.qml @@ -5,7 +5,8 @@ JsonObject { component Accents: JsonObject { property string primary: "#4080ff" - property string warning: "#ff6b6b" property string primaryAlt: "#60a0ff" + property string warning: "#ff6b6b" + property string warningAlt: "#ff8787" } } diff --git a/Helpers/SearchWallpapers.qml b/Helpers/SearchWallpapers.qml index 7b63002..52e77a1 100644 --- a/Helpers/SearchWallpapers.qml +++ b/Helpers/SearchWallpapers.qml @@ -16,15 +16,6 @@ Searcher { forward: false }) - // FileView { - // path: root.currentNamePath - // watchChanges: true - // onFileChanged: reload() - // onLoaded: { - // root.actualCurrent = text().trim(); - // } - // } - FileSystemModel { id: wallpapers diff --git a/Modules/NotificationCenter.qml b/Modules/NotificationCenter.qml index 25bdfd2..4530238 100644 --- a/Modules/NotificationCenter.qml +++ b/Modules/NotificationCenter.qml @@ -22,6 +22,7 @@ PanelWindow { } WlrLayershell.layer: WlrLayer.Overlay + WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand required property PanelWindow bar property bool centerShown: false property alias posX: backgroundRect.x @@ -51,6 +52,13 @@ PanelWindow { } } + Keys.onPressed: { + if ( event.key === Qt.Key_Escape ) { + root.centerShown = false; + event.accepted = true; + } + } + Timer { id: closeTimer interval: 300 diff --git a/Modules/Resource.qml b/Modules/Resource.qml index a9cba01..3378456 100644 --- a/Modules/Resource.qml +++ b/Modules/Resource.qml @@ -1,6 +1,7 @@ import qs.Modules import QtQuick import QtQuick.Layouts +import QtQuick.Shapes import Quickshell import qs.Config @@ -46,36 +47,51 @@ Item { border.width: 1 } - Canvas { - id: progressCanvas + Shape { anchors.fill: backgroundCircle - Connections { - target: root - function onPercentageChanged() { - progressCanvas.requestPaint() + smooth: true + preferredRendererType: Shape.CurveRenderer + + ShapePath { + strokeWidth: 0 + fillColor: root.warning ? Config.accentColor.accents.warning : Config.accentColor.accents.primary + startX: backgroundCircle.width / 2 + startY: backgroundCircle.height / 2 + PathLine { + x: backgroundCircle.width / 2 + y: 0 + ( 1 / 2 ) } - function onWarningChanged() { - progressCanvas.requestPaint() + + PathAngleArc { + centerX: backgroundCircle.width / 2 + centerY: backgroundCircle.height / 2 + radiusX: backgroundCircle.width / 2 - ( 1 / 2 ) + radiusY: backgroundCircle.height / 2 - ( 1 / 2 ) + startAngle: -90 + sweepAngle: 360 * root.percentage + } + + PathLine { + x: backgroundCircle.width / 2 + y: backgroundCircle.height / 2 } } - onPaint: { - var ctx = getContext("2d"); - ctx.reset(); - - var centerX = width / 2; - var centerY = height / 2; - var radius = width / 2; - var startAngle = -Math.PI / 2; // Start at top - var endAngle = startAngle + (2 * Math.PI * percentage); + ShapePath { + strokeWidth: 1 + strokeColor: root.warning ? Config.accentColor.accents.warningAlt : Config.accentColor.accents.primaryAlt + fillColor: "transparent" + capStyle: ShapePath.FlatCap - ctx.fillStyle = warning ? Config.accentColor.accents.warning : Config.accentColor.accents.primary; - ctx.beginPath(); - ctx.moveTo(centerX, centerY); - ctx.arc(centerX, centerY, radius, startAngle, endAngle); - ctx.lineTo(centerX, centerY); - ctx.fill(); + PathAngleArc { + centerX: backgroundCircle.width / 2 + centerY: backgroundCircle.height / 2 + radiusX: backgroundCircle.width / 2 - ( 1 / 2 ) + radiusY: backgroundCircle.height / 2 - ( 1 / 2 ) + startAngle: -90 + sweepAngle: 360 * root.percentage + } } } } diff --git a/Modules/Resources.qml b/Modules/Resources.qml index 85f6962..8df7ffc 100644 --- a/Modules/Resources.qml +++ b/Modules/Resources.qml @@ -81,6 +81,7 @@ Item { } MouseArea { + id: widgetMouseArea anchors.fill: parent hoverEnabled: true onEntered: { @@ -97,9 +98,7 @@ Item { component ResourcePopout: PanelWindow { id: popoutWindow - property alias containsMouse: popoutWindow.mouseAreaContainsMouse property int rectHeight: contentRect.implicitHeight - property bool mouseAreaContainsMouse: mouseArea.containsMouse WlrLayershell.exclusionMode: ExclusionMode.Ignore anchors { @@ -127,10 +126,6 @@ Item { duration: MaterialEasing.expressiveEffectsTime easing.bezierCurve: MaterialEasing.expressiveEffects } - onFinished: { - if ( !mouseArea.containsMouse ) - closeAnim.start(); - } } ParallelAnimation { @@ -171,40 +166,40 @@ Item { spacing: 10 ResourceDetail { - resourceName: qsTr("Memory Usage") + resourceName: qsTr( "Memory Usage" ) iconString: "\uf7a3" percentage: ResourceUsage.memoryUsedPercentage warningThreshold: 95 - details: qsTr("%1 of %2 MB used") - .arg(Math.round(ResourceUsage.memoryUsed * 0.001)) - .arg(Math.round(ResourceUsage.memoryTotal * 0.001)) + details: qsTr( "%1 of %2 MB used" ) + .arg( Math.round( ResourceUsage.memoryUsed * 0.001 )) + .arg( Math.round( ResourceUsage.memoryTotal * 0.001 )) } ResourceDetail { - resourceName: qsTr("CPU Usage") + resourceName: qsTr( "CPU Usage" ) iconString: "\ue322" percentage: ResourceUsage.cpuUsage warningThreshold: 95 - details: qsTr("%1% used") - .arg(Math.round(ResourceUsage.cpuUsage * 100)) + details: qsTr( "%1% used" ) + .arg( Math.round( ResourceUsage.cpuUsage * 100 )) } ResourceDetail { - resourceName: qsTr("GPU Usage") + resourceName: qsTr( "GPU Usage" ) iconString: "\ue30f" percentage: ResourceUsage.gpuUsage warningThreshold: 95 - details: qsTr("%1% used") - .arg(Math.round(ResourceUsage.gpuUsage * 100)) + details: qsTr( "%1% used" ) + .arg( Math.round( ResourceUsage.gpuUsage * 100 )) } ResourceDetail { - resourceName: qsTr("VRAM Usage") + resourceName: qsTr( "VRAM Usage" ) iconString: "\ue30d" percentage: ResourceUsage.gpuMemUsage warningThreshold: 95 - details: qsTr("%1% used") - .arg(Math.round(ResourceUsage.gpuMemUsage * 100)) + details: qsTr( "%1% used" ) + .arg( Math.round( ResourceUsage.gpuMemUsage * 100 )) } } MouseArea { diff --git a/Modules/TrackedNotification.qml b/Modules/TrackedNotification.qml index 6aebee1..af96291 100644 --- a/Modules/TrackedNotification.qml +++ b/Modules/TrackedNotification.qml @@ -131,26 +131,13 @@ PanelWindow { border.color: "#555555" radius: 8 - // Rectangle { - // anchors.bottom: parent.bottom - // anchors.left: parent.left - // anchors.right: parent.right - // height: 4 - // bottomLeftRadius: parent.radius - // bottomRightRadius: parent.radius - // color: "#40000000" - // Rectangle { - // anchors.fill: parent - // width: parent.width * ( Math.max(0, Math.min( rootItem.modelData.timer ) ) ) - // } - // } - Component.onCompleted: { root.notifRegions.push( notifRegion.createObject(root, { item: backgroundRect })); } Column { id: contentLayout + z: 0 anchors.left: parent.left anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter @@ -238,11 +225,10 @@ PanelWindow { } MouseArea { - property int timePassed + z: 1 anchors.fill: parent hoverEnabled: true onEntered: { - // rootItem.modelData.timer.interval = 5000 - timer.restartMs(); rootItem.modelData.timer.stop(); } onExited: {