status/powerProfiles: Add power mode selection

Settings' power panel gained support for switchable power profiles
in GNOME 40. It's useful to have that functionality more readily
available, so expose it in the system status menu as well.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3944

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1907>
This commit is contained in:
Florian Müllner
2021-07-07 22:05:25 +02:00
parent 770f15207c
commit f1320bd250
6 changed files with 194 additions and 0 deletions

View File

@ -684,6 +684,7 @@ class AggregateMenu extends PanelMenu.Button {
this._remoteAccess = new imports.ui.status.remoteAccess.RemoteAccessApplet();
this._power = new imports.ui.status.power.Indicator();
this._powerProfiles = new imports.ui.status.powerProfiles.Indicator();
this._rfkill = new imports.ui.status.rfkill.Indicator();
this._volume = new imports.ui.status.volume.Indicator();
this._brightness = new imports.ui.status.brightness.Indicator();
@ -703,6 +704,7 @@ class AggregateMenu extends PanelMenu.Button {
this._indicators.add_child(this._rfkill);
this._indicators.add_child(this._volume);
this._indicators.add_child(this._power);
this._indicators.add_child(this._powerProfiles);
this.menu.addMenuItem(this._volume.menu);
this.menu.addMenuItem(this._brightness.menu);
@ -717,6 +719,7 @@ class AggregateMenu extends PanelMenu.Button {
this.menu.addMenuItem(this._location.menu);
this.menu.addMenuItem(this._rfkill.menu);
this.menu.addMenuItem(this._power.menu);
this.menu.addMenuItem(this._powerProfiles.menu);
this.menu.addMenuItem(this._nightLight.menu);
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
this.menu.addMenuItem(this._system.menu);
@ -724,6 +727,7 @@ class AggregateMenu extends PanelMenu.Button {
menuLayout.addSizeChild(this._location.menu.actor);
menuLayout.addSizeChild(this._rfkill.menu.actor);
menuLayout.addSizeChild(this._power.menu.actor);
menuLayout.addSizeChild(this._powerProfiles.menu.actor);
menuLayout.addSizeChild(this._system.menu.actor);
}
});