Add move-clock extension

Notifications are shown underneath the clock/date menu, so moving
the menu also changes the location of notification banners.

Resolves: RHEL-33429
This commit is contained in:
Florian Müllner 2024-05-21 19:02:25 +02:00
parent 3f1814970a
commit 91a7b11e13
No known key found for this signature in database
2 changed files with 121 additions and 1 deletions

View File

@ -0,0 +1,101 @@
From 13ea90a5f6f5e73d83a2ab04ea70c6263f6d8f5f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Tue, 21 May 2024 19:01:30 +0200
Subject: [PATCH] Add move-clock extension
---
extensions/move-clock/extension.js | 38 ++++++++++++++++++++++++++
extensions/move-clock/meson.build | 5 ++++
extensions/move-clock/metadata.json.in | 10 +++++++
meson.build | 1 +
4 files changed, 54 insertions(+)
create mode 100644 extensions/move-clock/extension.js
create mode 100644 extensions/move-clock/meson.build
create mode 100644 extensions/move-clock/metadata.json.in
diff --git a/extensions/move-clock/extension.js b/extensions/move-clock/extension.js
new file mode 100644
index 00000000..571567f7
--- /dev/null
+++ b/extensions/move-clock/extension.js
@@ -0,0 +1,38 @@
+/* exported enable disable */
+const Main = imports.ui.main;
+const SessionMode = imports.ui.sessionMode;
+
+class MoveClockExtension {
+ enable() {
+ const panel = SessionMode._modes['user'].panel;
+
+ const clockIndex = panel.center.indexOf('dateMenu');
+ this._modified = clockIndex !== -1;
+
+ if (!this._modified)
+ return;
+
+ panel.center.splice(clockIndex, 1);
+ panel.right.splice(-1, 0, 'dateMenu');
+
+ Main.panel._updatePanel();
+ }
+
+ disable() {
+ if (!this._modified)
+ return;
+
+ const panel = SessionMode._modes['user'].panel;
+ const clockIndex = panel.right.indexOf('dateMenu');
+
+ if (clockIndex !== -1)
+ panel.right.splice(clockIndex, 1);
+ panel.center.unshift('dateMenu');
+
+ Main.panel._updatePanel();
+ }
+}
+
+function init() {
+ return new MoveClockExtension();
+}
diff --git a/extensions/move-clock/meson.build b/extensions/move-clock/meson.build
new file mode 100644
index 00000000..48504f63
--- /dev/null
+++ b/extensions/move-clock/meson.build
@@ -0,0 +1,5 @@
+extension_data += configure_file(
+ input: metadata_name + '.in',
+ output: metadata_name,
+ configuration: metadata_conf
+)
diff --git a/extensions/move-clock/metadata.json.in b/extensions/move-clock/metadata.json.in
new file mode 100644
index 00000000..d872ab63
--- /dev/null
+++ b/extensions/move-clock/metadata.json.in
@@ -0,0 +1,10 @@
+{
+"extension-id": "@extension_id@",
+"uuid": "@uuid@",
+"settings-schema": "@gschemaname@",
+"gettext-domain": "@gettext_domain@",
+"name": "Move notification menu",
+"description": "Move the notification menu to the right",
+"shell-version": [ "@shell_current@" ],
+"url": "@url@"
+}
diff --git a/meson.build b/meson.build
index 7e6ed3e8..ea6efb76 100644
--- a/meson.build
+++ b/meson.build
@@ -53,6 +53,7 @@ all_extensions += [
'dash-to-dock',
'dash-to-panel',
'gesture-inhibitor',
+ 'move-clock',
'native-window-placement',
'panel-favorites',
'systemMonitor',
--
2.45.1

View File

@ -7,7 +7,7 @@
Name: gnome-shell-extensions
Version: 40.7
Release: 17%{?dist}
Release: 18%{?dist}
Summary: Modify and extend GNOME Shell functionality and behavior
License: GPLv2+
@ -47,6 +47,7 @@ Patch024: 0001-desktop-icons-Notify-icon-drags.patch
Patch025: prefer-window-icon.patch
Patch026: 0001-desktop-icons-Handle-touch-events.patch
Patch027: more-ws-previews.patch
Patch028: 0001-Add-move-clock-extension.patch
%description
GNOME Shell Extensions is a collection of extensions providing additional and
@ -64,6 +65,7 @@ Enabled extensions:
* gesture-inhibitor
* launch-new-instance
* heads-up-display
* move-clock
* native-window-placement
* panel-favorites
* places-menu
@ -202,6 +204,15 @@ This GNOME Shell extension modifies the behavior of clicking in the dash and app
launcher to always launch a new application instance.
%package -n %{pkg_prefix}-move-clock
Summary: Move GNOME Shell notification menu to the right
License: GPLv2+
Requires: %{pkg_prefix}-common = %{version}-%{release}
%description -n %{pkg_prefix}-move-clock
This GNOME Shell extension moves the notification menu to the right.
%package -n %{pkg_prefix}-heads-up-display
Summary: Display persistent on-screen message
Group: User Interface/Desktops
@ -395,6 +406,10 @@ workspaces.
%{_datadir}/gnome-shell/extensions/launch-new-instance*/
%files -n %{pkg_prefix}-move-clock
%{_datadir}/gnome-shell/extensions/move-clock*/
%files -n %{pkg_prefix}-heads-up-display
%{_datadir}/glib-2.0/schemas/org.gnome.shell.extensions.heads-up-display.gschema.xml
%{_datadir}/gnome-shell/extensions/heads-up-display*/
@ -451,6 +466,10 @@ workspaces.
%changelog
* Tue May 21 2024 Florian Müllner <fmuellner@redhat.com> - 40.7-18
- Add "move-clock" extension
Resolves: RHEL-33429
* Fri Apr 19 2024 Florian Müllner <fmuellner@redhat.com> - 40.7-17
- Fix downstream stylesheets
Resolves: RHEL-25016