Fix various issues in downstream patches

- don't duplicate logo in apps-menu in non-classic session
 - adjust panel-favorites, updates-dialog and systemMonitor
   extensions to GNOME 40
 - apply style changes to pre-generated CSS

Resolves: #1932261
This commit is contained in:
Florian Müllner 2021-05-26 22:01:06 +02:00
parent bb7b5bde29
commit 08d9ade02c
5 changed files with 691 additions and 419 deletions

View File

@ -24,6 +24,20 @@ index 1f46507..ad638b2 100644
// status area icons
.system-status-icon {
icon-size: $base_icon_size;
diff --git a/data/gnome-classic.css b/data/gnome-classic.css
index f4826de..ad71bf6 100644
--- a/data/gnome-classic.css
+++ b/data/gnome-classic.css
@@ -1234,6 +1234,9 @@ StScrollBar {
box-shadow: none; }
#panel .panel-button:hover.clock-display .clock, #panel .panel-button:active.clock-display .clock, #panel .panel-button:overview.clock-display .clock, #panel .panel-button:focus.clock-display .clock, #panel .panel-button:checked.clock-display .clock {
box-shadow: inset 0 0 0 100px rgba(255, 255, 255, 0.2); }
+ #panel .panel-button .panel-logo-icon {
+ padding-right: .4em;
+ icon-size: 1em; }
#panel .panel-button .system-status-icon {
icon-size: 1.09em;
padding: 5px;
--
2.28.0

View File

