Skip to content

Commit

Permalink
Merge pull request linuxmint#268 from Odyseus/0dyseus@SysmonitorByOrcus
Browse files Browse the repository at this point in the history
System Monitor (Fork By Odyseus) (0dyseus@SysmonitorByOrcus) update
  • Loading branch information
brownsr authored Apr 1, 2017
2 parents 2c7ae77 + 3f3b3ac commit 474f65a
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 45 deletions.
3 changes: 3 additions & 0 deletions 0dyseus@SysmonitorByOrcus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Change Log

##### 1.10
- Better handling of dependencies.

##### 1.09
- Fixed system freeze on applet removal on Cinnamon 3.2.x.
- Cleaned code of unused constants and functions.
Expand Down
31 changes: 26 additions & 5 deletions 0dyseus@SysmonitorByOrcus/HELP.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,36 @@

# Help for System Monitor applet
# Help for System Monitor (Fork By Odyseus) applet

### IMPORTANT!!!
Never delete any of the files found inside this applet folder. It might break this applet functionality.

***

<h2 style="color:red;">Bug reports, feature requests and contributions</h2>
<span style="color:red;">
If anyone has bugs to report, a feature request or a contribution, do so on <a href="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/Odyseus/CinnamonTools">this xlet GitHub page</a>.
</span>

***

### Dependencies

- **gir1.2-gtop-2.0**: The gtop library reads information about processes and the state of the
system.
- Debian based distributions: The package is called **gir1.2-gtop-2.0**.
- Archlinux based distributions: The package is called **libgtop**.
- Fedora based distributions: The package is called **libgtop2-devel**.
- **NetworkManager**: NetworkManager is a system network service that manages your network devices and connections, attempting to keep active network connectivity when available.
- Debian based distributions: The package is called **gir1.2-networkmanager-1.0**.
- Archlinux based distributions: The package is called **networkmanager**.
- Fedora based distributions: The package is called **NetworkManager**.

**Important note:** NetworkManager is only used if the **GTop** library version installed on a system is < **2.32** and doesn't support certain library calls. So, basically, if the network graph on this applet works without having installed NetworkManager, then you don't need to install it.

**Restart Cinnamon after installing the packages for the applet to recognize them.**

***

### Applet localization

