[gnome-shell] panel: Show warning indicator when unsafe-mode is on



commit 3bee7c7f4b6bea0d5749889339c860265cba55fe
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Sep 2 17:15:36 2021 +0200

    panel: Show warning indicator when unsafe-mode is on
    
    MetaContext added an unsafe-mode property, which we will use to restrict
    a number of privileged operations unless it is enabled. It is meant to
    only be enabled temporarily for development/debugging purposes, so add
    a scary icon to the top bar as a reminder to turn it off again.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3943
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>

 js/ui/panel.js | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 89b082ad05..dafba690a5 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -507,6 +507,20 @@ class PanelCorner extends St.DrawingArea {
     }
 });
 
+const UnsafeModeIndicator = GObject.registerClass(
+class UnsafeModeIndicator extends PanelMenu.SystemIndicator {
+    _init() {
+        super._init();
+
+        this._indicator = this._addIndicator();
+        this._indicator.icon_name = 'channel-insecure-symbolic';
+
+        global.context.bind_property('unsafe-mode',
+            this._indicator, 'visible',
+            GObject.BindingFlags.SYNC_CREATE);
+    }
+});
+
 var AggregateLayout = GObject.registerClass(
 class AggregateLayout extends Clutter.BoxLayout {
     _init(params = {}) {
@@ -568,6 +582,7 @@ class AggregateMenu extends PanelMenu.Button {
         this._location = new imports.ui.status.location.Indicator();
         this._nightLight = new imports.ui.status.nightLight.Indicator();
         this._thunderbolt = new imports.ui.status.thunderbolt.Indicator();
+        this._unsafeMode = new UnsafeModeIndicator();
 
         this._indicators.add_child(this._remoteAccess);
         this._indicators.add_child(this._thunderbolt);
@@ -579,6 +594,7 @@ class AggregateMenu extends PanelMenu.Button {
             this._indicators.add_child(this._bluetooth);
         this._indicators.add_child(this._rfkill);
         this._indicators.add_child(this._volume);
+        this._indicators.add_child(this._unsafeMode);
         this._indicators.add_child(this._power);
         this._indicators.add_child(this._powerProfiles);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]