Settings window #20

Merged
Zacharias-Brohn merged 83 commits from settingsWindow into main 2026-03-06 23:27:24 +01:00
2 changed files with 35 additions and 41 deletions
Showing only changes of commit fb1cc51eda - Show all commits
+23 -8
View File
@@ -7,26 +7,34 @@ import qs.Config
Item { Item {
id: root id: root
property color accentColor: DynamicColors.palette.m3primary property color accentColor: warning ? DynamicColors.palette.m3error : mainColor
property real animatedPercentage: 0 property real animatedPercentage: 0
readonly property real arcStartAngle: 0.75 * Math.PI readonly property real arcStartAngle: 0.75 * Math.PI
readonly property real arcSweep: 1.5 * Math.PI readonly property real arcSweep: 1.5 * Math.PI
property color borderColor: warning ? DynamicColors.palette.m3onError : mainColor
property string icon property string icon
required property color mainColor required property color mainColor
required property double percentage required property double percentage
property bool shown: true property bool shown: true
property string subtitle
property string title
property color usageColor: warning ? DynamicColors.palette.m3error : mainColor property color usageColor: warning ? DynamicColors.palette.m3error : mainColor
property bool warning: percentage * 100 >= warningThreshold property bool warning: percentage * 100 >= warningThreshold
property int warningThreshold: 100 property int warningThreshold: 80
clip: true clip: true
implicitHeight: root.parent.height height: implicitHeight
implicitWidth: root.parent.width implicitHeight: 34
implicitWidth: 34
percentage: 0 percentage: 0
visible: width > 0 && height > 0 visible: width > 0 && height > 0
width: implicitWidth
Behavior on animatedPercentage {
Anim {
duration: Appearance.anim.durations.large
}
}
Component.onCompleted: animatedPercentage = percentage
onPercentageChanged: animatedPercentage = percentage
Canvas { Canvas {
id: gaugeCanvas id: gaugeCanvas
@@ -40,7 +48,7 @@ Item {
const ctx = getContext("2d"); const ctx = getContext("2d");
ctx.reset(); ctx.reset();
const cx = width / 2; const cx = width / 2;
const cy = height / 2; const cy = (height / 2) + 1;
const radius = (Math.min(width, height) - 12) / 2; const radius = (Math.min(width, height) - 12) / 2;
const lineWidth = 3; const lineWidth = 3;
ctx.beginPath(); ctx.beginPath();
@@ -75,4 +83,11 @@ Item {
target: DynamicColors target: DynamicColors
} }
} }
MaterialIcon {
anchors.centerIn: parent
color: DynamicColors.palette.m3onSurface
font.pointSize: 12
text: root.icon
}
} }
+12 -33
View File
@@ -3,10 +3,9 @@ pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import Quickshell import Quickshell
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell.Wayland import qs.Helpers
import qs.Modules import qs.Modules
import qs.Config import qs.Config
import qs.Effects
import qs.Components import qs.Components
Item { Item {
@@ -41,57 +40,37 @@ Item {
id: rowLayout id: rowLayout
anchors.centerIn: parent anchors.centerIn: parent
spacing: 6 spacing: 0
MaterialIcon { Ref {
Layout.alignment: Qt.AlignVCenter service: SystemUsage
color: DynamicColors.palette.m3onSurface
font.pointSize: 14
text: "memory_alt"
} }
Resource { Resource {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
icon: "memory"
mainColor: DynamicColors.palette.m3primary mainColor: DynamicColors.palette.m3primary
percentage: ResourceUsage.memoryUsedPercentage percentage: SystemUsage.cpuPerc
warningThreshold: 95 warningThreshold: 95
} }
MaterialIcon {
Layout.alignment: Qt.AlignVCenter
color: DynamicColors.palette.m3onSurface
font.pointSize: 14
text: "memory"
}
Resource { Resource {
icon: "memory_alt"
mainColor: DynamicColors.palette.m3secondary mainColor: DynamicColors.palette.m3secondary
percentage: ResourceUsage.cpuUsage percentage: SystemUsage.memPerc
warningThreshold: 80 warningThreshold: 80
} }
MaterialIcon {
Layout.alignment: Qt.AlignVCenter
color: DynamicColors.palette.m3onSurface
font.pointSize: 14
text: "gamepad"
}
Resource { Resource {
icon: "gamepad"
mainColor: DynamicColors.palette.m3tertiary mainColor: DynamicColors.palette.m3tertiary
percentage: ResourceUsage.gpuUsage percentage: SystemUsage.gpuPerc
}
MaterialIcon {
Layout.alignment: Qt.AlignVCenter
color: DynamicColors.palette.m3onSurface
font.pointSize: 14
text: "developer_board"
} }
Resource { Resource {
icon: "developer_board"
mainColor: DynamicColors.palette.m3primary mainColor: DynamicColors.palette.m3primary
percentage: ResourceUsage.gpuMemUsage percentage: SystemUsage.gpuMemUsed
} }
} }
} }