Compare commits

..

No commits in common. "c5067c4e7ffabf719c204ba4137bd11ba14aa68d" and "19eedf9c0ea351e9700270e8fa99b37048d5ab80" have entirely different histories.

7 changed files with 294 additions and 289 deletions

View file

@ -205,7 +205,7 @@ M.BarSection {
anchors.leftMargin: 12 anchors.leftMargin: 12
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: "\uF185" text: "\uF185"
color: root.accentColor color: M.Theme.base0A
font.pixelSize: M.Theme.fontSize + 2 font.pixelSize: M.Theme.fontSize + 2
font.family: M.Theme.iconFontFamily font.family: M.Theme.iconFontFamily
} }
@ -228,7 +228,7 @@ M.BarSection {
Rectangle { Rectangle {
width: parent.width * root.percent / 100 width: parent.width * root.percent / 100
height: parent.height height: parent.height
color: root.accentColor color: M.Theme.base0A
radius: 3 radius: 3
Behavior on width { Behavior on width {

View file

@ -107,10 +107,8 @@ PanelWindow {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
spacing: M.Theme.groupSpacing spacing: M.Theme.groupSpacing
M.Privacy {}
M.BarGroup { M.BarGroup {
M.Privacy {
visible: M.Modules.privacy.enable
}
M.Clock { M.Clock {
visible: M.Modules.clock.enable visible: M.Modules.clock.enable
} }

View file

@ -79,12 +79,6 @@ QtObject {
warning: 25, warning: 25,
critical: 15 critical: 15
}) })
property var privacy: ({
enable: true
})
property var screenCorners: ({
enable: true
})
property var power: ({ property var power: ({
enable: true enable: true
}) })

View file

@ -252,7 +252,7 @@ M.BarSection {
width: (parent.width - 15 * parent.spacing) / 16 width: (parent.width - 15 * parent.spacing) / 16
height: parent.height * (root._cavaBars[index] ?? 0) height: parent.height * (root._cavaBars[index] ?? 0)
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
color: root.accentColor color: M.Theme.base0E
radius: 1 radius: 1
Behavior on height { Behavior on height {
@ -382,7 +382,7 @@ M.BarSection {
Rectangle { Rectangle {
width: parent.width * Math.min(1, Math.max(0, parent.parent.frac)) width: parent.width * Math.min(1, Math.max(0, parent.parent.frac))
height: parent.height height: parent.height
color: root.accentColor color: M.Theme.base0E
radius: 2 radius: 2
} }
} }
@ -413,7 +413,7 @@ M.BarSection {
Text { Text {
text: root.playing ? "\uF04C" : "\uF04B" text: root.playing ? "\uF04C" : "\uF04B"
color: root.accentColor color: M.Theme.base0E
font.pixelSize: M.Theme.fontSize + 8 font.pixelSize: M.Theme.fontSize + 8
font.family: M.Theme.iconFontFamily font.family: M.Theme.iconFontFamily
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -459,7 +459,7 @@ M.BarSection {
height: 18 height: 18
radius: 9 radius: 9
color: _active ? M.Theme.base02 : (pArea.containsMouse ? M.Theme.base02 : "transparent") color: _active ? M.Theme.base02 : (pArea.containsMouse ? M.Theme.base02 : "transparent")
border.color: _active ? root.accentColor : M.Theme.base03 border.color: _active ? M.Theme.base0E : M.Theme.base03
border.width: _active ? 1 : 0 border.width: _active ? 1 : 0
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -467,7 +467,7 @@ M.BarSection {
id: _pLabel id: _pLabel
anchors.centerIn: parent anchors.centerIn: parent
text: modelData.identity ?? "Player" text: modelData.identity ?? "Player"
color: _active ? root.accentColor : M.Theme.base04 color: _active ? M.Theme.base0E : M.Theme.base04
font.pixelSize: M.Theme.fontSize - 2 font.pixelSize: M.Theme.fontSize - 2
font.family: M.Theme.fontFamily font.family: M.Theme.fontFamily
font.bold: _active font.bold: _active

View file

@ -64,32 +64,24 @@ M.PopupPanel {
} }
} }
property var _delegates: []
property var _pendingDismissIds: [] property var _pendingDismissIds: []
function _cascadeDismiss() { function _cascadeDismiss() {
const list = M.NotifService.list; const dels = _delegates.filter(d => d && d.modelData && !d.modelData.closed);
if (list.length === 0) if (dels.length === 0)
return; return;
_pendingDismissIds = list.map(n => n.id); _pendingDismissIds = dels.map(d => d.modelData.id);
const visibles = []; for (let i = 0; i < dels.length; i++) {
for (let i = 0; i < list.length; i++) { const d = dels[i];
const d = notifList.itemAtIndex(i); const isLast = (i === dels.length - 1);
if (d && d.modelData?.state !== "dismissing")
visibles.push(d);
}
if (visibles.length === 0) {
_finishCascade();
return;
}
for (let i = 0; i < visibles.length; i++) {
_cascadeTimer.createObject(menuWindow, { _cascadeTimer.createObject(menuWindow, {
_target: visibles[i], _target: d,
_delay: i * 60, _delay: i * 60,
_isLast: i === visibles.length - 1 _isLast: isLast
}); });
} }
} }
@ -122,7 +114,7 @@ M.PopupPanel {
property Component _bulkTimer: Component { property Component _bulkTimer: Component {
Timer { Timer {
interval: 400 // swipe (200) + collapse (150) + margin interval: 400 // swipe (200) + collapse (150) + margin
running: true running: true
onTriggered: { onTriggered: {
menuWindow._finishCascade(); menuWindow._finishCascade();
@ -140,273 +132,297 @@ M.PopupPanel {
} }
// Notification list (scrollable) // Notification list (scrollable)
ListView { Item {
id: notifList
width: menuWindow.panelWidth width: menuWindow.panelWidth
height: Math.min(contentHeight, 60 * (M.Modules.notifications.maxVisible || 10)) height: Math.min(notifFlick.contentHeight, _maxHeight)
clip: true readonly property real _itemHeight: 60
boundsBehavior: Flickable.StopAtBounds readonly property real _maxHeight: _itemHeight * (M.Modules.notifications.maxVisible || 10)
model: M.NotifService.list
delegate: Item { Flickable {
id: notifItem id: notifFlick
required property var modelData anchors.fill: parent
required property int index contentWidth: width
contentHeight: notifCol.implicitHeight
width: menuWindow.panelWidth
height: _targetHeight * _heightScale
opacity: 0
clip: true clip: true
boundsBehavior: Flickable.StopAtBounds
readonly property real _targetHeight: notifContent.height + 12
property real _heightScale: 1
property bool _skipDismiss: false
function dismiss() {
if (notifItem.modelData.state === "dismissing")
return;
notifItem.modelData.beginDismiss();
_dismissAnim.start();
}
function dismissVisualOnly() {
if (notifItem.modelData.state === "dismissing")
return;
notifItem.modelData.beginDismiss();
_skipDismiss = true;
_dismissAnim.start();
}
Component.onCompleted: fadeIn.start()
NumberAnimation {
id: fadeIn
target: notifItem
property: "opacity"
to: 1
duration: 150
easing.type: Easing.OutCubic
}
Rectangle {
anchors.fill: parent
anchors.leftMargin: 4
anchors.rightMargin: 4
color: notifArea.containsMouse ? M.Theme.base02 : "transparent"
radius: M.Theme.radius
Rectangle {
visible: (notifItem.modelData.hints?.value ?? -1) >= 0
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
width: parent.width * Math.min(1, Math.max(0, (notifItem.modelData.hints?.value ?? 0) / 100))
color: M.Theme.base02
radius: parent.radius
Behavior on width {
NumberAnimation {
duration: 200
}
}
}
}
// Urgency accent
Rectangle {
anchors.left: parent.left
anchors.leftMargin: 4
anchors.top: parent.top
anchors.topMargin: 4
anchors.bottom: parent.bottom
anchors.bottomMargin: 4
width: 2
radius: 1
color: {
const u = notifItem.modelData.urgency;
return u === NotificationUrgency.Critical ? M.Theme.base08 : u === NotificationUrgency.Low ? M.Theme.base04 : M.Theme.base0D;
}
}
Image {
id: ncIcon
anchors.left: parent.left
anchors.leftMargin: 14
anchors.top: parent.top
anchors.topMargin: 6
width: 24
height: 24
source: notifItem.modelData.image || notifItem.modelData.appIcon || ""
visible: status === Image.Ready
fillMode: Image.PreserveAspectFit
sourceSize: Qt.size(24, 24)
asynchronous: true
}
Column { Column {
id: notifContent id: notifCol
anchors.left: ncIcon.visible ? ncIcon.right : parent.left width: parent.width
anchors.right: dismissBtn.left
anchors.top: parent.top
anchors.leftMargin: ncIcon.visible ? 6 : 14
anchors.topMargin: 6
spacing: 1
// App + time Repeater {
Row { model: M.NotifService.list
width: parent.width
Text { delegate: Item {
text: notifItem.modelData.appName || "Notification" id: notifItem
color: M.Theme.base04 required property var modelData
font.pixelSize: M.Theme.fontSize - 2 required property int index
font.family: M.Theme.fontFamily
elide: Text.ElideRight width: menuWindow.panelWidth
width: parent.width - ageText.width - 4 height: _targetHeight * _heightScale
} opacity: 0
Text { clip: true
id: ageText
text: { readonly property real _targetHeight: notifContent.height + 12
const diff = Math.floor((Date.now() - notifItem.modelData.time) / 60000); property real _heightScale: 1
if (diff < 1) property bool _skipDismiss: false
return "now";
if (diff < 60) function dismiss() {
return diff + "m"; if (notifItem.modelData.state === "dismissing")
if (diff < 1440) return;
return Math.floor(diff / 60) + "h"; notifItem.modelData.beginDismiss();
return Math.floor(diff / 1440) + "d"; _dismissAnim.start();
} }
color: M.Theme.base03
font.pixelSize: M.Theme.fontSize - 2
font.family: M.Theme.fontFamily
}
}
Text { function dismissVisualOnly() {
width: parent.width if (notifItem.modelData.state === "dismissing")
text: notifItem.modelData.summary || "" return;
color: M.Theme.base05 notifItem.modelData.beginDismiss();
font.pixelSize: M.Theme.fontSize _skipDismiss = true;
font.family: M.Theme.fontFamily _dismissAnim.start();
font.bold: true }
elide: Text.ElideRight
}
Text { Component.onCompleted: {
width: parent.width menuWindow._delegates.push(notifItem);
text: notifItem.modelData.body || "" fadeIn.start();
color: M.Theme.base04 }
font.pixelSize: M.Theme.fontSize - 1 Component.onDestruction: {
font.family: M.Theme.fontFamily const idx = menuWindow._delegates.indexOf(notifItem);
wrapMode: Text.WordWrap if (idx >= 0)
maximumLineCount: 2 menuWindow._delegates.splice(idx, 1);
elide: Text.ElideRight }
visible: text !== ""
}
// Actions NumberAnimation {
Row { id: fadeIn
spacing: 4 target: notifItem
visible: notifItem.modelData.actions && notifItem.modelData.actions.length > 0 property: "opacity"
to: 1
duration: 150
easing.type: Easing.OutCubic
}
Repeater { Rectangle {
model: notifItem.modelData.actions || [] anchors.fill: parent
delegate: Rectangle { anchors.leftMargin: 4
required property var modelData anchors.rightMargin: 4
width: actText.implicitWidth + 10 color: notifArea.containsMouse ? M.Theme.base02 : "transparent"
height: actText.implicitHeight + 4
radius: M.Theme.radius radius: M.Theme.radius
color: actArea.containsMouse ? M.Theme.base02 : "transparent"
border.color: M.Theme.base03
border.width: 1
Text { Rectangle {
id: actText visible: (notifItem.modelData.hints?.value ?? -1) >= 0
anchors.centerIn: parent anchors.top: parent.top
text: parent.modelData.text anchors.bottom: parent.bottom
color: M.Theme.base0D anchors.left: parent.left
font.pixelSize: M.Theme.fontSize - 2 width: parent.width * Math.min(1, Math.max(0, (notifItem.modelData.hints?.value ?? 0) / 100))
font.family: M.Theme.fontFamily color: M.Theme.base02
} radius: parent.radius
MouseArea {
id: actArea Behavior on width {
anchors.fill: parent NumberAnimation {
hoverEnabled: true duration: 200
cursorShape: Qt.PointingHandCursor }
onClicked: {
parent.modelData.invoke();
M.NotifService.dismiss(notifItem.modelData.id);
} }
} }
} }
}
}
}
// Dismiss button // Urgency accent
Text { Rectangle {
id: dismissBtn anchors.left: parent.left
anchors.right: parent.right anchors.leftMargin: 4
anchors.rightMargin: 10 anchors.top: parent.top
anchors.top: parent.top anchors.topMargin: 4
anchors.topMargin: 8 anchors.bottom: parent.bottom
text: "\uF00D" anchors.bottomMargin: 4
color: dismissArea.containsMouse ? M.Theme.base08 : M.Theme.base03 width: 2
font.pixelSize: M.Theme.fontSize - 1 radius: 1
font.family: M.Theme.iconFontFamily color: {
const u = notifItem.modelData.urgency;
return u === NotificationUrgency.Critical ? M.Theme.base08 : u === NotificationUrgency.Low ? M.Theme.base04 : M.Theme.base0D;
}
}
MouseArea { Image {
id: dismissArea id: ncIcon
anchors.fill: parent anchors.left: parent.left
anchors.margins: -4 anchors.leftMargin: 14
hoverEnabled: true anchors.top: parent.top
cursorShape: Qt.PointingHandCursor anchors.topMargin: 6
onClicked: _dismissAnim.start() width: 24
} height: 24
} source: notifItem.modelData.image || notifItem.modelData.appIcon || ""
visible: status === Image.Ready
fillMode: Image.PreserveAspectFit
sourceSize: Qt.size(24, 24)
asynchronous: true
}
SequentialAnimation { Column {
id: _dismissAnim id: notifContent
ParallelAnimation { anchors.left: ncIcon.visible ? ncIcon.right : parent.left
NumberAnimation { anchors.right: dismissBtn.left
target: notifItem anchors.top: parent.top
property: "x" anchors.leftMargin: ncIcon.visible ? 6 : 14
to: menuWindow.panelWidth anchors.topMargin: 6
duration: 200 spacing: 1
easing.type: Easing.InCubic
}
NumberAnimation {
target: notifItem
property: "opacity"
to: 0
duration: 200
easing.type: Easing.InCubic
}
}
NumberAnimation {
target: notifItem
property: "_heightScale"
to: 0
duration: 150
easing.type: Easing.OutCubic
}
ScriptAction {
script: {
if (!notifItem._skipDismiss)
M.NotifService.dismiss(notifItem.modelData.id);
}
}
}
MouseArea { // App + time
id: notifArea Row {
anchors.fill: parent width: parent.width
z: -1 Text {
hoverEnabled: true text: notifItem.modelData.appName || "Notification"
acceptedButtons: Qt.RightButton color: M.Theme.base04
onClicked: _dismissAnim.start() font.pixelSize: M.Theme.fontSize - 2
} font.family: M.Theme.fontFamily
} elide: Text.ElideRight
} width: parent.width - ageText.width - 4
}
Text {
id: ageText
text: {
const diff = Math.floor((Date.now() - notifItem.modelData.time) / 60000);
if (diff < 1)
return "now";
if (diff < 60)
return diff + "m";
if (diff < 1440)
return Math.floor(diff / 60) + "h";
return Math.floor(diff / 1440) + "d";
}
color: M.Theme.base03
font.pixelSize: M.Theme.fontSize - 2
font.family: M.Theme.fontFamily
}
}
Text {
width: parent.width
text: notifItem.modelData.summary || ""
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
font.bold: true
elide: Text.ElideRight
}
Text {
width: parent.width
text: notifItem.modelData.body || ""
color: M.Theme.base04
font.pixelSize: M.Theme.fontSize - 1
font.family: M.Theme.fontFamily
wrapMode: Text.WordWrap
maximumLineCount: 2
elide: Text.ElideRight
visible: text !== ""
}
// Actions
Row {
spacing: 4
visible: notifItem.modelData.actions && notifItem.modelData.actions.length > 0
Repeater {
model: notifItem.modelData.actions || []
delegate: Rectangle {
required property var modelData
width: actText.implicitWidth + 10
height: actText.implicitHeight + 4
radius: M.Theme.radius
color: actArea.containsMouse ? M.Theme.base02 : "transparent"
border.color: M.Theme.base03
border.width: 1
Text {
id: actText
anchors.centerIn: parent
text: parent.modelData.text
color: M.Theme.base0D
font.pixelSize: M.Theme.fontSize - 2
font.family: M.Theme.fontFamily
}
MouseArea {
id: actArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
parent.modelData.invoke();
M.NotifService.dismiss(notifItem.modelData.id);
}
}
}
}
}
}
// Dismiss button
Text {
id: dismissBtn
anchors.right: parent.right
anchors.rightMargin: 10
anchors.top: parent.top
anchors.topMargin: 8
text: "\uF00D"
color: dismissArea.containsMouse ? M.Theme.base08 : M.Theme.base03
font.pixelSize: M.Theme.fontSize - 1
font.family: M.Theme.iconFontFamily
MouseArea {
id: dismissArea
anchors.fill: parent
anchors.margins: -4
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: _dismissAnim.start()
}
}
SequentialAnimation {
id: _dismissAnim
ParallelAnimation {
NumberAnimation {
target: notifItem
property: "x"
to: menuWindow.panelWidth
duration: 200
easing.type: Easing.InCubic
}
NumberAnimation {
target: notifItem
property: "opacity"
to: 0
duration: 200
easing.type: Easing.InCubic
}
}
NumberAnimation {
target: notifItem
property: "_heightScale"
to: 0
duration: 150
easing.type: Easing.OutCubic
}
ScriptAction {
script: {
if (!notifItem._skipDismiss)
M.NotifService.dismiss(notifItem.modelData.id);
}
}
}
MouseArea {
id: notifArea
anchors.fill: parent
z: -1
hoverEnabled: true
acceptedButtons: Qt.RightButton
onClicked: _dismissAnim.start()
}
}
} // Repeater
} // Column
} // Flickable
} // Item
// Empty state // Empty state
Text { Text {

View file

@ -365,7 +365,7 @@ M.BarSection {
anchors.rightMargin: 12 anchors.rightMargin: 12
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: modelData.description || modelData.name || "Unknown" text: modelData.description || modelData.name || "Unknown"
color: parent._active ? root.accentColor : M.Theme.base05 color: parent._active ? M.Theme.base0E : M.Theme.base05
font.pixelSize: M.Theme.fontSize font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily font.family: M.Theme.fontFamily
font.bold: parent._active font.bold: parent._active
@ -472,7 +472,7 @@ M.BarSection {
Rectangle { Rectangle {
width: parent.width * Math.min(1, Math.max(0, streamEntry._vol)) width: parent.width * Math.min(1, Math.max(0, streamEntry._vol))
height: parent.height height: parent.height
color: streamEntry._muted ? M.Theme.base04 : root.accentColor color: streamEntry._muted ? M.Theme.base04 : M.Theme.base0E
radius: 2 radius: 2
} }

View file

@ -40,11 +40,8 @@ ShellRoot {
} }
} }
LazyLoader { ScreenCorners {
active: Modules.screenCorners.enable screen: scope.modelData
ScreenCorners {
screen: scope.modelData
}
} }
} }
} }