diff --git a/extension.js b/extension.js index dc77ebd..c58784a 100644 --- a/extension.js +++ b/extension.js @@ -88,6 +88,16 @@ class Extension { this._upowerProxy = new UPowerProxy(Gio.DBus.system, 'org.freedesktop.UPower', '/org/freedesktop/UPower'); + // This is used to get the current power profile. + // Ab 41?? + const PowerProfilesProxy = Gio.DBusProxy.makeProxyWrapper( + utils.getStringResource('/interfaces/net.hadess.PowerProfiles.xml')); + this._powerProfilesProxy = new PowerProfilesProxy( + Gio.DBus.system, 'net.hadess.PowerProfiles', '/net/hadess/PowerProfiles'); + + console.log(this._powerProfilesProxy); + console.log(this._powerProfilesProxy.get_connection()); + // We will monkey-patch these methods. Let's store the original ones. this._origAddWindowClone = Workspace.prototype._addWindowClone; this._origWindowRemoved = Workspace.prototype._windowRemoved; @@ -381,9 +391,13 @@ class Extension { return; } - // We may have to do nothing if running on battery power. - if (this._settings.get_boolean('disable-on-battery') && this._upowerProxy.OnBattery && - previewNick == '') { + // We may have to do nothing if running on battery power or if in power-save mode. + let disableOnBattery = + this._settings.get_boolean('disable-on-battery') && this._upowerProxy.OnBattery; + let disableOnPowerSave = this._settings.get_boolean('disable-on-power-save') && + this._powerProfilesProxy.ActiveProfile == 'power-saver'; + + if ((disableOnBattery || disableOnPowerSave) && previewNick == '') { this._fixAnimationTimes(isDialogWindow, forOpening, null); return; } diff --git a/resources/interfaces/net.hadess.PowerProfiles.xml b/resources/interfaces/net.hadess.PowerProfiles.xml new file mode 100644 index 0000000..f9223a5 --- /dev/null +++ b/resources/interfaces/net.hadess.PowerProfiles.xml @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file diff --git a/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml b/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml index 807ed9d..e0e2604 100644 --- a/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml +++ b/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml @@ -25,6 +25,12 @@ SPDX-License-Identifier: CC0-1.0 Enable effects only if plugged in. + + false + Disable on Power Save + Enable effects only if power saver is disabled. + + "" Close Preview Effect