From 491ff95cfda69b025d4ed6319a978e2c81324236 Mon Sep 17 00:00:00 2001 From: Gilles Date: Sun, 7 Dec 2025 09:31:52 +0100 Subject: [PATCH] upgrade 1 --- {CMUD@sonichy => CMUD@gil.soulier}/README.md | 0 .../extension.js | 48 ++++++++++++------ .../metadata.json | 10 ++-- .../preview.png | Bin 4 files changed, 37 insertions(+), 21 deletions(-) rename {CMUD@sonichy => CMUD@gil.soulier}/README.md (100%) rename {CMUD@sonichy => CMUD@gil.soulier}/extension.js (88%) rename {CMUD@sonichy => CMUD@gil.soulier}/metadata.json (60%) rename {CMUD@sonichy => CMUD@gil.soulier}/preview.png (100%) diff --git a/CMUD@sonichy/README.md b/CMUD@gil.soulier/README.md similarity index 100% rename from CMUD@sonichy/README.md rename to CMUD@gil.soulier/README.md diff --git a/CMUD@sonichy/extension.js b/CMUD@gil.soulier/extension.js similarity index 88% rename from CMUD@sonichy/extension.js rename to CMUD@gil.soulier/extension.js index 2947848..025b1ff 100755 --- a/CMUD@sonichy/extension.js +++ b/CMUD@gil.soulier/extension.js @@ -24,9 +24,12 @@ export default class CMUDExtension extends Extension { area_mem.connect('repaint', this.onRepaint_mem); box.add_child(area_mem); - var label = new St.Label({ text: '↑ 0KB/s\n↓ 0KB/s', y_align: Clutter.ActorAlign.CENTER }); - label.set_style('text-align:center; font-family:Noto Mono'); - box.add_child(label); + var label = new St.Label({ + text: 'CPU 0%\nMEM 0%', + 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(); area_cpu.width = 3; @@ -62,19 +65,32 @@ export default class CMUDExtension extends Extension { this.label_tooltip.hide(); }); - this._timeout = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => { - var net = this.net(); - label.set_text('↑' + this.B2G(net.ubs) + '/s\n↓' + this.B2G(net.dbs) + '/s'); - this.mem(); - area_mem.queue_repaint(); - this.cpu(); - 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; - this.label_tooltip.text = s; - // Run as loop, not once. - return GLib.SOURCE_CONTINUE; - }); +this._timeout = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => { + // Met à jour mémoire et CPU + this.mem(); // met à jour la variable globale mp (% mémoire) + area_mem.queue_repaint(); + + this.cpu(); // met à jour la variable globale cp (% CPU) + area_cpu.queue_repaint(); + + // Affiche CPU / MEM dans la barre + label.set_text(`CPU ${cp}%\nMEM ${mp}%`); + + // 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; +}); + } diff --git a/CMUD@sonichy/metadata.json b/CMUD@gil.soulier/metadata.json similarity index 60% rename from CMUD@sonichy/metadata.json rename to CMUD@gil.soulier/metadata.json index 35fe37f..0d235f3 100644 --- a/CMUD@sonichy/metadata.json +++ b/CMUD@gil.soulier/metadata.json @@ -1,6 +1,6 @@ { "_generated": "Generated by SweetTooth, do not edit", - "author": "sonichy", + "author": "gile.soulier", "description": "Display uptime, cpu, memory, upload, download on GNOME taskbar.", "name": "CMUD", "shell-version": [ @@ -9,7 +9,7 @@ "47", "48" ], - "url": "https://github.com/sonichy/GNOME_extension", - "uuid": "CMUD@sonichy", - "version": 7 -} \ No newline at end of file + "url": "https://gitea.maison43.duckdns.org/gilles/GNOME_extension", + "uuid": "CMUD@gil.soulier", + "version": 8 +} diff --git a/CMUD@sonichy/preview.png b/CMUD@gil.soulier/preview.png similarity index 100% rename from CMUD@sonichy/preview.png rename to CMUD@gil.soulier/preview.png