Merge pull request #316000 from Nanotwerp/gnome-shell-extensions-fix

gnome.gnome-shell-extensions: patch `GTop` path for the builtin GNOME System Monitor extension
This commit is contained in:
Jan Tojnar 2024-05-31 23:27:34 +02:00 committed by GitHub
commit 661b8098ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 43 additions and 14 deletions

View File

@ -1,14 +1,16 @@
{ lib
, stdenv
, fetchurl
, meson
, ninja
, gettext
, pkg-config
, glib
, gnome
, gnome-menus
, substituteAll
{
lib,
stdenv,
fetchurl,
meson,
ninja,
gettext,
pkg-config,
libgtop,
glib,
gnome,
gnome-menus,
substituteAll,
}:
stdenv.mkDerivation (finalAttrs: {
@ -25,6 +27,10 @@ stdenv.mkDerivation (finalAttrs: {
src = ./fix_gmenu.patch;
gmenu_path = "${gnome-menus}/lib/girepository-1.0";
})
(substituteAll {
src = ./fix_gtop.patch;
gtop_path = "${libgtop}/lib/girepository-1.0";
})
];
nativeBuildInputs = [
@ -35,9 +41,7 @@ stdenv.mkDerivation (finalAttrs: {
glib
];
mesonFlags = [
"-Dextension_set=all"
];
mesonFlags = [ "-Dextension_set=all" ];
preFixup = ''
# Since we do not install the schemas to central location,

View File

@ -0,0 +1,25 @@
diff --git a/extensions/system-monitor/extension.js b/extensions/system-monitor/extension.js
index 37d2eb1..232d0d5 100644
--- a/extensions/system-monitor/extension.js
+++ b/extensions/system-monitor/extension.js
@@ -6,9 +6,9 @@
import Clutter from 'gi://Clutter';
import Gio from 'gi://Gio';
+import GIRepository from "gi://GIRepository";
import GLib from 'gi://GLib';
import GObject from 'gi://GObject';
-import GTop from 'gi://GTop';
import Pango from 'gi://Pango';
import Shell from 'gi://Shell';
import St from 'gi://St';
@@ -19,6 +19,9 @@ import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
+GIRepository.Repository.prepend_search_path('@gtop_path@');
+const GTop = (await import("gi://GTop")).default;
+
const THRESHOLD_HIGH = 0.80;
// adapted from load-graph.cpp in gnome-system-monitor