mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Merge pull request #1726 from deep4lpha/optional-lockscreen-animations
make lockscreen animations optional
This commit is contained in:
@@ -8,6 +8,30 @@ import qs.Widgets
|
||||
// Time, Date, and User Profile Container
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
// Whether to enable lock screen animations (avatar pulse, breathing, smooth cursor blink).
|
||||
// Defaults to false to reduce GPU usage. Set Settings.data.general.lockScreenAnimations = true to restore.
|
||||
readonly property bool animationsEnabled: Settings.data.general.lockScreenAnimations || false
|
||||
|
||||
// Use timer-driven properties instead of Time.now to avoid per-frame repaints.
|
||||
// Time.now updates every frame (~60+ Hz); these update only when needed.
|
||||
property date currentTime: new Date()
|
||||
property date currentDate: new Date()
|
||||
|
||||
Timer {
|
||||
interval: 1000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: root.currentTime = new Date()
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 60000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: root.currentDate = new Date()
|
||||
}
|
||||
|
||||
width: Math.max(500, contentRow.implicitWidth + 32)
|
||||
height: Math.max(120, contentRow.implicitHeight + 32)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -41,6 +65,7 @@ Rectangle {
|
||||
|
||||
SequentialAnimation on border.color {
|
||||
loops: Animation.Infinite
|
||||
running: root.animationsEnabled
|
||||
ColorAnimation {
|
||||
to: Qt.alpha(Color.mPrimary, 1.0)
|
||||
duration: 2000
|
||||
@@ -64,6 +89,7 @@ Rectangle {
|
||||
|
||||
SequentialAnimation on scale {
|
||||
loops: Animation.Infinite
|
||||
running: root.animationsEnabled
|
||||
NumberAnimation {
|
||||
to: 1.02
|
||||
duration: 4000
|
||||
@@ -110,7 +136,7 @@ Rectangle {
|
||||
"sv": "dddd d MMMM",
|
||||
"zh": "yyyy年M月d日 dddd"
|
||||
};
|
||||
var dateString = I18n.locale.toString(Time.now, formats[lang] || "dddd, d MMMM");
|
||||
var dateString = I18n.locale.toString(root.currentDate, formats[lang] || "dddd, d MMMM");
|
||||
return dateString.charAt(0).toUpperCase() + dateString.slice(1);
|
||||
}
|
||||
pointSize: Style.fontSizeXL
|
||||
@@ -136,7 +162,7 @@ Rectangle {
|
||||
width: 70
|
||||
height: 70
|
||||
visible: Settings.data.general.clockStyle === "analog"
|
||||
now: Time.now
|
||||
now: root.currentTime
|
||||
clockStyle: "analog"
|
||||
backgroundColor: "transparent"
|
||||
clockColor: Color.mOnSurface
|
||||
@@ -149,7 +175,7 @@ Rectangle {
|
||||
width: 70
|
||||
height: 70
|
||||
visible: Settings.data.general.clockStyle === "digital"
|
||||
now: Time.now
|
||||
now: root.currentTime
|
||||
clockStyle: "digital"
|
||||
showProgress: true
|
||||
progressColor: Color.mPrimary
|
||||
@@ -168,7 +194,7 @@ Rectangle {
|
||||
spacing: -3
|
||||
|
||||
Repeater {
|
||||
model: I18n.locale.toString(Time.now, (Settings.data.general.clockFormat || "hh\\nmm").replace(/\\n/g, "\n")).split("\n")
|
||||
model: I18n.locale.toString(root.currentTime, (Settings.data.general.clockFormat || "hh\\nmm").replace(/\\n/g, "\n")).split("\n")
|
||||
NText {
|
||||
text: modelData
|
||||
pointSize: Style.fontSizeL
|
||||
|
||||
@@ -20,6 +20,10 @@ Item {
|
||||
required property var keyboardLayout
|
||||
required property TextInput passwordInput
|
||||
|
||||
// Whether to enable lock screen animations (smooth cursor blink).
|
||||
// Defaults to false to reduce GPU usage. Set Settings.data.general.lockScreenAnimations = true to restore.
|
||||
readonly property bool animationsEnabled: Settings.data.general.lockScreenAnimations || false
|
||||
|
||||
Component.onCompleted: {
|
||||
if (Settings.data.general.autoStartAuth) {
|
||||
doUnlock();
|
||||
@@ -544,9 +548,10 @@ Item {
|
||||
visible: passwordInput.activeFocus && passwordInput.text.length === 0
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
// Smooth fade animation (when animations enabled)
|
||||
SequentialAnimation on opacity {
|
||||
loops: Animation.Infinite
|
||||
running: passwordInput.activeFocus && passwordInput.text.length === 0
|
||||
running: root.animationsEnabled && passwordInput.activeFocus && passwordInput.text.length === 0
|
||||
NumberAnimation {
|
||||
to: 0
|
||||
duration: 530
|
||||
@@ -556,6 +561,14 @@ Item {
|
||||
duration: 530
|
||||
}
|
||||
}
|
||||
|
||||
// Simple toggle (when animations disabled) — no per-frame repaints
|
||||
Timer {
|
||||
interval: 530
|
||||
running: !root.animationsEnabled && passwordInput.activeFocus && passwordInput.text.length === 0
|
||||
repeat: true
|
||||
onTriggered: parent.opacity = parent.opacity > 0.5 ? 0 : 1
|
||||
}
|
||||
}
|
||||
|
||||
// Password display - show dots or actual text based on passwordVisible
|
||||
@@ -601,9 +614,10 @@ Item {
|
||||
visible: passwordInput.activeFocus && passwordInput.text.length > 0
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
// Smooth fade animation (when animations enabled)
|
||||
SequentialAnimation on opacity {
|
||||
loops: Animation.Infinite
|
||||
running: passwordInput.activeFocus && passwordInput.text.length > 0
|
||||
running: root.animationsEnabled && passwordInput.activeFocus && passwordInput.text.length > 0
|
||||
NumberAnimation {
|
||||
to: 0
|
||||
duration: 530
|
||||
@@ -613,6 +627,14 @@ Item {
|
||||
duration: 530
|
||||
}
|
||||
}
|
||||
|
||||
// Simple toggle (when animations disabled) — no per-frame repaints
|
||||
Timer {
|
||||
interval: 530
|
||||
running: !root.animationsEnabled && passwordInput.activeFocus && passwordInput.text.length > 0
|
||||
repeat: true
|
||||
onTriggered: parent.opacity = parent.opacity > 0.5 ? 0 : 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,14 @@ ColumnLayout {
|
||||
defaultValue: Settings.getDefaultValue("general.compactLockScreen")
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: I18n.tr("panels.lock-screen.lock-screen-animations-label")
|
||||
description: I18n.tr("panels.lock-screen.lock-screen-animations-description")
|
||||
checked: Settings.data.general.lockScreenAnimations
|
||||
onToggled: checked => Settings.data.general.lockScreenAnimations = checked
|
||||
defaultValue: Settings.getDefaultValue("general.lockScreenAnimations")
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: I18n.tr("panels.lock-screen.auto-start-auth-label")
|
||||
description: I18n.tr("panels.lock-screen.auto-start-auth-description")
|
||||
|
||||
Reference in New Issue
Block a user