Skip to content

screenShield: Compute lock timeout fade duration using animation settings

When the screen is marked as idle, we normally start a fading animation and a timeout to finally lock the screen. This timeout is configured using the fade time if no longer delay is set in settings.

However if animations are disabled or slowed-down/up, the fade time is different from the STANDARD_FADE_TIME and so we might end up showing the lock shield without actually locking for STANDARD_FADE_TIME in the disabled or slowed-up animations case, or locking too early in case of slowed-down animations.

So, just adjust the timeout time using the same logic of animations so that this value is matching all the times.

Related to #1744 (closed)


Another option to solve this case is something like this instead, without involving the manual usage of adjustAnimationTime, while is true that in such case we might not take care of the slowdown setting if default delay matches the standard fade time.

diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index 2e2e95a387..6852b58551 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -834,15 +834,23 @@ var ScreenShield = class {
             let lockTimeout = Math.max(
                 STANDARD_FADE_TIME,
                 this._settings.get_uint(LOCK_DELAY_KEY) * 1000);
-            this._lockTimeoutId = GLib.timeout_add(
-                GLib.PRIORITY_DEFAULT,
-                lockTimeout,
-                () => {
-                    this._lockTimeoutId = 0;
+
+            if (lockTimeout != STANDARD_FADE_TIME) {
+                this._lockTimeoutId = GLib.timeout_add(
+                    GLib.PRIORITY_DEFAULT,
+                    lockTimeout,
+                    () => {
+                        this._lockTimeoutId = 0;
+                        this.lock(false);
+                        return GLib.SOURCE_REMOVE;
+                    });
+                GLib.Source.set_name_by_id(this._lockTimeoutId, '[gnome-shell] this.lock');
+            } else {
+                let id = this._longLightbox.connect('shown', () => {
+                    this._longLightbox.disconnect(id);
                     this.lock(false);
-                    return GLib.SOURCE_REMOVE;
                 });
-            GLib.Source.set_name_by_id(this._lockTimeoutId, '[gnome-shell] this.lock');
+            }
         }
 
         this._activateFade(this._longLightbox, STANDARD_FADE_TIME);

However... I'm actually wondering if for this case we still want to show the animation, being something indicative and slow enough that should not cause issue even in slower systems (not sure about remote sharing though)....

So, here's some code that allows to force specific animations or per-actor animations. Not fully happy with it though (probably it's just better to allow this per-ease and not per-actor, using actor specific properties instead), but anyways that's an idea that we could discuss about.

Edited by Marco Trevisan

Merge request reports