status/camera: New indicator

Add a new status indicator following the system-status-indicators
mockup.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2840>
This commit is contained in:
robert.mader@collabora.com 2023-07-13 23:34:30 +02:00
parent d09d24666a
commit 63c3f3e7be
3 changed files with 27 additions and 0 deletions

View File

@ -138,6 +138,7 @@
<file>ui/status/autoRotate.js</file> <file>ui/status/autoRotate.js</file>
<file>ui/status/backgroundApps.js</file> <file>ui/status/backgroundApps.js</file>
<file>ui/status/brightness.js</file> <file>ui/status/brightness.js</file>
<file>ui/status/camera.js</file>
<file>ui/status/darkMode.js</file> <file>ui/status/darkMode.js</file>
<file>ui/status/dwellClick.js</file> <file>ui/status/dwellClick.js</file>
<file>ui/status/location.js</file> <file>ui/status/location.js</file>

View File

@ -23,6 +23,7 @@ const Main = imports.ui.main;
const RemoteAccessStatus = imports.ui.status.remoteAccess; const RemoteAccessStatus = imports.ui.status.remoteAccess;
const PowerProfileStatus = imports.ui.status.powerProfiles; const PowerProfileStatus = imports.ui.status.powerProfiles;
const RFKillStatus = imports.ui.status.rfkill; const RFKillStatus = imports.ui.status.rfkill;
const CameraStatus = imports.ui.status.camera;
const VolumeStatus = imports.ui.status.volume; const VolumeStatus = imports.ui.status.volume;
const BrightnessStatus = imports.ui.status.brightness; const BrightnessStatus = imports.ui.status.brightness;
const SystemStatus = imports.ui.status.system; const SystemStatus = imports.ui.status.system;
@ -388,6 +389,7 @@ class QuickSettings extends PanelMenu.Button {
} }
this._system = new SystemStatus.Indicator(); this._system = new SystemStatus.Indicator();
this._camera = new CameraStatus.Indicator();
this._volumeOutput = new VolumeStatus.OutputIndicator(); this._volumeOutput = new VolumeStatus.OutputIndicator();
this._volumeInput = new VolumeStatus.InputIndicator(); this._volumeInput = new VolumeStatus.InputIndicator();
this._brightness = new BrightnessStatus.Indicator(); this._brightness = new BrightnessStatus.Indicator();
@ -403,6 +405,7 @@ class QuickSettings extends PanelMenu.Button {
this._backgroundApps = new BackgroundAppsStatus.Indicator(); this._backgroundApps = new BackgroundAppsStatus.Indicator();
this._indicators.add_child(this._remoteAccess); this._indicators.add_child(this._remoteAccess);
this._indicators.add_child(this._camera);
this._indicators.add_child(this._volumeInput); this._indicators.add_child(this._volumeInput);
this._indicators.add_child(this._location); this._indicators.add_child(this._location);
this._indicators.add_child(this._brightness); this._indicators.add_child(this._brightness);
@ -421,6 +424,7 @@ class QuickSettings extends PanelMenu.Button {
this._indicators.add_child(this._system); this._indicators.add_child(this._system);
this._addItems(this._system.quickSettingsItems, N_QUICK_SETTINGS_COLUMNS); this._addItems(this._system.quickSettingsItems, N_QUICK_SETTINGS_COLUMNS);
this._addItems(this._camera.quickSettingsItems, N_QUICK_SETTINGS_COLUMNS);
this._addItems(this._volumeOutput.quickSettingsItems, N_QUICK_SETTINGS_COLUMNS); this._addItems(this._volumeOutput.quickSettingsItems, N_QUICK_SETTINGS_COLUMNS);
this._addItems(this._volumeInput.quickSettingsItems, N_QUICK_SETTINGS_COLUMNS); this._addItems(this._volumeInput.quickSettingsItems, N_QUICK_SETTINGS_COLUMNS);
this._addItems(this._brightness.quickSettingsItems, N_QUICK_SETTINGS_COLUMNS); this._addItems(this._brightness.quickSettingsItems, N_QUICK_SETTINGS_COLUMNS);

22
js/ui/status/camera.js Normal file
View File

@ -0,0 +1,22 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported Indicator */
const GObject = imports.gi.GObject;
const Shell = imports.gi.Shell;
const {SystemIndicator} = imports.ui.quickSettings;
var Indicator = GObject.registerClass(
class Indicator extends SystemIndicator {
constructor() {
super();
this._indicator = this._addIndicator();
this._indicator.icon_name = 'camera-web-symbolic';
this._indicator.add_style_class_name('privacy-indicator');
this._cameraMonitor = new Shell.CameraMonitor();
this._cameraMonitor.bind_property('cameras-in-use', this._indicator,
'visible', GObject.BindingFlags.SYNC_CREATE);
}
});