Skip to content

Commit

Permalink
Merge pull request #316000 from Nanotwerp/gnome-shell-extensions-fix
Browse files Browse the repository at this point in the history
gnome.gnome-shell-extensions: patch `GTop` path for the builtin GNOME System Monitor extension
  • Loading branch information
jtojnar authored May 31, 2024
2 parents e45abe6 + 78ecb91 commit 661b809
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 14 deletions.
32 changes: 18 additions & 14 deletions pkgs/desktops/gnome/core/gnome-shell-extensions/default.nix
Original file line number Diff line number Diff line change
@@ -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: {
Expand All @@ -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 = [
Expand All @@ -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,
Expand Down
25 changes: 25 additions & 0 deletions pkgs/desktops/gnome/core/gnome-shell-extensions/fix_gtop.patch
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 661b809

Please sign in to comment.