Blame SOURCES/resurrect-system-monitor.patch

58a5c8
From 57bb099db30703a474a023122f1106e199ff79ed Mon Sep 17 00:00:00 2001
e8fd09
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
e8fd09
Date: Wed, 17 May 2017 19:13:50 +0200
e8fd09
Subject: [PATCH 1/4] extensions: Resurrect systemMonitor extension
e8fd09
e8fd09
The extension was removed upstream because:
e8fd09
 - it hooks into the message tray that was removed
e8fd09
 - it was known to have performance issues
e8fd09
 - there are plenty of alternatives
e8fd09
e8fd09
Those aren't good enough reasons for dropping it downstream
e8fd09
as well though, so we need to bring it back ...
e8fd09
e8fd09
This reverts commit c9a6421f362cd156cf731289eadc11f44f6970ac.
e8fd09
---
58a5c8
 extensions/systemMonitor/extension.js     | 376 ++++++++++++++++++++++
58a5c8
 extensions/systemMonitor/meson.build      |   5 +
e8fd09
 extensions/systemMonitor/metadata.json.in |  11 +
58a5c8
 extensions/systemMonitor/stylesheet.css   |  35 ++
58a5c8
 meson.build                               |   1 +
58a5c8
 5 files changed, 428 insertions(+)
e8fd09
 create mode 100644 extensions/systemMonitor/extension.js
58a5c8
 create mode 100644 extensions/systemMonitor/meson.build
e8fd09
 create mode 100644 extensions/systemMonitor/metadata.json.in
e8fd09
 create mode 100644 extensions/systemMonitor/stylesheet.css
