🪲 Fix issue #278
This commit is contained in:
+5
-1
@@ -89,10 +89,14 @@ class Extension {
|
|||||||
'/org/freedesktop/UPower');
|
'/org/freedesktop/UPower');
|
||||||
|
|
||||||
// This is used to get the current power profile.
|
// This is used to get the current power profile.
|
||||||
|
try {
|
||||||
const PowerProfilesProxy = Gio.DBusProxy.makeProxyWrapper(
|
const PowerProfilesProxy = Gio.DBusProxy.makeProxyWrapper(
|
||||||
utils.getStringResource('/interfaces/net.hadess.PowerProfiles.xml'));
|
utils.getStringResource('/interfaces/net.hadess.PowerProfiles.xml'));
|
||||||
this._powerProfilesProxy = new PowerProfilesProxy(
|
this._powerProfilesProxy = new PowerProfilesProxy(
|
||||||
Gio.DBus.system, 'net.hadess.PowerProfiles', '/net/hadess/PowerProfiles');
|
Gio.DBus.system, 'net.hadess.PowerProfiles', '/net/hadess/PowerProfiles');
|
||||||
|
} catch (e) {
|
||||||
|
// Maybe the service is masked...
|
||||||
|
}
|
||||||
|
|
||||||
// We will monkey-patch these methods. Let's store the original ones.
|
// We will monkey-patch these methods. Let's store the original ones.
|
||||||
this._origAddWindowClone = Workspace.prototype._addWindowClone;
|
this._origAddWindowClone = Workspace.prototype._addWindowClone;
|
||||||
@@ -391,7 +395,7 @@ class Extension {
|
|||||||
let disableOnBattery =
|
let disableOnBattery =
|
||||||
this._settings.get_boolean('disable-on-battery') && this._upowerProxy.OnBattery;
|
this._settings.get_boolean('disable-on-battery') && this._upowerProxy.OnBattery;
|
||||||
let disableOnPowerSave = this._settings.get_boolean('disable-on-power-save') &&
|
let disableOnPowerSave = this._settings.get_boolean('disable-on-power-save') &&
|
||||||
this._powerProfilesProxy.ActiveProfile == 'power-saver';
|
this._powerProfilesProxy && this._powerProfilesProxy.ActiveProfile == 'power-saver';
|
||||||
|
|
||||||
if ((disableOnBattery || disableOnPowerSave) && previewNick == '') {
|
if ((disableOnBattery || disableOnPowerSave) && previewNick == '') {
|
||||||
this._fixAnimationTimes(isDialogWindow, forOpening, null);
|
this._fixAnimationTimes(isDialogWindow, forOpening, null);
|
||||||
|
|||||||
@@ -108,15 +108,20 @@ var PreferencesDialog = class PreferencesDialog {
|
|||||||
|
|
||||||
// Check whether the power profiles daemon is available - if not, we hide the
|
// Check whether the power profiles daemon is available - if not, we hide the
|
||||||
// corresponding settings row.
|
// corresponding settings row.
|
||||||
|
let hasPowerProfiles = false;
|
||||||
|
try {
|
||||||
const PowerProfilesProxy = Gio.DBusProxy.makeProxyWrapper(
|
const PowerProfilesProxy = Gio.DBusProxy.makeProxyWrapper(
|
||||||
utils.getStringResource('/interfaces/net.hadess.PowerProfiles.xml'));
|
utils.getStringResource('/interfaces/net.hadess.PowerProfiles.xml'));
|
||||||
let powerProfilesProxy = new PowerProfilesProxy(
|
let powerProfilesProxy = new PowerProfilesProxy(
|
||||||
Gio.DBus.system, 'net.hadess.PowerProfiles', '/net/hadess/PowerProfiles');
|
Gio.DBus.system, 'net.hadess.PowerProfiles', '/net/hadess/PowerProfiles');
|
||||||
|
|
||||||
if (powerProfilesProxy.get_name_owner() == null) {
|
hasPowerProfiles = powerProfilesProxy.get_name_owner() != null;
|
||||||
this._builder.get_object('disable-on-power-save-row').set_visible(false);
|
} catch (e) {
|
||||||
|
// Maybe the service is masked...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._builder.get_object('disable-on-power-save-row').set_visible(hasPowerProfiles);
|
||||||
|
|
||||||
// Starting with GNOME Shell 42, the settings dialog uses libadwaita (at least most of
|
// 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
|
// the time - it seems that pop!_OS does not support libadwaita even on GNOME 42). We
|
||||||
// have to use a different layout, as the stack sidebar looks pretty ugly with the
|
// have to use a different layout, as the stack sidebar looks pretty ugly with the
|
||||||
|
|||||||
Reference in New Issue
Block a user