🔀 Merge pull request #270 from Schneegans/feature/disable-on-battery-save
This commit is contained in:
@@ -12,6 +12,7 @@ SPDX-License-Identifier: CC-BY-4.0
|
||||
#### New Features
|
||||
|
||||
* **New Effect: Glitch.** This effect applies some intentional graphics issues to your windows.
|
||||
* There is a new option to disable the effects when power-save mode is active. This may not only help to reduce power consumption, but also help in situation where the window animation do not run fluently in power-save mode. This option requires the power-profiles daemon, so it should be available for GNOME Shell 41 and beyond.
|
||||
|
||||
#### Other Enhancements
|
||||
|
||||
|
||||
+13
-3
@@ -88,6 +88,12 @@ class Extension {
|
||||
this._upowerProxy = new UPowerProxy(Gio.DBus.system, 'org.freedesktop.UPower',
|
||||
'/org/freedesktop/UPower');
|
||||
|
||||
// This is used to get the current power profile.
|
||||
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');
|
||||
|
||||
// We will monkey-patch these methods. Let's store the original ones.
|
||||
this._origAddWindowClone = Workspace.prototype._addWindowClone;
|
||||
this._origWindowRemoved = Workspace.prototype._windowRemoved;
|
||||
@@ -381,9 +387,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;
|
||||
}
|
||||
|
||||
+55
-49
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: burn-my-windows\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-01-03 13:46+0100\n"
|
||||
"POT-Creation-Date: 2023-01-07 13:39+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -113,50 +113,50 @@ msgstr ""
|
||||
msgid "Wisps"
|
||||
msgstr ""
|
||||
|
||||
#: prefs.js:122
|
||||
#: prefs.js:134
|
||||
msgid "Effects"
|
||||
msgstr ""
|
||||
|
||||
#: prefs.js:164 resources/ui/gtk4/effectPage.ui:43
|
||||
#: prefs.js:176 resources/ui/gtk4/effectPage.ui:43
|
||||
#: resources/ui/gtk3/effectPage.ui:43
|
||||
msgid "Preview this effect"
|
||||
msgstr ""
|
||||
|
||||
#: prefs.js:199
|
||||
#: prefs.js:211
|
||||
msgid "Use this effect when opening windows"
|
||||
msgstr ""
|
||||
|
||||
#: prefs.js:200
|
||||
#: prefs.js:212
|
||||
msgid "Use this effect when closing windows"
|
||||
msgstr ""
|
||||
|
||||
#: prefs.js:226
|
||||
#: prefs.js:238
|
||||
msgid "General Options"
|
||||
msgstr ""
|
||||
|
||||
#: prefs.js:320
|
||||
#: prefs.js:332
|
||||
msgid "Gold Sponsors"
|
||||
msgstr ""
|
||||
|
||||
#: prefs.js:323
|
||||
#: prefs.js:335
|
||||
msgid "Silver Sponsors"
|
||||
msgstr ""
|
||||
|
||||
#: prefs.js:326
|
||||
#: prefs.js:338
|
||||
msgid "Bronze Sponsors"
|
||||
msgstr ""
|
||||
|
||||
#: prefs.js:329
|
||||
#: prefs.js:341
|
||||
msgid "Past Sponsors"
|
||||
msgstr ""
|
||||
|
||||
#. Translators: %s will be replaced by the effect's name.
|
||||
#: prefs.js:536
|
||||
#: prefs.js:548
|
||||
#, javascript-format
|
||||
msgid "Preview for %s"
|
||||
msgstr ""
|
||||
|
||||
#: prefs.js:558
|
||||
#: prefs.js:570
|
||||
msgid "Close this Window to Preview the Effect!"
|
||||
msgstr ""
|
||||
|
||||
@@ -251,37 +251,38 @@ msgstr ""
|
||||
#: resources/ui/gtk4/EnergizeB.ui:104 resources/ui/gtk4/EnergizeB.ui:138
|
||||
#: resources/ui/gtk4/Pixelate.ui:58 resources/ui/gtk4/Pixelate.ui:104
|
||||
#: resources/ui/gtk4/Pixelate.ui:150 resources/ui/gtk4/prefs.ui:172
|
||||
#: resources/ui/gtk4/prefs.ui:206 resources/ui/gtk4/Apparition.ui:58
|
||||
#: resources/ui/gtk4/Apparition.ui:104 resources/ui/gtk4/Apparition.ui:150
|
||||
#: resources/ui/gtk4/Apparition.ui:196 resources/ui/gtk4/Apparition.ui:242
|
||||
#: resources/ui/gtk4/Portal.ui:58 resources/ui/gtk4/Portal.ui:104
|
||||
#: resources/ui/gtk4/Portal.ui:150 resources/ui/gtk4/Portal.ui:196
|
||||
#: resources/ui/gtk4/Portal.ui:230 resources/ui/gtk3/Incinerate.ui:81
|
||||
#: resources/ui/gtk3/Incinerate.ui:130 resources/ui/gtk3/Incinerate.ui:179
|
||||
#: resources/ui/gtk3/Incinerate.ui:241 resources/ui/gtk3/Incinerate.ui:284
|
||||
#: resources/ui/gtk3/Wisps.ui:74 resources/ui/gtk3/Wisps.ui:123
|
||||
#: resources/ui/gtk3/Wisps.ui:166 resources/ui/gtk3/Fire.ui:125
|
||||
#: resources/ui/gtk3/Fire.ui:173 resources/ui/gtk3/Fire.ui:221
|
||||
#: resources/ui/gtk3/Fire.ui:283 resources/ui/gtk3/Fire.ui:351
|
||||
#: resources/ui/gtk3/Glide.ui:95 resources/ui/gtk3/Glide.ui:144
|
||||
#: resources/ui/gtk3/Glide.ui:193 resources/ui/gtk3/Glide.ui:242
|
||||
#: resources/ui/gtk3/Glide.ui:291 resources/ui/gtk3/PixelWipe.ui:81
|
||||
#: resources/ui/gtk3/PixelWipe.ui:130 resources/ui/gtk3/PixelWheel.ui:81
|
||||
#: resources/ui/gtk3/PixelWheel.ui:130 resources/ui/gtk3/PixelWheel.ui:179
|
||||
#: resources/ui/gtk3/Doom.ui:88 resources/ui/gtk3/Doom.ui:137
|
||||
#: resources/ui/gtk3/Doom.ui:186 resources/ui/gtk3/Doom.ui:235
|
||||
#: resources/ui/gtk3/Glitch.ui:88 resources/ui/gtk3/Glitch.ui:137
|
||||
#: resources/ui/gtk3/Glitch.ui:186 resources/ui/gtk3/Glitch.ui:235
|
||||
#: resources/ui/gtk3/Glitch.ui:278 resources/ui/gtk3/TVEffect.ui:67
|
||||
#: resources/ui/gtk3/TVEffect.ui:110 resources/ui/gtk3/EnergizeA.ui:74
|
||||
#: resources/ui/gtk3/EnergizeA.ui:123 resources/ui/gtk3/EnergizeA.ui:166
|
||||
#: resources/ui/gtk3/Hexagon.ui:81 resources/ui/gtk3/Hexagon.ui:130
|
||||
#: resources/ui/gtk3/Hexagon.ui:179 resources/ui/gtk3/Hexagon.ui:222
|
||||
#: resources/ui/gtk3/Hexagon.ui:265 resources/ui/gtk3/Hexagon.ui:327
|
||||
#: resources/ui/gtk3/EnergizeB.ui:74 resources/ui/gtk3/EnergizeB.ui:123
|
||||
#: resources/ui/gtk3/EnergizeB.ui:166 resources/ui/gtk3/Pixelate.ui:81
|
||||
#: resources/ui/gtk3/Pixelate.ui:130 resources/ui/gtk3/Pixelate.ui:179
|
||||
#: resources/ui/gtk3/prefs.ui:225 resources/ui/gtk3/prefs.ui:269
|
||||
#: resources/ui/gtk4/prefs.ui:206 resources/ui/gtk4/prefs.ui:240
|
||||
#: resources/ui/gtk4/Apparition.ui:58 resources/ui/gtk4/Apparition.ui:104
|
||||
#: resources/ui/gtk4/Apparition.ui:150 resources/ui/gtk4/Apparition.ui:196
|
||||
#: resources/ui/gtk4/Apparition.ui:242 resources/ui/gtk4/Portal.ui:58
|
||||
#: resources/ui/gtk4/Portal.ui:104 resources/ui/gtk4/Portal.ui:150
|
||||
#: resources/ui/gtk4/Portal.ui:196 resources/ui/gtk4/Portal.ui:230
|
||||
#: resources/ui/gtk3/Incinerate.ui:81 resources/ui/gtk3/Incinerate.ui:130
|
||||
#: resources/ui/gtk3/Incinerate.ui:179 resources/ui/gtk3/Incinerate.ui:241
|
||||
#: resources/ui/gtk3/Incinerate.ui:284 resources/ui/gtk3/Wisps.ui:74
|
||||
#: resources/ui/gtk3/Wisps.ui:123 resources/ui/gtk3/Wisps.ui:166
|
||||
#: resources/ui/gtk3/Fire.ui:125 resources/ui/gtk3/Fire.ui:173
|
||||
#: resources/ui/gtk3/Fire.ui:221 resources/ui/gtk3/Fire.ui:283
|
||||
#: resources/ui/gtk3/Fire.ui:351 resources/ui/gtk3/Glide.ui:95
|
||||
#: resources/ui/gtk3/Glide.ui:144 resources/ui/gtk3/Glide.ui:193
|
||||
#: resources/ui/gtk3/Glide.ui:242 resources/ui/gtk3/Glide.ui:291
|
||||
#: resources/ui/gtk3/PixelWipe.ui:81 resources/ui/gtk3/PixelWipe.ui:130
|
||||
#: resources/ui/gtk3/PixelWheel.ui:81 resources/ui/gtk3/PixelWheel.ui:130
|
||||
#: resources/ui/gtk3/PixelWheel.ui:179 resources/ui/gtk3/Doom.ui:88
|
||||
#: resources/ui/gtk3/Doom.ui:137 resources/ui/gtk3/Doom.ui:186
|
||||
#: resources/ui/gtk3/Doom.ui:235 resources/ui/gtk3/Glitch.ui:88
|
||||
#: resources/ui/gtk3/Glitch.ui:137 resources/ui/gtk3/Glitch.ui:186
|
||||
#: resources/ui/gtk3/Glitch.ui:235 resources/ui/gtk3/Glitch.ui:278
|
||||
#: resources/ui/gtk3/TVEffect.ui:67 resources/ui/gtk3/TVEffect.ui:110
|
||||
#: resources/ui/gtk3/EnergizeA.ui:74 resources/ui/gtk3/EnergizeA.ui:123
|
||||
#: resources/ui/gtk3/EnergizeA.ui:166 resources/ui/gtk3/Hexagon.ui:81
|
||||
#: resources/ui/gtk3/Hexagon.ui:130 resources/ui/gtk3/Hexagon.ui:179
|
||||
#: resources/ui/gtk3/Hexagon.ui:222 resources/ui/gtk3/Hexagon.ui:265
|
||||
#: resources/ui/gtk3/Hexagon.ui:327 resources/ui/gtk3/EnergizeB.ui:74
|
||||
#: resources/ui/gtk3/EnergizeB.ui:123 resources/ui/gtk3/EnergizeB.ui:166
|
||||
#: resources/ui/gtk3/Pixelate.ui:81 resources/ui/gtk3/Pixelate.ui:130
|
||||
#: resources/ui/gtk3/Pixelate.ui:179 resources/ui/gtk3/prefs.ui:225
|
||||
#: resources/ui/gtk3/prefs.ui:269 resources/ui/gtk3/prefs.ui:313
|
||||
#: resources/ui/gtk3/Apparition.ui:95 resources/ui/gtk3/Apparition.ui:144
|
||||
#: resources/ui/gtk3/Apparition.ui:193 resources/ui/gtk3/Apparition.ui:242
|
||||
#: resources/ui/gtk3/Apparition.ui:291 resources/ui/gtk3/Portal.ui:89
|
||||
@@ -320,12 +321,12 @@ msgstr ""
|
||||
#: resources/ui/adw/EnergizeB.ui:70 resources/ui/adw/EnergizeB.ui:95
|
||||
#: resources/ui/adw/Pixelate.ui:36 resources/ui/adw/Pixelate.ui:69
|
||||
#: resources/ui/adw/Pixelate.ui:102 resources/ui/adw/prefs.ui:63
|
||||
#: resources/ui/adw/prefs.ui:85 resources/ui/adw/Apparition.ui:37
|
||||
#: resources/ui/adw/Apparition.ui:70 resources/ui/adw/Apparition.ui:103
|
||||
#: resources/ui/adw/Apparition.ui:136 resources/ui/adw/Apparition.ui:169
|
||||
#: resources/ui/adw/Portal.ui:36 resources/ui/adw/Portal.ui:69
|
||||
#: resources/ui/adw/Portal.ui:102 resources/ui/adw/Portal.ui:135
|
||||
#: resources/ui/adw/Portal.ui:160
|
||||
#: resources/ui/adw/prefs.ui:85 resources/ui/adw/prefs.ui:107
|
||||
#: resources/ui/adw/Apparition.ui:37 resources/ui/adw/Apparition.ui:70
|
||||
#: resources/ui/adw/Apparition.ui:103 resources/ui/adw/Apparition.ui:136
|
||||
#: resources/ui/adw/Apparition.ui:169 resources/ui/adw/Portal.ui:36
|
||||
#: resources/ui/adw/Portal.ui:69 resources/ui/adw/Portal.ui:102
|
||||
#: resources/ui/adw/Portal.ui:135 resources/ui/adw/Portal.ui:160
|
||||
msgid "Reset to Default Value"
|
||||
msgstr ""
|
||||
|
||||
@@ -567,6 +568,11 @@ msgstr ""
|
||||
msgid "Disable on Battery Power"
|
||||
msgstr ""
|
||||
|
||||
#: resources/ui/gtk4/prefs.ui:224 resources/ui/gtk3/prefs.ui:292
|
||||
#: resources/ui/adw/prefs.ui:96
|
||||
msgid "Disable in Power-Save Mode"
|
||||
msgstr ""
|
||||
|
||||
#: resources/ui/gtk4/Apparition.ui:122 resources/ui/gtk3/Apparition.ui:167
|
||||
#: resources/ui/adw/Apparition.ui:81
|
||||
msgid "Twirl Intensity"
|
||||
|
||||
@@ -104,6 +104,18 @@ var PreferencesDialog = class PreferencesDialog {
|
||||
// Bind general options properties.
|
||||
this.bindSwitch('destroy-dialogs');
|
||||
this.bindSwitch('disable-on-battery');
|
||||
this.bindSwitch('disable-on-power-save');
|
||||
|
||||
// Check whether the power profiles daemon is available - if not, we hide the
|
||||
// corresponding settings row.
|
||||
const PowerProfilesProxy = Gio.DBusProxy.makeProxyWrapper(
|
||||
utils.getStringResource('/interfaces/net.hadess.PowerProfiles.xml'));
|
||||
let powerProfilesProxy = new PowerProfilesProxy(
|
||||
Gio.DBus.system, 'net.hadess.PowerProfiles', '/net/hadess/PowerProfiles');
|
||||
|
||||
if (powerProfilesProxy.get_name_owner() == null) {
|
||||
this._builder.get_object('disable-on-power-save-row').set_visible(false);
|
||||
}
|
||||
|
||||
// Starting with GNOME Shell 42, the settings dialog uses libadwaita (at least most of
|
||||
// the time - it seems that pop!_OS does not support libadwaita even on GNOME 42). We
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de>
|
||||
SPDX-License-Identifier: CC0-1.0
|
||||
-->
|
||||
|
||||
<node>
|
||||
<interface name="net.hadess.PowerProfiles">
|
||||
<property name="ActiveProfile" type="s" access="read"/>
|
||||
</interface>
|
||||
</node>
|
||||
|
||||
@@ -91,6 +91,28 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow" id="disable-on-power-save-row">
|
||||
<property name="title" translatable="yes">Disable in Power-Save Mode</property>
|
||||
<property name="activatable-widget">disable-on-power-save</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="disable-on-power-save">
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="reset-disable-on-power-save">
|
||||
<property name="icon-name">edit-clear-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
|
||||
|
||||
@@ -277,6 +277,50 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="disable-on-power-save-row">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Disable in Power-Save Mode</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="disable-on-power-save">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="reset-disable-on-power-save">
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="icon-name">edit-clear-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -214,6 +214,40 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="disable-on-power-save-row">
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Disable in Power-Save Mode</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="disable-on-power-save">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="reset-disable-on-power-save">
|
||||
<property name="icon-name">edit-clear-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -25,6 +25,12 @@ SPDX-License-Identifier: CC0-1.0
|
||||
<description>Enable effects only if plugged in.</description>
|
||||
</key>
|
||||
|
||||
<key name="disable-on-power-save" type="b">
|
||||
<default>false</default>
|
||||
<summary>Disable on Power Save</summary>
|
||||
<description>Enable effects only if power saver is disabled.</description>
|
||||
</key>
|
||||
|
||||
<key name="close-preview-effect" type="s">
|
||||
<default>""</default>
|
||||
<summary>Close Preview Effect</summary>
|
||||
|
||||
Reference in New Issue
Block a user