make urgen notifs have cookie shape

This commit is contained in:
end-4
2025-10-12 18:34:20 +02:00
parent e1d77c0c3e
commit 4637b82471
2 changed files with 14 additions and 13 deletions
@@ -6,25 +6,25 @@ import Quickshell
import Quickshell.Widgets import Quickshell.Widgets
import Quickshell.Services.Notifications import Quickshell.Services.Notifications
Rectangle { // App icon MaterialCookie { // App icon
id: root id: root
property var appIcon: "" property var appIcon: ""
property var summary: "" property var summary: ""
property var urgency: NotificationUrgency.Normal property var urgency: NotificationUrgency.Normal
property bool isUrgent: urgency === NotificationUrgency.Critical
property var image: "" property var image: ""
property real scale: 1
property real size: 38 * scale
property real materialIconScale: 0.57 property real materialIconScale: 0.57
property real appIconScale: 0.8 property real appIconScale: 0.8
property real smallAppIconScale: 0.49 property real smallAppIconScale: 0.49
property real materialIconSize: size * materialIconScale property real materialIconSize: implicitSize * materialIconScale
property real appIconSize: size * appIconScale property real appIconSize: implicitSize * appIconScale
property real smallAppIconSize: size * smallAppIconScale property real smallAppIconSize: implicitSize * smallAppIconScale
implicitWidth: size implicitSize: 38 * scale
implicitHeight: size sides: isUrgent ? 12 : 0
radius: Appearance.rounding.full amplitude: implicitSize / 30
color: Appearance.colors.colSecondaryContainer
color: isUrgent ? Appearance.colors.colPrimary : Appearance.colors.colSecondaryContainer
Loader { Loader {
id: materialSymbolLoader id: materialSymbolLoader
active: root.appIcon == "" active: root.appIcon == ""
@@ -37,9 +37,7 @@ Rectangle { // App icon
"release_alert" : guessedIcon "release_alert" : guessedIcon
} }
anchors.fill: parent anchors.fill: parent
color: (root.urgency == NotificationUrgency.Critical) ? color: isUrgent ? Appearance.colors.colOnPrimary : Appearance.colors.colOnSecondaryContainer
ColorUtils.mix(Appearance.m3colors.m3onSecondary, Appearance.m3colors.m3onSecondaryContainer, 0.1) :
Appearance.m3colors.m3onSecondaryContainer
iconSize: root.materialIconSize iconSize: root.materialIconSize
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
@@ -6,6 +6,7 @@ import "./notification_utils.js" as NotificationUtils
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Services.Notifications
/** /**
* A group of notifications from the same app. * A group of notifications from the same app.
@@ -154,6 +155,8 @@ MouseArea { // Notification group area
image: root?.multipleNotifications ? "" : notificationGroup?.notifications[0]?.image ?? "" image: root?.multipleNotifications ? "" : notificationGroup?.notifications[0]?.image ?? ""
appIcon: notificationGroup?.appIcon appIcon: notificationGroup?.appIcon
summary: notificationGroup?.notifications[root.notificationCount - 1]?.summary summary: notificationGroup?.notifications[root.notificationCount - 1]?.summary
urgency: root.notifications.some(n => n.urgency === NotificationUrgency.Critical.toString()) ?
NotificationUrgency.Critical : NotificationUrgency.Normal
} }
ColumnLayout { // Content ColumnLayout { // Content