- If this applet was installed from Cinnamon Settings, all of this applet's localizations were automatically installed.
Expand All @@ -17,7 +42,3 @@ Never delete any of the files found inside this applet folder. It might break th
- If you don't have/want a GitHub account:
- You can send me a [Pastebin](https://pastebin.com/) (or similar service) to my [Mint Forums account](https://forums.linuxmint.com/memberlist.php?mode=viewprofile&u=164858).
- If the source text (in English) and/or my translation to Spanish has errors/inconsistencies, feel free to report them.

### Bug reports, feature requests and contributions

If anyone has bugs to report, a feature request or a contribution, do so on [this xlet GitHub page](https://github.com/Odyseus/CinnamonTools).
8 changes: 6 additions & 2 deletions 0dyseus@SysmonitorByOrcus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
If anyone has bugs to report, a feature request or a contribution, do so on <a href="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/Odyseus/CinnamonTools">this xlet GitHub page</a>.
</span>

## System Monitor fork applet description
## System Monitor (Fork By Odyseus) applet description

This applet is a fork of [System Monitor](https://cinnamon-spices.linuxmint.com/applets/view/88) applet by Josef Michálek (a.k.a. Orcus).

Expand All @@ -20,12 +20,16 @@ This applet is a fork of [System Monitor](https://cinnamon-spices.linuxmint.com/
- I added an option to use a custom command on applet click.
- I added an option to set a custom width for each graph individually.
- I added an option to align this applet tooltip text to the left.
- Removed NetworkManager dependency (only for distros that don't support certain **gtop** library calls).
- Removed NetworkManager dependency.

## Dependencies

- **gir1.2-gtop-2.0**: The gtop library reads information about processes and the state of the
system.
- **NetworkManager**: NetworkManager is a system network service that manages your network devices and connections, attempting to keep active network connectivity when available.
- **Note:** NetworkManager is only used if the **GTop** library version installed on a system is < **2.32** and doesn't support certain library calls.

**Important note:** NetworkManager is only used if the **GTop** library version installed on a system is < **2.32** and doesn't support certain library calls. So, basically, if the network graph on this applet works without having installed NetworkManager, then you don't need to install it.

## Contributors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,32 @@
const Lang = imports.lang;
const Applet = imports.ui.applet;
const Mainloop = imports.mainloop;
const GTop = imports.gi.GTop;
const GLib = imports.gi.GLib;
const St = imports.gi.St;
const Gettext = imports.gettext;
const PopupMenu = imports.ui.popupMenu;
const Util = imports.misc.util;
const NMClient = imports.gi.NMClient;
const Gio = imports.gi.Gio;
const Settings = imports.ui.settings;
const Tooltips = imports.ui.tooltips;
const Main = imports.ui.main;

var UUID;
let GTop,
NMClient;

try {
GTop = imports.gi.GTop;
} catch (aErr) {
GTop = null;
}

try {
NMClient = imports.gi.NMClient;
} catch (aErr) {
NMClient = null;
}

let UUID;

function _(aStr) {
let customTrans = Gettext.dgettext(UUID, aStr);
Expand All @@ -56,10 +70,10 @@ function MyApplet(aMetadata, aOrientation, aPanel_height, aInstance_id) {
}

MyApplet.prototype = {
__proto__: Applet.Applet.prototype,
__proto__: Applet.IconApplet.prototype,

_init: function(aMetadata, aOrientation, aPanel_height, aInstance_id) {
Applet.Applet.prototype._init.call(this, aOrientation);
Applet.IconApplet.prototype._init.call(this, aOrientation, aPanel_height, aInstance_id);

// Condition needed for retro-compatibility.
// Mark for deletion on EOL.
Expand All @@ -69,6 +83,7 @@ MyApplet.prototype = {
this.settings = new Settings.AppletSettings(this, aMetadata.uuid, aInstance_id);

this.update_id = 0;
this.metadata = aMetadata;
this.applet_dir = aMetadata.path;
this.main_applet_dir = this.applet_dir;

Expand Down Expand Up @@ -105,6 +120,14 @@ MyApplet.prototype = {
this.tooltip = false;
}

if (!GTop) {
this._informDependency();
this._applet_icon_box.show();
return;
}

this._applet_icon_box.hide();

let ncpu = GTop.glibtop_get_sysinfo().ncpu;

if (this.pref_show_cpu_graph) {
Expand Down Expand Up @@ -148,6 +171,35 @@ MyApplet.prototype = {
}
},

_informDependency: function() {
this.set_applet_icon_symbolic_name("dialog-error");
let msg = [_("Missing dependency!!!"),
_("This applet needs the GTop library installed on your system for it to work."),
_("Read this applet help for more details (Applet context menu > Help item).")
];

let tt = _(this.metadata.name) + "\n\n" + msg.join("\n");

if (this.tooltip) {
try {
this.tooltip._tooltip.get_clutter_text().set_markup(
"<span color=\"red\"><b>" + tt + "</b></span>");
} catch (aErr) {
global.logError("System Monitor (Fork By Odyseus): " + aErr.message);
}
} else {
this.set_applet_tooltip(tt);
}

let icon = new St.Icon({
icon_name: "dialog-error",
icon_type: St.IconType.SYMBOLIC,
icon_size: 24
});

Main.criticalNotify(_(this.metadata.name), msg.join("\n"), icon);
},

_restart_cinnamon: function() {
global.reexec_self();
},
Expand Down Expand Up @@ -516,6 +568,9 @@ NetDataProvider.prototype = {
if (typeof GTop.glibtop.get_netlist === "function") {
this.devices = GTop.glibtop.get_netlist(new GTop.glibtop_netlist());
} else {
if (!NMClient)
return;

let dev = NMClient.Client.new().get_devices();
this.devices = [];
for (let i = 0; i < dev.length; ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,36 @@
padding-right: 15px !important;
}
/* pre tag tweaks */
</style></head><body><div id="mainarea"><div class="container boxed"><h1>Help for System Monitor applet</h1>
</style></head><body><div id="mainarea"><div class="container boxed"><h1>Help for System Monitor (Fork By Odyseus) applet</h1>
<h3>IMPORTANT!!!</h3>
<p>Never delete any of the files found inside this applet folder. It might break this applet functionality.</p>
<hr>
<h2 style="color:red;">Bug reports, feature requests and contributions</h2>
<span style="color:red;">
If anyone has bugs to report, a feature request or a contribution, do so on <a href="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/Odyseus/CinnamonTools">this xlet GitHub page</a>.
</span>
<hr>
<h3>Dependencies</h3>
<ul>
<li><strong>gir1.2-gtop-2.0</strong>: The gtop library reads information about processes and the state of the
system.
<ul>
<li>Debian based distributions: The package is called <strong>gir1.2-gtop-2.0</strong>.</li>
<li>Archlinux based distributions: The package is called <strong>libgtop</strong>.</li>
<li>Fedora based distributions: The package is called <strong>libgtop2-devel</strong>.</li>
</ul>
</li>
<li><strong>NetworkManager</strong>: NetworkManager is a system network service that manages your network devices and connections, attempting to keep active network connectivity when available.
<ul>
<li>Debian based distributions: The package is called <strong>gir1.2-networkmanager-1.0</strong>.</li>
<li>Archlinux based distributions: The package is called <strong>networkmanager</strong>.</li>
<li>Fedora based distributions: The package is called <strong>NetworkManager</strong>.</li>
</ul>
</li>
</ul>
<p><strong>Important note:</strong> NetworkManager is only used if the <strong>GTop</strong> library version installed on a system is &lt; <strong>2.32</strong> and doesn't support certain library calls. So, basically, if the network graph on this applet works without having installed NetworkManager, then you don't need to install it.</p>
<p><strong>Restart Cinnamon after installing the packages for the applet to recognize them.</strong></p>
<hr>
<h3>Applet localization</h3>
<ul>
<li>If this applet was installed from Cinnamon Settings, all of this applet's localizations were automatically installed.</li>
Expand All @@ -243,6 +269,4 @@ <h3>Applet localization</h3>
</li>
<li>If the source text (in English) and/or my translation to Spanish has errors/inconsistencies, feel free to report them.</li>
</ul>
<h3>Bug reports, feature requests and contributions</h3>
<p>If anyone has bugs to report, a feature request or a contribution, do so on <a href="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/Odyseus/CinnamonTools">this xlet GitHub page</a>.</p>
</div></div></body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,32 @@
const Lang = imports.lang;
const Applet = imports.ui.applet;
const Mainloop = imports.mainloop;
const GTop = imports.gi.GTop;
const GLib = imports.gi.GLib;
const St = imports.gi.St;
const Gettext = imports.gettext;
const PopupMenu = imports.ui.popupMenu;
const Util = imports.misc.util;
const NMClient = imports.gi.NMClient;
const Gio = imports.gi.Gio;
const Settings = imports.ui.settings;
const Tooltips = imports.ui.tooltips;
const Main = imports.ui.main;

var UUID;
let GTop,
NMClient;

try {
GTop = imports.gi.GTop;
} catch (aErr) {
GTop = null;
}

try {
NMClient = imports.gi.NMClient;
} catch (aErr) {
NMClient = null;
}

let UUID;

function _(aStr) {
let customTrans = Gettext.dgettext(UUID, aStr);
Expand All @@ -56,10 +70,10 @@ function MyApplet(aMetadata, aOrientation, aPanel_height, aInstance_id) {
}

MyApplet.prototype = {
__proto__: Applet.Applet.prototype,
__proto__: Applet.IconApplet.prototype,

_init: function(aMetadata, aOrientation, aPanel_height, aInstance_id) {
Applet.Applet.prototype._init.call(this, aOrientation);
Applet.IconApplet.prototype._init.call(this, aOrientation, aPanel_height, aInstance_id);

// Condition needed for retro-compatibility.
// Mark for deletion on EOL.
Expand All @@ -69,6 +83,7 @@ MyApplet.prototype = {
this.settings = new Settings.AppletSettings(this, aMetadata.uuid, aInstance_id);

this.update_id = 0;
this.metadata = aMetadata;
this.applet_dir = aMetadata.path;
this.main_applet_dir = this.applet_dir;

Expand Down Expand Up @@ -105,6 +120,14 @@ MyApplet.prototype = {
this.tooltip = false;
}

if (!GTop) {
this._informDependency();
this._applet_icon_box.show();
return;
}

this._applet_icon_box.hide();

let ncpu = GTop.glibtop_get_sysinfo().ncpu;

if (this.pref_show_cpu_graph) {
Expand Down Expand Up @@ -148,6 +171,35 @@ MyApplet.prototype = {
}
},

_informDependency: function() {
this.set_applet_icon_symbolic_name("dialog-error");
let msg = [_("Missing dependency!!!"),
_("This applet needs the GTop library installed on your system for it to work."),
_("Read this applet help for more details (Applet context menu > Help item).")
];

let tt = _(this.metadata.name) + "\n\n" + msg.join("\n");

if (this.tooltip) {
try {
this.tooltip._tooltip.get_clutter_text().set_markup(
"<span color=\"red\"><b>" + tt + "</b></span>");
} catch (aErr) {
global.logError("System Monitor (Fork By Odyseus): " + aErr.message);
}
} else {
this.set_applet_tooltip(tt);
}

let icon = new St.Icon({
icon_name: "dialog-error",
icon_type: St.IconType.SYMBOLIC,
icon_size: 24
});

Main.criticalNotify(_(this.metadata.name), msg.join("\n"), icon);
},

_restart_cinnamon: function() {
global.reexec_self();
},
Expand Down Expand Up @@ -516,6 +568,9 @@ NetDataProvider.prototype = {
if (typeof GTop.glibtop.get_netlist === "function") {
this.devices = GTop.glibtop.get_netlist(new GTop.glibtop_netlist());
} else {
if (!NMClient)
return;

let dev = NMClient.Client.new().get_devices();
this.devices = [];
for (let i = 0; i < dev.length; ++i)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{
"website": "https://github.com/Odyseus/CinnamonTools",
"multiversion": true,
"uuid": "0dyseus@SysmonitorByOrcus",
"description": "Displays CPU, memory, swap, network usage and load in graphs.",
"contributors": "buzz: Bug fixes.,muzena: Croatian localization.,giwhub: Chinese localization.",
"dangerous": true,
"description": "Displays CPU, memory, swap, network usage and load in graphs.",
"comments": "Bug reports, feature requests and contributions should be done on this xlet's repository linked below.",
"comments": "Bug reports and feature requests should be reported on this applet's repository linked below.",
"name": "System Monitor (Fork By Odyseus)",
"version": "1.09",
"version": "1.10",
"cinnamon-version": [
"2.8",
"3.0",
"3.2"
],
"last-edited": 1485899403
"uuid": "0dyseus@SysmonitorByOrcus"
}
Loading

0 comments on commit 474f65a

Please sign in to comment.