better spacing of action buttons in notification popups
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 10s
Python / lint-format (pull_request) Successful in 20s
Python / test (pull_request) Successful in 28s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m14s

This commit is contained in:
2026-06-21 17:44:58 +02:00
parent e55d4aa36b
commit 164b48ab6a
2 changed files with 27 additions and 13 deletions
+14 -10
View File
@@ -1,6 +1,6 @@
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import qs.Modules import ZShell.Services
import qs.Components import qs.Components
import qs.Helpers import qs.Helpers
import qs.Config import qs.Config
@@ -16,30 +16,34 @@ GridLayout {
rowSpacing: Appearance.spacing.large rowSpacing: Appearance.spacing.large
rows: 1 rows: 1
Ref { ServiceRef {
service: SystemUsage service: Memory
}
ServiceRef {
service: Cpu
} }
Resource { Resource {
Layout.bottomMargin: Appearance.padding.large Layout.bottomMargin: Appearance.padding.large
Layout.topMargin: Appearance.padding.large Layout.topMargin: Appearance.padding.large
color: DynamicColors.palette.m3primary fgColor: DynamicColors.palette.m3primary
icon: "memory" icon: "memory"
value: SystemUsage.cpuPerc value: Cpu.percentage
} }
Resource { Resource {
Layout.bottomMargin: Appearance.padding.large Layout.bottomMargin: Appearance.padding.large
Layout.topMargin: Appearance.padding.large Layout.topMargin: Appearance.padding.large
color: DynamicColors.palette.m3secondary fgColor: DynamicColors.palette.m3secondary
icon: "memory_alt" icon: "memory_alt"
value: SystemUsage.memPerc value: Memory.percentage
} }
component Resource: CustomRect { component Resource: CustomRect {
id: res id: res
required property color color required property color fgColor
required property string icon required property string icon
required property real value required property real value
@@ -59,7 +63,7 @@ GridLayout {
anchors.fill: parent anchors.fill: parent
bgColor: DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, 3) bgColor: DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, 3)
fgColor: res.color fgColor: res.fgColor
padding: Appearance.padding.large * 3 padding: Appearance.padding.large * 3
strokeWidth: width < 200 ? Appearance.padding.smaller : Appearance.padding.normal strokeWidth: width < 200 ? Appearance.padding.smaller : Appearance.padding.normal
value: res.value value: res.value
@@ -69,7 +73,7 @@ GridLayout {
id: icon id: icon
anchors.centerIn: parent anchors.centerIn: parent
color: res.color color: res.fgColor
font.pointSize: (circ.arcRadius * 0.7) || 1 font.pointSize: (circ.arcRadius * 0.7) || 1
font.weight: 600 font.weight: 600
text: res.icon text: res.icon
+13 -3
View File
@@ -13,7 +13,6 @@ import qs.Components
CustomRect { CustomRect {
id: root id: root
readonly property int bodyTextFormat: /[<*_`#\[\]]/.test(modelData.body) ? Text.MarkdownText : Text.PlainText
property bool expanded: Config.notifs.openExpanded property bool expanded: Config.notifs.openExpanded
readonly property bool hasAppIcon: modelData.appIcon.length > 0 readonly property bool hasAppIcon: modelData.appIcon.length > 0
readonly property bool hasImage: modelData.image.length > 0 readonly property bool hasImage: modelData.image.length > 0
@@ -246,6 +245,7 @@ CustomRect {
anchors.leftMargin: Appearance.spacing.small anchors.leftMargin: Appearance.spacing.small
anchors.top: parent.top anchors.top: parent.top
animate: true animate: true
font.pointSize: Appearance.font.size.small
height: implicitHeight height: implicitHeight
maximumLineCount: 1 maximumLineCount: 1
text: summaryMetrics.elidedText text: summaryMetrics.elidedText
@@ -326,6 +326,7 @@ CustomRect {
anchors.top: parent.top anchors.top: parent.top
animate: true animate: true
color: DynamicColors.palette.m3onSurfaceVariant color: DynamicColors.palette.m3onSurfaceVariant
font.pointSize: Appearance.font.size.small
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
text: root.modelData.timeStr text: root.modelData.timeStr
} }
@@ -374,9 +375,10 @@ CustomRect {
anchors.top: summary.bottom anchors.top: summary.bottom
animate: true animate: true
color: DynamicColors.palette.m3onSurfaceVariant color: DynamicColors.palette.m3onSurfaceVariant
font.pointSize: Appearance.font.size.small
opacity: root.expanded ? 0 : 1 opacity: root.expanded ? 0 : 1
text: bodyPreviewMetrics.elidedText text: bodyPreviewMetrics.elidedText
textFormat: root.bodyTextFormat textFormat: Text.MarkdownText
Behavior on opacity { Behavior on opacity {
Anim { Anim {
@@ -406,7 +408,7 @@ CustomRect {
height: text ? implicitHeight : 0 height: text ? implicitHeight : 0
opacity: root.expanded ? 1 : 0 opacity: root.expanded ? 1 : 0
text: root.modelData.body text: root.modelData.body
textFormat: root.bodyTextFormat textFormat: Text.MarkdownText
wrapMode: Text.WrapAtWordBoundaryOrAnywhere wrapMode: Text.WrapAtWordBoundaryOrAnywhere
Behavior on opacity { Behavior on opacity {
@@ -441,6 +443,7 @@ CustomRect {
} }
IconButton { IconButton {
enabled: root.expanded
fillWidth: root.modelData.actions.length === 0 fillWidth: root.modelData.actions.length === 0
icon: "close" icon: "close"
inactiveColor: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3secondary : DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, 2) inactiveColor: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3secondary : DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, 2)
@@ -458,7 +461,13 @@ CustomRect {
TextButton { TextButton {
required property var modelData required property var modelData
enabled: root.expanded
fillWidth: true fillWidth: true
font: {
const f = Qt.font(font);
f.pointSize = Appearance.font.size.small;
return f;
}
implicitWidth: label.implicitWidth implicitWidth: label.implicitWidth
inactiveColor: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3secondary : DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, 2) inactiveColor: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3secondary : DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, 2)
inactiveOnColor: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3onSecondary : DynamicColors.palette.m3onSurfaceVariant inactiveOnColor: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3onSecondary : DynamicColors.palette.m3onSurfaceVariant
@@ -478,6 +487,7 @@ CustomRect {
} }
IconButton { IconButton {
enabled: root.expanded
fillWidth: root.modelData.actions.length === 0 fillWidth: root.modelData.actions.length === 0
icon: copyTimer.running ? "inventory" : "content_copy" icon: copyTimer.running ? "inventory" : "content_copy"
inactiveColor: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3secondary : DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, 2) inactiveColor: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3secondary : DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, 2)