a
This commit is contained in:
@@ -80,7 +80,7 @@ notifications:
|
|||||||
|
|
||||||
timeouts:
|
timeouts:
|
||||||
fallback default ms: 5000
|
fallback default ms: 5000
|
||||||
fallback low ms: 4500
|
fallback low ms: 1000
|
||||||
fallback normal ms: 5000
|
fallback normal ms: 5000
|
||||||
fallback critical ms: 8000
|
fallback critical ms: 8000
|
||||||
|
|
||||||
|
|||||||
@@ -27,15 +27,54 @@ Item {
|
|||||||
readonly property string notifBody: notifObject ? String(notifObject.body || "") : ""
|
readonly property string notifBody: notifObject ? String(notifObject.body || "") : ""
|
||||||
readonly property string notifAppName: notifObject ? String(notifObject.appName || "") : ""
|
readonly property string notifAppName: notifObject ? String(notifObject.appName || "") : ""
|
||||||
readonly property string notifAppIcon: notifObject ? String(notifObject.appIcon || "") : ""
|
readonly property string notifAppIcon: notifObject ? String(notifObject.appIcon || "") : ""
|
||||||
|
readonly property string notifDesktopEntry: {
|
||||||
|
if (!notifObject || !notifObject.hints)
|
||||||
|
return "";
|
||||||
|
const value = notifObject.hints["desktop-entry"];
|
||||||
|
return value === undefined || value === null ? "" : String(value);
|
||||||
|
}
|
||||||
readonly property string notifImage: notifObject ? String(notifObject.image || "") : ""
|
readonly property string notifImage: notifObject ? String(notifObject.image || "") : ""
|
||||||
readonly property bool isExpanded: forceExpanded || contextOpen
|
readonly property bool isExpanded: forceExpanded || contextOpen
|
||||||
|
|
||||||
readonly property string appIconSource: {
|
function resolveIconSource(iconName) {
|
||||||
if (!notifAppIcon || notifAppIcon.length === 0)
|
const normalized = String(iconName || "").trim();
|
||||||
|
if (normalized.length === 0)
|
||||||
return "";
|
return "";
|
||||||
if (notifAppIcon.indexOf("/") >= 0 || notifAppIcon.indexOf("file://") === 0)
|
if (normalized.indexOf("/") >= 0 || normalized.indexOf("file://") === 0)
|
||||||
return notifAppIcon;
|
return normalized;
|
||||||
return Quickshell.iconPath(notifAppIcon);
|
return String(Quickshell.iconPath(normalized) || "");
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly property string appIconSource: {
|
||||||
|
const candidates = [];
|
||||||
|
const desktopEntry = notifDesktopEntry.trim();
|
||||||
|
const appName = notifAppName.trim();
|
||||||
|
const appIcon = notifAppIcon.trim();
|
||||||
|
|
||||||
|
if (desktopEntry.length > 0) {
|
||||||
|
candidates.push(desktopEntry);
|
||||||
|
if (desktopEntry.endsWith(".desktop"))
|
||||||
|
candidates.push(desktopEntry.slice(0, desktopEntry.length - 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (appName.length > 0) {
|
||||||
|
candidates.push(appName);
|
||||||
|
const normalizedAppName = appName.toLowerCase();
|
||||||
|
candidates.push(normalizedAppName);
|
||||||
|
candidates.push(normalizedAppName.replace(/\s+/g, "-"));
|
||||||
|
candidates.push(normalizedAppName.replace(/\s+/g, ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (appIcon.length > 0)
|
||||||
|
candidates.push(appIcon);
|
||||||
|
|
||||||
|
for (let i = 0; i < candidates.length; i++) {
|
||||||
|
const resolved = resolveIconSource(candidates[i]);
|
||||||
|
if (resolved.length > 0)
|
||||||
|
return resolved;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property string customImageSource: notifImage
|
readonly property string customImageSource: notifImage
|
||||||
@@ -82,7 +121,7 @@ Item {
|
|||||||
const rawTimeout = Number(notifObject.expireTimeout);
|
const rawTimeout = Number(notifObject.expireTimeout);
|
||||||
if (Number.isFinite(rawTimeout) && rawTimeout > 0) {
|
if (Number.isFinite(rawTimeout) && rawTimeout > 0) {
|
||||||
const normalizedTimeout = rawTimeout > 100 ? Math.round(rawTimeout) : Math.round(rawTimeout * 1000);
|
const normalizedTimeout = rawTimeout > 100 ? Math.round(rawTimeout) : Math.round(rawTimeout * 1000);
|
||||||
return Math.max(theme ? theme.minimumTimeoutMs : 4500, normalizedTimeout);
|
return Math.max(theme ? theme.minimumTimeoutMs : 2000, normalizedTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
const urgency = notifObject.urgency;
|
const urgency = notifObject.urgency;
|
||||||
@@ -144,18 +183,50 @@ Item {
|
|||||||
id: enterAnimation
|
id: enterAnimation
|
||||||
running: !peekMode
|
running: !peekMode
|
||||||
|
|
||||||
PropertyAction { target: root; property: "opacity"; value: 0 }
|
PropertyAction {
|
||||||
PropertyAction { target: root; property: "x"; value: 20 }
|
target: root
|
||||||
|
property: "opacity"
|
||||||
|
value: 0
|
||||||
|
}
|
||||||
|
PropertyAction {
|
||||||
|
target: root
|
||||||
|
property: "x"
|
||||||
|
value: 20
|
||||||
|
}
|
||||||
ParallelAnimation {
|
ParallelAnimation {
|
||||||
NumberAnimation { target: root; property: "opacity"; to: 1; duration: theme ? theme.enterMs : 170; easing.type: Easing.OutCubic }
|
NumberAnimation {
|
||||||
NumberAnimation { target: root; property: "x"; to: 0; duration: theme ? theme.enterMs : 170; easing.type: Easing.OutCubic }
|
target: root
|
||||||
|
property: "opacity"
|
||||||
|
to: 1
|
||||||
|
duration: theme ? theme.enterMs : 170
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
}
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
property: "x"
|
||||||
|
to: 0
|
||||||
|
duration: theme ? theme.enterMs : 170
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ParallelAnimation {
|
ParallelAnimation {
|
||||||
id: closeAnimation
|
id: closeAnimation
|
||||||
NumberAnimation { target: root; property: "opacity"; to: 0; duration: theme ? theme.fadeMs : 120; easing.type: Easing.InCubic }
|
NumberAnimation {
|
||||||
NumberAnimation { target: root; property: "x"; to: width; duration: theme ? theme.exitMs : 140; easing.type: Easing.InCubic }
|
target: root
|
||||||
|
property: "opacity"
|
||||||
|
to: 0
|
||||||
|
duration: theme ? theme.fadeMs : 120
|
||||||
|
easing.type: Easing.InCubic
|
||||||
|
}
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
property: "x"
|
||||||
|
to: width
|
||||||
|
duration: theme ? theme.exitMs : 140
|
||||||
|
easing.type: Easing.InCubic
|
||||||
|
}
|
||||||
onFinished: root.closeFinished(root.notificationId, root.closeReason)
|
onFinished: root.closeFinished(root.notificationId, root.closeReason)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,8 +289,8 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: root.primaryIconSource.length === 0
|
visible: root.primaryIconSource.length === 0
|
||||||
color: "#000000"
|
color: "#000000"
|
||||||
border.width: 1
|
border.width: 0
|
||||||
border.color: theme ? theme.panelBorder : "#ffffff"
|
border.color: "transparent"
|
||||||
radius: 0
|
radius: 0
|
||||||
antialiasing: false
|
antialiasing: false
|
||||||
}
|
}
|
||||||
@@ -318,7 +389,9 @@ Item {
|
|||||||
radius: 0
|
radius: 0
|
||||||
antialiasing: false
|
antialiasing: false
|
||||||
|
|
||||||
HoverHandler { id: actionHover }
|
HoverHandler {
|
||||||
|
id: actionHover
|
||||||
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ QtObject {
|
|||||||
|
|
||||||
readonly property int dragDismissThreshold: 140
|
readonly property int dragDismissThreshold: 140
|
||||||
|
|
||||||
readonly property int fallbackLowTimeoutMs: 4500
|
readonly property int fallbackLowTimeoutMs: 1000
|
||||||
readonly property int fallbackNormalTimeoutMs: 5000
|
readonly property int fallbackNormalTimeoutMs: 5000
|
||||||
readonly property int fallbackCriticalTimeoutMs: 8000
|
readonly property int fallbackCriticalTimeoutMs: 8000
|
||||||
readonly property int minimumTimeoutMs: 4500
|
readonly property int minimumTimeoutMs: 1000
|
||||||
|
|
||||||
readonly property int enterMs: 170
|
readonly property int enterMs: 170
|
||||||
readonly property int exitMs: 140
|
readonly property int exitMs: 140
|
||||||
|
|||||||
Reference in New Issue
Block a user