upgrade 1
This commit is contained in:
@@ -24,9 +24,12 @@ export default class CMUDExtension extends Extension {
|
|||||||
area_mem.connect('repaint', this.onRepaint_mem);
|
area_mem.connect('repaint', this.onRepaint_mem);
|
||||||
box.add_child(area_mem);
|
box.add_child(area_mem);
|
||||||
|
|
||||||
var label = new St.Label({ text: '↑ 0KB/s\n↓ 0KB/s', y_align: Clutter.ActorAlign.CENTER });
|
var label = new St.Label({
|
||||||
label.set_style('text-align:center; font-family:Noto Mono');
|
text: 'CPU 0%\nMEM 0%',
|
||||||
box.add_child(label);
|
y_align: Clutter.ActorAlign.CENTER,
|
||||||
|
});
|
||||||
|
label.set_style('text-align:center; font-family:Noto Mono');
|
||||||
|
box.add_child(label);
|
||||||
|
|
||||||
var area_cpu = new St.DrawingArea();
|
var area_cpu = new St.DrawingArea();
|
||||||
area_cpu.width = 3;
|
area_cpu.width = 3;
|
||||||
@@ -62,19 +65,32 @@ export default class CMUDExtension extends Extension {
|
|||||||
this.label_tooltip.hide();
|
this.label_tooltip.hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
this._timeout = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => {
|
this._timeout = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => {
|
||||||
var net = this.net();
|
// Met à jour mémoire et CPU
|
||||||
label.set_text('↑' + this.B2G(net.ubs) + '/s\n↓' + this.B2G(net.dbs) + '/s');
|
this.mem(); // met à jour la variable globale mp (% mémoire)
|
||||||
this.mem();
|
area_mem.queue_repaint();
|
||||||
area_mem.queue_repaint();
|
|
||||||
this.cpu();
|
this.cpu(); // met à jour la variable globale cp (% CPU)
|
||||||
area_cpu.queue_repaint();
|
area_cpu.queue_repaint();
|
||||||
var s = 'UPT: ' + this.uptime() + '\nCPU: ' + cp + '%\nMEM: ' + this.mem() + '\nUPB: ' + this.B2G(net.ub) + '\nDNB: ' + this.B2G(net.db);
|
|
||||||
//menuItem.label.text = s;
|
// Affiche CPU / MEM dans la barre
|
||||||
this.label_tooltip.text = s;
|
label.set_text(`CPU ${cp}%\nMEM ${mp}%`);
|
||||||
// Run as loop, not once.
|
|
||||||
return GLib.SOURCE_CONTINUE;
|
// On garde les infos réseau pour le tooltip
|
||||||
});
|
const net = this.net(); // { db, ub, dbs, ubs }
|
||||||
|
|
||||||
|
const s =
|
||||||
|
'UPT: ' + this.uptime() +
|
||||||
|
'\nCPU: ' + cp + '%' +
|
||||||
|
'\nMEM: ' + mp + '%' +
|
||||||
|
'\nUPB: ' + this.B2G(net.ub) +
|
||||||
|
'\nDNB: ' + this.B2G(net.db);
|
||||||
|
|
||||||
|
this.label_tooltip.text = s;
|
||||||
|
|
||||||
|
return GLib.SOURCE_CONTINUE;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"_generated": "Generated by SweetTooth, do not edit",
|
"_generated": "Generated by SweetTooth, do not edit",
|
||||||
"author": "sonichy",
|
"author": "gile.soulier",
|
||||||
"description": "Display uptime, cpu, memory, upload, download on GNOME taskbar.",
|
"description": "Display uptime, cpu, memory, upload, download on GNOME taskbar.",
|
||||||
"name": "CMUD",
|
"name": "CMUD",
|
||||||
"shell-version": [
|
"shell-version": [
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"47",
|
"47",
|
||||||
"48"
|
"48"
|
||||||
],
|
],
|
||||||
"url": "https://github.com/sonichy/GNOME_extension",
|
"url": "https://gitea.maison43.duckdns.org/gilles/GNOME_extension",
|
||||||
"uuid": "CMUD@sonichy",
|
"uuid": "CMUD@gil.soulier",
|
||||||
"version": 7
|
"version": 8
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 135 KiB |
Reference in New Issue
Block a user