File gnome-shell-gdm-login-applet.patch of Package gnome-shell

diff -urpN gnome-shell-46.4.orig/js/js-resources.gresource.xml gnome-shell-46.4/js/js-resources.gresource.xml
--- gnome-shell-46.4.orig/js/js-resources.gresource.xml	2024-08-08 16:03:02.309824096 -0500
+++ gnome-shell-46.4/js/js-resources.gresource.xml	2024-08-08 16:04:00.523595099 -0500
@@ -43,6 +43,7 @@
     <file>misc/util.js</file>
     <file>misc/weather.js</file>
 
+    <file>ui/aboutMenu.js</file>
     <file>ui/accessDialog.js</file>
     <file>ui/altTab.js</file>
     <file>ui/animation.js</file>
diff -urpN gnome-shell-46.4.orig/js/ui/aboutMenu.js gnome-shell-46.4/js/ui/aboutMenu.js
--- gnome-shell-46.4.orig/js/ui/aboutMenu.js	1969-12-31 18:00:00.000000000 -0600
+++ gnome-shell-46.4/js/ui/aboutMenu.js	2024-08-08 16:04:32.667170062 -0500
@@ -0,0 +1,144 @@
+// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
+
+import GLib from 'gi://GLib';
+import Gio from 'gi://Gio';
+import Clutter from 'gi://Clutter';
+import St from 'gi://St';
+import GObject from 'gi://GObject';
+
+import * as PanelMenu from './panelMenu.js';
+
+export const AboutMenuButton = GObject.registerClass(
+class AboutMenuButton extends PanelMenu.Button {
+    _init() {
+        super._init(0.5);
+
+        this._hostname = null;
+        this._updateHostnameId = 0;
+        this._ticket = 1;
+
+        let hbox;
+        let vbox;
+
+        this.about_hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' });
+        this.hostname_label = new St.Label({y_align: Clutter.ActorAlign.CENTER});
+        this.about_hbox.add_child(this.hostname_label);
+
+        this.add_child(this.about_hbox);
+        hbox = new St.BoxLayout({ name: 'aboutArea' });
+        this.menu.box.add_child(hbox);
+
+        vbox = new St.BoxLayout({vertical: true});
+        hbox.add_child(vbox);
+
+        ///// Section: read '/etc/os-release' to get pretty name
+        //
+        // Note: previously this is defaulted to 'SUSE Linux Enterprise', now
+        // let's use a "safer" option.
+        let sysinfo_text = 'SUSE Linux';
+        try {
+            let _os_release = Gio.File.new_for_path('/etc/os-release');
+            let [success_, contents] = _os_release.load_contents(null);
+
+            let osReleaseContentStr = new TextDecoder().decode(contents);
+            let prettyNameReg = /^PRETTY_NAME="(.+)"/;
+            let match = null;
+            for (let line of osReleaseContentStr.split('\n')) {
+                match = prettyNameReg.exec(line);
+                if (match) {
+                    sysinfo_text = match[1];
+                }
+            }
+        }
+        catch (e) {
+            // NOTE soft fail, 'sysinfo_text' is the default
+            warn('ERROR: fail to read /etc/os-release');
+        }
+
+        this._sysinfo = new St.Label({ text: sysinfo_text, can_focus: true });
+        vbox.add_child(this._sysinfo);
+        this.hide();
+
+        this._updateHostnameId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
+                                                  this._ticket,
+                                                  ()=> {
+                                                      if (this._ticket < 60*60)
+                                                          this._ticket *= 2;
+                                                      this._updateHostnameId = 0;
+                                                      this._updateHostname();
+                                                      return GLib.SOURCE_REMOVE;
+                                                  });
+
+        return;
+    }
+
+    _updateHostname(){
+        let hostname_text = get_hostname();
+
+        if ((this._hostname == null) || (this._hostname != hostname_text)) {
+            this._ticket = 1;
+            this._hostname = hostname_text;
+            this.hostname_label.set_text(this._hostname);
+            this.show();
+        }
+        this._updateHostnameId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT,
+                                                  this._ticket,
+                                                  ()=> {
+                                                      if (this._ticket < 60*60)
+                                                          this._ticket *= 2;
+                                                      this._updateHostnameId = 0;
+                                                      this._updateHostname();
+                                                      return GLib.SOURCE_REMOVE;
+                                                  });
+    }
+
+    _destroy() {
+        this._ticket = 1;
+        if (this._updateHostnameId) {
+            GLib.source_remove (this._updateHostnameId);
+            this._updateHostnameId = 0;
+        }
+    }
+
+});
+
+function get_hostname() {
+    let hostname;
+    let interface_name = [GLib.Variant.new_string('org.freedesktop.hostname1'),
+            GLib.Variant.new_string('Hostname')];
+
+    let call = {
+        bus_name: 'org.freedesktop.hostname1',
+        object_path: '/org/freedesktop/hostname1',
+        interface_name: 'org.freedesktop.DBus.Properties',
+        method_name: 'Get',
+        parameters: GLib.Variant.new_tuple(interface_name),
+        reply_type: null,
+        flags: Gio.DBusCallFlags.NONE,
+        timeout_msec: -1,
+        cancellable: null,
+    };
+
+    try {
+        let dbusConnection = Gio.bus_get_sync(Gio.BusType.SYSTEM, null);
+
+        let message = dbusConnection.call_sync(
+            call.bus_name,
+            call.object_path,
+            call.interface_name,
+            call.method_name,
+            call.parameters,
+            call.reply_type,
+            call.flags,
+            call.timeout_msec,
+            call.cancellable
+        );
+
+        hostname = message.get_child_value(0).get_variant().get_string()[0];
+
+    } catch(e) {
+        hostname = 'localhost';
+    }
+
+    return hostname;
+}
diff -urpN gnome-shell-46.4.orig/js/ui/panel.js gnome-shell-46.4/js/ui/panel.js
--- gnome-shell-46.4.orig/js/ui/panel.js	2024-08-08 16:03:02.319824171 -0500
+++ gnome-shell-46.4/js/ui/panel.js	2024-08-08 16:04:00.523595099 -0500
@@ -36,6 +36,7 @@ import * as ThunderboltStatus from './st
 import * as AutoRotateStatus from './status/autoRotate.js';
 import * as BackgroundAppsStatus from './status/backgroundApps.js';
 
+import {AboutMenuButton} from './aboutMenu.js';
 import {DateMenuButton} from './dateMenu.js';
 import {ATIndicator} from './status/accessibility.js';
 import {InputSourceIndicator} from './status/keyboard.js';
@@ -631,6 +632,7 @@ class QuickSettings extends PanelMenu.Bu
 });
 
 const PANEL_ITEM_IMPLEMENTATIONS = {
+    'aboutMenu': AboutMenuButton,
     'activities': ActivitiesButton,
     'appMenu': AppMenuButton,
     'quickSettings': QuickSettings,
diff -urpN gnome-shell-46.4.orig/js/ui/sessionMode.js gnome-shell-46.4/js/ui/sessionMode.js
--- gnome-shell-46.4.orig/js/ui/sessionMode.js	2024-08-08 16:03:02.323157529 -0500
+++ gnome-shell-46.4/js/ui/sessionMode.js	2024-08-08 16:04:00.523595099 -0500
@@ -59,7 +59,7 @@ const _modes = {
             ? ['networkAgent', 'polkitAgent']
             : ['polkitAgent'],
         panel: {
-            left: [],
+            left: ['aboutMenu'],
             center: ['dateMenu'],
             right: ['dwellClick', 'a11y', 'keyboard', 'quickSettings'],
         },
openSUSE Build Service is sponsored by