mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-13 17:49:03 +00:00
Switched to qmlformat.
This commit is contained in:
@@ -2,9 +2,9 @@ import QtQuick
|
||||
import QtQuick.Effects
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Services.Notifications
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Widgets
|
||||
import qs.Commons
|
||||
import qs.Services.System
|
||||
import qs.Widgets
|
||||
@@ -35,7 +35,7 @@ Variants {
|
||||
target: notificationModel
|
||||
function onCountChanged() {
|
||||
if (notificationModel.count === 0 && root.active) {
|
||||
delayTimer.restart()
|
||||
delayTimer.restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,30 +66,30 @@ Variants {
|
||||
// Calculate bar offsets for each edge separately
|
||||
readonly property int barOffsetTop: {
|
||||
if (barPos !== "top")
|
||||
return 0
|
||||
const floatMarginV = isFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0
|
||||
return Style.barHeight + floatMarginV
|
||||
return 0;
|
||||
const floatMarginV = isFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0;
|
||||
return Style.barHeight + floatMarginV;
|
||||
}
|
||||
|
||||
readonly property int barOffsetBottom: {
|
||||
if (barPos !== "bottom")
|
||||
return 0
|
||||
const floatMarginV = isFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0
|
||||
return Style.barHeight + floatMarginV
|
||||
return 0;
|
||||
const floatMarginV = isFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0;
|
||||
return Style.barHeight + floatMarginV;
|
||||
}
|
||||
|
||||
readonly property int barOffsetLeft: {
|
||||
if (barPos !== "left")
|
||||
return 0
|
||||
const floatMarginH = isFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0
|
||||
return floatMarginH
|
||||
return 0;
|
||||
const floatMarginH = isFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0;
|
||||
return floatMarginH;
|
||||
}
|
||||
|
||||
readonly property int barOffsetRight: {
|
||||
if (barPos !== "right")
|
||||
return 0
|
||||
const floatMarginH = isFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0
|
||||
return floatMarginH
|
||||
return 0;
|
||||
const floatMarginH = isFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0;
|
||||
return floatMarginH;
|
||||
}
|
||||
|
||||
// Anchoring
|
||||
@@ -111,31 +111,31 @@ Variants {
|
||||
|
||||
Component.onCompleted: {
|
||||
animateConnection = function (notificationId) {
|
||||
var delegate = null
|
||||
var delegate = null;
|
||||
if (notificationRepeater) {
|
||||
for (var i = 0; i < notificationRepeater.count; i++) {
|
||||
var item = notificationRepeater.itemAt(i)
|
||||
var item = notificationRepeater.itemAt(i);
|
||||
if (item?.notificationId === notificationId) {
|
||||
delegate = item
|
||||
break
|
||||
delegate = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (delegate?.animateOut) {
|
||||
delegate.animateOut()
|
||||
delegate.animateOut();
|
||||
} else {
|
||||
NotificationService.dismissActiveNotification(notificationId)
|
||||
NotificationService.dismissActiveNotification(notificationId);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
NotificationService.animateAndRemove.connect(animateConnection)
|
||||
NotificationService.animateAndRemove.connect(animateConnection);
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
if (animateConnection) {
|
||||
NotificationService.animateAndRemove.disconnect(animateConnection)
|
||||
animateConnection = null
|
||||
NotificationService.animateAndRemove.disconnect(animateConnection);
|
||||
animateConnection = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,8 +223,8 @@ Variants {
|
||||
width: parent.availableWidth * model.progress
|
||||
|
||||
color: {
|
||||
var baseColor = model.urgency === 2 ? Color.mError : model.urgency === 0 ? Color.mOnSurface : Color.mPrimary
|
||||
return Qt.alpha(baseColor, Settings.data.notifications.backgroundOpacity || 1.0)
|
||||
var baseColor = model.urgency === 2 ? Color.mError : model.urgency === 0 ? Color.mOnSurface : Color.mPrimary;
|
||||
return Qt.alpha(baseColor, Settings.data.notifications.backgroundOpacity || 1.0);
|
||||
}
|
||||
|
||||
antialiasing: true
|
||||
@@ -257,10 +257,10 @@ Variants {
|
||||
// Hover handling
|
||||
onHoverCountChanged: {
|
||||
if (hoverCount > 0) {
|
||||
resumeTimer.stop()
|
||||
NotificationService.pauseTimeout(notificationId)
|
||||
resumeTimer.stop();
|
||||
NotificationService.pauseTimeout(notificationId);
|
||||
} else {
|
||||
resumeTimer.start()
|
||||
resumeTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ Variants {
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
if (hoverCount === 0) {
|
||||
NotificationService.resumeTimeout(notificationId)
|
||||
NotificationService.resumeTimeout(notificationId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -284,30 +284,30 @@ Variants {
|
||||
onExited: parent.hoverCount--
|
||||
onClicked: {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
animateOut()
|
||||
animateOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Animation setup
|
||||
function triggerEntryAnimation() {
|
||||
animInDelayTimer.stop()
|
||||
removalTimer.stop()
|
||||
resumeTimer.stop()
|
||||
isRemoving = false
|
||||
hoverCount = 0
|
||||
animInDelayTimer.stop();
|
||||
removalTimer.stop();
|
||||
resumeTimer.stop();
|
||||
isRemoving = false;
|
||||
hoverCount = 0;
|
||||
if (Settings.data.general.animationDisabled) {
|
||||
slideOffset = 0
|
||||
scaleValue = 1.0
|
||||
opacityValue = 1.0
|
||||
return
|
||||
slideOffset = 0;
|
||||
scaleValue = 1.0;
|
||||
opacityValue = 1.0;
|
||||
return;
|
||||
}
|
||||
|
||||
slideOffset = slideInOffset
|
||||
scaleValue = 0.8
|
||||
opacityValue = 0.0
|
||||
animInDelayTimer.interval = animationDelay
|
||||
animInDelayTimer.start()
|
||||
slideOffset = slideInOffset;
|
||||
scaleValue = 0.8;
|
||||
opacityValue = 0.0;
|
||||
animInDelayTimer.interval = animationDelay;
|
||||
animInDelayTimer.start();
|
||||
}
|
||||
|
||||
Component.onCompleted: triggerEntryAnimation()
|
||||
@@ -320,23 +320,23 @@ Variants {
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
if (card.isRemoving)
|
||||
return
|
||||
slideOffset = 0
|
||||
scaleValue = 1.0
|
||||
opacityValue = 1.0
|
||||
return;
|
||||
slideOffset = 0;
|
||||
scaleValue = 1.0;
|
||||
opacityValue = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
function animateOut() {
|
||||
if (isRemoving)
|
||||
return
|
||||
animInDelayTimer.stop()
|
||||
resumeTimer.stop()
|
||||
isRemoving = true
|
||||
return;
|
||||
animInDelayTimer.stop();
|
||||
resumeTimer.stop();
|
||||
isRemoving = true;
|
||||
if (!Settings.data.general.animationDisabled) {
|
||||
slideOffset = slideOutOffset
|
||||
scaleValue = 0.8
|
||||
opacityValue = 0.0
|
||||
slideOffset = slideOutOffset;
|
||||
scaleValue = 0.8;
|
||||
opacityValue = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,13 +345,13 @@ Variants {
|
||||
interval: Style.animationSlow
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
NotificationService.dismissActiveNotification(notificationId)
|
||||
NotificationService.dismissActiveNotification(notificationId);
|
||||
}
|
||||
}
|
||||
|
||||
onIsRemovingChanged: {
|
||||
if (isRemoving) {
|
||||
removalTimer.start()
|
||||
removalTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,9 +478,9 @@ Variants {
|
||||
property string parentNotificationId: notificationId
|
||||
property var parsedActions: {
|
||||
try {
|
||||
return model.actionsJson ? JSON.parse(model.actionsJson) : []
|
||||
return model.actionsJson ? JSON.parse(model.actionsJson) : [];
|
||||
} catch (e) {
|
||||
return []
|
||||
return [];
|
||||
}
|
||||
}
|
||||
visible: parsedActions.length > 0
|
||||
@@ -495,11 +495,11 @@ Variants {
|
||||
onExited: card.hoverCount--
|
||||
|
||||
text: {
|
||||
var actionText = actionData.text || "Open"
|
||||
var actionText = actionData.text || "Open";
|
||||
if (actionText.includes(",")) {
|
||||
return actionText.split(",")[1] || actionText
|
||||
return actionText.split(",")[1] || actionText;
|
||||
}
|
||||
return actionText
|
||||
return actionText;
|
||||
}
|
||||
fontSize: Style.fontSizeS
|
||||
backgroundColor: Color.mPrimary
|
||||
@@ -508,7 +508,7 @@ Variants {
|
||||
outlined: false
|
||||
implicitHeight: 24
|
||||
onClicked: {
|
||||
NotificationService.invokeAction(parent.parentNotificationId, actionData.identifier)
|
||||
NotificationService.invokeAction(parent.parentNotificationId, actionData.identifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -528,8 +528,8 @@ Variants {
|
||||
anchors.rightMargin: Style.marginXL
|
||||
|
||||
onClicked: {
|
||||
NotificationService.removeFromHistory(model.id)
|
||||
animateOut()
|
||||
NotificationService.removeFromHistory(model.id);
|
||||
animateOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user