make lockscreen animations optional

This commit is contained in:
Deep 4lpha
2026-02-07 20:33:31 +01:00
parent a7f70dcb4e
commit ec01421ec7
6 changed files with 68 additions and 8 deletions
+3 -1
View File
@@ -1178,6 +1178,8 @@
"clock-style-label": "Clock style",
"compact-lockscreen-description": "Show only the login input and system controls, hiding weather and media widgets.",
"compact-lockscreen-label": "Compact lock screen",
"lock-screen-animations-label": "Lockscreen animations",
"lock-screen-animations-description": "Enable or disable lockscreen animations",
"lock-on-suspend-description": "Automatically lock the screen when suspending the system.",
"lock-on-suspend-label": "Lock on suspend",
"show-hibernate-description": "Show the option 'hibernate' in the power controls.",
@@ -1889,4 +1891,4 @@
"poor": "Poor"
}
}
}
}
+2 -1
View File
@@ -80,6 +80,7 @@
"animationSpeed": 1,
"animationDisabled": false,
"compactLockScreen": false,
"lockScreenAnimations": false,
"lockOnSuspend": true,
"showSessionButtonsOnLockScreen": true,
"showHibernateOnLockScreen": false,
@@ -445,4 +446,4 @@
"gridSnap": false,
"monitorWidgets": []
}
}
}
+1
View File
@@ -269,6 +269,7 @@ Singleton {
property real animationSpeed: 1.0
property bool animationDisabled: false
property bool compactLockScreen: false
property bool lockScreenAnimations: false
property bool lockOnSuspend: true
property bool showSessionButtonsOnLockScreen: true
property bool showHibernateOnLockScreen: false
+30 -4
View File
@@ -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
+24 -2
View File
@@ -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")