paradoxxxzero/gnome-shell-system-monitor-applet — Issue #108: Pie size settings
Author: NVieville
Created: 2012-03-01 10:24:51+00:00
State: open

Hello,

As this was noticed by cyberorg in issue #95, the pie size is sometimes, on certain hosts, too big. So, I've tested a simple way to modify the pie size by adding a PieDisplayFactor constant in the extension.js file, and it seems to behave correctly (not tested extreme value such as 0.01, but what for). Here is the patch I used :

######### Beginning of the patch #########
--- extension.js.orig	2012-02-29 22:43:10.000000000 +0100
+++ extension.js	2012-03-01 10:07:47.154816719 +0100
@@ -38,6 +38,8 @@
const Util = imports.misc.util;
const _ = Gettext.gettext;

+const PieDisplayFactor = 0.50;
+
let ElementBase, Battery, Cpu, Mem, Swap, Net, Disk, Thermal, Freq, Pie, Chart, Icon, TipBox, TipItem, TipMenu;
let Schema, Background, IconSize;

@@ -1050,7 +1052,7 @@
return new_angle;
}
let rings = (this.mounts.length > 7?this.mounts.length:7);
- let thickness = (2 * rc) / (3 * rings);
+ let thickness = (2 * rc / PieDisplayFactor) / (3 * rings);
let fontsize = 14;
let r = rc - (thickness / 2);
cr.setLineWidth(thickness);
@@ -1107,7 +1109,7 @@
Main.__sm = {
tray: new PanelMenu.Button(0.5),
icon: new Icon(),
- pie: new Pie(300, 300),
+ pie: new Pie(300 * PieDisplayFactor, 300 * PieDisplayFactor),
elts: {
cpu: new Cpu(),
freq: new Freq(),
######### End of the patch #########

Unfortunately, I have no idea how to make this percentage (from 0.01 to 1) parameter to be set from the system-monitor-applet-config.py file (newbie in python script), and to make it sets dynamically without reloading gnome-shell (alt-f2 + r).

Hope this will be useful to get this feature that would make this applet more configurable for small displays.

Any question on this subject are welcome.

Cordially,

--
NVieville