Update to 43.1

This commit is contained in:
dwl301 2023-02-01 10:29:58 +08:00
parent 4ebc9a1d6e
commit 8058835cec
4 changed files with 171 additions and 11 deletions

View File

@ -0,0 +1,141 @@
Index: gnome-shell-extensions-43.rc/extensions/apps-menu/extension.js
===================================================================
--- gnome-shell-extensions-43.rc.orig/extensions/apps-menu/extension.js
+++ gnome-shell-extensions-43.rc/extensions/apps-menu/extension.js
@@ -5,6 +5,8 @@ const {
Atk, Clutter, Gio, GLib, GMenu, GObject, Gtk, Meta, Shell, St,
} = imports.gi;
const {EventEmitter} = imports.misc.signals;
+const BoxPointer = imports.ui.boxpointer;
+const AppFavorites = imports.ui.appFavorites;
const DND = imports.ui.dnd;
const ExtensionUtils = imports.misc.extensionUtils;
@@ -48,8 +50,19 @@ class ApplicationMenuItem extends PopupM
let textureCache = St.TextureCache.get_default();
let iconThemeChangedId = textureCache.connect('icon-theme-changed',
this._updateIcon.bind(this));
+
+ this.actor.connect('button-press-event', this._onButtonPress.bind(this));
+ this.actor.connect('popup-menu', this._onKeyboardPopupMenu.bind(this));
+ this._menu = null;
+ this._menuManager = new PopupMenu.PopupMenuManager(this);
+
this.connect('destroy', () => {
textureCache.disconnect(iconThemeChangedId);
+ if (this._menu) {
+ this._menu.destroy();
+ this._menu = null;
+ this._menuManager = null;
+ }
});
this._updateIcon();
@@ -64,6 +77,107 @@ class ApplicationMenuItem extends PopupM
};
}
+ _onKeyboardPopupMenu() {
+ this.popupMenu();
+ this._menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
+ }
+
+ _onButtonPress(actor, event) {
+ // close any opened menu to avoid input focus grab
+ if (this._menu && this._menu.isOpen) {
+ this._menu.close();
+ return Clutter.EVENT_STOP;
+ }
+
+ let button = event.get_button();
+ if (button == 3) {
+ this.popupMenu();
+ return Clutter.EVENT_STOP;
+ }
+ return Clutter.EVENT_PROPAGATE
+ }
+
+ popupMenu() {
+ if (!this._menu) {
+ this._menu = new PopupMenu.PopupMenu(this.actor, 0.0, St.Side.TOP, 0);
+ let openItem = new PopupMenu.PopupMenuItem(_("Open"));
+ this._menu.addMenuItem(openItem);
+ openItem.connect('activate', () => {
+ this._menu.destroy();
+ this._menu = null;
+ this._app.open_new_window(-1);
+ this._button.selectCategory(null, null);
+ this._button.menu.toggle();
+ });
+
+ let sepItem = new PopupMenu.PopupSeparatorMenuItem();
+ this._menu.addMenuItem(sepItem);
+
+ let isFavorite = AppFavorites.getAppFavorites().isFavorite(this._app.get_id());
+ let favText = null;
+ if (isFavorite)
+ favText = _("Remove from Favorites");
+ else
+ favText = _("Add to Favorites");
+
+ let favItem = new PopupMenu.PopupMenuItem(favText);
+ this._menu.addMenuItem(favItem);
+ favItem.connect('activate', () => {
+ let favs = AppFavorites.getAppFavorites();
+ let isFavorite = favs.isFavorite(this._app.get_id());
+ if (isFavorite)
+ favs.removeFavorite(this._app.get_id());
+ else
+ favs.addFavorite(this._app.get_id());
+
+ /*As the item text changes, we need to re-generate the menu */
+ this._menu.destroy();
+ this._menu = null;
+
+ this._button.selectCategory(null, null);
+ this._button.menu.toggle();
+ });
+
+ let desktopItem = new PopupMenu.PopupMenuItem(_("Add to Desktop"));
+ this._menu.addMenuItem(desktopItem);
+ desktopItem.connect('activate', () => {
+ let desktopApp = this._app.get_app_info();
+ let sourcePath = desktopApp.get_filename();
+ let sourceFile = Gio.File.new_for_path(sourcePath);
+ let destDirPath = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DESKTOP);
+ let destDir = Gio.File.new_for_path(destDirPath);
+
+ if (!destDir.query_exists(null)) {
+ destDirPath = Glib.build_filenamev([GLib.get_home_dir(), "Desktop"]);
+ }
+ let destFile = Gio.File.new_for_path(destDirPath + '/' + sourceFile.get_basename());
+ if (sourceFile.copy(destFile, Gio.FileCopyFlags.OVERWRITE, null, null)) {
+ // In order to make the general monitor recognize the setting of metadata,
+ // this function call should before the setting of unix mode.
+ let info = new Gio.FileInfo();
+ info.set_attribute_string('metadata::trusted', 'true');
+ destFile.set_attributes_from_info(info,
+ Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, null);
+ destFile.set_attribute_uint32( Gio.FILE_ATTRIBUTE_UNIX_MODE, parseInt("0755", 8),
+ Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, null);
+ }
+ this._menu.destroy();
+ this._menu = null;
+ this._button.selectCategory(null, null);
+ this._button.menu.toggle();
+ });
+
+ Main.uiGroup.add_actor(this._menu.actor);
+
+ this._menuManager.addMenu(this._menu);
+ }
+
+ this._menu.open(BoxPointer.PopupAnimation.NONE);
+ this._menuManager.ignoreRelease();
+
+ return false;
+ }
+
activate(event) {
this._app.open_new_window(-1);
this._button.selectCategory(null);

Binary file not shown.

Binary file not shown.

View File

@ -1,21 +1,20 @@
%global major_version %%(cut -d "." -f 1 <<<%{version})
# Minimum GNOME Shell version supported
%global min_gs_version %%(cut -d "." -f 1-3 <<<%{version})
%global pkg_prefix gnome-shell-extension
Name: gnome-shell-extensions
Version: 42.2
Version: 43.1
Release: 1
Summary: Modify and extend GNOME Shell functionality and behavior
License: GPLv2+
URL: http://wiki.gnome.org/Projects/GnomeShell/Extensions
Source0: http://ftp.gnome.org/pub/GNOME/sources/%{name}/%{major_version}/%{name}-%{version}.tar.xz
URL: https://wiki.gnome.org/Projects/GnomeShell/Extensions
Source0: https://download.gnome.org/sources/gnome-shell-extensions/43/%{name}-%{version}.tar.xz
Patch1: gnome-shell-add-app-to-desktop.patch
BuildRequires: meson sassc git gettext >= 0.19.6 pkgconfig(gnome-desktop-3.0) pkgconfig(libgtop-2.0)
Requires: gnome-shell >= %{min_gs_version} nautilus gnome-menus
BuildArch: noarch
BuildRequires: meson sassc
BuildRequires: fdupes gnome-shell >= %{version} gobject-introspection
Requires: gnome-shell >= %{version} nautilus gnome-menus
Provides: %{pkg_prefix}-common = %{version}-%{release} gnome-classic-session = %{version}-%{release}
Obsoletes: %{pkg_prefix}-common < %{version}-%{release} gnome-classic-session < %{version}-%{release}
Provides: %{pkg_prefix}-alternate-tab = %{version}-%{release} %{pkg_prefix}-apps-menu = %{version}-%{release}
@ -38,13 +37,30 @@ to execute additional and optional function.
%prep
%autosetup -n %{name}-%{version} -p1
%build
%meson -Dextension_set="all" -Dclassic_mode=true
%meson \
-D classic_mode=true \
-D extension_set=classic \
-D enable_extensions="apps-menu,places-menu,launch-new-instance,window-list,workspace-indicator,user-theme"
%meson_build
%install
%meson_install
%find_lang %{name}
%find_lang %{name} %{?no_lang_C}
%fdupes %{buildroot}%{_datadir}
mkdir -p %{buildroot}/usr/share/glib-2.0/schemas
/bin/cp -v ./extensions/auto-move-windows/org.gnome.shell.extensions.auto-move-windows.gschema.xml \
%{buildroot}/usr/share/glib-2.0/schemas/
/bin/cp -v ./extensions/native-window-placement/org.gnome.shell.extensions.native-window-placement.gschema.xml \
%{buildroot}/usr/share/glib-2.0/schemas/
/bin/cp -v ./extensions/screenshot-window-sizer/org.gnome.shell.extensions.screenshot-window-sizer.gschema.xml \
%{buildroot}/usr/share/glib-2.0/schemas/
mkdir -p %{buildroot}/usr/share/gnome-shell/extensions/screenshot-window-sizer
/bin/cp -v ./extensions/screenshot-window-sizer/* \
%{buildroot}/usr/share/gnome-shell/extensions/screenshot-window-sizer
%files -f %{name}.lang
%doc NEWS README.md COPYING
@ -67,6 +83,9 @@ to execute additional and optional function.
%{_datadir}/wayland-sessions/gnome-*.desktop
%changelog
* Mon Jan 02 2023 lin zhang <lin.zhang@turbolinux.com.cn> - 43.1-1
- Update to 43.1
* Mon Jun 13 2022 lin zhang <lin.zhang@turbolinux.com.cn> - 42.2-1
- Update to 42.2