initial commit for media widget update + anim tokens restructure
C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 20s
JS/TS / lint (pull_request) Successful in 22s
Python / static (pull_request) Successful in 57s
Rust / fmt (pull_request) Successful in 1m2s
C++ / build (pull_request) Successful in 2m10s
Rust / build (pull_request) Successful in 1m50s
Rust / clippy (pull_request) Successful in 1m25s
Python / verify (pull_request) Successful in 2m58s
C++ / clang-tidy (pull_request) Successful in 7m8s

This commit is contained in:
2026-08-18 16:14:41 +02:00
parent 8ec454306f
commit 7d6f3cc275
162 changed files with 1385 additions and 1080 deletions
+62 -50
View File
@@ -1,34 +1,40 @@
pragma ComponentBehavior: Bound
import qs.Components
import ZShell.Config
import qs.Modules
import qs.Daemons
import qs.Helpers
import Quickshell
import Quickshell.Services.Notifications
import QtQuick
import QtQuick.Layouts
import Quickshell
import Quickshell.Services.Notifications
import ZShell.Config
import qs.Components
import qs.Services
import qs.Helpers
import qs.Daemons
CustomRect {
id: root
readonly property string appIcon: notifs.find(n => !n.closed && n.appIcon.length > 0)?.appIcon ?? ""
readonly property list<var> activeNotifs: notifs.filter(n => !n.closed)
readonly property string appIcon: activeNotifs.find(n => n.appIcon.length > 0)?.appIcon ?? ""
required property Flickable container
readonly property bool expanded: props.expandedNotifs.includes(modelData)
readonly property string image: notifs.find(n => !n.closed && n.image.length > 0)?.image ?? ""
readonly property string image: activeNotifs.find(n => n.image.length > 0)?.image ?? ""
required property string modelData
readonly property int nonAnimHeight: {
const headerHeight = header.implicitHeight + (root.expanded ? Math.round(7 / 2) : 0);
const columnHeight = headerHeight + notifList.layoutHeight + column.Layout.topMargin + column.Layout.bottomMargin;
return Math.round(Math.max(Config.notifs.sizes.image, columnHeight) + 10 * 2);
const headerHeight = header.implicitHeight + (root.expanded ? Math.round(Tokens.spacing.extraSmall) : 0);
const columnHeight = headerHeight + notifList.layoutHeight;
return Math.round(Math.max(Config.notifs.sizes.image, columnHeight) + Tokens.padding.small * 2);
}
readonly property int notifCount: notifs.reduce((acc, n) => n.closed ? acc : acc + 1, 0)
readonly property int notifCount: activeNotifs.length
readonly property list<var> notifs: NotifServer.list.filter(n => n.appName === modelData)
required property Props props
readonly property int urgency: notifs.some(n => !n.closed && n.urgency === NotificationUrgency.Critical) ? NotificationUrgency.Critical : notifs.some(n => n.urgency === NotificationUrgency.Normal) ? NotificationUrgency.Normal : NotificationUrgency.Low
required property var visibilities
readonly property int urgency: {
if (activeNotifs.find(n => n.urgency === NotificationUrgency.Critical))
return NotificationUrgency.Critical;
if (activeNotifs.find(n => n.urgency === NotificationUrgency.Normal))
return NotificationUrgency.Normal;
return NotificationUrgency.Low;
}
required property PersistentProperties visibilities
function toggleExpand(expand: bool): void {
if (expand) {
@@ -43,8 +49,13 @@ CustomRect {
anchors.right: parent?.right
clip: true
color: Colors.layer(Colors.palette.m3surfaceContainer, 2)
implicitHeight: content.implicitHeight + 10 * 2
radius: Tokens.rounding.smallest
implicitHeight: nonAnimHeight
radius: Tokens.rounding.large
Behavior on implicitHeight {
Anim {
}
}
Component.onDestruction: {
if (notifCount === 0 && expanded)
@@ -55,10 +66,10 @@ CustomRect {
id: content
anchors.left: parent.left
anchors.margins: 10
anchors.margins: Tokens.padding.small
anchors.right: parent.right
anchors.top: parent.top
spacing: 10
spacing: Tokens.spacing.medium
Item {
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
@@ -74,6 +85,10 @@ CustomRect {
fillMode: Image.PreserveAspectCrop
height: Config.notifs.sizes.image
source: Qt.resolvedUrl(root.image)
sourceSize: {
const size = Config.notifs.sizes.image * ((QsWindow.window as QsWindow)?.devicePixelRatio ?? 1);
return Qt.size(size, size);
}
width: Config.notifs.sizes.image
}
}
@@ -81,7 +96,8 @@ CustomRect {
Component {
id: appIconComp
CustomIcon {
ColoredIcon {
color: root.urgency === NotificationUrgency.Critical ? Colors.palette.m3onError : root.urgency === NotificationUrgency.Low ? Colors.palette.m3onSurface : Colors.palette.m3onSecondaryContainer
implicitSize: Math.round(Config.notifs.sizes.image * 0.6)
layer.enabled: root.appIcon.endsWith("symbolic")
source: Quickshell.iconPath(root.appIcon)
@@ -93,8 +109,7 @@ CustomRect {
MaterialIcon {
color: root.urgency === NotificationUrgency.Critical ? Colors.palette.m3onError : root.urgency === NotificationUrgency.Low ? Colors.palette.m3onSurface : Colors.palette.m3onSecondaryContainer
font.pointSize: 18
text: Icons.getNotifIcon(root.notifs[0]?.summary, root.urgency)
text: Icons.getNotifIcon(root.activeNotifs[0]?.summary, root.urgency)
}
}
@@ -105,6 +120,8 @@ CustomRect {
Loader {
anchors.centerIn: parent
anchors.verticalCenterOffset: sourceComponent === materialIconComp ? 1 : 0
asynchronous: true
sourceComponent: root.image ? imageComp : root.appIcon ? appIconComp : materialIconComp
}
}
@@ -113,6 +130,7 @@ CustomRect {
active: root.appIcon && root.image
anchors.bottom: parent.bottom
anchors.right: parent.right
asynchronous: true
sourceComponent: CustomRect {
color: root.urgency === NotificationUrgency.Critical ? Colors.palette.m3error : root.urgency === NotificationUrgency.Low ? Colors.palette.m3surfaceContainerHigh : Colors.palette.m3secondaryContainer
@@ -120,8 +138,9 @@ CustomRect {
implicitWidth: Config.notifs.sizes.badge
radius: Tokens.rounding.full
CustomIcon {
ColoredIcon {
anchors.centerIn: parent
color: root.urgency === NotificationUrgency.Critical ? Colors.palette.m3onError : root.urgency === NotificationUrgency.Low ? Colors.palette.m3onSurface : Colors.palette.m3onSecondaryContainer
implicitSize: Math.round(Config.notifs.sizes.badge * 0.6)
layer.enabled: root.appIcon.endsWith("symbolic")
source: Quickshell.iconPath(root.appIcon)
@@ -130,75 +149,68 @@ CustomRect {
}
}
ColumnLayout {
Column {
id: column
Layout.bottomMargin: -10 / 2
Layout.fillWidth: true
Layout.topMargin: -10
spacing: 0
spacing: root.expanded ? Math.round(Tokens.spacing.extraSmall) : 0
Behavior on spacing {
Anim {
}
}
RowLayout {
id: header
Layout.bottomMargin: root.expanded ? Math.round(7 / 2) : 0
Layout.fillWidth: true
spacing: 5
Behavior on Layout.bottomMargin {
Anim {
}
}
anchors.left: parent.left
anchors.right: parent.right
spacing: Tokens.spacing.small
CustomText {
Layout.fillWidth: true
color: Colors.palette.m3onSurfaceVariant
elide: Text.ElideRight
font.pointSize: 11
text: root.modelData
}
CustomText {
animate: true
color: Colors.palette.m3outline
font.pointSize: 11
text: root.notifs.find(n => !n.closed)?.timeStr ?? ""
text: root.activeNotifs[0]?.timeStr ?? ""
}
CustomRect {
color: root.urgency === NotificationUrgency.Critical ? Colors.palette.m3error : Colors.layer(Colors.palette.m3surfaceContainerHigh, 3)
implicitHeight: groupCount.implicitHeight + Tokens.padding.small
implicitWidth: expandBtn.implicitWidth + 7 * 2
implicitHeight: groupCount.implicitHeight + Tokens.padding.extraSmall
implicitWidth: expandBtn.implicitWidth + Tokens.padding.large
radius: Tokens.rounding.full
StateLayer {
color: root.urgency === NotificationUrgency.Critical ? Colors.palette.m3onError : Colors.palette.m3onSurface
onClicked: {
root.toggleExpand(!root.expanded);
}
onClicked: root.toggleExpand(!root.expanded)
}
RowLayout {
id: expandBtn
anchors.centerIn: parent
spacing: 7 / 2
spacing: Tokens.spacing.extraSmall
CustomText {
id: groupCount
Layout.leftMargin: 10 / 2
Layout.leftMargin: Tokens.padding.extraSmall / 2
animate: true
color: root.urgency === NotificationUrgency.Critical ? Colors.palette.m3onError : Colors.palette.m3onSurface
font.pointSize: 11
color: root.urgency === NotificationUrgency.Critical ? Colors.palette.m3onError : Colors.palette.m3onSurfaceVariant
text: root.notifCount
}
MaterialIcon {
Layout.rightMargin: -10 / 2
// Layout.topMargin: root.expanded ? -Math.floor(7 / 2) : 0
color: root.urgency === NotificationUrgency.Critical ? Colors.palette.m3onError : Colors.palette.m3onSurface
Layout.rightMargin: -Tokens.padding.extraSmall / 2
Layout.topMargin: root.expanded ? -Math.floor(Tokens.padding.extraSmall) : 0
color: root.urgency === NotificationUrgency.Critical ? Colors.palette.m3onError : Colors.palette.m3onSurfaceVariant
rotation: root.expanded ? 180 : 0
text: "expand_more"