loginManager: Use signal argument to detect preparing for sleep
The DBus PreparingForSleep property on org.freedesktop.login1.Manager does not trigger PropertyChanged signals, leading to wrong values due to gdbus caching. In most cases it would have always been false. Additionally it was not included in the XML interface description file included in gnome-shell. So it was actually undefined. Since this property is used in _calculateUserStateFromLogind() to determine that a user is not active when closing the lid on a laptop, the user was considered still active. Fix this by storing the "start" argument from the PrepareForSleep signal instead of trying to read from the property. Fixes: 6a43b6f55 ("timeLimitsManager: Store screen time state on suspend/resume") Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8185 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3679>
This commit is contained in:
parent
97506dece0
commit
0e304100ab
@ -93,6 +93,8 @@ class LoginManagerSystemd extends Signals.EventEmitter {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this._preparingForSleep = false;
|
||||
|
||||
this._proxy = new SystemdLoginManager(Gio.DBus.system,
|
||||
'org.freedesktop.login1',
|
||||
'/org/freedesktop/login1');
|
||||
@ -224,6 +226,7 @@ class LoginManagerSystemd extends Signals.EventEmitter {
|
||||
}
|
||||
|
||||
_prepareForSleep(proxy, sender, [aboutToSuspend]) {
|
||||
this._preparingForSleep = aboutToSuspend;
|
||||
this.emit('prepare-for-sleep', aboutToSuspend);
|
||||
}
|
||||
|
||||
@ -235,7 +238,7 @@ class LoginManagerSystemd extends Signals.EventEmitter {
|
||||
* @type {boolean}
|
||||
*/
|
||||
get preparingForSleep() {
|
||||
return this._proxy.PreparingForSleep;
|
||||
return this._preparingForSleep;
|
||||
}
|
||||
|
||||
_sessionRemoved(proxy, sender, [sessionId]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user