e6414d8afc
Re-apply rebased and updated version of the RHEL 9 downstream patches, with some exceptions: Branding is still TBD, so has been left out for now. The desktop-icons extension will be replaced by an upstreamed version of desktop-icons-ng, which is still work-in-progress. Both dash-to-dock and dash-to-panel will be moved to separate packages, based on the existing Fedora package. It was decided to drop the panel-favorites and updates-dialog extensions. Resolves: RHEL-34255
159 lines
4.6 KiB
Diff
159 lines
4.6 KiB
Diff
From 56da93fbbe675144ae8eb60daedb9f9d3e93be0f Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
Date: Wed, 20 May 2015 17:44:50 +0200
|
|
Subject: [PATCH 1/5] Add top-icons extension
|
|
|
|
---
|
|
extensions/top-icons/extension.js | 91 +++++++++++++++++++++++++++
|
|
extensions/top-icons/meson.build | 9 +++
|
|
extensions/top-icons/metadata.json.in | 10 +++
|
|
meson.build | 1 +
|
|
4 files changed, 111 insertions(+)
|
|
create mode 100644 extensions/top-icons/extension.js
|
|
create mode 100644 extensions/top-icons/meson.build
|
|
create mode 100644 extensions/top-icons/metadata.json.in
|
|
|
|
diff --git a/extensions/top-icons/extension.js b/extensions/top-icons/extension.js
|
|
new file mode 100644
|
|
index 00000000..c28f1386
|
|
--- /dev/null
|
|
+++ b/extensions/top-icons/extension.js
|
|
@@ -0,0 +1,91 @@
|
|
+// SPDX-FileCopyrightText: 2018 Adel Gadllah <adel.gadllah@gmail.com>
|
|
+// SPDX-FileCopyrightText: 2018 Florian Müllner <fmuellner@gnome.org>
|
|
+//
|
|
+// SPDX-License-Identifier: GPL-2.0-or-later
|
|
+
|
|
+import Clutter from 'gi://Clutter';
|
|
+import Shell from 'gi://Shell';
|
|
+import St from 'gi://St';
|
|
+
|
|
+import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
|
+import {Button as PanelButton} from 'resource:///org/gnome/shell/ui/panelMenu.js';
|
|
+
|
|
+const PANEL_ICON_SIZE = 16;
|
|
+
|
|
+const STANDARD_TRAY_ICON_IMPLEMENTATIONS = [
|
|
+ 'bluetooth-applet',
|
|
+ 'gnome-sound-applet',
|
|
+ 'nm-applet',
|
|
+ 'gnome-power-manager',
|
|
+ 'keyboard',
|
|
+ 'a11y-keyboard',
|
|
+ 'kbd-scrolllock',
|
|
+ 'kbd-numlock',
|
|
+ 'kbd-capslock',
|
|
+ 'ibus-ui-gtk',
|
|
+];
|
|
+
|
|
+export default class SysTray {
|
|
+ constructor() {
|
|
+ this._icons = new Map();
|
|
+ this._tray = null;
|
|
+ }
|
|
+
|
|
+ _onTrayIconAdded(o, icon) {
|
|
+ let wmClass = icon.wm_class ? icon.wm_class.toLowerCase() : '';
|
|
+ if (STANDARD_TRAY_ICON_IMPLEMENTATIONS.includes(wmClass))
|
|
+ return;
|
|
+
|
|
+ let button = new PanelButton(0.5, null, true);
|
|
+
|
|
+ let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
|
+ let iconSize = PANEL_ICON_SIZE * scaleFactor;
|
|
+
|
|
+ icon.set({
|
|
+ width: iconSize,
|
|
+ height: iconSize,
|
|
+ x_align: Clutter.ActorAlign.CENTER,
|
|
+ y_align: Clutter.ActorAlign.CENTER,
|
|
+ });
|
|
+
|
|
+ let iconBin = new St.Widget({
|
|
+ layout_manager: new Clutter.BinLayout(),
|
|
+ style_class: 'system-status-icon',
|
|
+ });
|
|
+ iconBin.add_child(icon);
|
|
+ button.add_child(iconBin);
|
|
+
|
|
+ this._icons.set(icon, button);
|
|
+
|
|
+ button.connect('button-release-event',
|
|
+ (actor, event) => icon.click(event));
|
|
+ button.connect('key-press-event',
|
|
+ (actor, event) => icon.click(event));
|
|
+
|
|
+ const role = `${icon}`;
|
|
+ Main.panel.addToStatusArea(role, button);
|
|
+ }
|
|
+
|
|
+ _onTrayIconRemoved(o, icon) {
|
|
+ const button = this._icons.get(icon);
|
|
+ button?.destroy();
|
|
+ this._icons.delete(icon);
|
|
+ }
|
|
+
|
|
+ enable() {
|
|
+ this._tray = new Shell.TrayManager();
|
|
+ this._tray.connect('tray-icon-added',
|
|
+ this._onTrayIconAdded.bind(this));
|
|
+ this._tray.connect('tray-icon-removed',
|
|
+ this._onTrayIconRemoved.bind(this));
|
|
+ this._tray.manage_screen(Main.panel);
|
|
+ }
|
|
+
|
|
+ disable() {
|
|
+ this._icons.forEach(button => button.destroy());
|
|
+ this._icons.clear();
|
|
+
|
|
+ this._tray.unmanage_screen();
|
|
+ this._tray = null;
|
|
+ }
|
|
+}
|
|
diff --git a/extensions/top-icons/meson.build b/extensions/top-icons/meson.build
|
|
new file mode 100644
|
|
index 00000000..b30272ad
|
|
--- /dev/null
|
|
+++ b/extensions/top-icons/meson.build
|
|
@@ -0,0 +1,9 @@
|
|
+# SPDX-FileCopyrightText: 2018 Florian Müllner <fmuellner@gnome.org>
|
|
+#
|
|
+# SPDX-License-Identifier: GPL-2.0-or-later
|
|
+
|
|
+extension_data += configure_file(
|
|
+ input: metadata_name + '.in',
|
|
+ output: metadata_name,
|
|
+ configuration: metadata_conf
|
|
+)
|
|
diff --git a/extensions/top-icons/metadata.json.in b/extensions/top-icons/metadata.json.in
|
|
new file mode 100644
|
|
index 00000000..1d2e0bc2
|
|
--- /dev/null
|
|
+++ b/extensions/top-icons/metadata.json.in
|
|
@@ -0,0 +1,10 @@
|
|
+{
|
|
+"extension-id": "@extension_id@",
|
|
+"uuid": "@uuid@",
|
|
+"settings-schema": "@gschemaname@",
|
|
+"gettext-domain": "@gettext_domain@",
|
|
+"name": "Top Icons",
|
|
+"description": "Show legacy tray icons on top",
|
|
+"shell-version": [ "@shell_current@" ],
|
|
+"url": "@url@"
|
|
+}
|
|
diff --git a/meson.build b/meson.build
|
|
index 6d403512..4d2ca280 100644
|
|
--- a/meson.build
|
|
+++ b/meson.build
|
|
@@ -43,6 +43,7 @@ default_extensions += [
|
|
'light-style',
|
|
'screenshot-window-sizer',
|
|
'system-monitor',
|
|
+ 'top-icons',
|
|
'windowsNavigator',
|
|
'workspace-indicator'
|
|
]
|
|
--
|
|
2.45.0
|
|
|