loginManager: Expose systemd’s PreparingForSleep property
This will be used in upcoming commits to save the screen time state just before the system goes to sleep. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8185 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3643>
This commit is contained in:
parent
dd4fe0d281
commit
2415b4f005
@ -227,12 +227,29 @@ class LoginManagerSystemd extends Signals.EventEmitter {
|
||||
this.emit('prepare-for-sleep', aboutToSuspend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the machine is preparing to sleep.
|
||||
*
|
||||
* This is true between paired emissions of `prepare-for-sleep`.
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
get preparingForSleep() {
|
||||
return this._proxy.PreparingForSleep;
|
||||
}
|
||||
|
||||
_sessionRemoved(proxy, sender, [sessionId]) {
|
||||
this.emit('session-removed', sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
class LoginManagerDummy extends Signals.EventEmitter {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this._preparingForSleep = false;
|
||||
}
|
||||
|
||||
getCurrentUserProxy() {
|
||||
// we could return a DummyUser object that fakes whatever callers
|
||||
// expect, but just never settling the promise should be safer
|
||||
@ -272,10 +289,16 @@ class LoginManagerDummy extends Signals.EventEmitter {
|
||||
}
|
||||
|
||||
suspend() {
|
||||
this._preparingForSleep = true;
|
||||
this.emit('prepare-for-sleep', true);
|
||||
this._preparingForSleep = false;
|
||||
this.emit('prepare-for-sleep', false);
|
||||
}
|
||||
|
||||
get preparingForSleep() {
|
||||
return this._preparingForSleep;
|
||||
}
|
||||
|
||||
/* eslint-disable-next-line require-await */
|
||||
async inhibit() {
|
||||
return null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user