@ -1,15 +1,15 @@
From 3fd6013393765bd8f1350da6e64b86a0961be9cd Mon Sep 17 00:00:00 2001
From a28e752ac10f9882d33a52189fc237d11d541fed Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 21 Jan 2014 16:48:17 -0500
Subject: [PATCH] apps-menu: add logo icon to Applications menu
Brand requested it.
---
extensions/apps-menu/extension.js | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
extensions/apps-menu/extension.js | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index 6376b52..17285fd 100644
index 6376b524..1b1f01f1 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -363,13 +363,24 @@ class ApplicationsButton extends PanelMenu.Button {
@ -22,7 +22,7 @@ index 6376b52..17285fd 100644
+ '/usr/share/icons/hicolor/scalable/apps/start-here.svg');
+ this._icon = new St.Icon({
+ gicon: new Gio.FileIcon({ file: iconFile }),
+ style_class: 'panel-logo-icon'
+ style_class: 'panel-logo-icon',
+ });
+ hbox.add_actor(this._icon);
+
@ -38,6 +38,29 @@ index 6376b52..17285fd 100644
this.name = 'panelApplications';
this.label_actor = this._label;
@@ -403,6 +414,14 @@ class ApplicationsButton extends PanelMenu.Button {
this._display();
this._installedChangedId = appSys.connect('installed-changed',
this._onTreeChanged.bind(this));
+ this._sessionUpdatedId = Main.sessionMode.connect('updated',
+ this._sessionUpdated.bind(this));
+ this._sessionUpdated();
+ }
+
+ _sessionUpdated() {
+ this._icon.visible =
+ !Main.sessionMode.panel.left.includes('activities');
}
_onTreeChanged() {
@@ -428,6 +447,7 @@ class ApplicationsButton extends PanelMenu.Button {
Main.overview.disconnect(this._showingId);
Main.overview.disconnect(this._hidingId);
+ Main.sessionMode.disconnect(this._sessionUpdatedId);
appSys.disconnect(this._installedChangedId);
this._tree.disconnect(this._treeChangedId);
this._tree = null;
--
2.28.0
2.31.1

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
Name: gnome-shell-extensions
Version: 40.1
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Modify and extend GNOME Shell functionality and behavior
License: GPLv2+
@ -348,6 +348,10 @@ workspaces.
%changelog
* Wed May 26 2021 Florian Müllner <fmuellner@redhat.com> - 40.1-3
- Fix various issues in downstream patches
Resolves: #1932261
* Mon May 24 2021 Florian Müllner <fmuellner@redhat.com> - 40.1-2
- Rebase downstream patches
Resolves: #1932261

View File

@ -1,7 +1,7 @@
From a226633a5acd6356f9ed8794a12f7501f25e018b Mon Sep 17 00:00:00 2001
From 3178a99e48167ad31b1e52e9afc2041bfee34593 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Wed, 17 May 2017 19:13:50 +0200
Subject: [PATCH 1/5] extensions: Resurrect systemMonitor extension
Subject: [PATCH 1/6] extensions: Resurrect systemMonitor extension
The extension was removed upstream because:
- it hooks into the message tray that was removed
@ -26,7 +26,7 @@ This reverts commit c9a6421f362cd156cf731289eadc11f44f6970ac.
diff --git a/extensions/systemMonitor/extension.js b/extensions/systemMonitor/extension.js
new file mode 100644
index 0000000..7b09df0
index 00000000..7b09df01
--- /dev/null
+++ b/extensions/systemMonitor/extension.js
@@ -0,0 +1,376 @@
@ -408,7 +408,7 @@ index 0000000..7b09df0
+}
diff --git a/extensions/systemMonitor/meson.build b/extensions/systemMonitor/meson.build
new file mode 100644
index 0000000..48504f6
index 00000000..48504f63
--- /dev/null
+++ b/extensions/systemMonitor/meson.build
@@ -0,0 +1,5 @@
@ -419,7 +419,7 @@ index 0000000..48504f6
+)
diff --git a/extensions/systemMonitor/metadata.json.in b/extensions/systemMonitor/metadata.json.in
new file mode 100644
index 0000000..fa75007
index 00000000..fa750074
--- /dev/null
+++ b/extensions/systemMonitor/metadata.json.in
@@ -0,0 +1,11 @@
@ -436,7 +436,7 @@ index 0000000..fa75007
+}
diff --git a/extensions/systemMonitor/stylesheet.css b/extensions/systemMonitor/stylesheet.css
new file mode 100644
index 0000000..13f95ec
index 00000000..13f95ec7
--- /dev/null
+++ b/extensions/systemMonitor/stylesheet.css
@@ -0,0 +1,35 @@
@ -476,7 +476,7 @@ index 0000000..13f95ec
+ font-weight: bold;
+}
diff --git a/meson.build b/meson.build
index b95dfc3..ada6b92 100644
index b95dfc30..ada6b921 100644
--- a/meson.build
+++ b/meson.build
@@ -48,6 +48,7 @@ all_extensions += [
@ -488,27 +488,29 @@ index b95dfc3..ada6b92 100644
'updates-dialog',
'user-theme'
--
2.28.0
2.31.1
From 260d286780690b9df6020472bb1af664ecf33e43 Mon Sep 17 00:00:00 2001
From d93f5edfc243dc065db74535de3db1222b483865 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Fri, 17 May 2019 22:55:48 +0000
Subject: [PATCH 2/5] systemMonitor: Modernise code
Subject: [PATCH 2/6] systemMonitor: Modernise code
- port to ES6 classes
- replace Lang.bind()
- replace Tweener
- use standard align/expand properties
- destructure imports
- fix style issues (stray/missing spaces/semi-colons, indent, ...)
---
extensions/systemMonitor/extension.js | 377 +++++++++++++-------------
1 file changed, 192 insertions(+), 185 deletions(-)
extensions/systemMonitor/extension.js | 422 +++++++++++++-------------
1 file changed, 212 insertions(+), 210 deletions(-)
diff --git a/extensions/systemMonitor/extension.js b/extensions/systemMonitor/extension.js
index 7b09df0..89f8916 100644
index 7b09df01..f7c6a4a9 100644
--- a/extensions/systemMonitor/extension.js
+++ b/extensions/systemMonitor/extension.js
@@ -1,22 +1,16 @@
@@ -1,56 +1,57 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
-const Clutter = imports.gi.Clutter;
@ -523,7 +525,7 @@ index 7b09df0..89f8916 100644
+
+const ExtensionUtils = imports.misc.extensionUtils;
const Main = imports.ui.main;
const Tweener = imports.ui.tweener;
-const Tweener = imports.ui.tweener;
const Gettext = imports.gettext.domain('gnome-shell-extensions');
const _ = Gettext.gettext;
@ -535,8 +537,10 @@ index 7b09df0..89f8916 100644
const INDICATOR_UPDATE_INTERVAL = 500;
const INDICATOR_NUM_GRID_LINES = 3;
@@ -24,32 +18,38 @@ const ITEM_LABEL_SHOW_TIME = 0.15;
const ITEM_LABEL_HIDE_TIME = 0.1;
-const ITEM_LABEL_SHOW_TIME = 0.15;
-const ITEM_LABEL_HIDE_TIME = 0.1;
+const ITEM_LABEL_SHOW_TIME = 150;
+const ITEM_LABEL_HIDE_TIME = 100;
const ITEM_HOVER_TIMEOUT = 300;
-const Indicator = new Lang.Class({
@ -549,7 +553,11 @@ index 7b09df0..89f8916 100644
- this.drawing_area = new St.DrawingArea({ reactive: true });
- this.drawing_area.connect('repaint', Lang.bind(this, this._draw));
- this.drawing_area.connect('button-press-event', function() {
+ this._drawingArea = new St.DrawingArea({ reactive: true });
+ this._drawingArea = new St.DrawingArea({
+ reactive: true,
+ x_expand: true,
+ y_expand: true,
+ });
+ this._drawingArea.connect('repaint', this._draw.bind(this));
+ this._drawingArea.connect('button-press-event', () => {
let app = Shell.AppSystem.get_default().lookup_app('gnome-system-monitor.desktop');
@ -565,10 +573,10 @@ index 7b09df0..89f8916 100644
+ style_class: 'extension-systemMonitor-indicator-area',
+ reactive: true,
+ track_hover: true,
+ x_fill: true,
+ y_fill: true
+ });
+ this.actor.add_actor(this._drawingArea);
+
+ this.actor.connect('destroy', this._onDestroy.bind(this));
- this._timeout = Mainloop.timeout_add(INDICATOR_UPDATE_INTERVAL, Lang.bind(this, function () {
- this._updateValues();
@ -576,9 +584,6 @@ index 7b09df0..89f8916 100644
- return true;
- }));
- },
+ this.actor.connect('destroy', this._onDestroy.bind(this));
- showLabel: function() {
+ this._timeout = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
+ INDICATOR_UPDATE_INTERVAL,
+ () => {
@ -587,12 +592,15 @@ index 7b09df0..89f8916 100644
+ return GLib.SOURCE_CONTINUE;
+ });
+ }
+
- showLabel: function() {
- if (this.label == null)
+ showLabel() {
if (this.label == null)
+ if (this.label === null)
return;
@@ -58,12 +58,10 @@ const Indicator = new Lang.Class({
this.label.opacity = 0;
@@ -58,12 +59,10 @@ const Indicator = new Lang.Class({
let [stageX, stageY] = this.actor.get_transformed_position();
@ -608,7 +616,7 @@ index 7b09df0..89f8916 100644
let x = stageX + xOffset;
@@ -73,48 +71,51 @@ const Indicator = new Lang.Class({
@@ -73,116 +72,113 @@ const Indicator = new Lang.Class({
let y = stageY - this.label.get_height() - yOffset;
this.label.set_position(x, y);
@ -618,21 +626,22 @@ index 7b09df0..89f8916 100644
- transition: 'easeOutQuad',
- });
- },
-
- setLabelText: function(text) {
+ Tweener.addTween(this.label, {
+ this.label.ease({
+ opacity: 255,
+ time: ITEM_LABEL_SHOW_TIME,
+ transition: 'easeOutQuad',
+ duration: ITEM_LABEL_SHOW_TIME,
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ });
+ }
+
+ setLabelText(text) {
if (this.label == null)
- setLabelText: function(text) {
- if (this.label == null)
- this.label = new St.Label({ style_class: 'extension-systemMonitor-indicator-label'});
+ setLabelText(text) {
+ if (this.label === null) {
+ this.label = new St.Label({
+ style_class: 'extension-systemMonitor-indicator-label'
+ style_class: 'extension-systemMonitor-indicator-label',
+ });
+ }
this.label.set_text(text);
Main.layoutManager.addChrome(this.label);
@ -655,11 +664,11 @@ index 7b09df0..89f8916 100644
+ }
+ hideLabel() {
+ Tweener.addTween(this.label, {
+ this.label.ease({
+ opacity: 0,
+ time: ITEM_LABEL_HIDE_TIME,
+ transition: 'easeOutQuad',
+ onComplete: () => this.label.hide()
+ duration: ITEM_LABEL_HIDE_TIME,
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ onComplete: () => this.label.hide(),
+ });
+ }
+
@ -669,30 +678,32 @@ index 7b09df0..89f8916 100644
- this.label.destroy();
- },
+ }
+
+ _onDestroy() {
+ GLib.source_remove(this._timeout);
+
+ if (this.label)
+ this.label.destroy();
+ }
- _initValues: function() {
- },
+ _initValues() {
+ }
+ _onDestroy() {
+ GLib.source_remove(this._timeout);
- _updateValues: function() {
- },
+ _updateValues() {
+ if (this.label)
+ this.label.destroy();
+ }
+
+ _initValues() {
+ }
- _draw: function(area) {
+ _updateValues() {
+ }
+
+ _draw(area) {
let [width, height] = area.get_surface_size();
let themeNode = this.actor.get_theme_node();
let cr = area.get_context();
@@ -123,12 +124,12 @@ const Indicator = new Lang.Class({
- //draw the background grid
+ // draw the background grid
let color = themeNode.get_color(this.gridColor);
let gridOffset = Math.floor(height / (INDICATOR_NUM_GRID_LINES + 1));
for (let i = 1; i <= INDICATOR_NUM_GRID_LINES; ++i) {
@ -707,23 +718,61 @@ index 7b09df0..89f8916 100644
+ cr.setDash([4, 1], 0);
cr.stroke();
//draw the foreground
@@ -155,12 +156,12 @@ const Indicator = new Lang.Class({
- //draw the foreground
+ // draw the foreground
- function makePath(values, reverse, nudge) {
- if (nudge == null) {
- nudge = 0;
- }
- //if we are going in reverse, we are completing the bottom of a chart, so use lineTo
+ function makePath(values, reverse, nudge = 0) {
+ // if we are going in reverse, we are completing the bottom of a chart, so use lineTo
if (reverse) {
cr.lineTo(values.length - 1, (1 - values[values.length - 1]) * height + nudge);
- for (let k = values.length - 2; k >= 0; --k) {
+ for (let k = values.length - 2; k >= 0; --k)
cr.lineTo(k, (1 - values[k]) * height + nudge);
- }
} else {
cr.moveTo(0, (1 - values[0]) * height + nudge);
- for (let k = 1; k < values.length; ++k) {
+ for (let k = 1; k < values.length; ++k)
cr.lineTo(k, (1 - values[k]) * height + nudge);
- }
-
}
}
let renderStats = this.renderStats;
// Make sure we don't have more sample points than pixels
- renderStats.map(Lang.bind(this, function(k){
+ renderStats.map(k => {
+ renderStats.forEach(k => {
let stat = this.stats[k];
if (stat.values.length > width) {
- if (stat.values.length > width) {
+ if (stat.values.length > width)
stat.values = stat.values.slice(stat.values.length - width, stat.values.length);
}
- }
- }));
+ });
for (let i = 0; i < renderStats.length; ++i) {
let stat = this.stats[renderStats[i]];
@@ -178,10 +179,10 @@ const Indicator = new Lang.Class({
// We outline at full opacity and fill with 40% opacity
let outlineColor = themeNode.get_color(stat.color);
- let color = new Clutter.Color(outlineColor);
- color.alpha = color.alpha * .4;
+ let fillColor = new Clutter.Color(outlineColor);
+ fillColor.alpha *= .4;
// Render the background between us and the next level
makePath(stat.values, false);
// If there is a process below us, render the cpu between us and it, otherwise,
// render to the bottom of the chart
- if (i == renderStats.length - 1) {
+ if (i === renderStats.length - 1) {
cr.lineTo(stat.values.length - 1, height);
cr.lineTo(0, height);
cr.closePath();
} else {
@ -732,21 +781,23 @@ index 7b09df0..89f8916 100644
makePath(nextStat.values, true);
}
- cr.closePath()
- Clutter.cairo_set_source_color(cr, color);
+ cr.closePath();
Clutter.cairo_set_source_color(cr, color);
+ Clutter.cairo_set_source_color(cr, fillColor);
cr.fill();
@@ -193,40 +194,42 @@ const Indicator = new Lang.Class({
// Render the outline of this level
@@ -193,41 +189,43 @@ const Indicator = new Lang.Class({
cr.stroke();
}
}
-});
-
+};
-const CpuIndicator = new Lang.Class({
- Name: 'SystemMonitor.CpuIndicator',
- Extends: Indicator,
+};
-
- _init: function() {
- this.parent();
+const CpuIndicator = class extends Indicator {
@ -764,7 +815,7 @@ index 7b09df0..89f8916 100644
+ 'cpu-total': 0,
+ 'cpu-user': 1,
+ 'cpu-sys': 2,
+ 'cpu-iowait': 3
+ 'cpu-iowait': 3,
+ };
+ this.renderStats = this.renderStats.sort((a, b) => {
return renderStatOrder[a] - renderStatOrder[b];
@ -776,8 +827,9 @@ index 7b09df0..89f8916 100644
+ }
- _initValues: function() {
- this._prev = new GTop.glibtop_cpu;
+ _initValues() {
this._prev = new GTop.glibtop_cpu;
+ this._prev = new GTop.glibtop_cpu();
GTop.glibtop_get_cpu(this._prev);
this.stats = {
@ -789,18 +841,20 @@ index 7b09df0..89f8916 100644
- },
-
- _updateValues: function() {
- let cpu = new GTop.glibtop_cpu;
+ 'cpu-user': { color: '-cpu-user-color', values: [] },
+ 'cpu-sys': { color: '-cpu-sys-color', values: [] },
+ 'cpu-iowait': { color: '-cpu-iowait-color', values: [] },
+ 'cpu-total': { color: '-cpu-total-color', values: [] }
+ 'cpu-total': { color: '-cpu-total-color', values: [] },
+ };
+ }
+
+ _updateValues() {
let cpu = new GTop.glibtop_cpu;
+ let cpu = new GTop.glibtop_cpu();
let t = 0.0;
GTop.glibtop_get_cpu(cpu);
@@ -246,37 +249,34 @@ const CpuIndicator = new Lang.Class({
let total = cpu.total - this._prev.total;
@@ -246,37 +244,34 @@ const CpuIndicator = new Lang.Class({
this._prev = cpu;
}
@ -834,8 +888,9 @@ index 7b09df0..89f8916 100644
+ }
- _initValues: function() {
- this.mem = new GTop.glibtop_mem;
+ _initValues() {
this.mem = new GTop.glibtop_mem;
+ this.mem = new GTop.glibtop_mem();
this.stats = {
- 'mem-user': { color: "-mem-user-color", values: [] },
- 'mem-other': { color: "-mem-other-color", values: [] },
@ -844,7 +899,7 @@ index 7b09df0..89f8916 100644
- },
+ 'mem-user': { color: '-mem-user-color', values: [] },
+ 'mem-other': { color: '-mem-other-color', values: [] },
+ 'mem-cached': { color: '-mem-cached-color', values: [] }
+ 'mem-cached': { color: '-mem-cached-color', values: [] },
+ };
+ }
@ -853,7 +908,7 @@ index 7b09df0..89f8916 100644
GTop.glibtop_get_mem(this.mem);
let t = this.mem.user / this.mem.total;
@@ -286,90 +286,97 @@ const MemoryIndicator = new Lang.Class({
@@ -286,90 +281,97 @@ const MemoryIndicator = new Lang.Class({
t += this.mem.cached / this.mem.total;
this.stats['mem-cached'].values.push(t);
}
@ -926,12 +981,12 @@ index 7b09df0..89f8916 100644
+ this._box = new St.BoxLayout({
+ style_class: 'extension-systemMonitor-container',
+ x_align: Clutter.ActorAlign.START,
+ x_expand: true
+ x_expand: true,
+ });
+ this._indicators = [];
+
+ for (let i = 0; i < INDICATORS.length; i++) {
+ let indicator = new (INDICATORS[i])();
+ let indicator = new INDICATORS[i]();
+
+ indicator.actor.connect('notify::hover', () => {
+ this._onHover(indicator);
@ -1026,13 +1081,119 @@ index 7b09df0..89f8916 100644
function init() {
return new Extension();
--
2.28.0
2.31.1
From b98133d5a73701d876c3ab2be591762359a16669 Mon Sep 17 00:00:00 2001
From 84d881157d59a8701f351f69698edfbaf806898e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Wed, 26 May 2021 19:50:37 +0200
Subject: [PATCH 3/6] systemMonitor: Make label property private
There is no good reason to use a public property, and the name will
clash when we subclass St.Button.
---
extensions/systemMonitor/extension.js | 35 ++++++++++++++-------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/extensions/systemMonitor/extension.js b/extensions/systemMonitor/extension.js
index f7c6a4a9..bde25a1d 100644
--- a/extensions/systemMonitor/extension.js
+++ b/extensions/systemMonitor/extension.js
@@ -19,6 +19,7 @@ const ITEM_HOVER_TIMEOUT = 300;
const Indicator = class {
constructor() {
+ this._label = null;
this._initValues();
this._drawingArea = new St.DrawingArea({
reactive: true,
@@ -51,28 +52,28 @@ const Indicator = class {
}
showLabel() {
- if (this.label === null)
+ if (this._label === null)
return;
- this.label.opacity = 0;
- this.label.show();
+ this._label.opacity = 0;
+ this._label.show();
let [stageX, stageY] = this.actor.get_transformed_position();
let itemWidth = this.actor.allocation.x2 - this.actor.allocation.x1;
- let labelWidth = this.label.width;
+ let labelWidth = this._label.width;
let xOffset = Math.floor((itemWidth - labelWidth) / 2);
let x = stageX + xOffset;
- let node = this.label.get_theme_node();
+ let node = this._label.get_theme_node();
let yOffset = node.get_length('-y-offset');
- let y = stageY - this.label.get_height() - yOffset;
+ let y = stageY - this._label.get_height() - yOffset;
- this.label.set_position(x, y);
- this.label.ease({
+ this._label.set_position(x, y);
+ this._label.ease({
opacity: 255,
duration: ITEM_LABEL_SHOW_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
@@ -80,23 +81,23 @@ const Indicator = class {
}
setLabelText(text) {
- if (this.label === null) {
- this.label = new St.Label({
+ if (this._label === null) {
+ this._label = new St.Label({
style_class: 'extension-systemMonitor-indicator-label',
});
}
- this.label.set_text(text);
- Main.layoutManager.addChrome(this.label);
- this.label.hide();
+ this._label.set_text(text);
+ Main.layoutManager.addChrome(this._label);
+ this._label.hide();
}
hideLabel() {
- this.label.ease({
+ this._label.ease({
opacity: 0,
duration: ITEM_LABEL_HIDE_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
- onComplete: () => this.label.hide(),
+ onComplete: () => this._label.hide(),
});
}
@@ -107,8 +108,8 @@ const Indicator = class {
_onDestroy() {
GLib.source_remove(this._timeout);
- if (this.label)
- this.label.destroy();
+ if (this._label)
+ this._label.destroy();
}
_initValues() {
--
2.31.1
From fd961a7f6766e4c48d492bb4e37ee8bc250eb228 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Wed, 17 May 2017 19:31:58 +0200
Subject: [PATCH 3/5] systemMonitor: Move indicators to calendar
Subject: [PATCH 4/6] systemMonitor: Move indicators to calendar
The message tray joined the invisible choir, so we have to find
a new home for the extension UI. The message list in the calendar
@ -1040,45 +1201,59 @@ drop-down looks like the best option, given that it replaced the
old tray (and also took over the old keyboard shortcut to bring
it up quickly).
---
extensions/systemMonitor/extension.js | 65 ++++++++++++-------------
extensions/systemMonitor/stylesheet.css | 14 ------
2 files changed, 31 insertions(+), 48 deletions(-)
extensions/systemMonitor/extension.js | 106 +++++++++++-------------
extensions/systemMonitor/stylesheet.css | 14 ----
2 files changed, 50 insertions(+), 70 deletions(-)
diff --git a/extensions/systemMonitor/extension.js b/extensions/systemMonitor/extension.js
index 89f8916..0188960 100644
index bde25a1d..1fd01ab4 100644
--- a/extensions/systemMonitor/extension.js
+++ b/extensions/systemMonitor/extension.js
@@ -3,9 +3,11 @@
@@ -2,10 +2,11 @@
/* exported init */
const { Clutter, GLib, GTop, Shell, St } = imports.gi;
+const Signals = imports.signals;
-const { Clutter, GLib, GTop, Shell, St } = imports.gi;
+const { Clutter, GLib, GObject, GTop, Shell, St } = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils;
const Main = imports.ui.main;
+const MessageList = imports.ui.messageList;
const Tweener = imports.ui.tweener;
const Gettext = imports.gettext.domain('gnome-shell-extensions');
@@ -21,22 +23,25 @@ const ITEM_HOVER_TIMEOUT = 300;
const Indicator = class {
constructor() {
const _ = Gettext.gettext;
@@ -17,30 +18,38 @@ const ITEM_LABEL_SHOW_TIME = 150;
const ITEM_LABEL_HIDE_TIME = 100;
const ITEM_HOVER_TIMEOUT = 300;
-const Indicator = class {
- constructor() {
+const Indicator = GObject.registerClass({
+ Signals: {
+ 'close': {},
+ 'expanded': {},
+ 'unexpanded': {},
+ },
+}, class Indicator extends St.Button {
+ _init() {
this._label = null;
this._initValues();
- this._drawingArea = new St.DrawingArea({ reactive: true });
+ this._drawingArea = new St.DrawingArea();
this._drawingArea = new St.DrawingArea({
- reactive: true,
x_expand: true,
y_expand: true,
});
this._drawingArea.connect('repaint', this._draw.bind(this));
- this._drawingArea.connect('button-press-event', () => {
+
+ this.actor = new St.Button({
+ super._init({
+ style_class: 'message message-content extension-systemMonitor-indicator-area',
+ child: this._drawingArea,
+ x_expand: true,
+ x_fill: true,
+ y_fill: true,
+ can_focus: true
+ can_focus: true,
+ });
+
+ this.actor.connect('clicked', () => {
+ this.connect('clicked', () => {
let app = Shell.AppSystem.get_default().lookup_app('gnome-system-monitor.desktop');
app.open_new_window(-1);
- return true;
@ -1088,66 +1263,125 @@ index 89f8916..0188960 100644
- style_class: 'extension-systemMonitor-indicator-area',
- reactive: true,
- track_hover: true,
- x_fill: true,
- y_fill: true
+ Main.overview.hide();
+ Main.panel.closeCalendar();
});
- this.actor.add_actor(this._drawingArea);
this.actor.connect('destroy', this._onDestroy.bind(this));
- this.actor.connect('destroy', this._onDestroy.bind(this));
+ this.connect('destroy', this._onDestroy.bind(this));
@@ -71,6 +76,7 @@ const Indicator = class {
let y = stageY - this.label.get_height() - yOffset;
this._timeout = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
INDICATOR_UPDATE_INTERVAL,
@@ -58,9 +67,9 @@ const Indicator = class {
this._label.opacity = 0;
this._label.show();
this.label.set_position(x, y);
+ this.label.get_parent().set_child_above_sibling(this.label, null);
Tweener.addTween(this.label, {
- let [stageX, stageY] = this.actor.get_transformed_position();
+ let [stageX, stageY] = this.get_transformed_position();
- let itemWidth = this.actor.allocation.x2 - this.actor.allocation.x1;
+ let itemWidth = this.allocation.x2 - this.allocation.x1;
let labelWidth = this._label.width;
let xOffset = Math.floor((itemWidth - labelWidth) / 2);
@@ -73,6 +82,7 @@ const Indicator = class {
let y = stageY - this._label.get_height() - yOffset;
this._label.set_position(x, y);
+ this._label.get_parent().set_child_above_sibling(this._label, null);
this._label.ease({
opacity: 255,
time: ITEM_LABEL_SHOW_TIME,
@@ -98,6 +104,14 @@ const Indicator = class {
duration: ITEM_LABEL_SHOW_TIME,
@@ -101,8 +111,12 @@ const Indicator = class {
});
}
- destroy() {
- this.actor.destroy();
+ /* MessageList.Message boilerplate */
+ canClose() {
+ return false;
+ }
+
+ clear() {
+ }
+
destroy() {
this.actor.destroy();
}
@@ -195,6 +209,7 @@ const Indicator = class {
_onDestroy() {
@@ -120,7 +134,7 @@ const Indicator = class {
_draw(area) {
let [width, height] = area.get_surface_size();
- let themeNode = this.actor.get_theme_node();
+ let themeNode = this.get_theme_node();
let cr = area.get_context();
// draw the background grid
@@ -190,11 +204,12 @@ const Indicator = class {
cr.stroke();
}
}
};
+Signals.addSignalMethods(Indicator.prototype); // For MessageList.Message compat
-};
+});
const CpuIndicator = class extends Indicator {
constructor() {
@@ -300,11 +315,7 @@ class Extension {
-const CpuIndicator = class extends Indicator {
- constructor() {
- super();
+const CpuIndicator = GObject.registerClass(
+class CpuIndicator extends Indicator {
+ _init() {
+ super._init();
this.gridColor = '-grid-color';
this.renderStats = ['cpu-user', 'cpu-sys', 'cpu-iowait'];
@@ -245,11 +260,12 @@ const CpuIndicator = class extends Indicator {
this._prev = cpu;
}
-};
+});
-const MemoryIndicator = class extends Indicator {
- constructor() {
- super();
+const MemoryIndicator = GObject.registerClass(
+class MemoryIndicator extends Indicator {
+ _init() {
+ super._init();
this.gridColor = '-grid-color';
this.renderStats = ['mem-user', 'mem-other', 'mem-cached'];
@@ -282,7 +298,7 @@ const MemoryIndicator = class extends Indicator {
t += this.mem.cached / this.mem.total;
this.stats['mem-cached'].values.push(t);
}
-};
+});
const INDICATORS = [CpuIndicator, MemoryIndicator];
@@ -296,49 +312,27 @@ class Extension {
}
enable() {
- this._box = new St.BoxLayout({
- style_class: 'extension-systemMonitor-container',
- x_align: Clutter.ActorAlign.START,
- x_expand: true
- x_expand: true,
- });
- this._indicators = [];
+ this._section = new MessageList.MessageListSection(_('System Monitor'));
this._indicators = [];
for (let i = 0; i < INDICATORS.length; i++) {
@@ -313,32 +324,18 @@ class Extension {
indicator.actor.connect('notify::hover', () => {
let indicator = new INDICATORS[i]();
- indicator.actor.connect('notify::hover', () => {
+ indicator.connect('notify::hover', () => {
this._onHover(indicator);
});
- this._box.add_actor(indicator.actor);
- this._indicators.push(indicator);
+ this._section.addMessage(indicator, false);
this._indicators.push(indicator);
}
- this._boxHolder = new St.BoxLayout({
@ -1162,24 +1396,29 @@ index 89f8916..0188960 100644
- this._boxHolder.add_child(this._box);
- this._boxHolder.add_child(menuButton);
+ Main.panel.statusArea.dateMenu._messageList._addSection(this._section);
+ this._section.actor.get_parent().set_child_at_index(this._section.actor, 0);
+ this._section.get_parent().set_child_at_index(this._section, 0);
}
disable() {
this._indicators.forEach(i => i.destroy());
- this._indicators.forEach(i => i.destroy());
-
- let menuButton = Main.messageTray._messageTrayMenuButton.actor;
- this._boxHolder.remove_child(menuButton);
- Main.messageTray.actor.add_child(menuButton);
-
- this._box.destroy();
- this._boxHolder.destroy();
+ Main.panel.statusArea.dateMenu._messageList._removeSection(this._section);
+ this._section.destroy();
}
_onHover(item) {
- if (item.actor.get_hover()) {
+ if (item.get_hover()) {
if (this._showLabelTimeoutId)
return;
diff --git a/extensions/systemMonitor/stylesheet.css b/extensions/systemMonitor/stylesheet.css
index 13f95ec..978ac12 100644
index 13f95ec7..978ac12a 100644
--- a/extensions/systemMonitor/stylesheet.css
+++ b/extensions/systemMonitor/stylesheet.css
@@ -1,17 +1,4 @@
@ -1209,13 +1448,13 @@ index 13f95ec..978ac12 100644
.extension-systemMonitor-indicator-label {
--
2.28.0
2.31.1
From 9585edb8edfd60f04607017e769891eda294b9d7 Mon Sep 17 00:00:00 2001
From 5796b0714f03cb1faa5cd70d50b46b57f67c4eea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Thu, 18 May 2017 16:20:07 +0200
Subject: [PATCH 4/5] systemMonitor: Handle clicks on section title
Subject: [PATCH 5/6] systemMonitor: Handle clicks on section title
While on 3.24.x only the event section still has a clickable title,
it's a generic message list feature in previous versions. It's easy
@ -1224,20 +1463,21 @@ the generic baseclass.
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell-extensions3
---
extensions/systemMonitor/extension.js | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
extensions/systemMonitor/extension.js | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/extensions/systemMonitor/extension.js b/extensions/systemMonitor/extension.js
index 0188960..b4d5a9d 100644
index 1fd01ab4..57bdb51f 100644
--- a/extensions/systemMonitor/extension.js
+++ b/extensions/systemMonitor/extension.js
@@ -303,6 +303,21 @@ const MemoryIndicator = class extends Indicator {
@@ -300,6 +300,22 @@ class MemoryIndicator extends Indicator {
}
};
});
+const SystemMonitorSection = GObject.registerClass(
+class SystemMonitorSection extends MessageList.MessageListSection {
+ constructor() {
+ super(_('System Monitor'));
+ _init() {
+ super._init(_('System Monitor'));
+ }
+
+ _onTitleClicked() {
@ -1248,28 +1488,28 @@ index 0188960..b4d5a9d 100644
+ if (app)
+ app.open_new_window(-1);
+ }
+}
+});
+
const INDICATORS = [CpuIndicator, MemoryIndicator];
class Extension {
@@ -315,7 +330,7 @@ class Extension {
@@ -312,7 +328,7 @@ class Extension {
}
enable() {
- this._section = new MessageList.MessageListSection(_('System Monitor'));
+ this._section = new SystemMonitorSection();
this._indicators = [];
for (let i = 0; i < INDICATORS.length; i++) {
let indicator = new INDICATORS[i]();
--
2.28.0
2.31.1
From 2470f7842aae83c16fc2583a0462151e23a17d12 Mon Sep 17 00:00:00 2001
From e762e2dd17cc62b9258e44458157997a07bbdbfa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Thu, 18 May 2017 18:00:17 +0200
Subject: [PATCH 5/5] systemMonitor: Provide classic styling
Subject: [PATCH 6/6] systemMonitor: Provide classic styling
The indicator tooltips currently don't work out in classic mode
(dark text on dark background), so provide some mode-specific
@ -1284,7 +1524,7 @@ Fixes: #4
diff --git a/extensions/systemMonitor/classic.css b/extensions/systemMonitor/classic.css
new file mode 100644
index 0000000..946863d
index 00000000..946863dc
--- /dev/null
+++ b/extensions/systemMonitor/classic.css
@@ -0,0 +1,6 @@
@ -1295,7 +1535,7 @@ index 0000000..946863d
+ border: 1px solid #a1a1a1;
+}
diff --git a/extensions/systemMonitor/meson.build b/extensions/systemMonitor/meson.build
index 48504f6..b6548b1 100644
index 48504f63..b6548b14 100644
--- a/extensions/systemMonitor/meson.build
+++ b/extensions/systemMonitor/meson.build
@@ -3,3 +3,7 @@ extension_data += configure_file(
@ -1307,5 +1547,5 @@ index 48504f6..b6548b1 100644
+ extension_data += files('classic.css')
+endif
--
2.28.0
2.31.1