e8fd09
e8fd09
diff --git a/extensions/systemMonitor/extension.js b/extensions/systemMonitor/extension.js
e8fd09
new file mode 100644
58a5c8
index 0000000..7b09df0
e8fd09
--- /dev/null
e8fd09
+++ b/extensions/systemMonitor/extension.js
e8fd09
@@ -0,0 +1,376 @@
e8fd09
+/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
e8fd09
+
e8fd09
+const Clutter = imports.gi.Clutter;
e8fd09
+const GTop = imports.gi.GTop;
e8fd09
+const Lang = imports.lang;
e8fd09
+const Mainloop = imports.mainloop;
e8fd09
+const St = imports.gi.St;
e8fd09
+const Shell = imports.gi.Shell;
e8fd09
+
e8fd09
+const Main = imports.ui.main;
e8fd09
+const Tweener = imports.ui.tweener;
e8fd09
+
e8fd09
+const Gettext = imports.gettext.domain('gnome-shell-extensions');
e8fd09
+const _ = Gettext.gettext;
e8fd09
+
e8fd09
+const ExtensionUtils = imports.misc.extensionUtils;
e8fd09
+const Me = ExtensionUtils.getCurrentExtension();
e8fd09
+const Convenience = Me.imports.convenience;
e8fd09
+
e8fd09
+const INDICATOR_UPDATE_INTERVAL = 500;
e8fd09
+const INDICATOR_NUM_GRID_LINES = 3;
e8fd09
+
e8fd09
+const ITEM_LABEL_SHOW_TIME = 0.15;
e8fd09
+const ITEM_LABEL_HIDE_TIME = 0.1;
e8fd09
+const ITEM_HOVER_TIMEOUT = 300;
e8fd09
+
e8fd09
+const Indicator = new Lang.Class({
e8fd09
+    Name: 'SystemMonitor.Indicator',
e8fd09
+
e8fd09
+    _init: function() {
e8fd09
+        this._initValues();
e8fd09
+        this.drawing_area = new St.DrawingArea({ reactive: true });
e8fd09
+        this.drawing_area.connect('repaint', Lang.bind(this, this._draw));
e8fd09
+        this.drawing_area.connect('button-press-event', function() {
e8fd09
+            let app = Shell.AppSystem.get_default().lookup_app('gnome-system-monitor.desktop');
e8fd09
+            app.open_new_window(-1);
e8fd09
+            return true;
e8fd09
+        });
e8fd09
+
e8fd09
+        this.actor = new St.Bin({ style_class: "extension-systemMonitor-indicator-area",
e8fd09
+                                  reactive: true, track_hover: true,
e8fd09
+				  x_fill: true, y_fill: true });
e8fd09
+        this.actor.add_actor(this.drawing_area);
e8fd09
+
e8fd09
+        this._timeout = Mainloop.timeout_add(INDICATOR_UPDATE_INTERVAL, Lang.bind(this, function () {
e8fd09
+            this._updateValues();
e8fd09
+            this.drawing_area.queue_repaint();
e8fd09
+            return true;
e8fd09
+        }));
e8fd09
+    },
e8fd09
+
e8fd09
+    showLabel: function() {
e8fd09
+        if (this.label == null)
e8fd09
+            return;
e8fd09
+
e8fd09
+        this.label.opacity = 0;
e8fd09
+        this.label.show();
e8fd09
+
e8fd09
+        let [stageX, stageY] = this.actor.get_transformed_position();
e8fd09
+
e8fd09
+	let itemWidth = this.actor.allocation.x2 - this.actor.allocation.x1;
e8fd09
+        let itemHeight = this.actor.allocation.y2 - this.actor.allocation.y1;
e8fd09
+
e8fd09
+	let labelWidth = this.label.width;
e8fd09
+        let labelHeight = this.label.height;
e8fd09
+        let xOffset = Math.floor((itemWidth - labelWidth) / 2)
e8fd09
+
e8fd09
+        let x = stageX + xOffset;
e8fd09
+
e8fd09
+        let node = this.label.get_theme_node();
e8fd09
+        let yOffset = node.get_length('-y-offset');
e8fd09
+
e8fd09
+        let y = stageY - this.label.get_height() - yOffset;
e8fd09
+
e8fd09
+        this.label.set_position(x, y);
e8fd09
+        Tweener.addTween(this.label,
e8fd09
+                         { opacity: 255,
e8fd09
+                           time: ITEM_LABEL_SHOW_TIME,
e8fd09
+                           transition: 'easeOutQuad',
e8fd09
+                         });
e8fd09
+    },
e8fd09
+
e8fd09
+    setLabelText: function(text) {
e8fd09
+        if (this.label == null)
e8fd09
+            this.label = new St.Label({ style_class: 'extension-systemMonitor-indicator-label'});
e8fd09
+
e8fd09
+        this.label.set_text(text);
e8fd09
+        Main.layoutManager.addChrome(this.label);
e8fd09
+        this.label.hide();
e8fd09
+    },
e8fd09
+
e8fd09
+    hideLabel: function () {
e8fd09
+        Tweener.addTween(this.label,
e8fd09
+                         { opacity: 0,
e8fd09
+                           time: ITEM_LABEL_HIDE_TIME,
e8fd09
+                           transition: 'easeOutQuad',
e8fd09
+                           onComplete: Lang.bind(this, function() {
e8fd09
+                               this.label.hide();
e8fd09
+                           })
e8fd09
+                         });
e8fd09
+    },
e8fd09
+
e8fd09
+    destroy: function() {
e8fd09
+        Mainloop.source_remove(this._timeout);
e8fd09
+
e8fd09
+        this.actor.destroy();
e8fd09
+	if (this.label)
e8fd09
+	    this.label.destroy();
e8fd09
+    },
e8fd09
+
e8fd09
+    _initValues: function() {
e8fd09
+    },
e8fd09
+
e8fd09
+    _updateValues: function() {
e8fd09
+    },
e8fd09
+
e8fd09
+    _draw: function(area) {
e8fd09
+        let [width, height] = area.get_surface_size();
e8fd09
+        let themeNode = this.actor.get_theme_node();
e8fd09
+        let cr = area.get_context();
e8fd09
+
e8fd09
+        //draw the background grid
e8fd09
+        let color = themeNode.get_color(this.gridColor);
e8fd09
+        let gridOffset = Math.floor(height / (INDICATOR_NUM_GRID_LINES + 1));
e8fd09
+        for (let i = 1; i <= INDICATOR_NUM_GRID_LINES; ++i) {
e8fd09
+                cr.moveTo(0, i * gridOffset + .5);
e8fd09
+                cr.lineTo(width, i * gridOffset + .5);
e8fd09
+        }
e8fd09
+        Clutter.cairo_set_source_color(cr, color);
e8fd09
+        cr.setLineWidth(1);
e8fd09
+        cr.setDash([4,1], 0);
e8fd09
+        cr.stroke();
58a5c8
+
e8fd09
+        //draw the foreground
e8fd09
+
e8fd09
+        function makePath(values, reverse, nudge) {
e8fd09
+            if (nudge == null) {
e8fd09
+                nudge = 0;
e8fd09
+            }
e8fd09
+            //if we are going in reverse, we are completing the bottom of a chart, so use lineTo
e8fd09
+            if (reverse) {
e8fd09
+                cr.lineTo(values.length - 1, (1 - values[values.length - 1]) * height + nudge);
e8fd09
+                for (let k = values.length - 2; k >= 0; --k) {
e8fd09
+                    cr.lineTo(k, (1 - values[k]) * height + nudge);
e8fd09
+                }
e8fd09
+            } else {
e8fd09
+                cr.moveTo(0, (1 - values[0]) * height + nudge);
e8fd09
+                for (let k = 1; k < values.length; ++k) {
e8fd09
+                    cr.lineTo(k, (1 - values[k]) * height + nudge);
e8fd09
+                }
e8fd09
+
e8fd09
+            }
e8fd09
+        }
58a5c8
+
e8fd09
+        let renderStats = this.renderStats;
e8fd09
+
e8fd09
+        // Make sure we don't have more sample points than pixels
e8fd09
+        renderStats.map(Lang.bind(this, function(k){
e8fd09
+            let stat = this.stats[k];
e8fd09
+            if (stat.values.length > width) {
e8fd09
+                stat.values = stat.values.slice(stat.values.length - width, stat.values.length);
e8fd09
+            }
e8fd09
+        }));
e8fd09
+
e8fd09
+        for (let i = 0; i < renderStats.length; ++i) {
e8fd09
+            let stat = this.stats[renderStats[i]];
e8fd09
+            // We outline at full opacity and fill with 40% opacity
e8fd09
+            let outlineColor = themeNode.get_color(stat.color);
e8fd09
+            let color = new Clutter.Color(outlineColor);
e8fd09
+            color.alpha = color.alpha * .4;
58a5c8
+
e8fd09
+            // Render the background between us and the next level
e8fd09
+            makePath(stat.values, false);
58a5c8
+            // If there is a process below us, render the cpu between us and it, otherwise,
e8fd09
+            // render to the bottom of the chart
e8fd09
+            if (i == renderStats.length - 1) {
e8fd09
+                cr.lineTo(stat.values.length - 1, height);
e8fd09
+                cr.lineTo(0, height);
e8fd09
+                cr.closePath();
e8fd09
+            } else {
e8fd09
+                let nextStat = this.stats[renderStats[i+1]];
e8fd09
+                makePath(nextStat.values, true);
e8fd09
+            }
e8fd09
+            cr.closePath()
e8fd09
+            Clutter.cairo_set_source_color(cr, color);
e8fd09
+            cr.fill();
58a5c8
+
e8fd09
+            // Render the outline of this level
e8fd09
+            makePath(stat.values, false, .5);
e8fd09
+            Clutter.cairo_set_source_color(cr, outlineColor);
e8fd09
+            cr.setLineWidth(1.0);
e8fd09
+            cr.setDash([], 0);
e8fd09
+            cr.stroke();
e8fd09
+        }
e8fd09
+    }
e8fd09
+});
e8fd09
+
e8fd09
+const CpuIndicator = new Lang.Class({
e8fd09
+    Name: 'SystemMonitor.CpuIndicator',
e8fd09
+    Extends: Indicator,
e8fd09
+
e8fd09
+    _init: function() {
e8fd09
+        this.parent();
e8fd09
+
e8fd09
+        this.gridColor = '-grid-color';
e8fd09
+        this.renderStats = [ 'cpu-user', 'cpu-sys', 'cpu-iowait' ];
58a5c8
+
e8fd09
+        // Make sure renderStats is sorted as necessary for rendering
e8fd09
+        let renderStatOrder = {'cpu-total': 0, 'cpu-user': 1, 'cpu-sys': 2, 'cpu-iowait': 3};
e8fd09
+        this.renderStats = this.renderStats.sort(function(a,b) {
e8fd09
+            return renderStatOrder[a] - renderStatOrder[b];
e8fd09
+        });
e8fd09
+
e8fd09
+	this.setLabelText(_("CPU"));
e8fd09
+    },
e8fd09
+
e8fd09
+    _initValues: function() {
e8fd09
+        this._prev = new GTop.glibtop_cpu;
e8fd09
+        GTop.glibtop_get_cpu(this._prev);
e8fd09
+
58a5c8
+        this.stats = {
e8fd09
+                       'cpu-user': {color: '-cpu-user-color', values: []},
e8fd09
+                       'cpu-sys': {color: '-cpu-sys-color', values: []},
e8fd09
+                       'cpu-iowait': {color: '-cpu-iowait-color', values: []},
58a5c8
+                       'cpu-total': {color: '-cpu-total-color', values: []}
e8fd09
+                     };
e8fd09
+    },
e8fd09
+
e8fd09
+    _updateValues: function() {
e8fd09
+        let cpu = new GTop.glibtop_cpu;
e8fd09
+        let t = 0.0;
e8fd09
+        GTop.glibtop_get_cpu(cpu);
e8fd09
+        let total = cpu.total - this._prev.total;
e8fd09
+        let user = cpu.user - this._prev.user;
e8fd09
+        let sys = cpu.sys - this._prev.sys;
e8fd09
+        let iowait = cpu.iowait - this._prev.iowait;
e8fd09
+        let idle = cpu.idle - this._prev.idle;
e8fd09
+
e8fd09
+        t += iowait / total;
e8fd09
+        this.stats['cpu-iowait'].values.push(t);
e8fd09
+        t += sys / total;
e8fd09
+        this.stats['cpu-sys'].values.push(t);
e8fd09
+        t += user / total;
e8fd09
+        this.stats['cpu-user'].values.push(t);
e8fd09
+        this.stats['cpu-total'].values.push(1 - idle / total);
58a5c8
+
e8fd09
+        this._prev = cpu;
e8fd09
+    }
e8fd09
+});
e8fd09
+
e8fd09
+const MemoryIndicator = new Lang.Class({
e8fd09
+    Name: 'SystemMonitor.MemoryIndicator',
e8fd09
+    Extends: Indicator,
58a5c8
+
e8fd09
+    _init: function() {
e8fd09
+        this.parent();
e8fd09
+
e8fd09
+        this.gridColor = '-grid-color';
e8fd09
+        this.renderStats = [ 'mem-user', 'mem-other', 'mem-cached' ];
58a5c8
+
e8fd09
+        // Make sure renderStats is sorted as necessary for rendering
e8fd09
+        let renderStatOrder = { 'mem-cached': 0, 'mem-other': 1, 'mem-user': 2 };
e8fd09
+        this.renderStats = this.renderStats.sort(function(a,b) {
e8fd09
+            return renderStatOrder[a] - renderStatOrder[b];
e8fd09
+        });
e8fd09
+
e8fd09
+	this.setLabelText(_("Memory"));
e8fd09
+    },
e8fd09
+
e8fd09
+    _initValues: function() {
e8fd09
+        this.mem = new GTop.glibtop_mem;
e8fd09
+        this.stats = {
e8fd09
+                        'mem-user': { color: "-mem-user-color", values: [] },
e8fd09
+                        'mem-other': { color: "-mem-other-color", values: [] },
e8fd09
+                        'mem-cached': { color: "-mem-cached-color", values: [] }
e8fd09
+                     };
e8fd09
+    },
e8fd09
+
e8fd09
+    _updateValues: function() {
e8fd09
+        GTop.glibtop_get_mem(this.mem);
e8fd09
+
e8fd09
+        let t = this.mem.user / this.mem.total;
e8fd09
+        this.stats['mem-user'].values.push(t);
e8fd09
+        t += (this.mem.used - this.mem.user - this.mem.cached) / this.mem.total;
e8fd09
+        this.stats['mem-other'].values.push(t);
e8fd09
+        t += this.mem.cached / this.mem.total;
e8fd09
+        this.stats['mem-cached'].values.push(t);
e8fd09
+    }
e8fd09
+});
e8fd09
+
e8fd09
+const INDICATORS = [CpuIndicator, MemoryIndicator];
e8fd09
+
e8fd09
+const Extension = new Lang.Class({
e8fd09
+    Name: 'SystemMonitor.Extension',
e8fd09
+
e8fd09
+    _init: function() {
e8fd09
+	Convenience.initTranslations();
e8fd09
+
e8fd09
+	this._showLabelTimeoutId = 0;
e8fd09
+	this._resetHoverTimeoutId = 0;
e8fd09
+	this._labelShowing = false;
e8fd09
+    },
e8fd09
+
e8fd09
+    enable: function() {
e8fd09
+	this._box = new St.BoxLayout({ style_class: 'extension-systemMonitor-container',
e8fd09
+				       x_align: Clutter.ActorAlign.START,
e8fd09
+				       x_expand: true });
e8fd09
+	this._indicators = [ ];
e8fd09
+
e8fd09
+	for (let i = 0; i < INDICATORS.length; i++) {
e8fd09
+	    let indicator = new (INDICATORS[i])();
e8fd09
+
e8fd09
+            indicator.actor.connect('notify::hover', Lang.bind(this, function() {
e8fd09
+		this._onHover(indicator);
e8fd09
+	    }));
e8fd09
+	    this._box.add_actor(indicator.actor);
e8fd09
+	    this._indicators.push(indicator);
e8fd09
+	}
e8fd09
+
e8fd09
+	this._boxHolder = new St.BoxLayout({ x_expand: true,
e8fd09
+					     y_expand: true,
e8fd09
+					     x_align: Clutter.ActorAlign.START,
e8fd09
+					   });
e8fd09
+	let menuButton = Main.messageTray._messageTrayMenuButton.actor;
e8fd09
+	Main.messageTray.actor.remove_child(menuButton);
e8fd09
+	Main.messageTray.actor.add_child(this._boxHolder);
e8fd09
+
e8fd09
+	this._boxHolder.add_child(this._box);
e8fd09
+	this._boxHolder.add_child(menuButton);
e8fd09
+    },
e8fd09
+
e8fd09
+    disable: function() {
e8fd09
+	this._indicators.forEach(function(i) { i.destroy(); });
e8fd09
+
e8fd09
+	let menuButton = Main.messageTray._messageTrayMenuButton.actor;
e8fd09
+	this._boxHolder.remove_child(menuButton);
e8fd09
+	Main.messageTray.actor.add_child(menuButton);
e8fd09
+
e8fd09
+	this._box.destroy();
e8fd09
+	this._boxHolder.destroy();
e8fd09
+    },
e8fd09
+
e8fd09
+    _onHover: function (item) {
e8fd09
+        if (item.actor.get_hover()) {
e8fd09
+            if (this._showLabelTimeoutId == 0) {
e8fd09
+                let timeout = this._labelShowing ? 0 : ITEM_HOVER_TIMEOUT;
e8fd09
+                this._showLabelTimeoutId = Mainloop.timeout_add(timeout,
e8fd09
+                    Lang.bind(this, function() {
e8fd09
+                        this._labelShowing = true;
e8fd09
+                        item.showLabel();
e8fd09
+                        return false;
e8fd09
+                    }));
e8fd09
+                if (this._resetHoverTimeoutId > 0) {
e8fd09
+                    Mainloop.source_remove(this._resetHoverTimeoutId);
e8fd09
+                    this._resetHoverTimeoutId = 0;
e8fd09
+                }
e8fd09
+            }
e8fd09
+        } else {
e8fd09
+            if (this._showLabelTimeoutId > 0)
e8fd09
+                Mainloop.source_remove(this._showLabelTimeoutId);
e8fd09
+            this._showLabelTimeoutId = 0;
e8fd09
+            item.hideLabel();
e8fd09
+            if (this._labelShowing) {
e8fd09
+                this._resetHoverTimeoutId = Mainloop.timeout_add(ITEM_HOVER_TIMEOUT,
e8fd09
+                    Lang.bind(this, function() {
e8fd09
+                        this._labelShowing = false;
e8fd09
+                        return false;
e8fd09
+                    }));
e8fd09
+            }
e8fd09
+        }
e8fd09
+    },
e8fd09
+});
e8fd09
+
e8fd09
+function init() {
e8fd09
+    return new Extension();
e8fd09
+}
58a5c8
diff --git a/extensions/systemMonitor/meson.build b/extensions/systemMonitor/meson.build
58a5c8
new file mode 100644
58a5c8
index 0000000..48504f6
58a5c8
--- /dev/null
58a5c8
+++ b/extensions/systemMonitor/meson.build
58a5c8
@@ -0,0 +1,5 @@
58a5c8
+extension_data += configure_file(
58a5c8
+  input: metadata_name + '.in',
58a5c8
+  output: metadata_name,
58a5c8
+  configuration: metadata_conf
58a5c8
+)
e8fd09
diff --git a/extensions/systemMonitor/metadata.json.in b/extensions/systemMonitor/metadata.json.in
e8fd09
new file mode 100644
e8fd09
index 0000000..fa75007
e8fd09
--- /dev/null
e8fd09
+++ b/extensions/systemMonitor/metadata.json.in
e8fd09
@@ -0,0 +1,11 @@
e8fd09
+{
e8fd09
+    "shell-version": ["@shell_current@" ],
e8fd09
+    "uuid": "@uuid@",
e8fd09
+    "extension-id": "@extension_id@",
e8fd09
+    "settings-schema": "@gschemaname@",
e8fd09
+    "gettext-domain": "@gettext_domain@",
e8fd09
+    "original-author": "zaspire@rambler.ru",
e8fd09
+    "name": "SystemMonitor",
e8fd09
+    "description": "System monitor showing CPU and memory usage in the message tray.",
e8fd09
+    "url": "@url@"
e8fd09
+}
e8fd09
diff --git a/extensions/systemMonitor/stylesheet.css b/extensions/systemMonitor/stylesheet.css
e8fd09
new file mode 100644
e8fd09
index 0000000..13f95ec
e8fd09
--- /dev/null
e8fd09
+++ b/extensions/systemMonitor/stylesheet.css
e8fd09
@@ -0,0 +1,35 @@
e8fd09
+.extension-systemMonitor-container {
e8fd09
+    spacing: 5px;
e8fd09
+    padding-left: 5px;
e8fd09
+    padding-right: 5px;
e8fd09
+    padding-bottom: 10px;
e8fd09
+    padding-top: 10px;
e8fd09
+}
e8fd09
+
e8fd09
+.extension-systemMonitor-indicator-area {
e8fd09
+    border: 1px solid #8d8d8d;
e8fd09
+    border-radius: 3px;
e8fd09
+    width: 100px;
e8fd09
+    /* message tray is 72px, so 20px padding of the container,
e8fd09
+       2px of border, makes it 50px */
e8fd09
+    height: 50px;
e8fd09
+    -grid-color: #575757;
e8fd09
+    -cpu-total-color: rgb(0,154,62);
e8fd09
+    -cpu-user-color: rgb(69,154,0);
e8fd09
+    -cpu-sys-color: rgb(255,253,81);
e8fd09
+    -cpu-iowait-color: rgb(210,148,0);
e8fd09
+    -mem-user-color: rgb(210,148,0);
e8fd09
+    -mem-cached-color: rgb(90,90,90);
e8fd09
+    -mem-other-color: rgb(205,203,41);
e8fd09
+    background-color: #1e1e1e;
e8fd09
+}
e8fd09
+
e8fd09
+.extension-systemMonitor-indicator-label {
e8fd09
+    border-radius: 7px;
e8fd09
+    padding: 4px 12px;
e8fd09
+    background-color: rgba(0,0,0,0.9);
e8fd09
+    text-align: center;
e8fd09
+    -y-offset: 8px;
e8fd09
+    font-size: 9pt;
e8fd09
+    font-weight: bold;
e8fd09
+}
58a5c8
diff --git a/meson.build b/meson.build
5ba545
index 7562eb1..955b5ee 100644
58a5c8
--- a/meson.build
58a5c8
+++ b/meson.build
5ba545
@@ -58,6 +58,7 @@ all_extensions += [
58a5c8
   'native-window-placement',
58a5c8
   'no-hot-corner',
58a5c8
   'panel-favorites',
58a5c8
+  'systemMonitor',
58a5c8
   'top-icons',
58a5c8
   'updates-dialog',
5ba545
   'user-theme',
e8fd09
-- 
5ba545
2.21.0
e8fd09
e8fd09
5ba545
From 2f3092238bf17bf41749674dd94bf4609a955624 Mon Sep 17 00:00:00 2001
e8fd09
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
e8fd09
Date: Wed, 17 May 2017 19:31:58 +0200
e8fd09
Subject: [PATCH 2/4] systemMonitor: Move indicators to calendar
e8fd09
e8fd09
The message tray joined the invisible choir, so we have to find
e8fd09
a new home for the extension UI. The message list in the calendar
e8fd09
drop-down looks like the best option, given that it replaced the
e8fd09
old tray (and also took over the old keyboard shortcut to bring
e8fd09
it up quickly).
e8fd09
---
58a5c8
 extensions/systemMonitor/extension.js   | 56 ++++++++++++-------------
58a5c8
 extensions/systemMonitor/stylesheet.css | 14 -------
e8fd09
 2 files changed, 28 insertions(+), 42 deletions(-)
e8fd09
e8fd09
diff --git a/extensions/systemMonitor/extension.js b/extensions/systemMonitor/extension.js
58a5c8
index 7b09df0..1388a1f 100644
e8fd09
--- a/extensions/systemMonitor/extension.js
e8fd09
+++ b/extensions/systemMonitor/extension.js
58a5c8
@@ -1,132 +1,146 @@
58a5c8
 /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
58a5c8
 
58a5c8
 const Clutter = imports.gi.Clutter;
e8fd09
 const GTop = imports.gi.GTop;
e8fd09
 const Lang = imports.lang;
e8fd09
 const Mainloop = imports.mainloop;
e8fd09
+const Signals = imports.signals;
e8fd09
 const St = imports.gi.St;
e8fd09
 const Shell = imports.gi.Shell;
e8fd09
 
e8fd09
 const Main = imports.ui.main;
e8fd09
+const MessageList = imports.ui.messageList;
e8fd09
 const Tweener = imports.ui.tweener;
e8fd09
 
e8fd09
 const Gettext = imports.gettext.domain('gnome-shell-extensions');
58a5c8
 const _ = Gettext.gettext;
58a5c8
 
58a5c8
 const ExtensionUtils = imports.misc.extensionUtils;
58a5c8
 const Me = ExtensionUtils.getCurrentExtension();
58a5c8
 const Convenience = Me.imports.convenience;
58a5c8
 
58a5c8
 const INDICATOR_UPDATE_INTERVAL = 500;
58a5c8
 const INDICATOR_NUM_GRID_LINES = 3;
58a5c8
 
58a5c8
 const ITEM_LABEL_SHOW_TIME = 0.15;
58a5c8
 const ITEM_LABEL_HIDE_TIME = 0.1;
58a5c8
 const ITEM_HOVER_TIMEOUT = 300;
58a5c8
 
58a5c8
 const Indicator = new Lang.Class({
58a5c8
     Name: 'SystemMonitor.Indicator',
e8fd09
 
e8fd09
     _init: function() {
e8fd09
         this._initValues();
e8fd09
-        this.drawing_area = new St.DrawingArea({ reactive: true });
e8fd09
+        this.drawing_area = new St.DrawingArea();
e8fd09
         this.drawing_area.connect('repaint', Lang.bind(this, this._draw));
e8fd09
-        this.drawing_area.connect('button-press-event', function() {
e8fd09
+
e8fd09
+        this.actor = new St.Button({ style_class: "message message-content extension-systemMonitor-indicator-area",
e8fd09
+				      x_expand: true, x_fill: true,
e8fd09
+                                      y_fill: true, can_focus: true });
e8fd09
+        this.actor.add_actor(this.drawing_area);
e8fd09
+
e8fd09
+        this.actor.connect('clicked', function() {
e8fd09
             let app = Shell.AppSystem.get_default().lookup_app('gnome-system-monitor.desktop');
e8fd09
             app.open_new_window(-1);
e8fd09
-            return true;
e8fd09
-        });
e8fd09
 
e8fd09
-        this.actor = new St.Bin({ style_class: "extension-systemMonitor-indicator-area",
e8fd09
-                                  reactive: true, track_hover: true,
e8fd09
-				  x_fill: true, y_fill: true });
e8fd09
-        this.actor.add_actor(this.drawing_area);
e8fd09
+            Main.overview.hide();
e8fd09
+            Main.panel.closeCalendar();
e8fd09
+        });
e8fd09
 
e8fd09
         this._timeout = Mainloop.timeout_add(INDICATOR_UPDATE_INTERVAL, Lang.bind(this, function () {
e8fd09
             this._updateValues();
58a5c8
             this.drawing_area.queue_repaint();
58a5c8
             return true;
58a5c8
         }));
58a5c8
     },
58a5c8
 
58a5c8
     showLabel: function() {
58a5c8
         if (this.label == null)
58a5c8
             return;
58a5c8
 
58a5c8
         this.label.opacity = 0;
58a5c8
         this.label.show();
58a5c8
 
58a5c8
         let [stageX, stageY] = this.actor.get_transformed_position();
58a5c8
 
58a5c8
 	let itemWidth = this.actor.allocation.x2 - this.actor.allocation.x1;
58a5c8
         let itemHeight = this.actor.allocation.y2 - this.actor.allocation.y1;
58a5c8
 
58a5c8
 	let labelWidth = this.label.width;
58a5c8
         let labelHeight = this.label.height;
58a5c8
         let xOffset = Math.floor((itemWidth - labelWidth) / 2)
58a5c8
 
58a5c8
         let x = stageX + xOffset;
58a5c8
 
58a5c8
         let node = this.label.get_theme_node();
58a5c8
         let yOffset = node.get_length('-y-offset');
58a5c8
 
e8fd09
         let y = stageY - this.label.get_height() - yOffset;
e8fd09
 
e8fd09
         this.label.set_position(x, y);
e8fd09
+        this.label.get_parent().set_child_above_sibling(this.label, null);
e8fd09
         Tweener.addTween(this.label,
e8fd09
                          { opacity: 255,
e8fd09
                            time: ITEM_LABEL_SHOW_TIME,
58a5c8
                            transition: 'easeOutQuad',
58a5c8
                          });
58a5c8
     },
58a5c8
 
58a5c8
     setLabelText: function(text) {
58a5c8
         if (this.label == null)
58a5c8
             this.label = new St.Label({ style_class: 'extension-systemMonitor-indicator-label'});
58a5c8
 
58a5c8
         this.label.set_text(text);
58a5c8
         Main.layoutManager.addChrome(this.label);
58a5c8
         this.label.hide();
58a5c8
     },
58a5c8
 
58a5c8
     hideLabel: function () {
58a5c8
         Tweener.addTween(this.label,
58a5c8
                          { opacity: 0,
58a5c8
                            time: ITEM_LABEL_HIDE_TIME,
58a5c8
                            transition: 'easeOutQuad',
58a5c8
                            onComplete: Lang.bind(this, function() {
58a5c8
                                this.label.hide();
58a5c8
                            })
e8fd09
                          });
e8fd09
     },
e8fd09
 
e8fd09
+    /* MessageList.Message boilerplate */
e8fd09
+    canClose: function() {
e8fd09
+        return false;
e8fd09
+    },
e8fd09
+
e8fd09
+    clear: function() {
e8fd09
+    },
e8fd09
+
e8fd09
     destroy: function() {
e8fd09
         Mainloop.source_remove(this._timeout);
e8fd09
 
58a5c8
         this.actor.destroy();
58a5c8
 	if (this.label)
58a5c8
 	    this.label.destroy();
58a5c8
     },
58a5c8
 
58a5c8
     _initValues: function() {
58a5c8
     },
58a5c8
 
58a5c8
     _updateValues: function() {
58a5c8
     },
58a5c8
 
58a5c8
     _draw: function(area) {
58a5c8
         let [width, height] = area.get_surface_size();
58a5c8
         let themeNode = this.actor.get_theme_node();
58a5c8
         let cr = area.get_context();
58a5c8
 
58a5c8
         //draw the background grid
58a5c8
         let color = themeNode.get_color(this.gridColor);
58a5c8
         let gridOffset = Math.floor(height / (INDICATOR_NUM_GRID_LINES + 1));
58a5c8
         for (let i = 1; i <= INDICATOR_NUM_GRID_LINES; ++i) {
58a5c8
                 cr.moveTo(0, i * gridOffset + .5);
58a5c8
                 cr.lineTo(width, i * gridOffset + .5);
58a5c8
         }
58a5c8
         Clutter.cairo_set_source_color(cr, color);
58a5c8
         cr.setLineWidth(1);
58a5c8
         cr.setDash([4,1], 0);
58a5c8
         cr.stroke();
58a5c8
@@ -167,60 +181,61 @@ const Indicator = new Lang.Class({
58a5c8
             // We outline at full opacity and fill with 40% opacity
58a5c8
             let outlineColor = themeNode.get_color(stat.color);
58a5c8
             let color = new Clutter.Color(outlineColor);
58a5c8
             color.alpha = color.alpha * .4;
58a5c8
 
58a5c8
             // Render the background between us and the next level
58a5c8
             makePath(stat.values, false);
58a5c8
             // If there is a process below us, render the cpu between us and it, otherwise,
58a5c8
             // render to the bottom of the chart
58a5c8
             if (i == renderStats.length - 1) {
58a5c8
                 cr.lineTo(stat.values.length - 1, height);
58a5c8
                 cr.lineTo(0, height);
58a5c8
                 cr.closePath();
58a5c8
             } else {
58a5c8
                 let nextStat = this.stats[renderStats[i+1]];
58a5c8
                 makePath(nextStat.values, true);
58a5c8
             }
58a5c8
             cr.closePath()
58a5c8
             Clutter.cairo_set_source_color(cr, color);
58a5c8
             cr.fill();
58a5c8
 
58a5c8
             // Render the outline of this level
58a5c8
             makePath(stat.values, false, .5);
58a5c8
             Clutter.cairo_set_source_color(cr, outlineColor);
58a5c8
             cr.setLineWidth(1.0);
58a5c8
             cr.setDash([], 0);
58a5c8
             cr.stroke();
e8fd09
         }
e8fd09
     }
e8fd09
 });
e8fd09
+Signals.addSignalMethods(Indicator.prototype); // For MessageList.Message compat
e8fd09
 
e8fd09
 const CpuIndicator = new Lang.Class({
e8fd09
     Name: 'SystemMonitor.CpuIndicator',
58a5c8
     Extends: Indicator,
58a5c8
 
58a5c8
     _init: function() {
58a5c8
         this.parent();
58a5c8
 
58a5c8
         this.gridColor = '-grid-color';
58a5c8
         this.renderStats = [ 'cpu-user', 'cpu-sys', 'cpu-iowait' ];
58a5c8
 
58a5c8
         // Make sure renderStats is sorted as necessary for rendering
58a5c8
         let renderStatOrder = {'cpu-total': 0, 'cpu-user': 1, 'cpu-sys': 2, 'cpu-iowait': 3};
58a5c8
         this.renderStats = this.renderStats.sort(function(a,b) {
58a5c8
             return renderStatOrder[a] - renderStatOrder[b];
58a5c8
         });
58a5c8
 
58a5c8
 	this.setLabelText(_("CPU"));
58a5c8
     },
58a5c8
 
58a5c8
     _initValues: function() {
58a5c8
         this._prev = new GTop.glibtop_cpu;
58a5c8
         GTop.glibtop_get_cpu(this._prev);
58a5c8
 
58a5c8
         this.stats = {
58a5c8
                        'cpu-user': {color: '-cpu-user-color', values: []},
58a5c8
                        'cpu-sys': {color: '-cpu-sys-color', values: []},
58a5c8
                        'cpu-iowait': {color: '-cpu-iowait-color', values: []},
58a5c8
                        'cpu-total': {color: '-cpu-total-color', values: []}
58a5c8
                      };
58a5c8
@@ -275,96 +290,81 @@ const MemoryIndicator = new Lang.Class({
58a5c8
                         'mem-cached': { color: "-mem-cached-color", values: [] }
58a5c8
                      };
58a5c8
     },
58a5c8
 
58a5c8
     _updateValues: function() {
58a5c8
         GTop.glibtop_get_mem(this.mem);
58a5c8
 
58a5c8
         let t = this.mem.user / this.mem.total;
58a5c8
         this.stats['mem-user'].values.push(t);
58a5c8
         t += (this.mem.used - this.mem.user - this.mem.cached) / this.mem.total;
58a5c8
         this.stats['mem-other'].values.push(t);
58a5c8
         t += this.mem.cached / this.mem.total;
58a5c8
         this.stats['mem-cached'].values.push(t);
58a5c8
     }
58a5c8
 });
58a5c8
 
58a5c8
 const INDICATORS = [CpuIndicator, MemoryIndicator];
58a5c8
 
58a5c8
 const Extension = new Lang.Class({
58a5c8
     Name: 'SystemMonitor.Extension',
58a5c8
 
58a5c8
     _init: function() {
58a5c8
 	Convenience.initTranslations();
58a5c8
 
58a5c8
 	this._showLabelTimeoutId = 0;
58a5c8
 	this._resetHoverTimeoutId = 0;
58a5c8
 	this._labelShowing = false;
e8fd09
     },
e8fd09
 
e8fd09
     enable: function() {
e8fd09
-	this._box = new St.BoxLayout({ style_class: 'extension-systemMonitor-container',
e8fd09
-				       x_align: Clutter.ActorAlign.START,
e8fd09
-				       x_expand: true });
e8fd09
+	this._section = new MessageList.MessageListSection(_("System Monitor"));
e8fd09
 	this._indicators = [ ];
e8fd09
 
e8fd09
 	for (let i = 0; i < INDICATORS.length; i++) {
58a5c8
 	    let indicator = new (INDICATORS[i])();
58a5c8
 
e8fd09
             indicator.actor.connect('notify::hover', Lang.bind(this, function() {
e8fd09
 		this._onHover(indicator);
e8fd09
 	    }));
e8fd09
-	    this._box.add_actor(indicator.actor);
e8fd09
+	    this._section.addMessage(indicator, false);
e8fd09
 	    this._indicators.push(indicator);
e8fd09
 	}
e8fd09
 
e8fd09
-	this._boxHolder = new St.BoxLayout({ x_expand: true,
e8fd09
-					     y_expand: true,
e8fd09
-					     x_align: Clutter.ActorAlign.START,
e8fd09
-					   });
e8fd09
-	let menuButton = Main.messageTray._messageTrayMenuButton.actor;
e8fd09
-	Main.messageTray.actor.remove_child(menuButton);
e8fd09
-	Main.messageTray.actor.add_child(this._boxHolder);
e8fd09
-
e8fd09
-	this._boxHolder.add_child(this._box);
e8fd09
-	this._boxHolder.add_child(menuButton);
e8fd09
+        Main.panel.statusArea.dateMenu._messageList._addSection(this._section);
e8fd09
+        this._section.actor.get_parent().set_child_at_index(this._section.actor, 0);
e8fd09
     },
e8fd09
 
e8fd09
     disable: function() {
e8fd09
 	this._indicators.forEach(function(i) { i.destroy(); });
e8fd09
 
e8fd09
-	let menuButton = Main.messageTray._messageTrayMenuButton.actor;
e8fd09
-	this._boxHolder.remove_child(menuButton);
e8fd09
-	Main.messageTray.actor.add_child(menuButton);
e8fd09
-
e8fd09
-	this._box.destroy();
e8fd09
-	this._boxHolder.destroy();
e8fd09
+        Main.panel.statusArea.dateMenu._messageList._removeSection(this._section);
e8fd09
     },
e8fd09
 
e8fd09
     _onHover: function (item) {
58a5c8
         if (item.actor.get_hover()) {
58a5c8
             if (this._showLabelTimeoutId == 0) {
58a5c8
                 let timeout = this._labelShowing ? 0 : ITEM_HOVER_TIMEOUT;
58a5c8
                 this._showLabelTimeoutId = Mainloop.timeout_add(timeout,
58a5c8
                     Lang.bind(this, function() {
58a5c8
                         this._labelShowing = true;
58a5c8
                         item.showLabel();
58a5c8
                         return false;
58a5c8
                     }));
58a5c8
                 if (this._resetHoverTimeoutId > 0) {
58a5c8
                     Mainloop.source_remove(this._resetHoverTimeoutId);
58a5c8
                     this._resetHoverTimeoutId = 0;
58a5c8
                 }
58a5c8
             }
58a5c8
         } else {
58a5c8
             if (this._showLabelTimeoutId > 0)
58a5c8
                 Mainloop.source_remove(this._showLabelTimeoutId);
58a5c8
             this._showLabelTimeoutId = 0;
58a5c8
             item.hideLabel();
58a5c8
             if (this._labelShowing) {
58a5c8
                 this._resetHoverTimeoutId = Mainloop.timeout_add(ITEM_HOVER_TIMEOUT,
58a5c8
                     Lang.bind(this, function() {
58a5c8
                         this._labelShowing = false;
58a5c8
                         return false;
58a5c8
                     }));
58a5c8
             }
58a5c8
         }
e8fd09
diff --git a/extensions/systemMonitor/stylesheet.css b/extensions/systemMonitor/stylesheet.css
e8fd09
index 13f95ec..978ac12 100644
e8fd09
--- a/extensions/systemMonitor/stylesheet.css
e8fd09
+++ b/extensions/systemMonitor/stylesheet.css
58a5c8
@@ -1,35 +1,21 @@
e8fd09
-.extension-systemMonitor-container {
e8fd09
-    spacing: 5px;
e8fd09
-    padding-left: 5px;
e8fd09
-    padding-right: 5px;
e8fd09
-    padding-bottom: 10px;
e8fd09
-    padding-top: 10px;
e8fd09
-}
e8fd09
-
e8fd09
 .extension-systemMonitor-indicator-area {
e8fd09
-    border: 1px solid #8d8d8d;
e8fd09
-    border-radius: 3px;
e8fd09
-    width: 100px;
e8fd09
-    /* message tray is 72px, so 20px padding of the container,
e8fd09
-       2px of border, makes it 50px */
e8fd09
     height: 50px;
e8fd09
     -grid-color: #575757;
e8fd09
     -cpu-total-color: rgb(0,154,62);
58a5c8
     -cpu-user-color: rgb(69,154,0);
58a5c8
     -cpu-sys-color: rgb(255,253,81);
58a5c8
     -cpu-iowait-color: rgb(210,148,0);
e8fd09
     -mem-user-color: rgb(210,148,0);
e8fd09
     -mem-cached-color: rgb(90,90,90);
e8fd09
     -mem-other-color: rgb(205,203,41);
e8fd09
-    background-color: #1e1e1e;
e8fd09
 }
e8fd09
 
e8fd09
 .extension-systemMonitor-indicator-label {
58a5c8
     border-radius: 7px;
58a5c8
     padding: 4px 12px;
58a5c8
     background-color: rgba(0,0,0,0.9);
58a5c8
     text-align: center;
58a5c8
     -y-offset: 8px;
58a5c8
     font-size: 9pt;
58a5c8
     font-weight: bold;
58a5c8
 }
e8fd09
-- 
58a5c8
2.17.1
e8fd09
e8fd09
58a5c8
From e1133a8a92c49a90e02f8d2f1e66c7aae9d19519 Mon Sep 17 00:00:00 2001
e8fd09
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
e8fd09
Date: Thu, 18 May 2017 16:20:07 +0200
e8fd09
Subject: [PATCH 3/4] systemMonitor: Handle clicks on section title
e8fd09
e8fd09
While on 3.24.x only the event section still has a clickable title,
e8fd09
it's a generic message list feature in previous versions. It's easy
e8fd09
enough to support with a small subclass, so use that instead of
e8fd09
the generic baseclass.
e8fd09
e8fd09
Fixes: #3
e8fd09
---
e8fd09
 extensions/systemMonitor/extension.js | 20 +++++++++++++++++++-
e8fd09
 1 file changed, 19 insertions(+), 1 deletion(-)
e8fd09
e8fd09
diff --git a/extensions/systemMonitor/extension.js b/extensions/systemMonitor/extension.js
58a5c8
index 1388a1f..9c010d8 100644
e8fd09
--- a/extensions/systemMonitor/extension.js
e8fd09
+++ b/extensions/systemMonitor/extension.js
58a5c8
@@ -276,75 +276,93 @@ const MemoryIndicator = new Lang.Class({
58a5c8
         // Make sure renderStats is sorted as necessary for rendering
58a5c8
         let renderStatOrder = { 'mem-cached': 0, 'mem-other': 1, 'mem-user': 2 };
58a5c8
         this.renderStats = this.renderStats.sort(function(a,b) {
58a5c8
             return renderStatOrder[a] - renderStatOrder[b];
58a5c8
         });
58a5c8
 
58a5c8
 	this.setLabelText(_("Memory"));
58a5c8
     },
58a5c8
 
58a5c8
     _initValues: function() {
58a5c8
         this.mem = new GTop.glibtop_mem;
58a5c8
         this.stats = {
58a5c8
                         'mem-user': { color: "-mem-user-color", values: [] },
58a5c8
                         'mem-other': { color: "-mem-other-color", values: [] },
58a5c8
                         'mem-cached': { color: "-mem-cached-color", values: [] }
58a5c8
                      };
58a5c8
     },
58a5c8
 
58a5c8
     _updateValues: function() {
58a5c8
         GTop.glibtop_get_mem(this.mem);
58a5c8
 
58a5c8
         let t = this.mem.user / this.mem.total;
58a5c8
         this.stats['mem-user'].values.push(t);
58a5c8
         t += (this.mem.used - this.mem.user - this.mem.cached) / this.mem.total;
58a5c8
         this.stats['mem-other'].values.push(t);
58a5c8
         t += this.mem.cached / this.mem.total;
58a5c8
         this.stats['mem-cached'].values.push(t);
e8fd09
     }
e8fd09
 });
e8fd09
 
e8fd09
+const SystemMonitorSection = new Lang.Class({
e8fd09
+    Name: 'SystemMonitorSection',
e8fd09
+    Extends: MessageList.MessageListSection,
e8fd09
+
e8fd09
+    _init: function() {
e8fd09
+        this.parent(_("System Monitor"));
e8fd09
+    },
e8fd09
+
e8fd09
+    _onTitleClicked: function() {
e8fd09
+        this.parent();
e8fd09
+
e8fd09
+        let appSys = Shell.AppSystem.get_default();
e8fd09
+        let app = appSys.lookup_app('gnome-system-monitor.desktop');
e8fd09
+        if (app)
e8fd09
+            app.open_new_window(-1);
e8fd09
+    }
e8fd09
+});
e8fd09
+
e8fd09
 const INDICATORS = [CpuIndicator, MemoryIndicator];
e8fd09
 
e8fd09
 const Extension = new Lang.Class({
58a5c8
     Name: 'SystemMonitor.Extension',
58a5c8
 
58a5c8
     _init: function() {
58a5c8
 	Convenience.initTranslations();
58a5c8
 
58a5c8
 	this._showLabelTimeoutId = 0;
58a5c8
 	this._resetHoverTimeoutId = 0;
58a5c8
 	this._labelShowing = false;
e8fd09
     },
e8fd09
 
e8fd09
     enable: function() {
e8fd09
-	this._section = new MessageList.MessageListSection(_("System Monitor"));
e8fd09
+	this._section = new SystemMonitorSection();
e8fd09
 	this._indicators = [ ];
e8fd09
 
e8fd09
 	for (let i = 0; i < INDICATORS.length; i++) {
58a5c8
 	    let indicator = new (INDICATORS[i])();
58a5c8
 
58a5c8
             indicator.actor.connect('notify::hover', Lang.bind(this, function() {
58a5c8
 		this._onHover(indicator);
58a5c8
 	    }));
58a5c8
 	    this._section.addMessage(indicator, false);
58a5c8
 	    this._indicators.push(indicator);
58a5c8
 	}
58a5c8
 
58a5c8
         Main.panel.statusArea.dateMenu._messageList._addSection(this._section);
58a5c8
         this._section.actor.get_parent().set_child_at_index(this._section.actor, 0);
58a5c8
     },
58a5c8
 
58a5c8
     disable: function() {
58a5c8
 	this._indicators.forEach(function(i) { i.destroy(); });
58a5c8
 
58a5c8
         Main.panel.statusArea.dateMenu._messageList._removeSection(this._section);
58a5c8
     },
58a5c8
 
58a5c8
     _onHover: function (item) {
58a5c8
         if (item.actor.get_hover()) {
58a5c8
             if (this._showLabelTimeoutId == 0) {
58a5c8
                 let timeout = this._labelShowing ? 0 : ITEM_HOVER_TIMEOUT;
58a5c8
                 this._showLabelTimeoutId = Mainloop.timeout_add(timeout,
58a5c8
                     Lang.bind(this, function() {
58a5c8
                         this._labelShowing = true;
58a5c8
                         item.showLabel();
e8fd09
-- 
58a5c8
2.17.1
e8fd09
e8fd09
58a5c8
From d2a0c7bfdb3fedf56021b6fd64628e4cda1aa294 Mon Sep 17 00:00:00 2001
e8fd09
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
e8fd09
Date: Thu, 18 May 2017 18:00:17 +0200
e8fd09
Subject: [PATCH 4/4] systemMonitor: Provide classic styling
e8fd09
e8fd09
The indicator tooltips currently don't work out in classic mode
e8fd09
(dark text on dark background), so provide some mode-specific
e8fd09
style.
e8fd09
e8fd09
Fixes: #4
e8fd09
---
e8fd09
 extensions/systemMonitor/classic.css | 6 ++++++
58a5c8
 extensions/systemMonitor/meson.build | 4 ++++
58a5c8
 2 files changed, 10 insertions(+)
e8fd09
 create mode 100644 extensions/systemMonitor/classic.css
e8fd09
e8fd09
diff --git a/extensions/systemMonitor/classic.css b/extensions/systemMonitor/classic.css
e8fd09
new file mode 100644
e8fd09
index 0000000..946863d
e8fd09
--- /dev/null
e8fd09
+++ b/extensions/systemMonitor/classic.css
e8fd09
@@ -0,0 +1,6 @@
e8fd09
+@import url("stylesheet.css");
e8fd09
+
e8fd09
+.extension-systemMonitor-indicator-label {
e8fd09
+    background-color: rgba(237,237,237,0.9);
e8fd09
+    border: 1px solid #a1a1a1;
e8fd09
+}
58a5c8
diff --git a/extensions/systemMonitor/meson.build b/extensions/systemMonitor/meson.build
58a5c8
index 48504f6..b6548b1 100644
58a5c8
--- a/extensions/systemMonitor/meson.build
58a5c8
+++ b/extensions/systemMonitor/meson.build
58a5c8
@@ -1,5 +1,9 @@
58a5c8
 extension_data += configure_file(
58a5c8
   input: metadata_name + '.in',
58a5c8
   output: metadata_name,
58a5c8
   configuration: metadata_conf
58a5c8
 )
58a5c8
+
58a5c8
+if classic_mode_enabled
58a5c8
+  extension_data += files('classic.css')
58a5c8
+endif
e8fd09
-- 
58a5c8
2.17.1
e8fd09